ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
5include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroup.php';
6include_once './Services/Table/classes/class.ilTable2GUI.php';
7
14{
15
16 private $user_id = 0;
17
24 public function __construct($a_parent_obj, $a_parent_cmd, $a_user_id)
25 {
26 $this->user_id = $a_user_id;
27 $this->setId('chgrp_'.$this->user_id);
28 parent::__construct($a_parent_obj,$a_parent_cmd);
29
30 $this->initTable();
31 }
32
36 protected function initTable()
37 {
38 $this->setRowTemplate('tpl.ch_group_row.html','Services/Calendar');
39
40 $this->setTitle($GLOBALS['lng']->txt('cal_ch_grps'));
41 $this->setFormAction($GLOBALS['ilCtrl']->getFormAction($this->getParentObject(),$this->getParentCmd()));
42
43 $this->addColumn($GLOBALS['lng']->txt('title'),'title');
44 $this->addColumn($GLOBALS['lng']->txt('cal_ch_assigned_apps'),'apps');
45 $this->addColumn($GLOBALS['lng']->txt('cal_ch_max_books'), 'max_books');
46 $this->addColumn($GLOBALS['lng']->txt('actions'), '');
47
48 $this->enable('sort');
49 $this->enable('header');
50 $this->enable('num_info');
51
52 $this->setDefaultOrderField('title');
53 }
54
59 public function fillRow($a_set)
60 {
61 global $ilCtrl;
62
63 $this->tpl->setVariable('TITLE',$a_set['title']);
64 $this->tpl->setVariable('MAX_BOOKINGS',$a_set['max_books']);
65 $this->tpl->setVariable('ASSIGNED',$a_set['assigned']);
66
67 include_once './Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
68 $list = new ilAdvancedSelectionListGUI();
69 $list->setId('act_chgrp_'.$this->user_id.'_'.$a_set['id']);
70 $list->setListTitle($this->lng->txt('actions'));
71
72 $ilCtrl->setParameter($this->getParentObject(),'grp_id',$a_set['id']);
73 $list->addItem(
74 $this->lng->txt('edit'),
75 '',
76 $ilCtrl->getLinkTarget($this->getParentObject(),'editGroup')
77 );
78
79 // add members
80 if($a_set['assigned'])
81 {
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 {
109 $rows[$counter]['id'] = $group->getGroupId();
110 $rows[$counter]['title'] = $group->getTitle();
111 $rows[$counter]['max_books'] = $group->getMaxAssignments();
112 $rows[$counter]['assigned'] = count(ilConsultationHourAppointments::getAppointmentIdsByGroup(
113 $this->user_id,
114 $group->getGroupId(),
115 null
116 )
117 );
118 ++$counter;
119 }
120 $this->setData($rows);
121 }
122}
123?>
User interface class for advanced drop-down selection lists.
static getAppointmentIdsByGroup($a_user_id, $a_ch_group_id, ilDateTime $start=null)
Get appointment ids by consultation hour group.
__construct($a_parent_obj, $a_parent_cmd, $a_user_id)
Constructor.
Class ilTable2GUI.
getParentCmd()
Get parent command.
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.
getParentObject()
Get parent object.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
getFormAction()
Get Form action parameter.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setId($a_val)
Set id.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
enable($a_module_name)
enables particular modules of table
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
global $ilCtrl
Definition: ilias.php:18