forked from ILIAS-eLearning/ILIAS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclass.ilBookingAssignParticipantsTableGUI.php
More file actions
174 lines (142 loc) · 3.89 KB
/
class.ilBookingAssignParticipantsTableGUI.php
File metadata and controls
174 lines (142 loc) · 3.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<?php
/* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
/**
* List participant / booking pool assignment.
*
* @author Jesús López <lopez@leifos.com>
* @version $Id$
*
* @ingroup ModulesBookingManager
*/
class ilBookingAssignParticipantsTableGUI extends ilTable2GUI
{
/**
* @var ilAccessHandler
*/
protected $access;
/**
* @var ilObjUser
*/
protected $user;
/**
* @var int
*/
protected $ref_id;
/**
* @var int
*/
protected $pool_id;
/**
* @var int
*/
protected $bp_object_id;
/**
* @var ilObjBookingPool
*/
protected $bp_object;
/**
* @var int
*/
protected $current_bookings; // [int]
/**
* @var array
*/
protected $filter; // [array]
/**
* @var array
*/
protected $objects; // array
//TODO clean unused vars.
protected $has_schedule; // [bool]
protected $may_edit; // [bool]
protected $may_assign; // [bool]
protected $overall_limit; // [int]
protected $reservations = array(); // [array]
/**
* Constructor
* @param ilBookingObjectGUI $a_parent_obj
* @param string $a_parent_cmd
* @param int $a_ref_id
* @param int $a_pool_id
* @param int $a_booking_obj_id //booking object to assign users.
*/
function __construct(ilBookingObjectGUI $a_parent_obj, $a_parent_cmd, $a_ref_id, $a_pool_id, $a_booking_obj_id)
{
global $DIC;
$this->ctrl = $DIC->ctrl();
$this->lng = $DIC->language();
$this->user = $DIC->user();
$this->access = $DIC->access();
$this->ref_id = $a_ref_id;
$this->bp_object_id = $a_booking_obj_id;
$this->pool_id = $a_pool_id;
$this->bp_object = new ilBookingObject($a_booking_obj_id);
$this->setId("bkaprt".$a_ref_id);
parent::__construct($a_parent_obj, $a_parent_cmd);
$this->setTitle($this->lng->txt("book_assign_participant").": ".$this->bp_object->getTitle());
$this->addColumn("", "");
$this->addColumn($this->lng->txt("name"), "name");
$this->addColumn($this->lng->txt("book_bobj"));
$this->addColumn($this->lng->txt("action"));
$this->setDefaultOrderField("name");
$this->setDefaultOrderDirection("asc");
$this->setEnableHeader(true);
$this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
$this->setRowTemplate("tpl.booking_assign_participant_row.html", "Modules/BookingManager");
//$this->setResetCommand("resetParticipantsFilter");
//$this->setFilterCommand("applyParticipantsFilter");
//$this->setDisableFilterHiding(true);
$this->initFilter();
$this->getItems($this->getCurrentFilter());
}
//TODO implement the filters if any.
function initFilter()
{
return array();
}
/**
* Get current filter settings
* @return array
*/
function getCurrentFilter()
{
$filter = array();
if($this->filter["user_id"])
{
$filter["user_id"] = $this->filter["user_id"];
}
return $filter;
}
/**
* Gather data and build rows
* @param array $filter
*/
function getItems(array $filter = null)
{
include_once "Modules/BookingManager/classes/class.ilBookingParticipant.php";
$data = ilBookingParticipant::getAssignableParticipants($this->bp_object_id);
$this->setMaxCount(sizeof($data));
$this->setData($data);
}
/**
* Fill table row
* @param array $a_set
*/
protected function fillRow($a_set)
{
$this->tpl->setVariable("TXT_NAME", $a_set['name']);
$this->tpl->setCurrentBlock('object_titles');
foreach($a_set['object_title'] as $obj_title)
{
$this->tpl->setVariable("TXT_OBJECT", $obj_title);
$this->tpl->parseCurrentBlock();
}
$this->ctrl->setParameter($this->parent_obj, 'bkusr', $a_set['user_id']);
$this->ctrl->setParameter($this->parent_obj, 'object_id', $this->bp_object_id);
$this->tpl->setVariable("TXT_ACTION", $this->lng->txt("book_assign"));
$this->tpl->setVariable("URL_ACTION", $this->ctrl->getLinkTarget($this->parent_obj, 'book'));
$this->ctrl->setParameter($this->parent_obj, 'bkusr', '');
$this->ctrl->setParameter($this->parent_obj, 'object_id', '');
}
}
?>