5 include_once
"Services/Cron/classes/class.ilCronManager.php";
22 $lng->loadLanguageModule(
"cron");
24 $cmd = $ilCtrl->getCmd(
"render");
34 if($ilSetting->get(
'last_cronjob_start_ts'))
40 $tstamp = $lng->txt(
'cronjob_last_start_unknown');
44 include_once
"Services/Cron/classes/class.ilCronManagerTableGUI.php";
46 $tpl->setContent($tbl->getHTML());
56 $ilCtrl->redirect($this,
"render");
64 $tpl->setContent($a_form->getHTML());
74 $ilCtrl->redirect($this,
"render");
77 $ilCtrl->setParameter($this,
"jid", $a_job_id);
81 include_once(
"Services/Cron/classes/class.ilCronJob.php");
82 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
84 $form->setFormAction($ilCtrl->getFormAction($this,
"update"));
85 $form->setTitle($lng->txt(
"cron_action_edit").
': "'.$job->getTitle().
'"');
87 if($job->hasFlexibleSchedule())
91 $type->setValue($data[
"schedule_type"]);
98 $min =
new ilRadioOption(sprintf($lng->txt(
"cron_schedule_in_minutes"),
"x"),
105 $mini->setValue($data[
"schedule_value"]);
107 $min->addSubItem($mini);
108 $type->addOption($min);
110 $hr =
new ilRadioOption(sprintf($lng->txt(
"cron_schedule_in_hours"),
"x"),
117 $hri->setValue($data[
"schedule_value"]);
119 $hr->addSubItem($hri);
120 $type->addOption($hr);
122 $dy =
new ilRadioOption(sprintf($lng->txt(
"cron_schedule_in_days"),
"x"),
129 $dyi->setValue($data[
"schedule_value"]);
131 $dy->addSubItem($dyi);
132 $type->addOption($dy);
134 $form->addItem($type);
137 if($job->hasCustomSettings())
139 $job->addCustomSettingsToForm($form);
142 $form->addCommandButton(
"update", $lng->txt(
"save"));
143 $form->addCommandButton(
"render", $lng->txt(
"cancel"));
155 $ilCtrl->redirect($this,
"render");
159 if($form->checkInput())
165 if($job->hasCustomSettings() &&
166 !$job->saveCustomSettings($form))
171 if(
$valid && $job->hasFlexibleSchedule())
173 $type = $form->getInput(
"type");
177 $value = $form->getInput(
"smini");
181 $value = $form->getInput(
"shri");
185 $value = $form->getInput(
"sdyi");
197 $ilCtrl->redirect($this,
"render");
202 $form->setValuesByPost();
208 $this->confirm(
"run");
215 $job_id =
$_GET[
"jid"];
228 $ilCtrl->redirect($this,
"render");
233 $this->confirm(
"activate");
243 foreach($jobs as $job)
255 $ilCtrl->redirect($this,
"render");
260 $this->confirm(
"deactivate");
270 foreach($jobs as $job)
281 $ilCtrl->redirect($this,
"render");
286 $this->confirm(
"reset");
293 $job_id =
$_GET[
"jid"];
305 $ilCtrl->redirect($this,
"render");
318 $res[$job_id] = $job;
328 $res[$job_id] = $job;
336 protected function confirm($a_action)
343 $ilCtrl->redirect($this,
"render");
346 if(
'run' == $a_action)
349 $jobs = array_filter($jobs,
function ($job) {
353 return $job->isManuallyExecutable();
356 if(0 == count($jobs))
359 $ilCtrl->redirect($this,
'render');
363 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
366 if(
sizeof($jobs) == 1)
368 $job_id = array_pop(array_keys($jobs));
369 $job = array_pop($jobs);
370 $title = $job->getTitle();
373 $title = preg_replace(
"[^A-Za-z0-9_\-]",
"", $job->getId());
376 $cgui->setHeaderText(sprintf($lng->txt(
"cron_action_".$a_action.
"_sure"),
379 $ilCtrl->setParameter($this,
"jid", $job_id);
383 $cgui->setHeaderText($lng->txt(
"cron_action_".$a_action.
"_sure_multi"));
385 foreach($jobs as $job_id => $job)
387 $cgui->addItem(
"mjid[]", $job_id, $job->getTitle());
391 $cgui->setFormAction($ilCtrl->getFormAction($this,
"confirmed".ucfirst($a_action)));
392 $cgui->setCancel($lng->txt(
"cancel"),
"render");
393 $cgui->setConfirm($lng->txt(
"cron_action_".$a_action),
"confirmed".ucfirst($a_action));
395 $tpl->setContent($cgui->getHTML());
403 foreach($data as $item)
406 $item[
"component"], $item[
"class"], $item[
"path"]);
408 if(method_exists($job,
"addToExternalSettingsForm"))
410 $job->addToExternalSettingsForm($a_form_id, $fields, $item[
"job_status"]);
416 return array(
"cron_jobs"=>array(
"jumpToCronJobs", $fields));