4include_once 
'./Services/Table/classes/class.ilTable2GUI.php';
 
    5include_once 
'./Services/Cron/classes/class.ilCronJobResult.php';
 
   25                $this->
setId(
"crnmng"); 
 
   27                parent::__construct($a_parent_obj, $a_parent_cmd);
 
   30                $this->
addColumn($this->lng->txt(
"cron_job_id"), 
"title");
 
   31                $this->
addColumn($this->lng->txt(
"cron_component"), 
"component");
 
   32                $this->
addColumn($this->lng->txt(
"cron_schedule"), 
"schedule");
 
   33                $this->
addColumn($this->lng->txt(
"cron_status"), 
"status");
 
   34                $this->
addColumn($this->lng->txt(
"cron_status_info"), 
"");
 
   35                $this->
addColumn($this->lng->txt(
"cron_result"), 
"result");
 
   36                $this->
addColumn($this->lng->txt(
"cron_result_info"), 
"");              
 
   37                $this->
addColumn($this->lng->txt(
"cron_last_run"), 
"last_run");                 
 
   38                $this->
addColumn($this->lng->txt(
"actions"), 
"");
 
   40                $this->
setTitle($this->lng->txt(
"cron_jobs"));
 
   45                $this->
addMultiCommand(
"deactivate", $lng->txt(
"cron_action_deactivate"));
 
   49                $this->
setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
 
   66                        $res[
"title"] = $a_item[
"job_id"];
 
   73                        if($a_item[
"schedule_type"])
 
   80                        $res[
"editable_schedule"] = 
false;
 
   85                        if(!$a_item[
"schedule_type"])
 
   90                                        $a_item[
"schedule_value"]);
 
   93                        $res[
"editable_schedule"] = 
true;
 
   96                switch($a_item[
"schedule_type"])
 
   99                                $schedule = 
$lng->txt(
"cron_schedule_daily");
 
  103                                $schedule = 
$lng->txt(
"cron_schedule_weekly");
 
  107                                $schedule = 
$lng->txt(
"cron_schedule_monthly");
 
  111                                $schedule = 
$lng->txt(
"cron_schedule_quarterly");
 
  115                                $schedule = 
$lng->txt(
"cron_schedule_yearly");
 
  119                                $schedule = 
sprintf(
$lng->txt(
"cron_schedule_in_minutes"), $a_item[
"schedule_value"]);
 
  123                                $schedule = 
sprintf(
$lng->txt(
"cron_schedule_in_hours"), $a_item[
"schedule_value"]);
 
  127                                $schedule = 
sprintf(
$lng->txt(
"cron_schedule_in_days"), $a_item[
"schedule_value"]);
 
  130                $res[
"schedule"] = $schedule;
 
  133                if($a_item[
"job_status"])
 
  135                        $res[
"status"] = 
$lng->txt(
"cron_status_active");
 
  139                        $res[
"status"] = 
$lng->txt(
"cron_status_inactive");
 
  142                $status_info = array();
 
  143                if($a_item[
"job_status_ts"])
 
  147                if(!$a_item[
"job_status_type"])
 
  149                        $status_info[] = 
$lng->txt(
"cron_changed_by_crontab");
 
  155                $res[
"status_info"] = implode(
"<br />", $status_info); 
 
  159                if($a_item[
"job_result_status"])
 
  161                        switch($a_item[
"job_result_status"])
 
  164                                        $result = 
$lng->txt(
"cron_result_status_invalid_configuration");
 
  168                                        $result = 
$lng->txt(
"cron_result_status_no_action");
 
  190                $result_info = array();                 
 
  191                if($a_item[
"job_result_dur"])
 
  193                        $result_info[] = ($a_item[
"job_result_dur"]/1000).
" sec";
 
  195                if($a_item[
"job_result_message"])
 
  197                        $result_info[] = $a_item[
"job_result_message"];
 
  199                if(DEVMODE && $a_item[
"job_result_code"]) 
 
  201                        $resultCode = $a_item[
"job_result_code"];
 
  204                                $result_info[] = 
$lng->txt(
'cro_job_rc_' . $resultCode);
 
  208                                $result_info[] = $resultCode;
 
  211                if(!$a_item[
"job_result_type"])
 
  213                        $result_info[] = 
$lng->txt(
"cron_changed_by_crontab");
 
  219                $res[
"result_info"] = implode(
"<br />", $result_info); 
 
  221                if($a_item[
"running_ts"])
 
  223                        $res[
"last_run"] = strtotime(
"+1year", $a_item[
"running_ts"]);                          
 
  225                else if($a_item[
"job_result_ts"])
 
  227                        $res[
"last_run"] = $a_item[
"job_result_ts"];
 
  231                        $res[
"last_run"] = 
null;
 
  241                global $ilPluginAdmin, 
$lng;
 
  243                include_once 
"Services/User/classes/class.ilUserUtil.php";
 
  244                include_once 
"Services/Cron/classes/class.ilCronJobResult.php";
 
  248                foreach(
$data as $idx => $item)
 
  251                                        $item[
"component"], $item[
"class"], $item[
"path"]);             
 
  259                $lng->loadLanguageModule(
"cmps");
 
  265                        $item[
"job_id"] = 
"pl__".$item[
"component"].
"__".$job->getId();
 
  266                        $item[
"component"] = 
$lng->txt(
"cmps_plugin").
"/".$item[
"component"];
 
  278                $this->tpl->setVariable(
"VAL_ID", $a_set[
"title"]);
 
  279                $this->tpl->setVariable(
"VAL_JID", $a_set[
"job_id"]);
 
  281                if($a_set[
"description"])
 
  283                        $this->tpl->setVariable(
"VAL_DESC", $a_set[
"description"]);
 
  286                $this->tpl->setVariable(
"VAL_COMPONENT", $a_set[
"component"]);
 
  287                $this->tpl->setVariable(
"VAL_SCHEDULE", $a_set[
"schedule"]);
 
  288                $this->tpl->setVariable(
"VAL_STATUS", $a_set[
"status"]);
 
  289                $this->tpl->setVariable(
"VAL_STATUS_INFO", $a_set[
"status_info"]);              
 
  290                $this->tpl->setVariable(
"VAL_RESULT", $a_set[
"result"]);        
 
  291                $this->tpl->setVariable(
"VAL_RESULT_INFO", $a_set[
"result_info"]);              
 
  292                if($a_set[
"last_run"] > time())
 
  294                        $a_set[
"last_run"] = 
$lng->txt(
"cron_running_since").
" ".
 
  298                        if($a_set[
"alive_ts"] != $a_set[
"running_ts"])
 
  300                                $a_set[
"last_run"] .= 
"<br />(Ping: ".
 
  304                else if($a_set[
"last_run"])
 
  308                $this->tpl->setVariable(
"VAL_LAST_RUN", $a_set[
"last_run"] ? $a_set[
"last_run"] : 
"-"); 
 
  315                if(!$a_set[
"running_ts"])
 
  320                                $actions[] = 
"reset";
 
  323                        else if(!$a_set[
"job_status"])
 
  325                                $actions[] = 
"activate";
 
  330                                if($a_set[
'is_manually_executable'])
 
  334                                $actions[] = 
"deactivate";
 
  337                        if($a_set[
"editable_schedule"] || $a_set[
"has_settings"])
 
  344                        foreach($actions as $action)
 
  346                                $this->tpl->setCurrentBlock(
"action_bl");
 
  347                                $this->tpl->setVariable(
"URL_ACTION", 
 
  348                                        $ilCtrl->getLinkTarget($this->getParentObject(), $action));     
 
  349                                $this->tpl->setVariable(
"TXT_ACTION", 
$lng->txt(
"cron_action_".$action));
 
  350                                $this->tpl->parseCurrentBlock();        
 
sprintf('%.4f', $callTime)
An exception for terminatinating execution or to throw for unit testing.
const STATUS_INVALID_CONFIGURATION
Cron job application base class.
const SCHEDULE_TYPE_IN_DAYS
getDefaultScheduleType()
Get schedule type.
getDescription()
Get description.
const SCHEDULE_TYPE_IN_HOURS
getDefaultScheduleValue()
Get schedule value.
hasCustomSettings()
Has cron job any custom setting which can be edited?
const SCHEDULE_TYPE_IN_MINUTES
isManuallyExecutable()
Defines whether or not a cron job can be started manually.
const SCHEDULE_TYPE_WEEKLY
const SCHEDULE_TYPE_YEARLY
const SCHEDULE_TYPE_DAILY
hasFlexibleSchedule()
Can the schedule be configured?
const SCHEDULE_TYPE_QUARTERLY
const SCHEDULE_TYPE_MONTHLY
List all active cron jobs.
__construct($a_parent_obj, $a_parent_cmd)
Constructor.
parseJobToData(array $a_item, ilCronJob $job)
fillRow($a_set)
Standard Version of Fill Row.
static getCronJobData($a_id=null, $a_include_inactive=true)
Get cron job configuration/execution data.
static getJobInstance($a_id, $a_component, $a_class, $a_path=null)
Get job instance (by job data)
static updateJobSchedule(ilCronJob $a_job, $a_schedule_type, $a_schedule_value)
Update job schedule.
static getPluginJobs($a_only_active=false)
static formatDate(ilDateTime $date)
Format a date @access public.
@classDescription Date and time handling
addColumn($a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
getParentObject()
Get parent object.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
static getNamePresentation($a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false)
Default behaviour is: