Пример #1
0
 /**
  * Browse all jobs.
  *
  * @param null $action
  *
  * @return void
  */
 public function browse($action = NULL)
 {
     // using Export action for Execute. Doh.
     if ($this->_action & CRM_Core_Action::EXPORT) {
         $jm = new CRM_Core_JobManager();
         $jm->executeJobById($this->_id);
         CRM_Core_Session::setStatus(ts('Selected Scheduled Job has been executed. See the log for details.'), ts("Executed"), "success");
     }
     $sj = new CRM_Core_JobManager();
     $rows = $temp = array();
     foreach ($sj->jobs as $job) {
         $action = array_sum(array_keys($this->links()));
         // update enable/disable links.
         // CRM-9868- remove enable action for jobs that should never be run automatically via execute action or runjobs url
         if ($job->api_action == 'process_membership_reminder_date' || $job->api_action == 'update_greeting') {
             $action -= CRM_Core_Action::ENABLE;
             $action -= CRM_Core_Action::DISABLE;
         } elseif ($job->is_active) {
             $action -= CRM_Core_Action::ENABLE;
         } else {
             $action -= CRM_Core_Action::DISABLE;
         }
         $job->action = CRM_Core_Action::formLink(self::links(), $action, array('id' => $job->id), ts('more'), FALSE, 'job.manage.action', 'Job', $job->id);
         $rows[] = get_object_vars($job);
     }
     $this->assign('rows', $rows);
 }