Esempio n. 1
0
 function content_block()
 {
     //  Build the FormProcessor, and add the
     //  form content object that the FormProcessor
     //  will use.
     //
     $container = container();
     $sdifqueue = new SDIFResultsQueue();
     if (!$sdifqueue->ValidateQueue()) {
         $msgs = $sdifqueue->get_status_message();
         foreach ($msgs as $msg) {
             $container->add($this->status_message($msg['msg'], $msg['severity']));
         }
         return $container;
     }
     //  Create the form
     $form = new SDIFQueueProcessForm("Process SDIF Queue", $_SERVER['PHP_SELF'], 600);
     //  Create the form processor
     $fp = new FormProcessor($form);
     //  Don't display the form again if processing was successful.
     $fp->set_render_form_after_success(false);
     //  Add the Form Processor to the container.
     //  If the Form Processor was succesful, display
     //  some statistics about the uploaded file.
     if ($fp->is_action_successful()) {
         //$container->add($form->get_action_message()) ;
         //  Add the Form Processor to the container.
         $container->add(html_br(2), $fp);
     } else {
         $container->add($fp);
     }
     return $container;
 }
Esempio n. 2
0
 /**
  * This method is called ONLY after ALL validation has
  * passed.  This is the method that allows you to 
  * do something with the data, say insert/update records
  * in the DB.
  */
 function form_action()
 {
     $success = true;
     $sdifqueue = new SDIFResultsQueue();
     $cnt = $sdifqueue->ProcessQueue();
     $c = container();
     $msgs = $sdifqueue->get_status_message();
     foreach ($msgs as $msg) {
         $c->add(html_div(sprintf('ft-%s-msg', $msg['severity']), $msg['msg']));
     }
     $c->add(html_div('ft-note-msg', sprintf("%d record%s processed from SDIF Queue.", $cnt, $cnt == 1 ? "" : "s")));
     $this->set_action_message($c);
     unset($sdifqueue);
     return $success;
 }