ILIAS  release_8 Revision v8.24
class.ilSCGroupTableGUI.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
25{
26 public function __construct(object $a_parent_obj, string $a_parent_cmd = '')
27 {
28 $this->setId('sc_groups');
29 parent::__construct($a_parent_obj, $a_parent_cmd);
30 }
31
32 public function init(): void
33 {
34 $this->lng->loadLanguageModule('sysc');
35 $this->addColumn($this->lng->txt('title'), 'title', '60%');
36 $this->addColumn($this->lng->txt('last_update'), 'last_update_sort', '20%');
37 $this->addColumn($this->lng->txt('sysc_completed_num'), 'completed', '10%');
38 $this->addColumn($this->lng->txt('sysc_failed_num'), 'failed', '10%');
39 $this->addColumn($this->lng->txt('actions'), '', '10%');
40
41 $this->setTitle($this->lng->txt('sysc_overview'));
42
43 $this->setRowTemplate('tpl.syscheck_groups_row.html', 'Services/SystemCheck');
44 $this->setFormAction($this->ctrl->getFormAction($this->getParentObject()));
45 }
46
47 protected function fillRow(array $a_set): void
48 {
49 $this->tpl->setVariable('VAL_TITLE', (string) ($a_set['title'] ?? ''));
50
51 $id = (int) ($a_set['id'] ?? 0);
52 $this->ctrl->setParameter($this->getParentObject(), 'grp_id', $id);
53 $this->tpl->setVariable(
54 'VAL_LINK',
55 $this->ctrl->getLinkTarget($this->getParentObject(), 'showGroup')
56 );
57
58 $this->tpl->setVariable('VAL_DESC', (string) ($a_set['description'] ?? ''));
59 $this->tpl->setVariable('VAL_LAST_UPDATE', (string) ($a_set['last_update'] ?? ''));
60 $this->tpl->setVariable('VAL_COMPLETED', (int) ($a_set['completed'] ?? 0));
61 $this->tpl->setVariable('VAL_FAILED', (int) ($a_set['failed'] ?? 0));
62
63 switch ($a_set['status']) {
65 $this->tpl->setVariable('STATUS_CLASS', 'smallgreen');
66 break;
68 $this->tpl->setVariable('STATUS_CLASS', 'warning');
69 break;
70
71 }
72
73 // Actions
74
75 $list = new ilAdvancedSelectionListGUI();
76 $list->setSelectionHeaderClass('small');
77 $list->setItemLinkClass('small');
78 $list->setId('sysc_' . $id);
79 $list->setListTitle($this->lng->txt('actions'));
80
81 $this->ctrl->setParameter($this->getParentObject(), 'grp_id', $id);
82 $list->addItem(
83 $this->lng->txt('show'),
84 '',
85 $this->ctrl->getLinkTarget($this->getParentObject(), 'showGroup')
86 );
87 $this->tpl->setVariable('ACTIONS', $list->getHTML());
88 }
89
90 public function parse(): void
91 {
92 $data = array();
93
94 foreach (ilSCGroups::getInstance()->getGroups() as $group) {
95 $item = array();
96 $item['id'] = $group->getId();
97
99
100 $item['title'] = $task_gui->getGroupTitle();
101 $item['description'] = $task_gui->getGroupDescription();
102 $item['status'] = $group->getStatus();
103
104 $item['completed'] = ilSCTasks::lookupCompleted($group->getId());
105 $item['failed'] = ilSCTasks::lookupFailed($group->getId());
106
107 $last_update = ilSCTasks::lookupLastUpdate($group->getId());
108 $item['last_update'] = ilDatePresentation::formatDate($last_update);
109 $item['last_update_sort'] = $last_update->get(IL_CAL_UNIX);
110 $data[] = $item;
111 }
112
113 $this->setData($data);
114 }
115}
const IL_CAL_UNIX
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
static getComponentTaskGUIForGroup(int $a_group_id, ?int $a_task_id=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc