ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
15  private $group_id = 0;
16  private $component_task_handler = null;
17 
23  public function __construct($a_group_id, $a_parent_obj, $a_parent_cmd = "")
24  {
25  $this->group_id = $a_group_id;
26  $this->setId('sc_groups');
27 
28  parent::__construct($a_parent_obj, $a_parent_cmd);
29  }
30 
35  public function getGroupId()
36  {
37  return $this->group_id;
38  }
39 
40 
44  public function init()
45  {
46  global $ilCtrl, $lng;
47 
48  $lng->loadLanguageModule('sysc');
49  $this->addColumn($this->lng->txt('title'),'title','60%');
50  $this->addColumn($this->lng->txt('last_update'),'last_update_sort','20%');
51  $this->addColumn($this->lng->txt('status'),'status','10%');
52  $this->addColumn($this->lng->txt('actions'),'','10%');
53 
54  $this->setTitle($this->lng->txt('sysc_task_overview'));
55 
56  $this->setRowTemplate('tpl.syscheck_tasks_row.html','Services/SystemCheck');
57  $this->setFormAction($ilCtrl->getFormAction($this->getParentObject()));
58 
59  }
60 
65  public function fillRow($row)
66  {
67  $this->tpl->setVariable('VAL_TITLE',$row['title']);
68  $this->tpl->setVariable('VAL_DESC',$row['description']);
69 
70  include_once './Services/SystemCheck/classes/class.ilSCUtils.php';
72  switch($row['status'])
73  {
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';
93  $list = new ilAdvancedSelectionListGUI();
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['ilCtrl']->setParameterByClass(get_class($task_handler),'task_id',$row['id']);
103  foreach((array) $task_handler->getActions() as $actions)
104  {
105  $list->addItem(
106  $actions['txt'],
107  '',
108  $GLOBALS['ilCtrl']->getLinkTargetByClass(
109  get_class($task_handler),
110  $actions['command']
111  )
112  );
113  }
114 
115  $this->tpl->setVariable('ACTIONS',$list->getHTML());
116  }
117 
118 
122  public function parse()
123  {
124  $data = array();
125  include_once './Services/SystemCheck/classes/class.ilSCTasks.php';
126  foreach(ilSCTasks::getInstanceByGroupId($this->getGroupId())->getTasks() as $task)
127  {
128  include_once './Services/SystemCheck/classes/class.ilSCComponentTaskFactory.php';
129  $task_handler = ilSCComponentTaskFactory::getComponentTask($task->getId());
130 
131 
132  $item = array();
133  $item['id'] = $task->getId();
134  $item['title'] = $task_handler->getTitle();
135  $item['description'] = $task_handler->getDescription();
136  $item['last_update'] = ilDatePresentation::formatDate($task->getLastUpdate());
137  $item['last_update_sort'] = $task->getLastUpdate()->get(IL_CAL_UNIX);
138  $item['status'] = $task->getStatus();
139 
140  $data[] = $item;
141  }
142 
143  $this->setData($data);
144  }
145 }
146 ?>
getGroupId()
Get group id.
const STATUS_FAILED
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
const IL_CAL_UNIX
parse()
Parse system check groups.
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.
static formatDate(ilDateTime $date)
Format a date public.
static getInstanceByGroupId($a_group_id)
Get singleton instance.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
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
global $lng
Definition: privfeed.php:17
$text
static taskStatus2Text($a_status)
Table GUI for system check task overview.
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.