5include_once 
"Services/Cron/classes/class.ilCronManager.php";
 
   45        $this->lng = 
$DIC->language();
 
   46        $this->ctrl = 
$DIC->ctrl();
 
   48        $this->tpl = 
$DIC->ui()->mainTemplate();
 
   50        $this->lng->loadLanguageModule(
'cron');
 
   55        $class = $this->ctrl->getNextClass($this);
 
   58            case "ilpropertyformgui":
 
   60                $this->ctrl->forwardCommand(
$form);
 
   63        $cmd = $this->ctrl->getCmd(
"render");
 
   71        if ($this->
settings->get(
'last_cronjob_start_ts')) {
 
   74            $tstamp = $this->lng->txt(
'cronjob_last_start_unknown');
 
   78        include_once 
"Services/Cron/classes/class.ilCronManagerTableGUI.php";
 
   80        $this->tpl->setContent(
$tbl->getHTML());
 
   85        $id = $_REQUEST[
"jid"];
 
   87            $this->ctrl->redirect($this, 
"render");
 
   94        $this->tpl->setContent($a_form->getHTML());
 
  104        switch ($scheduleTypeId) {
 
  106                return $this->lng->txt(
'cron_schedule_daily');
 
  109                return $this->lng->txt(
'cron_schedule_weekly');
 
  112                return $this->lng->txt(
'cron_schedule_monthly');
 
  115                return $this->lng->txt(
'cron_schedule_quarterly');
 
  118                return $this->lng->txt(
'cron_schedule_yearly');
 
  121                return sprintf($this->lng->txt(
'cron_schedule_in_minutes'), 
'x');
 
  124                return sprintf($this->lng->txt(
'cron_schedule_in_hours'), 
'x');
 
  127                return sprintf($this->lng->txt(
'cron_schedule_in_days'), 
'x');
 
  130        throw new \InvalidArgumentException(sprintf(
'The passed argument %s is invalid!', var_export($scheduleTypeId, 1)));
 
  140        switch ($scheduleTypeId) {
 
  151        throw new \InvalidArgumentException(sprintf(
'The passed argument %s is invalid!', var_export($scheduleTypeId, 1)));
 
  174            $this->ctrl->redirect($this, 
"render");
 
  177        $this->ctrl->setParameter($this, 
"jid", $a_job_id);
 
  181        include_once(
"Services/Cron/classes/class.ilCronJob.php");
 
  182        include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
 
  184        $form->setFormAction($this->ctrl->getFormAction($this, 
"update"));
 
  185        $form->setTitle($this->lng->txt(
"cron_action_edit") . 
': "' . $job->getTitle() . 
'"');
 
  187        if ($job->hasFlexibleSchedule()) {
 
  189            $type->setRequired(
true);
 
  192            foreach ($job->getAllScheduleTypes() as $typeId) {
 
  193                if (!in_array($typeId, $job->getValidScheduleTypes())) {
 
  201                $type->addOption($option);
 
  203                if (in_array($typeId, $job->getScheduleTypesWithValues())) {
 
  205                        $this->lng->txt(
'cron_schedule_value'),
 
  206                        $this->getScheduleValueFormElementName($typeId)
 
  208                    $scheduleValue->allowDecimals(
false);
 
  209                    $scheduleValue->setRequired(
true);
 
  210                    $scheduleValue->setSize(5);
 
  211                    if (
$data[
'schedule_type'] == $typeId) {
 
  212                        $scheduleValue->setValue(
$data[
'schedule_value']);
 
  214                    $option->addSubItem($scheduleValue);
 
  221        if ($job->hasCustomSettings()) {
 
  222            $job->addCustomSettingsToForm(
$form);
 
  225        $form->addCommandButton(
"update", $this->lng->txt(
"save"));
 
  226        $form->addCommandButton(
"render", $this->lng->txt(
"cancel"));
 
  233        $id = $_REQUEST[
"jid"];
 
  235            $this->ctrl->redirect($this, 
"render");
 
  239        if (
$form->checkInput()) {
 
  243                if ($job->hasCustomSettings() &&
 
  244                    !$job->saveCustomSettings(
$form)) {
 
  248                if (
$valid && $job->hasFlexibleSchedule()) {
 
  263                    ilUtil::sendSuccess($this->lng->txt(
"cron_action_edit_success"), 
true);
 
  264                    $this->ctrl->redirect($this, 
"render");
 
  269        $form->setValuesByPost();
 
  275        $this->confirm(
"run");
 
  280        $job_id = 
$_GET[
"jid"];
 
  283                ilUtil::sendSuccess($this->lng->txt(
"cron_action_run_success"), 
true);
 
  289        $this->ctrl->redirect($this, 
"render");
 
  294        $this->confirm(
"activate");
 
  301            foreach ($jobs as $job) {
 
  308            ilUtil::sendSuccess($this->lng->txt(
"cron_action_activate_success"), 
true);
 
  311        $this->ctrl->redirect($this, 
"render");
 
  316        $this->confirm(
"deactivate");
 
  323            foreach ($jobs as $job) {
 
  329            ilUtil::sendSuccess($this->lng->txt(
"cron_action_deactivate_success"), 
true);
 
  332        $this->ctrl->redirect($this, 
"render");
 
  337        $this->confirm(
"reset");
 
  344            foreach ($jobs as $job) {
 
  347            ilUtil::sendSuccess($this->lng->txt(
"cron_action_reset_success"), 
true);
 
  350        $this->ctrl->redirect($this, 
"render");
 
  357        if ($_REQUEST[
"jid"]) {
 
  358            $job_id = trim($_REQUEST[
"jid"]);
 
  361                $res[$job_id] = $job;
 
  363        } elseif (is_array($_REQUEST[
"mjid"])) {
 
  364            foreach ($_REQUEST[
"mjid"] as $job_id) {
 
  367                    $res[$job_id] = $job;
 
  375    protected function confirm($a_action)
 
  379            $this->ctrl->redirect($this, 
"render");
 
  382        if (
'run' == $a_action) {
 
  384            $jobs = array_filter($jobs, 
function ($job) {
 
  388                return $job->isManuallyExecutable();
 
  391            if (0 == count($jobs)) {
 
  393                $this->ctrl->redirect($this, 
'render');
 
  397        include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
 
  400        if (
sizeof($jobs) == 1) {
 
  401            $job_id = array_pop(array_keys($jobs));
 
  402            $job = array_pop($jobs);
 
  403            $title = $job->getTitle();
 
  405                $title = preg_replace(
"[^A-Za-z0-9_\-]", 
"", $job->getId());
 
  408            $cgui->setHeaderText(sprintf(
 
  409                $this->lng->txt(
"cron_action_" . $a_action . 
"_sure"),
 
  413            $this->ctrl->setParameter($this, 
"jid", $job_id);
 
  415            $cgui->setHeaderText($this->lng->txt(
"cron_action_" . $a_action . 
"_sure_multi"));
 
  417            foreach ($jobs as $job_id => $job) {
 
  418                $cgui->addItem(
"mjid[]", $job_id, $job->getTitle());
 
  422        $cgui->setFormAction($this->ctrl->getFormAction($this, 
"confirmed" . ucfirst($a_action)));
 
  423        $cgui->setCancel($this->lng->txt(
"cancel"), 
"render");
 
  424        $cgui->setConfirm($this->lng->txt(
"cron_action_" . $a_action), 
"confirmed" . ucfirst($a_action));
 
  426        $this->tpl->setContent($cgui->getHTML());
 
  434        foreach (
$data as $item) {
 
  442            if (method_exists($job, 
"addToExternalSettingsForm")) {
 
  443                $job->addToExternalSettingsForm($a_form_id, $fields, $item[
"job_status"]);
 
  447        if (
sizeof($fields)) {
 
  448            return array(
"cron_jobs" => array(
"jumpToCronJobs", $fields));
 
An exception for terminatinating execution or to throw for unit testing.
Confirmation screen class.
const SCHEDULE_TYPE_IN_DAYS
const SCHEDULE_TYPE_IN_HOURS
const SCHEDULE_TYPE_IN_MINUTES
const SCHEDULE_TYPE_WEEKLY
const SCHEDULE_TYPE_YEARLY
const SCHEDULE_TYPE_DAILY
const SCHEDULE_TYPE_QUARTERLY
const SCHEDULE_TYPE_MONTHLY
addToExternalSettingsForm($a_form_id)
getScheduleTypeFormElementName(int $scheduleTypeId)
edit(ilPropertyFormGUI $a_form=null)
getScheduleValueFormElementName(int $scheduleTypeId)
__construct()
ilCronManagerGUI constructor.
hasScheduleValue(int $scheduleTypeId)
List all active cron jobs.
static getCronJobData($a_id=null, $a_include_inactive=true)
Get cron job configuration/execution data.
static isJobInactive($a_job_id)
Check if given job is currently inactive.
static getJobInstanceById($a_job_id)
Get job instance (by job id)
static runJobManual($a_job_id)
Run single job manually.
static activateJob(ilCronJob $a_job, $a_manual=false)
Activate cron job.
static getJobInstance($a_id, $a_component, $a_class, $a_path=null)
Get job instance (by job data)
static isJobActive($a_job_id)
Check if given job is currently active.
static deactivateJob(ilCronJob $a_job, $a_manual=false)
Deactivate cron job.
static resetJob(ilCronJob $a_job)
Reset job.
static updateJobSchedule(ilCronJob $a_job, $a_schedule_type, $a_schedule_value)
Update job schedule.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
@classDescription Date and time handling
This class represents an option in a radio group.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if(!array_key_exists('StateId', $_REQUEST)) $id
if(isset($_POST['submit'])) $form
foreach($_POST as $key=> $value) $res