Class ilCronManagerGUI.
More...
◆ activate()
ilCronManagerGUI::activate |
( |
| ) |
|
◆ addToExternalSettingsForm()
ilCronManagerGUI::addToExternalSettingsForm |
( |
int |
$a_form_id | ) |
|
Definition at line 548 of file class.ilCronManagerGUI.php.
References $data.
552 $data = $this->cronRepository->getCronJobData();
553 foreach (
$data as $item) {
554 $job = $this->cronRepository->getJobInstance(
559 if (!is_null($job)) {
560 $job->addToExternalSettingsForm($a_form_id, $fields, (
bool) $item[
'job_status']);
564 if ($fields !== []) {
573 return $form_elements;
◆ confirm()
ilCronManagerGUI::confirm |
( |
string |
$a_action | ) |
|
|
protected |
Definition at line 493 of file class.ilCronManagerGUI.php.
References ILIAS\Repository\ctrl(), getMultiActionData(), ilCronJob\isManuallyExecutable(), ILIAS\Repository\lng(), ILIAS\Repository\rbac(), and SYSTEM_FOLDER_ID.
Referenced by activate(), deactivate(), reset(), and run().
496 $this->error->raiseError($this->
lng->txt(
'no_permission'), $this->error->WARNING);
501 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'no_checkbox'),
true);
502 $this->
ctrl->redirect($this,
'render');
505 if (
'run' === $a_action) {
506 $jobs = array_filter($jobs,
static function (
ilCronJob $job):
bool {
511 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'cron_no_executable_job_selected'),
true);
512 $this->
ctrl->redirect($this,
'render');
518 if (1 === count($jobs)) {
519 $jobKeys = array_keys($jobs);
520 $job_id = array_pop($jobKeys);
521 $job = array_pop($jobs);
524 $title = preg_replace(
'[^A-Za-z0-9_\-]',
'', $job->
getId());
527 $cgui->setHeaderText(sprintf(
528 $this->
lng->txt(
'cron_action_' . $a_action .
'_sure'),
532 $this->
ctrl->setParameter($this,
'jid', $job_id);
534 $cgui->setHeaderText($this->
lng->txt(
'cron_action_' . $a_action .
'_sure_multi'));
536 foreach ($jobs as $job_id => $job) {
537 $cgui->addItem(
'mjid[]', $job_id, $job->
getTitle());
541 $cgui->setFormAction($this->
ctrl->getFormAction($this,
'confirmed' . ucfirst($a_action)));
542 $cgui->setCancel($this->
lng->txt(
'cancel'),
'render');
543 $cgui->setConfirm($this->
lng->txt(
'cron_action_' . $a_action),
'confirmed' . ucfirst($a_action));
545 $this->tpl->setContent($cgui->getHTML());
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
◆ confirmedActivate()
ilCronManagerGUI::confirmedActivate |
( |
| ) |
|
Definition at line 391 of file class.ilCronManagerGUI.php.
References ILIAS\Repository\ctrl(), getMultiActionData(), ILIAS\Repository\lng(), ILIAS\Repository\rbac(), and SYSTEM_FOLDER_ID.
394 $this->error->raiseError($this->
lng->txt(
'no_permission'), $this->error->WARNING);
399 foreach ($jobs as $job) {
400 if ($this->cronManager->isJobInactive($job->getId())) {
401 $this->cronManager->resetJob($job, $this->actor);
405 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'cron_action_activate_success'),
true);
407 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'no_checkbox'),
true);
410 $this->
ctrl->redirect($this,
'render');
◆ confirmedDeactivate()
ilCronManagerGUI::confirmedDeactivate |
( |
| ) |
|
Definition at line 418 of file class.ilCronManagerGUI.php.
References ILIAS\Repository\ctrl(), getMultiActionData(), ILIAS\Repository\lng(), ILIAS\Repository\rbac(), and SYSTEM_FOLDER_ID.
421 $this->error->raiseError($this->
lng->txt(
'no_permission'), $this->error->WARNING);
426 foreach ($jobs as $job) {
427 if ($this->cronManager->isJobActive($job->getId())) {
428 $this->cronManager->deactivateJob($job, $this->actor,
true);
432 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'cron_action_deactivate_success'),
true);
434 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'no_checkbox'),
true);
437 $this->
ctrl->redirect($this,
'render');
◆ confirmedReset()
ilCronManagerGUI::confirmedReset |
( |
| ) |
|
Definition at line 445 of file class.ilCronManagerGUI.php.
References ILIAS\Repository\ctrl(), getMultiActionData(), ILIAS\Repository\lng(), ILIAS\Repository\rbac(), and SYSTEM_FOLDER_ID.
448 $this->error->raiseError($this->
lng->txt(
'no_permission'), $this->error->WARNING);
453 foreach ($jobs as $job) {
454 $this->cronManager->resetJob($job, $this->actor);
456 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'cron_action_reset_success'),
true);
458 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'no_checkbox'),
true);
461 $this->
ctrl->redirect($this,
'render');
◆ confirmedRun()
ilCronManagerGUI::confirmedRun |
( |
| ) |
|
Definition at line 368 of file class.ilCronManagerGUI.php.
References ILIAS\Repository\ctrl(), getRequestValue(), ILIAS\Repository\lng(), ILIAS\Repository\rbac(), ILIAS\Repository\refinery(), and SYSTEM_FOLDER_ID.
371 $this->error->raiseError($this->
lng->txt(
'no_permission'), $this->error->WARNING);
376 if ($this->cronManager->runJobManual($job_id, $this->actor)) {
377 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'cron_action_run_success'),
true);
379 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'cron_action_run_fail'),
true);
383 $this->
ctrl->redirect($this,
'render');
getRequestValue(string $key, \ILIAS\Refinery\Transformation $trafo, bool $forceRetrieval=false, $default=null)
◆ deactivate()
ilCronManagerGUI::deactivate |
( |
| ) |
|
◆ edit()
Definition at line 177 of file class.ilCronManagerGUI.php.
References ILIAS\Repository\ctrl(), getRequestValue(), initEditForm(), ILIAS\Repository\lng(), ILIAS\Repository\rbac(), ILIAS\Repository\refinery(), and SYSTEM_FOLDER_ID.
Referenced by update().
180 $this->error->raiseError($this->
lng->txt(
'no_permission'), $this->error->WARNING);
185 $this->
ctrl->redirect($this,
'render');
188 if ($a_form === null) {
192 $this->tpl->setContent($a_form->
getHTML());
initEditForm(string $a_job_id)
getRequestValue(string $key, \ILIAS\Refinery\Transformation $trafo, bool $forceRetrieval=false, $default=null)
◆ executeCommand()
ilCronManagerGUI::executeCommand |
( |
| ) |
|
PhpSwitchStatementWitSingleBranchInspection
Definition at line 111 of file class.ilCronManagerGUI.php.
References ILIAS\Repository\ctrl(), getRequestValue(), initEditForm(), ILIAS\Repository\lng(), ILIAS\Repository\rbac(), ILIAS\Repository\refinery(), ilUtil\stripSlashes(), and SYSTEM_FOLDER_ID.
114 $this->error->raiseError($this->
lng->txt(
'no_permission'), $this->error->WARNING);
117 $class = $this->
ctrl->getNextClass($this);
120 switch (strtolower($class)) {
121 case strtolower(ilPropertyFormGUI::class):
124 $this->
ctrl->forwardCommand($form);
128 $cmd = $this->
ctrl->getCmd(
'render');
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
initEditForm(string $a_job_id)
getRequestValue(string $key, \ILIAS\Refinery\Transformation $trafo, bool $forceRetrieval=false, $default=null)
◆ getMultiActionData()
ilCronManagerGUI::getMultiActionData |
( |
| ) |
|
|
protected |
- Returns
- array<string, ilCronJob>
Definition at line 467 of file class.ilCronManagerGUI.php.
References Vendor\Package\$e, $res, getRequestValue(), and ILIAS\Repository\refinery().
Referenced by confirm(), confirmedActivate(), confirmedDeactivate(), and confirmedReset().
477 $this->
refinery->kindlyTo()->string()
483 foreach ($job_ids as $job_id) {
484 $job = $this->cronRepository->getJobInstanceById($job_id);
486 $res[$job_id] = $job;
Class ChatMainBarProvider .
getRequestValue(string $key, \ILIAS\Refinery\Transformation $trafo, bool $forceRetrieval=false, $default=null)
◆ getRequestValue()
◆ getScheduleTypeFormElementName()
ilCronManagerGUI::getScheduleTypeFormElementName |
( |
int |
$scheduleTypeId | ) |
|
|
protected |
Definition at line 195 of file class.ilCronManagerGUI.php.
References ILIAS\Repository\lng(), 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, and ilCronJob\SCHEDULE_TYPE_YEARLY.
Referenced by initEditForm().
197 switch ($scheduleTypeId) {
199 return $this->
lng->txt(
'cron_schedule_daily');
202 return $this->
lng->txt(
'cron_schedule_weekly');
205 return $this->
lng->txt(
'cron_schedule_monthly');
208 return $this->
lng->txt(
'cron_schedule_quarterly');
211 return $this->
lng->txt(
'cron_schedule_yearly');
214 return sprintf($this->
lng->txt(
'cron_schedule_in_minutes'),
'x');
217 return sprintf($this->
lng->txt(
'cron_schedule_in_hours'),
'x');
220 return sprintf($this->
lng->txt(
'cron_schedule_in_days'),
'x');
224 'The passed argument %s is invalid!',
225 var_export($scheduleTypeId,
true)
const SCHEDULE_TYPE_IN_MINUTES
This will be replaced with an ENUM in ILIAS 9
const SCHEDULE_TYPE_MONTHLY
This will be replaced with an ENUM in ILIAS 9
const SCHEDULE_TYPE_WEEKLY
This will be replaced with an ENUM in ILIAS 9
const SCHEDULE_TYPE_IN_DAYS
This will be replaced with an ENUM in ILIAS 9
const SCHEDULE_TYPE_YEARLY
This will be replaced with an ENUM in ILIAS 9
const SCHEDULE_TYPE_DAILY
This will be replaced with an ENUM in ILIAS 9
const SCHEDULE_TYPE_QUARTERLY
This will be replaced with an ENUM in ILIAS 9
const SCHEDULE_TYPE_IN_HOURS
This will be replaced with an ENUM in ILIAS 9
◆ getScheduleValueFormElementName()
ilCronManagerGUI::getScheduleValueFormElementName |
( |
int |
$scheduleTypeId | ) |
|
|
protected |
◆ hasScheduleValue()
ilCronManagerGUI::hasScheduleValue |
( |
int |
$scheduleTypeId | ) |
|
|
protected |
◆ initEditForm()
ilCronManagerGUI::initEditForm |
( |
string |
$a_job_id | ) |
|
|
protected |
Definition at line 257 of file class.ilCronManagerGUI.php.
References $type, $typeId, ilNumberInputGUI\allowDecimals(), ILIAS\Repository\ctrl(), getScheduleTypeFormElementName(), getScheduleValueFormElementName(), and ILIAS\Repository\lng().
Referenced by edit(), executeCommand(), and update().
259 $job = $this->cronRepository->getJobInstanceById($a_job_id);
261 $this->
ctrl->redirect($this,
'render');
264 $this->
ctrl->setParameter($this,
'jid', $a_job_id);
266 $jobs_data = $this->cronRepository->getCronJobData($job->getId());
267 $job_data = $jobs_data[0];
270 $form->setFormAction($this->
ctrl->getFormAction($this,
'update'));
271 $form->setTitle($this->
lng->txt(
'cron_action_edit') .
': "' . $job->getTitle() .
'"');
273 if ($job->hasFlexibleSchedule()) {
275 $type->setRequired(
true);
276 $type->setValue((
string) $job_data[
'schedule_type']);
278 foreach ($job->getAllScheduleTypes() as
$typeId) {
279 if (!in_array(
$typeId, $job->getValidScheduleTypes(),
true)) {
287 $type->addOption($option);
289 if (in_array(
$typeId, $job->getScheduleTypesWithValues(),
true)) {
291 $this->
lng->txt(
'cron_schedule_value'),
295 $scheduleValue->setRequired(
true);
296 $scheduleValue->setSize(5);
297 if ((
int) $job_data[
'schedule_type'] ===
$typeId) {
298 $scheduleValue->setValue($job_data[
'schedule_value'] === null ? null : (
string) $job_data[
'schedule_value']);
300 $option->addSubItem($scheduleValue);
304 $form->addItem(
$type);
307 if ($job->hasCustomSettings()) {
308 $job->addCustomSettingsToForm($form);
311 $form->addCommandButton(
'update', $this->
lng->txt(
'save'));
312 $form->addCommandButton(
'render', $this->
lng->txt(
'cancel'));
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getScheduleValueFormElementName(int $scheduleTypeId)
getScheduleTypeFormElementName(int $scheduleTypeId)
◆ render()
ilCronManagerGUI::render |
( |
| ) |
|
|
protected |
Definition at line 132 of file class.ilCronManagerGUI.php.
References $message, ILIAS\Repository\ctrl(), ilDatePresentation\formatDate(), IL_CAL_UNIX, ILIAS\Repository\lng(), ILIAS\Repository\rbac(), ILIAS\Repository\settings(), and SYSTEM_FOLDER_ID.
134 $tstamp = $this->
lng->txt(
'cronjob_last_start_unknown');
135 if ($this->
settings->get(
'last_cronjob_start_ts')) {
138 $this->
settings->get(
'last_cronjob_start_ts'),
144 $message = $this->uiFactory->messageBox()->info($this->
lng->txt(
'cronjob_last_start') .
': ' . $tstamp);
146 $cronJobs = $this->cronRepository->findAll();
154 $filter = $tableFilterMediator->filter($this->
ctrl->getFormAction(
163 $this->cronRepository,
167 $this->tpl->setContent(implode(
'', [
168 $this->uiRenderer->render([
$message, $filter]),
170 $tableFilterMediator->filteredJobs(
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
◆ reset()
ilCronManagerGUI::reset |
( |
| ) |
|
◆ run()
ilCronManagerGUI::run |
( |
| ) |
|
◆ update()
ilCronManagerGUI::update |
( |
| ) |
|
Definition at line 317 of file class.ilCronManagerGUI.php.
References $type, $valid, ILIAS\Repository\ctrl(), edit(), getRequestValue(), hasScheduleValue(), initEditForm(), ILIAS\Repository\int(), ILIAS\Repository\lng(), ILIAS\Repository\rbac(), ILIAS\Repository\refinery(), and SYSTEM_FOLDER_ID.
320 $this->error->raiseError($this->
lng->txt(
'no_permission'), $this->error->WARNING);
325 $this->
ctrl->redirect($this,
'render');
329 if ($form->checkInput()) {
330 $job = $this->cronRepository->getJobInstanceById($job_id);
333 if ($job->hasCustomSettings() && !$job->saveCustomSettings($form)) {
337 if (
$valid && $job->hasFlexibleSchedule()) {
338 $type = (
int) $form->getInput(
'type');
349 $this->cronRepository->updateJobSchedule($job,
$type, $value);
353 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'cron_action_edit_success'),
true);
354 $this->
ctrl->redirect($this,
'render');
359 $form->setValuesByPost();
getScheduleValueFormElementName(int $scheduleTypeId)
initEditForm(string $a_job_id)
hasScheduleValue(int $scheduleTypeId)
edit(ilPropertyFormGUI $a_form=null)
getRequestValue(string $key, \ILIAS\Refinery\Transformation $trafo, bool $forceRetrieval=false, $default=null)
◆ $actor
◆ $cronManager
◆ $cronRepository
◆ $ctrl
◆ $error
◆ $httpRequest
◆ $lng
◆ $rbac
ILIAS DI RBACServices ilCronManagerGUI::$rbac |
|
private |
◆ $refinery
◆ $settings
◆ $tpl
◆ $uiFactory
Factory ilCronManagerGUI::$uiFactory |
|
private |
◆ $uiRenderer
◆ $uiService
The documentation for this class was generated from the following file: