ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilConsultationHourBookingTableGUI.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 private $user_id = 0;
16
17 private $today = null;
18
25 public function __construct($a_parent_obj, $a_parent_cmd, $a_user_id)
26 {
27 $this->user_id = $a_user_id;
28 $this->setId('chboo_' . $this->user_id);
29 parent::__construct($a_parent_obj, $a_parent_cmd);
30
31 $this->initTable();
32
33
34 $this->today = new ilDateTime(time(), IL_CAL_UNIX);
35 }
36
40 protected function initTable()
41 {
42 $this->setRowTemplate('tpl.ch_booking_row.html', 'Services/Calendar');
43
44 $this->setTitle($GLOBALS['DIC']['lng']->txt('cal_ch_bookings_tbl'));
45 $this->setFormAction($GLOBALS['DIC']['ilCtrl']->getFormAction($this->getParentObject(), $this->getParentCmd()));
46
47 $this->addColumn('', '', '1px');
48 $this->addColumn($GLOBALS['DIC']['lng']->txt('cal_start'), 'start');
49 $this->addColumn($GLOBALS['DIC']['lng']->txt('name'), 'name');
50 $this->addColumn($GLOBALS['DIC']['lng']->txt('cal_ch_booking_message_tbl'), 'comment');
51 $this->addColumn($GLOBALS['DIC']['lng']->txt('title'), 'title');
52 $this->addColumn($GLOBALS['DIC']['lng']->txt('actions'), '');
53
54 $this->enable('sort');
55 $this->enable('header');
56 $this->enable('num_info');
57
58 $this->setDefaultOrderField('start');
59 $this->setSelectAllCheckbox('bookuser');
60 $this->setShowRowsSelector(true);
61 $this->addMultiCommand('confirmRejectBooking', $this->lng->txt('cal_ch_reject_booking'));
62 $this->addMultiCommand('confirmDeleteBooking', $this->lng->txt('cal_ch_delete_booking'));
63 }
64
69 public function fillRow($row)
70 {
71 global $DIC;
72
73 $ilCtrl = $DIC['ilCtrl'];
74
75 $this->tpl->setVariable('START', $row['start_str']);
76 $this->tpl->setVariable('NAME', $row['name']);
77 $this->tpl->setVariable('COMMENT', $row['comment']);
78 $this->tpl->setVariable('TITLE', $row['title']);
79 $this->tpl->setVariable('VAL_ID', $row['id']);
80
81 include_once './Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
82 $list = new ilAdvancedSelectionListGUI();
83 $list->setId('act_chboo_' . $row['id']);
84 $list->setListTitle($this->lng->txt('actions'));
85
86 $ilCtrl->setParameter($this->getParentObject(), 'bookuser', $row['id']);
87
88 $start = new ilDateTime($row['start'], IL_CAL_UNIX);
89 if (ilDateTime::_after($start, $this->today, IL_CAL_DAY)) {
90 $list->addItem(
91 $this->lng->txt('cal_ch_reject_booking'),
92 '',
93 $ilCtrl->getLinkTarget($this->getParentObject(), 'confirmRejectBooking')
94 );
95 }
96 $list->addItem(
97 $this->lng->txt('cal_ch_delete_booking'),
98 '',
99 $ilCtrl->getLinkTarget($this->getParentObject(), 'confirmDeleteBooking')
100 );
101 $this->tpl->setVariable('ACTIONS', $list->getHTML());
102 }
103
104
109 public function parse(array $appointments)
110 {
111 global $DIC;
112
113 $ilCtrl = $DIC['ilCtrl'];
114
115 $rows = array();
116 $counter = 0;
117 foreach ($appointments as $app) {
118 include_once './Services/Calendar/classes/class.ilCalendarEntry.php';
119 $cal_entry = new ilCalendarEntry($app);
120
121 include_once './Services/Booking/classes/class.ilBookingEntry.php';
123 include_once './Services/User/classes/class.ilUserUtil.php';
124 $rows[$counter]['name'] = ilUserUtil::getNamePresentation(
125 $user_id,
126 true,
127 true,
128 $ilCtrl->getLinkTarget($this->getParentObject(), $this->getParentCmd()),
129 true,
130 true
131 );
132
134 if (strlen(trim($message))) {
135 $rows[$counter]['comment'] = ('"' . $message . '"');
136 }
137 $rows[$counter]['title'] = $cal_entry->getTitle();
138 $rows[$counter]['start'] = $cal_entry->getStart()->get(IL_CAL_UNIX);
139 $rows[$counter]['start_str'] = ilDatePresentation::formatDate($cal_entry->getStart());
140 $rows[$counter]['id'] = $app . '_' . $user_id;
141 ++$counter;
142 }
143 }
144 $this->setData($rows);
145 }
146}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_UNIX
const IL_CAL_DAY
User interface class for advanced drop-down selection lists.
static lookupBookingsForAppointment($a_app_id)
Lookup booked users for appointment @global type $ilDB.
static lookupBookingMessage($a_entry_id, $a_usr_id)
Model for a calendar entry.
__construct($a_parent_obj, $a_parent_cmd, $a_user_id)
Constructor.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
@classDescription Date and time handling
static _after(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
compare two dates and check start is after end This method does not consider tz offsets.
Class ilTable2GUI.
getParentCmd()
Get parent command.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
getParentObject()
Get parent object.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
getFormAction()
Get Form action parameter.
setSelectAllCheckbox($a_select_all_checkbox, $a_select_all_on_top=false)
Set the name of the checkbox that should be toggled with a select all button.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
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.
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
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
$app
Definition: cli.php:38
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$message
Definition: xapiexit.php:14
$rows
Definition: xhr_table.php:10