Exemple #1
0
 /**
  * Run the next task and return status information
  *
  * @return array(is_error => bool, is_continue => bool, numberOfItems => int, exception => htmlString)
  */
 static function onEnd()
 {
     $errorPolicy = new CRM_Queue_ErrorPolicy();
     $errorPolicy->call(function () {
         global $activeQueueRunner;
         $qrid = CRM_Utils_Request::retrieve('qrid', 'String', CRM_Core_DAO::$_nullObject, TRUE, NULL, 'POST');
         $activeQueueRunner = CRM_Queue_Runner::instance($qrid);
         if (!is_object($activeQueueRunner)) {
             throw new Exception('Queue runner must be configured before execution. - onEnd');
         }
         $result = $activeQueueRunner->handleEnd(FALSE);
         CRM_Queue_Page_AJAX::_return('onEnd', $result);
     });
 }
 /**
  *
  * POST Param 'qrid': string, usually the name of the queue
  */
 function run()
 {
     $qrid = CRM_Utils_Request::retrieve('qrid', 'String', $this, TRUE);
     $runner = CRM_Queue_Runner::instance($qrid);
     // dpm(array( 'action' => 'CRM_Queue_Page_Runner::run()', 'session' => $_SESSION, 'runner' => $runner, 'qrid' => $qrid ));
     if (!is_object($runner)) {
         CRM_Core_Error::fatal('Queue runner must be configured before execution.');
     }
     CRM_Utils_System::setTitle($runner->title);
     $this->assign('queueRunnerData', array('qrid' => $runner->qrid, 'runNextAjax' => CRM_Utils_System::url($runner->pathPrefix . '/ajax/runNext', NULL, FALSE, NULL, FALSE), 'skipNextAjax' => CRM_Utils_System::url($runner->pathPrefix . '/ajax/skipNext', NULL, FALSE, NULL, FALSE), 'onEndAjax' => CRM_Utils_System::url($runner->pathPrefix . '/ajax/onEnd', NULL, FALSE, NULL, FALSE), 'completed' => 0, 'numberOfItems' => $runner->queue->numberOfItems(), 'buttons' => $runner->buttons));
     if ($runner->isMinimal) {
         $smarty = CRM_Core_Smarty::singleton();
         $content = $smarty->fetch('CRM/Queue/Page/Runner.tpl');
         echo CRM_Utils_System::theme('page', $content, TRUE, $this->_print, FALSE, TRUE);
     } else {
         parent::run();
     }
 }
Exemple #3
0
 /**
  *
  * POST Param 'qrid': string, usually the name of the queue
  */
 public function run()
 {
     $qrid = CRM_Utils_Request::retrieve('qrid', 'String', $this, TRUE);
     $runner = CRM_Queue_Runner::instance($qrid);
     if (!is_object($runner)) {
         CRM_Core_Error::fatal('Queue runner must be configured before execution.');
     }
     CRM_Utils_System::setTitle($runner->title);
     $this->assign('queueRunnerData', array('qrid' => $runner->qrid, 'runNextAjax' => CRM_Utils_System::url($runner->pathPrefix . '/ajax/runNext', NULL, FALSE, NULL, FALSE), 'skipNextAjax' => CRM_Utils_System::url($runner->pathPrefix . '/ajax/skipNext', NULL, FALSE, NULL, FALSE), 'onEndAjax' => CRM_Utils_System::url($runner->pathPrefix . '/ajax/onEnd', NULL, FALSE, NULL, FALSE), 'completed' => 0, 'numberOfItems' => $runner->queue->numberOfItems(), 'buttons' => $runner->buttons));
     if ($runner->isMinimal) {
         // Render page header
         if (!defined('CIVICRM_UF_HEAD') && ($region = CRM_Core_Region::instance('html-header', FALSE))) {
             CRM_Utils_System::addHTMLHead($region->render(''));
         }
         $smarty = CRM_Core_Smarty::singleton();
         $content = $smarty->fetch('CRM/Queue/Page/Runner.tpl');
         echo CRM_Utils_System::theme($content, $this->_print, TRUE);
     } else {
         parent::run();
     }
 }