ILIAS  release_7 Revision v7.30-3-g800a261c036
ilBookingParticipantGUI Class Reference

Class ilBookingParticipantGUI. More...

+ Collaboration diagram for ilBookingParticipantGUI:

Public Member Functions

 __construct (ilObjBookingPoolGUI $a_parent_obj)
 Constructor. More...
 
 executeCommand ()
 main switch More...
 
 render ()
 Render list of booking participants. More...
 
 addUserFromAutoCompleteObject ()
 Add user as member. More...
 
 addParticipantObject (array $a_user_ids)
 Add new partipant. More...
 
 applyParticipantsFilter ()
 Apply filter from participants table gui. More...
 
 resetParticipantsFilter ()
 Reset filter in participants table gui. More...
 
 assignObjects ()
 Book objects for other users. More...
 

Data Fields

const FILTER_ACTION_APPLY = 1
 
const FILTER_ACTION_RESET = 2
 
const PARTICIPANT_VIEW = 1
 

Protected Member Functions

 applyFilterAction ($a_filter_action)
 

Protected Attributes

 $tpl
 
 $tabs
 
 $ctrl
 
 $lng
 
 $access
 
 $toolbar
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilBookingParticipantGUI::__construct ( ilObjBookingPoolGUI  $a_parent_obj)

Constructor.

Parameters
object$a_parent_obj

Definition at line 54 of file class.ilBookingParticipantGUI.php.

55 {
56 global $DIC;
57
58 $this->tpl = $DIC["tpl"];
59 $this->tabs = $DIC->tabs();
60 $this->ctrl = $DIC->ctrl();
61 $this->lng = $DIC->language();
62 $this->access = $DIC->access();
63 $this->toolbar = $DIC->toolbar();
64
65 $this->ref_id = $a_parent_obj->ref_id;
66 $this->pool_id = $a_parent_obj->object->getId();
67
68 $this->lng->loadLanguageModule("book");
69 }
global $DIC
Definition: goto.php:24

References $DIC.

Member Function Documentation

◆ addParticipantObject()

ilBookingParticipantGUI::addParticipantObject ( array  $a_user_ids)

Add new partipant.

Parameters
array$a_user_ids
Returns
bool

Definition at line 163 of file class.ilBookingParticipantGUI.php.

164 {
165 foreach ($a_user_ids as $user_id) {
166 if (ilObject::_lookupType($user_id) === "usr") {
167 $participant_obj = new ilBookingParticipant($user_id, $this->pool_id);
168 if ($participant_obj->getIsNew()) {
169 ilUtil::sendSuccess($this->lng->txt("book_participant_assigned"), true);
170 } else {
171 ilUtil::sendFailure($this->lng->txt("book_participant_already_assigned"));
172 return false;
173 }
174 } else {
175 ilUtil::sendFailure("dummy error message, change me");
176 return false;
177 }
178 }
179
180 $this->ctrl->redirect($this, "render");
181 return true;
182 }
Class ilBookingParticipant.
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

References ilObject\_lookupType(), and ilUtil\sendFailure().

Referenced by addUserFromAutoCompleteObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addUserFromAutoCompleteObject()

ilBookingParticipantGUI::addUserFromAutoCompleteObject ( )

Add user as member.

Definition at line 134 of file class.ilBookingParticipantGUI.php.

135 {
136 if (!strlen(trim($_POST['user_login']))) {
137 ilUtil::sendFailure($this->lng->txt('msg_no_search_string'));
138 $this->render();
139 return false;
140 }
141
142 $users = explode(',', $_POST['user_login']);
143
144 $user_ids = array();
145 foreach ($users as $user) {
146 $user_id = ilObjUser::_lookupId($user);
147
148 if (!$user_id) {
149 ilUtil::sendFailure($this->lng->txt('user_not_known'));
150 $this->render();
151 }
152 $user_ids[] = $user_id;
153 }
154
155 return $this->addParticipantObject($user_ids);
156 }
$_POST["username"]
addParticipantObject(array $a_user_ids)
Add new partipant.
render()
Render list of booking participants.
static _lookupId($a_user_str)
Lookup id by login.

References $_POST, ilObjUser\_lookupId(), addParticipantObject(), render(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ applyFilterAction()

ilBookingParticipantGUI::applyFilterAction (   $a_filter_action)
protected

Definition at line 200 of file class.ilBookingParticipantGUI.php.

201 {
202 $table = new ilBookingParticipantsTableGUI($this, 'render', $this->ref_id, $this->pool_id);
203 $table->resetOffset();
204 if ($a_filter_action === self::FILTER_ACTION_RESET) {
205 $table->resetFilter();
206 } else {
207 $table->writeFilterToSession();
208 }
209
210 $this->render();
211 }

References render().

Referenced by applyParticipantsFilter(), and resetParticipantsFilter().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ applyParticipantsFilter()

ilBookingParticipantGUI::applyParticipantsFilter ( )

Apply filter from participants table gui.

Definition at line 187 of file class.ilBookingParticipantGUI.php.

188 {
189 $this->applyFilterAction(self::FILTER_ACTION_APPLY);
190 }

References applyFilterAction().

+ Here is the call graph for this function:

◆ assignObjects()

ilBookingParticipantGUI::assignObjects ( )

Book objects for other users.

Definition at line 216 of file class.ilBookingParticipantGUI.php.

217 {
218 $this->tabs->clearTargets();
219 $this->tabs->setBackTarget($this->lng->txt('book_back_to_list'), $this->ctrl->getLinkTarget($this, 'render'));
220
221 $table = new ilBookingAssignObjectsTableGUI($this, 'assignObjects', $this->ref_id, $this->pool_id);
222
223 $this->tpl->setContent($table->getHTML());
224 }
List objects / booking pool assignment.

◆ executeCommand()

ilBookingParticipantGUI::executeCommand ( )

main switch

Definition at line 74 of file class.ilBookingParticipantGUI.php.

75 {
76 $ilCtrl = $this->ctrl;
77
78 $next_class = $ilCtrl->getNextClass($this);
79
80 switch ($next_class) {
81 case 'ilrepositorysearchgui':
82 $rep_search = new ilRepositorySearchGUI();
83 $ref_id = $this->ref_id;
84 $rep_search->addUserAccessFilterCallable(function ($a_user_id) use ($ref_id) {
85 return $GLOBALS['DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
86 'render',
87 'render',
88 $this->ref_id,
89 $a_user_id
90 );
91 });
92 $rep_search->setTitle($this->lng->txt("exc_add_participant"));
93 $rep_search->setCallback($this, 'addParticipantObject');
94 $this->ctrl->setReturn($this, 'render');
95 $this->ctrl->forwardCommand($rep_search);
96 break;
97
98 default:
99 $cmd = $ilCtrl->getCmd("render");
100 $this->$cmd();
101 break;
102 }
103 return true;
104 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64

References $ctrl, and $GLOBALS.

◆ render()

ilBookingParticipantGUI::render ( )

Render list of booking participants.

uses ilBookingParticipantsTableGUI

Definition at line 111 of file class.ilBookingParticipantGUI.php.

112 {
113 if ($this->access->checkAccess('write', '', $this->ref_id)) {
115 $this,
116 $this->toolbar,
117 array(
118 'auto_complete_name' => $this->lng->txt('user'),
119 'submit_name' => $this->lng->txt('add'),
120 'add_search' => true,
121 'add_from_container' => $this->ref_id
122 )
123 );
124
125 $table = new ilBookingParticipantsTableGUI($this, 'render', $this->ref_id, $this->pool_id);
126
127 $this->tpl->setContent($table->getHTML());
128 }
129 }
static fillAutoCompleteToolbar($parent_object, ilToolbarGUI $toolbar=null, $a_options=array(), $a_sticky=false)
fill toolbar with

References ilRepositorySearchGUI\fillAutoCompleteToolbar().

Referenced by addUserFromAutoCompleteObject(), and applyFilterAction().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetParticipantsFilter()

ilBookingParticipantGUI::resetParticipantsFilter ( )

Reset filter in participants table gui.

Definition at line 195 of file class.ilBookingParticipantGUI.php.

196 {
197 $this->applyFilterAction(self::FILTER_ACTION_RESET);
198 }

References applyFilterAction().

+ Here is the call graph for this function:

Field Documentation

◆ $access

ilBookingParticipantGUI::$access
protected

Definition at line 38 of file class.ilBookingParticipantGUI.php.

◆ $ctrl

ilBookingParticipantGUI::$ctrl
protected

Definition at line 28 of file class.ilBookingParticipantGUI.php.

Referenced by executeCommand().

◆ $lng

ilBookingParticipantGUI::$lng
protected

Definition at line 33 of file class.ilBookingParticipantGUI.php.

◆ $tabs

ilBookingParticipantGUI::$tabs
protected

Definition at line 23 of file class.ilBookingParticipantGUI.php.

◆ $toolbar

ilBookingParticipantGUI::$toolbar
protected

Definition at line 43 of file class.ilBookingParticipantGUI.php.

◆ $tpl

ilBookingParticipantGUI::$tpl
protected

Definition at line 18 of file class.ilBookingParticipantGUI.php.

◆ FILTER_ACTION_APPLY

const ilBookingParticipantGUI::FILTER_ACTION_APPLY = 1

Definition at line 45 of file class.ilBookingParticipantGUI.php.

◆ FILTER_ACTION_RESET

const ilBookingParticipantGUI::FILTER_ACTION_RESET = 2

Definition at line 46 of file class.ilBookingParticipantGUI.php.

◆ PARTICIPANT_VIEW

const ilBookingParticipantGUI::PARTICIPANT_VIEW = 1

The documentation for this class was generated from the following file: