ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilSCGroupTableGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use ILIAS\UI\Factory as UIFactory;
22use ILIAS\UI\Renderer as UIRenderer;
23
29{
30 private UIRenderer $renderer;
31 private UIFactory $uiFactory;
32
33 public function __construct(object $a_parent_obj, string $a_parent_cmd = '')
34 {
35 $this->setId('sc_groups');
36 parent::__construct($a_parent_obj, $a_parent_cmd);
37
38 global $DIC;
39 $this->renderer = $DIC->ui()->renderer();
40 $this->uiFactory = $DIC->ui()->factory();
41 }
42
43 public function init(): void
44 {
45 $this->lng->loadLanguageModule('sysc');
46 $this->addColumn($this->lng->txt('title'), 'title', '60%');
47 $this->addColumn($this->lng->txt('last_update'), 'last_update_sort', '20%');
48 $this->addColumn($this->lng->txt('sysc_completed_num'), 'completed', '10%');
49 $this->addColumn($this->lng->txt('sysc_failed_num'), 'failed', '10%');
50 $this->addColumn($this->lng->txt('actions'), '', '10%');
51
52 $this->setTitle($this->lng->txt('sysc_overview'));
53
54 $this->setRowTemplate('tpl.syscheck_groups_row.html', 'components/ILIAS/SystemCheck');
55 $this->setFormAction($this->ctrl->getFormAction($this->getParentObject()));
56 }
57
58 protected function fillRow(array $a_set): void
59 {
60 $this->tpl->setVariable('VAL_TITLE', (string) ($a_set['title'] ?? ''));
61
62 $id = (int) ($a_set['id'] ?? 0);
63 $this->ctrl->setParameter($this->getParentObject(), 'grp_id', $id);
64 $this->tpl->setVariable(
65 'VAL_LINK',
66 $this->ctrl->getLinkTarget($this->getParentObject(), 'showGroup')
67 );
68
69 $this->tpl->setVariable('VAL_DESC', (string) ($a_set['description'] ?? ''));
70 $this->tpl->setVariable('VAL_LAST_UPDATE', (string) ($a_set['last_update'] ?? ''));
71 $this->tpl->setVariable('VAL_COMPLETED', (int) ($a_set['completed'] ?? 0));
72 $this->tpl->setVariable('VAL_FAILED', (int) ($a_set['failed'] ?? 0));
73
74 switch ($a_set['status']) {
76 $this->tpl->setVariable('STATUS_CLASS', 'smallgreen');
77 break;
79 $this->tpl->setVariable('STATUS_CLASS', 'warning');
80 break;
81 }
82
83 // Actions
84 $this->ctrl->setParameter($this->getParentObject(), 'grp_id', $id);
85 $dropDownItems = array(
86 $this->uiFactory->button()->shy(
87 $this->lng->txt('show'),
88 $this->ctrl->getLinkTarget($this->getParentObject(), 'showGroup')
89 )
90 );
91 $dropDown = $this->uiFactory->dropdown()->standard($dropDownItems)
92 ->withLabel($this->lng->txt('actions'));
93
94 $this->tpl->setVariable('ACTIONS', $this->renderer->render($dropDown));
95 }
96
97 public function parse(): void
98 {
99 $data = array();
100
101 foreach (ilSCGroups::getInstance()->getGroups() as $group) {
102 $item = array();
103 $item['id'] = $group->getId();
104
106
107 $item['title'] = $task_gui->getGroupTitle();
108 $item['description'] = $task_gui->getGroupDescription();
109 $item['status'] = $group->getStatus();
110
111 $item['completed'] = ilSCTasks::lookupCompleted($group->getId());
112 $item['failed'] = ilSCTasks::lookupFailed($group->getId());
113
114 $last_update = ilSCTasks::lookupLastUpdate($group->getId());
115 $item['last_update'] = ilDatePresentation::formatDate($last_update);
116 $item['last_update_sort'] = $last_update->get(IL_CAL_UNIX);
117 $data[] = $item;
118 }
119
120 $this->setData($data);
121 }
122}
renderer()
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
const IL_CAL_UNIX
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
static getComponentTaskGUIForGroup(int $a_group_id, ?int $a_task_id=null)
Table GUI for system check groups overview.
fillRow(array $a_set)
Standard Version of Fill Row.
__construct(object $a_parent_obj, string $a_parent_cmd='')
static getInstance()
const STATUS_COMPLETED
const STATUS_FAILED
static lookupLastUpdate(int $a_grp_id)
static lookupFailed(int $a_grp_id)
static lookupCompleted(int $a_grp_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
setFormAction(string $a_form_action, bool $a_multipart=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
setData(array $a_data)
Set table data.
An entity that renders components to a string output.
Definition: Renderer.php:31
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26