ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilConsultationHourGroupTableGUI.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/Calendar/classes/ConsultationHours/class.ilConsultationHourGroup.php';
6 include_once './Services/Table/classes/class.ilTable2GUI.php';
7 
14 {
15  private $user_id = 0;
16 
23  public function __construct($a_parent_obj, $a_parent_cmd, $a_user_id)
24  {
25  $this->user_id = $a_user_id;
26  $this->setId('chgrp_' . $this->user_id);
27  parent::__construct($a_parent_obj, $a_parent_cmd);
28 
29  $this->initTable();
30  }
31 
35  protected function initTable()
36  {
37  $this->setRowTemplate('tpl.ch_group_row.html', 'Services/Calendar');
38 
39  $this->setTitle($GLOBALS['lng']->txt('cal_ch_grps'));
40  $this->setFormAction($GLOBALS['ilCtrl']->getFormAction($this->getParentObject(), $this->getParentCmd()));
41 
42  $this->addColumn($GLOBALS['lng']->txt('title'), 'title');
43  $this->addColumn($GLOBALS['lng']->txt('cal_ch_assigned_apps'), 'apps');
44  $this->addColumn($GLOBALS['lng']->txt('cal_ch_max_books'), 'max_books');
45  $this->addColumn($GLOBALS['lng']->txt('actions'), '');
46 
47  $this->enable('sort');
48  $this->enable('header');
49  $this->enable('num_info');
50 
51  $this->setDefaultOrderField('title');
52  }
53 
58  public function fillRow($a_set)
59  {
60  global $ilCtrl;
61 
62  $this->tpl->setVariable('TITLE', $a_set['title']);
63  $this->tpl->setVariable('MAX_BOOKINGS', $a_set['max_books']);
64  $this->tpl->setVariable('ASSIGNED', $a_set['assigned']);
65 
66  include_once './Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
68  $list->setId('act_chgrp_' . $this->user_id . '_' . $a_set['id']);
69  $list->setListTitle($this->lng->txt('actions'));
70 
71  $ilCtrl->setParameter($this->getParentObject(), 'grp_id', $a_set['id']);
72  $list->addItem(
73  $this->lng->txt('edit'),
74  '',
75  $ilCtrl->getLinkTarget($this->getParentObject(), 'editGroup')
76  );
77 
78  // add members
79  if ($a_set['assigned']) {
80  $list->addItem(
81  $this->lng->txt('cal_ch_assign_participants'),
82  '',
83  $ilCtrl->getLinkTargetByClass('ilRepositorySearchGUI', '')
84  );
85  }
86 
87  $list->addItem(
88  $this->lng->txt('delete'),
89  '',
90  $ilCtrl->getLinkTarget($this->getParentObject(), 'confirmDeleteGroup')
91  );
92 
93  $this->tpl->setVariable('ACTIONS', $list->getHTML());
94  }
95 
96 
101  public function parse(array $groups)
102  {
103  $rows = array();
104  $counter = 0;
105  foreach ($groups as $group) {
106  $rows[$counter]['id'] = $group->getGroupId();
107  $rows[$counter]['title'] = $group->getTitle();
108  $rows[$counter]['max_books'] = $group->getMaxAssignments();
109  $rows[$counter]['assigned'] = count(
111  $this->user_id,
112  $group->getGroupId(),
113  null
114  )
115  );
116  ++$counter;
117  }
118  $this->setData($rows);
119  }
120 }
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
getParentCmd()
Get parent command.
getParentObject()
Get parent object.
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.
$counter
Class ilTable2GUI.
enable($a_module_name)
enables particular modules of table
getFormAction()
Get Form action parameter.
static getAppointmentIdsByGroup($a_user_id, $a_ch_group_id, ilDateTime $start=null)
Get appointment ids by consultation hour group.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
$rows
Definition: xhr_table.php:10
User interface class for advanced drop-down selection lists.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
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.
__construct($a_parent_obj, $a_parent_cmd, $a_user_id)
Constructor.