ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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 
20  private $access;
21 
27  public function __construct($a_group_id, $a_parent_obj, $a_parent_cmd = "")
28  {
29  global $DIC;
30  $this->group_id = $a_group_id;
31  $this->setId('sc_groups');
32  $this->access = $DIC->access();
33 
34  parent::__construct($a_parent_obj, $a_parent_cmd);
35  }
36 
41  public function getGroupId()
42  {
43  return $this->group_id;
44  }
45 
46 
50  public function init()
51  {
52  global $DIC;
53 
54  $ilCtrl = $DIC['ilCtrl'];
55  $lng = $DIC['lng'];
56 
57  $lng->loadLanguageModule('sysc');
58  $this->addColumn($this->lng->txt('title'), 'title', '60%');
59  $this->addColumn($this->lng->txt('last_update'), 'last_update_sort', '20%');
60  $this->addColumn($this->lng->txt('status'), 'status', '10%');
61  $this->addColumn($this->lng->txt('actions'), '', '10%');
62 
63  $this->setTitle($this->lng->txt('sysc_task_overview'));
64 
65  $this->setRowTemplate('tpl.syscheck_tasks_row.html', 'Services/SystemCheck');
66  $this->setFormAction($ilCtrl->getFormAction($this->getParentObject()));
67  }
68 
73  public function fillRow($row)
74  {
75  $this->tpl->setVariable('VAL_TITLE', $row['title']);
76  $this->tpl->setVariable('VAL_DESC', $row['description']);
77 
78  include_once './Services/SystemCheck/classes/class.ilSCUtils.php';
79  $text = ilSCUtils::taskStatus2Text($row['status']);
80  switch ($row['status']) {
82  $this->tpl->setVariable('VAL_STATUS_SUCCESS', $text);
83  break;
84 
86  $this->tpl->setCurrentBlock('warning');
87  $this->tpl->setVariable('VAL_STATUS_WARNING', $text);
88  $this->tpl->parseCurrentBlock();
89  break;
90 
91  default:
92  $this->tpl->setVariable('VAL_STATUS_STANDARD', $text);
93  break;
94  }
95 
96  $this->tpl->setVariable('VAL_LAST_UPDATE', $row['last_update']);
97 
98  // Actions
99  if ($this->access->checkAccess('write', '', $this->parent_obj->object->getRefId())) {
100  include_once './Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
101  $list = new ilAdvancedSelectionListGUI();
102  $list->setSelectionHeaderClass('small');
103  $list->setItemLinkClass('small');
104  $list->setId('sysc_' . $row['id']);
105  $list->setListTitle($this->lng->txt('actions'));
106 
107  include_once './Services/SystemCheck/classes/class.ilSCComponentTaskFactory.php';
108  $task_handler = ilSCComponentTaskFactory::getComponentTask($row['id']);
109 
110  $GLOBALS['DIC']['ilCtrl']->setParameterByClass(get_class($task_handler), 'task_id', $row['id']);
111  foreach ((array) $task_handler->getActions() as $actions) {
112  $list->addItem(
113  $actions['txt'],
114  '',
115  $GLOBALS['DIC']['ilCtrl']->getLinkTargetByClass(
116  get_class($task_handler),
117  $actions['command']
118  )
119  );
120  }
121 
122  $this->tpl->setVariable('ACTIONS', $list->getHTML());
123  }
124  }
125 
126 
130  public function parse()
131  {
132  $data = array();
133  include_once './Services/SystemCheck/classes/class.ilSCTasks.php';
134  foreach (ilSCTasks::getInstanceByGroupId($this->getGroupId())->getTasks() as $task) {
135  include_once './Services/SystemCheck/classes/class.ilSCComponentTaskFactory.php';
136  $task_handler = ilSCComponentTaskFactory::getComponentTask($task->getId());
137 
138  if (!$task->isActive()) {
139  continue;
140  }
141 
142  $item = array();
143  $item['id'] = $task->getId();
144  $item['title'] = $task_handler->getTitle();
145  $item['description'] = $task_handler->getDescription();
146  $item['last_update'] = ilDatePresentation::formatDate($task->getLastUpdate());
147  $item['last_update_sort'] = $task->getLastUpdate()->get(IL_CAL_UNIX);
148  $item['status'] = $task->getStatus();
149 
150  $data[] = $item;
151  }
152 
153  $this->setData($data);
154  }
155 }
getGroupId()
Get group id.
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.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
global $DIC
Definition: goto.php:24
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static getInstanceByGroupId($a_group_id)
Get singleton instance.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
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
__construct(Container $dic, ilPlugin $plugin)
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.