ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilCronManagerGUI Class Reference

Class ilCronManagerGUI. More...

+ Collaboration diagram for ilCronManagerGUI:

Public Member Functions

 executeCommand ()
 render ()
 edit (ilPropertyFormGUI $a_form=null)
 initEditForm ($a_job_id)
 update ()
 run ()
 confirmedRun ()
 activate ()
 confirmedActivate ()
 deactivate ()
 confirmedDeactivate ()
 reset ()
 confirmedReset ()
 addToExternalSettingsForm ($a_form_id)

Protected Member Functions

 getMultiActionData ()

Detailed Description

Class ilCronManagerGUI.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Id:
class.ilObjFolderGUI.php 25134 2010-08-13 14:22:11Z smeyer

ilCronManagerGUI:

Definition at line 16 of file class.ilCronManagerGUI.php.

Member Function Documentation

ilCronManagerGUI::activate ( )

Definition at line 229 of file class.ilCronManagerGUI.php.

{
$this->confirm("activate");
}
ilCronManagerGUI::addToExternalSettingsForm (   $a_form_id)

Definition at line 396 of file class.ilCronManagerGUI.php.

References ilCronManager\getCronJobData(), and ilCronManager\getJobInstance().

{
$fields = array();
foreach($data as $item)
{
$job = ilCronManager::getJobInstance($item["job_id"],
$item["component"], $item["class"], $item["path"]);
if(method_exists($job, "addToExternalSettingsForm"))
{
$job->addToExternalSettingsForm($a_form_id, $fields, $item["job_status"]);
}
}
if(sizeof($fields))
{
return array("cron_jobs"=>array("jumpToCronJobs", $fields));
}
}

+ Here is the call graph for this function:

ilCronManagerGUI::confirmedActivate ( )

Definition at line 234 of file class.ilCronManagerGUI.php.

References $ilCtrl, $lng, ilCronManager\activateJob(), getMultiActionData(), ilCronManager\isJobInactive(), ilCronManager\resetJob(), and ilUtil\sendSuccess().

{
global $ilCtrl, $lng;
$jobs = $this->getMultiActionData();
if($jobs)
{
foreach($jobs as $job)
{
if(ilCronManager::isJobInactive($job->getId()))
{
}
}
ilUtil::sendSuccess($lng->txt("cron_action_activate_success"), true);
}
$ilCtrl->redirect($this, "render");
}

+ Here is the call graph for this function:

ilCronManagerGUI::confirmedDeactivate ( )

Definition at line 261 of file class.ilCronManagerGUI.php.

References $ilCtrl, $lng, ilCronManager\deactivateJob(), getMultiActionData(), ilCronManager\isJobActive(), and ilUtil\sendSuccess().

{
global $ilCtrl, $lng;
$jobs = $this->getMultiActionData();
if($jobs)
{
foreach($jobs as $job)
{
if(ilCronManager::isJobActive($job->getId()))
{
}
}
ilUtil::sendSuccess($lng->txt("cron_action_deactivate_success"), true);
}
$ilCtrl->redirect($this, "render");
}

+ Here is the call graph for this function:

ilCronManagerGUI::confirmedReset ( )

Definition at line 287 of file class.ilCronManagerGUI.php.

References $_GET, $ilCtrl, $lng, ilCronManager\getJobInstanceById(), ilCronManager\resetJob(), and ilUtil\sendSuccess().

{
global $ilCtrl, $lng;
$job_id = $_GET["jid"];
if($job_id)
{
if($job)
{
ilUtil::sendSuccess($lng->txt("cron_action_reset_success"), true);
}
}
$ilCtrl->redirect($this, "render");
}

+ Here is the call graph for this function:

ilCronManagerGUI::confirmedRun ( )

Definition at line 209 of file class.ilCronManagerGUI.php.

References $_GET, $ilCtrl, $lng, ilCronManager\runJobManual(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

{
global $ilCtrl, $lng;
$job_id = $_GET["jid"];
if($job_id)
{
{
ilUtil::sendSuccess($lng->txt("cron_action_run_success"), true);
}
else
{
ilUtil::sendFailure($lng->txt("cron_action_run_fail"), true);
}
}
$ilCtrl->redirect($this, "render");
}

+ Here is the call graph for this function:

ilCronManagerGUI::deactivate ( )

Definition at line 256 of file class.ilCronManagerGUI.php.

{
$this->confirm("deactivate");
}
ilCronManagerGUI::edit ( ilPropertyFormGUI  $a_form = null)

Definition at line 49 of file class.ilCronManagerGUI.php.

References $_REQUEST, $ilCtrl, $tpl, and initEditForm().

Referenced by update().

{
global $ilCtrl, $tpl;
$id = $_REQUEST["jid"];
if(!$id)
{
$ilCtrl->redirect($this, "render");
}
if(!$a_form)
{
$a_form = $this->initEditForm($id);
}
$tpl->setContent($a_form->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCronManagerGUI::executeCommand ( )

Definition at line 18 of file class.ilCronManagerGUI.php.

References $cmd, $ilCtrl, and $lng.

{
global $ilCtrl, $lng;
$lng->loadLanguageModule("cron");
$cmd = $ilCtrl->getCmd("render");
$this->$cmd();
return true;
}
ilCronManagerGUI::getMultiActionData ( )
protected

Definition at line 306 of file class.ilCronManagerGUI.php.

References $_REQUEST, $res, and ilCronManager\getJobInstanceById().

Referenced by confirmedActivate(), and confirmedDeactivate().

{
$res = array();
if($_REQUEST["jid"])
{
$job_id = trim($_REQUEST["jid"]);
if($job)
{
$res[$job_id] = $job;
}
}
else if(is_array($_REQUEST["mjid"]))
{
foreach($_REQUEST["mjid"] as $job_id)
{
if($job)
{
$res[$job_id] = $job;
}
}
}
return $res;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCronManagerGUI::initEditForm (   $a_job_id)

Definition at line 67 of file class.ilCronManagerGUI.php.

References $ilCtrl, $lng, ilCronManager\getCronJobData(), ilCronManager\getJobInstanceById(), ilCronJob\SCHEDULE_TYPE_DAILY, ilCronJob\SCHEDULE_TYPE_IN_DAYS, ilCronJob\SCHEDULE_TYPE_IN_HOURS, ilCronJob\SCHEDULE_TYPE_IN_MINUTES, ilCronJob\SCHEDULE_TYPE_MONTHLY, ilCronJob\SCHEDULE_TYPE_QUARTERLY, ilCronJob\SCHEDULE_TYPE_WEEKLY, ilCronJob\SCHEDULE_TYPE_YEARLY, and ilFormPropertyGUI\setRequired().

Referenced by edit(), and update().

{
global $ilCtrl, $lng;
if(!$job)
{
$ilCtrl->redirect($this, "render");
}
$ilCtrl->setParameter($this, "jid", $a_job_id);
$data = array_pop(ilCronManager::getCronJobData($job->getId()));
include_once("Services/Cron/classes/class.ilCronJob.php");
include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
$form = new ilPropertyFormGUI();
$form->setFormAction($ilCtrl->getFormAction($this, "update"));
$form->setTitle($lng->txt("cron_action_edit"));
if($job->hasFlexibleSchedule())
{
$type = new ilRadioGroupInputGUI($lng->txt("cron_schedule_type"), "type");
$type->setRequired(true);
$type->setValue($data["schedule_type"]);
$type->addOption(new ilRadioOption($lng->txt("cron_schedule_daily"), ilCronJob::SCHEDULE_TYPE_DAILY));
$type->addOption(new ilRadioOption($lng->txt("cron_schedule_weekly"), ilCronJob::SCHEDULE_TYPE_WEEKLY));
$type->addOption(new ilRadioOption($lng->txt("cron_schedule_monthly"), ilCronJob::SCHEDULE_TYPE_MONTHLY));
$type->addOption(new ilRadioOption($lng->txt("cron_schedule_quarterly"), ilCronJob::SCHEDULE_TYPE_QUARTERLY));
$type->addOption(new ilRadioOption($lng->txt("cron_schedule_yearly"), ilCronJob::SCHEDULE_TYPE_YEARLY));
$min = new ilRadioOption(sprintf($lng->txt("cron_schedule_in_minutes"), "x"),
$mini = new ilNumberInputGUI($lng->txt("cron_schedule_value"), "smini");
$mini->setRequired(true);
$mini->setSize(5);
if($data["schedule_type"] == ilCronJob::SCHEDULE_TYPE_IN_MINUTES)
{
$mini->setValue($data["schedule_value"]);
}
$min->addSubItem($mini);
$type->addOption($min);
$hr = new ilRadioOption(sprintf($lng->txt("cron_schedule_in_hours"), "x"),
$hri = new ilNumberInputGUI($lng->txt("cron_schedule_value"), "shri");
$hri->setRequired(true);
$hri->setSize(5);
if($data["schedule_type"] == ilCronJob::SCHEDULE_TYPE_IN_HOURS)
{
$hri->setValue($data["schedule_value"]);
}
$hr->addSubItem($hri);
$type->addOption($hr);
$dy = new ilRadioOption(sprintf($lng->txt("cron_schedule_in_days"), "x"),
$dyi = new ilNumberInputGUI($lng->txt("cron_schedule_value"), "sdyi");
$dyi->setRequired(true);
$dyi->setSize(5);
if($data["schedule_type"] == ilCronJob::SCHEDULE_TYPE_IN_DAYS)
{
$dyi->setValue($data["schedule_value"]);
}
$dy->addSubItem($dyi);
$type->addOption($dy);
$form->addItem($type);
}
if($job->hasCustomSettings())
{
$job->addCustomSettingsToForm($form);
}
$form->addCommandButton("update", $lng->txt("save"));
$form->addCommandButton("render", $lng->txt("cancel"));
return $form;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCronManagerGUI::render ( )

Definition at line 30 of file class.ilCronManagerGUI.php.

References $ilSetting, $lng, $tpl, ilDatePresentation\formatDate(), IL_CAL_UNIX, and ilUtil\sendInfo().

{
global $tpl, $ilSetting, $lng;
if($ilSetting->get('last_cronjob_start_ts'))
{
$tstamp = ilDatePresentation::formatDate(new ilDateTime($ilSetting->get('last_cronjob_start_ts'), IL_CAL_UNIX));
}
else
{
$tstamp = $lng->txt('cronjob_last_start_unknown');
}
ilUtil::sendInfo($lng->txt('cronjob_last_start').": ".$tstamp);
include_once "Services/Cron/classes/class.ilCronManagerTableGUI.php";
$tbl = new ilCronManagerTableGUI($this, "render");
$tpl->setContent($tbl->getHTML());
}

+ Here is the call graph for this function:

ilCronManagerGUI::reset ( )

Definition at line 282 of file class.ilCronManagerGUI.php.

{
$this->confirm("reset");
}
ilCronManagerGUI::run ( )

Definition at line 204 of file class.ilCronManagerGUI.php.

{
$this->confirm("run");
}
ilCronManagerGUI::update ( )

Definition at line 148 of file class.ilCronManagerGUI.php.

References $_REQUEST, $ilCtrl, $lng, $valid, edit(), ilCronManager\getJobInstanceById(), initEditForm(), ilCronJob\SCHEDULE_TYPE_IN_DAYS, ilCronJob\SCHEDULE_TYPE_IN_HOURS, ilCronJob\SCHEDULE_TYPE_IN_MINUTES, ilUtil\sendSuccess(), and ilCronManager\updateJobSchedule().

{
global $ilCtrl, $lng;
$id = $_REQUEST["jid"];
if(!$id)
{
$ilCtrl->redirect($this, "render");
}
$form = $this->initEditForm($id);
if($form->checkInput())
{
if($job)
{
$valid = true;
if($job->hasCustomSettings() &&
!$job->saveCustomSettings($form))
{
$valid = false;
}
if($valid && $job->hasFlexibleSchedule())
{
$type = $form->getInput("type");
switch($type)
{
$value = $form->getInput("smini");
break;
$value = $form->getInput("shri");
break;
$value = $form->getInput("sdyi");
break;
default:
$value = null;
}
ilCronManager::updateJobSchedule($job, $type, $value);
}
ilUtil::sendSuccess($lng->txt("cron_action_edit_success"), true);
$ilCtrl->redirect($this, "render");
}
}
$form->setValuesByPost();
$this->edit($form);
}

+ Here is the call graph for this function:


The documentation for this class was generated from the following file: