Skip to main content
Skip table of contents

Exemples de scripts d'interaction utilisateur

Imprimer un travail couleur en N&B

PHP
// script entry point
function main(){
// If the job is color, show a Yes/No dialog to ask if they want to print the job in B&W.
 if ($this->job->color){
  $this->dialogYesNo("Jobs sent to this queue are printed in B&W,
  do you still want to send the job here?"); }
}

// If Yes clicked, the user is informed that the job was sent to the B&W queue via a MDC 
notification.
function onYes(){
 $this->job->owner->sendNotification("info","Job successfully sent","Your job was sent
 to the B&W queue.");
}

// If No clicked, the job is deleted and the user is informed about it via a MDC 
notification.
function onNo(){
 $this->job->delete(); $this->job->owner->sendNotification("info","Job deleted","Your
 job was deleted.");
}

Déplacer le travail vers une file d'attente personnelle

PHP
// script entry point
function main() {
    /** Job object */
    $job = $this->job;
 
    // Get the personal queues and create a list
    $queues = $job->owner->getPersonalQueues();
    $queueList = [];
    foreach ($queues as $queue) {
        $queueList[$queue->name] = $queue->name;
    }
 
    $list = $this->singleSelectList('Personal queues', $queueList);
 
    $this->dialog('Select a queue', [
        $list,
        $this->buttonPrint(),
        $this->buttonCancel()
    ]);
}
  
// If print clicked
function onPrint($inputs) {
    $queue = $this->getField('Personal queues');
    $this->job->moveToQueue($queue);
}
  
// If cancel clicked
function onCancel() {
    // nothing. Job will be released.
}
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.