ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilSCTaskTableGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once './Services/Table/classes/class.ilTable2GUI.php';
6 
13 {
14  private $group_id = 0;
15  private $component_task_handler = null;
16 
22  public function __construct($a_group_id, $a_parent_obj, $a_parent_cmd = "")
23  {
24  $this->group_id = $a_group_id;
25  $this->setId('sc_groups');
26 
27  parent::__construct($a_parent_obj, $a_parent_cmd);
28  }
29 
34  public function getGroupId()
35  {
36  return $this->group_id;
37  }
38 
39 
43  public function init()
44  {
45  global $DIC;
46 
47  $ilCtrl = $DIC['ilCtrl'];
48  $lng = $DIC['lng'];
49 
50  $lng->loadLanguageModule('sysc');
51  $this->addColumn($this->lng->txt('title'), 'title', '60%');
52  $this->addColumn($this->lng->txt('last_update'), 'last_update_sort', '20%');
53  $this->addColumn($this->lng->txt('status'), 'status', '10%');
54  $this->addColumn($this->lng->txt('actions'), '', '10%');
55 
56  $this->setTitle($this->lng->txt('sysc_task_overview'));
57 
58  $this->setRowTemplate('tpl.syscheck_tasks_row.html', 'Services/SystemCheck');
59  $this->setFormAction($ilCtrl->getFormAction($this->getParentObject()));
60  }
61 
66  public function fillRow($row)
67  {
68  $this->tpl->setVariable('VAL_TITLE', $row['title']);
69  $this->tpl->setVariable('VAL_DESC', $row['description']);
70 
71  include_once './Services/SystemCheck/classes/class.ilSCUtils.php';
73  switch ($row['status']) {
75  $this->tpl->setVariable('VAL_STATUS_SUCCESS', $text);
76  break;
77 
79  $this->tpl->setCurrentBlock('warning');
80  $this->tpl->setVariable('VAL_STATUS_WARNING', $text);
81  $this->tpl->parseCurrentBlock();
82  break;
83 
84  default:
85  $this->tpl->setVariable('VAL_STATUS_STANDARD', $text);
86  break;
87  }
88 
89  $this->tpl->setVariable('VAL_LAST_UPDATE', $row['last_update']);
90 
91  // Actions
92  include_once './Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
94  $list->setSelectionHeaderClass('small');
95  $list->setItemLinkClass('small');
96  $list->setId('sysc_' . $row['id']);
97  $list->setListTitle($this->lng->txt('actions'));
98 
99  include_once './Services/SystemCheck/classes/class.ilSCComponentTaskFactory.php';
100  $task_handler = ilSCComponentTaskFactory::getComponentTask($row['id']);
101 
102  $GLOBALS['DIC']['ilCtrl']->setParameterByClass(get_class($task_handler), 'task_id', $row['id']);
103  foreach ((array) $task_handler->getActions() as $actions) {
104  $list->addItem(
105  $actions['txt'],
106  '',
107  $GLOBALS['DIC']['ilCtrl']->getLinkTargetByClass(
108  get_class($task_handler),
109  $actions['command']
110  )
111  );
112  }
113 
114  $this->tpl->setVariable('ACTIONS', $list->getHTML());
115  }
116 
117 
121  public function parse()
122  {
123  $data = array();
124  include_once './Services/SystemCheck/classes/class.ilSCTasks.php';
125  foreach (ilSCTasks::getInstanceByGroupId($this->getGroupId())->getTasks() as $task) {
126  include_once './Services/SystemCheck/classes/class.ilSCComponentTaskFactory.php';
127  $task_handler = ilSCComponentTaskFactory::getComponentTask($task->getId());
128 
129  if (!$task->isActive()) {
130  continue;
131  }
132 
133  $item = array();
134  $item['id'] = $task->getId();
135  $item['title'] = $task_handler->getTitle();
136  $item['description'] = $task_handler->getDescription();
137  $item['last_update'] = ilDatePresentation::formatDate($task->getLastUpdate());
138  $item['last_update_sort'] = $task->getLastUpdate()->get(IL_CAL_UNIX);
139  $item['status'] = $task->getStatus();
140 
141  $data[] = $item;
142  }
143 
144  $this->setData($data);
145  }
146 }
getGroupId()
Get group id.
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41
global $DIC
Definition: saml.php:7
const STATUS_FAILED
const IL_CAL_UNIX
parse()
Parse system check groups.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
setId($a_val)
Set id.
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Class ilTable2GUI.
$text
Definition: errorreport.php:18
static getInstanceByGroupId($a_group_id)
Get singleton instance.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
$row
User interface class for advanced drop-down selection lists.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
__construct($a_group_id, $a_parent_obj, $a_parent_cmd="")
Constructor.
const STATUS_COMPLETED
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
static taskStatus2Text($a_status)
Table GUI for system check task overview.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.