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"));
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");
196 $ilCtrl->redirect($this,
"render");
200 $form->setValuesByPost();
206 $this->confirm(
"run");
213 $job_id =
$_GET[
"jid"];
226 $ilCtrl->redirect($this,
"render");
231 $this->confirm(
"activate");
241 foreach($jobs as $job)
253 $ilCtrl->redirect($this,
"render");
258 $this->confirm(
"deactivate");
268 foreach($jobs as $job)
279 $ilCtrl->redirect($this,
"render");
284 $this->confirm(
"reset");
291 $job_id =
$_GET[
"jid"];
303 $ilCtrl->redirect($this,
"render");
316 $res[$job_id] = $job;
326 $res[$job_id] = $job;
334 protected function confirm($a_action)
341 $ilCtrl->redirect($this,
"render");
344 if(
'run' == $a_action)
347 $jobs = array_filter($jobs,
function ($job) {
351 return $job->isManuallyExecutable();
354 if(0 == count($jobs))
357 $ilCtrl->redirect($this,
'render');
361 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
364 if(
sizeof($jobs) == 1)
366 $job_id = array_pop(array_keys($jobs));
367 $job = array_pop($jobs);
368 $title = $job->getTitle();
371 $title = preg_replace(
"[^A-Za-z0-9_\-]",
"", $job->getId());
374 $cgui->setHeaderText(sprintf($lng->txt(
"cron_action_".$a_action.
"_sure"),
377 $ilCtrl->setParameter($this,
"jid", $job_id);
381 $cgui->setHeaderText($lng->txt(
"cron_action_".$a_action.
"_sure_multi"));
383 foreach($jobs as $job_id => $job)
385 $cgui->addItem(
"mjid[]", $job_id, $job->getTitle());
389 $cgui->setFormAction($ilCtrl->getFormAction($this,
"confirmed".ucfirst($a_action)));
390 $cgui->setCancel($lng->txt(
"cancel"),
"render");
391 $cgui->setConfirm($lng->txt(
"cron_action_".$a_action),
"confirmed".ucfirst($a_action));
393 $tpl->setContent($cgui->getHTML());
401 foreach($data as $item)
404 $item[
"component"], $item[
"class"], $item[
"path"]);
406 if(method_exists($job,
"addToExternalSettingsForm"))
408 $job->addToExternalSettingsForm($a_form_id, $fields, $item[
"job_status"]);
414 return array(
"cron_jobs"=>array(
"jumpToCronJobs", $fields));