ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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['DIC']['lng']->txt('cal_ch_grps'));
40  $this->setFormAction($GLOBALS['DIC']['ilCtrl']->getFormAction($this->getParentObject(), $this->getParentCmd()));
41 
42  $this->addColumn($GLOBALS['DIC']['lng']->txt('title'), 'title');
43  $this->addColumn($GLOBALS['DIC']['lng']->txt('cal_ch_assigned_apps'), 'apps');
44  $this->addColumn($GLOBALS['DIC']['lng']->txt('cal_ch_max_books'), 'max_books');
45  $this->addColumn($GLOBALS['DIC']['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 $DIC;
61 
62  $ilCtrl = $DIC['ilCtrl'];
63 
64  $this->tpl->setVariable('TITLE', $a_set['title']);
65  $this->tpl->setVariable('MAX_BOOKINGS', $a_set['max_books']);
66  $this->tpl->setVariable('ASSIGNED', $a_set['assigned']);
67 
68  include_once './Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
70  $list->setId('act_chgrp_' . $this->user_id . '_' . $a_set['id']);
71  $list->setListTitle($this->lng->txt('actions'));
72 
73  $ilCtrl->setParameter($this->getParentObject(), 'grp_id', $a_set['id']);
74  $list->addItem(
75  $this->lng->txt('edit'),
76  '',
77  $ilCtrl->getLinkTarget($this->getParentObject(), 'editGroup')
78  );
79 
80  // add members
81  if ($a_set['assigned']) {
82  $list->addItem(
83  $this->lng->txt('cal_ch_assign_participants'),
84  '',
85  $ilCtrl->getLinkTargetByClass('ilRepositorySearchGUI', '')
86  );
87  }
88 
89  $list->addItem(
90  $this->lng->txt('delete'),
91  '',
92  $ilCtrl->getLinkTarget($this->getParentObject(), 'confirmDeleteGroup')
93  );
94 
95  $this->tpl->setVariable('ACTIONS', $list->getHTML());
96  }
97 
98 
103  public function parse(array $groups)
104  {
105  $rows = array();
106  $counter = 0;
107  foreach ($groups as $group) {
108  $rows[$counter]['id'] = $group->getGroupId();
109  $rows[$counter]['title'] = $group->getTitle();
110  $rows[$counter]['max_books'] = $group->getMaxAssignments();
111  $rows[$counter]['assigned'] = count(
113  $this->user_id,
114  $group->getGroupId(),
115  null
116  )
117  );
118  ++$counter;
119  }
120  $this->setData($rows);
121  }
122 }
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
global $DIC
Definition: saml.php:7
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.
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.
$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.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.