ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilObjStudyProgrammeMembersGUI Class Reference

Class ilObjStudyProgrammeMembersGUI. More...

+ Collaboration diagram for ilObjStudyProgrammeMembersGUI:

Public Member Functions

 __construct ($a_parent_gui, $a_ref_id)
 
 executeCommand ()
 
 addUsers ($a_users)
 
 viewCompletedCourses ($a_completed_courses, $a_users)
 
 addUsersWithAcknowledgedCourses ()
 
 markAccredited ()
 
 unmarkAccredited ()
 
 removeUser ()
 
 getStudyProgramme ($a_ref_id=null)
 
 getLinkTargetForAction ($a_action, $a_prgrs_id, $a_ass_id)
 Get the link target for an action on user progress. More...
 

Data Fields

 $ctrl
 
 $tpl
 
 $object
 
 $ilias
 
 $lng
 
 $toolbar
 
 $user
 

Protected Member Functions

 view ()
 
 _addUsers ($a_users)
 
 getProgressObject ()
 
 showSuccessMessage ($a_lng_var)
 
 initSearchGUI ()
 

Protected Attributes

 $ilAccess
 
 $ilLog
 
 $parent_gui
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjStudyProgrammeMembersGUI::__construct (   $a_parent_gui,
  $a_ref_id 
)

Definition at line 64 of file class.ilObjStudyProgrammeMembersGUI.php.

64 {
65 global $DIC;
66 $tpl = $DIC['tpl'];
67 $ilCtrl = $DIC['ilCtrl'];
68 $ilAccess = $DIC['ilAccess'];
69 $ilToolbar = $DIC['ilToolbar'];
70 $ilLocator = $DIC['ilLocator'];
71 $tree = $DIC['tree'];
72 $lng = $DIC['lng'];
73 $ilLog = $DIC['ilLog'];
74 $ilias = $DIC['ilias'];
75 $ilUser = $DIC['ilUser'];
76
77 $this->ref_id = $a_ref_id;
78 $this->parent_gui = $a_parent_gui;
79 $this->tpl = $tpl;
80 $this->ctrl = $ilCtrl;
81 $this->ilAccess = $ilAccess;
82 $this->ilLocator = $ilLocator;
83 $this->tree = $tree;
84 $this->toolbar = $ilToolbar;
85 $this->ilLog = $ilLog;
86 $this->ilias = $ilias;
87 $this->lng = $lng;
88 $this->user = $ilUser;
89 $this->progress_object = null;
90
91 $this->object = null;
92
93 $lng->loadLanguageModule("prg");
94 }
user()
Definition: user.php:4
logging
Definition: class.ilLog.php:19
global $ilCtrl
Definition: ilias.php:18
redirection script todo: (a better solution should control the processing via a xml file)
global $DIC
$ilUser
Definition: imgupload.php:18

References $DIC, $ilAccess, $ilCtrl, $ilias, $ilLog, $ilUser, $lng, $tpl, and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ _addUsers()

ilObjStudyProgrammeMembersGUI::_addUsers (   $a_users)
protected

Definition at line 228 of file class.ilObjStudyProgrammeMembersGUI.php.

228 {
229 $prg = $this->getStudyProgramme();
230
231 $assignments = array();
232
233 foreach ($a_users as $user_id) {
234 $assignments[$user_id] = $prg->assignUser($user_id);
235 }
236
237 if (count($a_users) == 1) {
238 ilUtil::sendSuccess($this->lng->txt("prg_added_member"), true);
239 }
240 if (count($a_users) > 1) {
241 ilUtil::sendSuccess($this->lng->txt("prg_added_members"), true);
242 }
243
244 return $assignments;
245 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.

References getStudyProgramme(), and ilUtil\sendSuccess().

Referenced by addUsers(), and addUsersWithAcknowledgedCourses().

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

◆ addUsers()

ilObjStudyProgrammeMembersGUI::addUsers (   $a_users)

Definition at line 158 of file class.ilObjStudyProgrammeMembersGUI.php.

158 {
159 $prg = $this->getStudyProgramme();
160
161 $completed_courses = array();
162
163 foreach ($a_users as $user_id) {
164 $completed_crss = $prg->getCompletedCourses($user_id);
165 if ($completed_crss) {
166 $completed_courses[$user_id] = $completed_crss;
167 }
168 }
169
170 if (count($completed_courses) > 0) {
171 $this->viewCompletedCourses($completed_courses, $a_users);
172 return true;
173 }
174
175 $this->_addUsers($a_users);
176
177 $this->ctrl->redirect($this, "view");
178 }
viewCompletedCourses($a_completed_courses, $a_users)

References _addUsers(), getStudyProgramme(), and viewCompletedCourses().

+ Here is the call graph for this function:

◆ addUsersWithAcknowledgedCourses()

ilObjStudyProgrammeMembersGUI::addUsersWithAcknowledgedCourses ( )

Definition at line 210 of file class.ilObjStudyProgrammeMembersGUI.php.

210 {
211 $users = $_POST["users"];
212 $assignments = $this->_addUsers($users);
213
214 $completed_programmes = $_POST["courses"];
215 foreach ($completed_programmes as $user_id => $prg_ref_ids) {
216 $ass_id = $assignments[$user_id]->getId();
217 foreach ($prg_ref_ids as $ids) {
218 list($prg_ref_id, $crs_id, $crsr_id) = explode(";", $ids);
219 $prg = $this->getStudyProgramme($prg_ref_id);
220 $progress = $prg->getProgressForAssignment($ass_id);
221 $progress->setLPCompleted($crsr_id, $user_id);
222 }
223 }
224
225 $this->ctrl->redirect($this, "view");
226 }
$_POST["username"]

References $_POST, _addUsers(), and getStudyProgramme().

+ Here is the call graph for this function:

◆ executeCommand()

ilObjStudyProgrammeMembersGUI::executeCommand ( )

Definition at line 96 of file class.ilObjStudyProgrammeMembersGUI.php.

96 {
97 $cmd = $this->ctrl->getCmd();
98 $next_class = $this->ctrl->getNextClass($this);
99
100
101 if ($cmd == "") {
102 $cmd = "view";
103 }
104
105 # TODO: Check permission of user!!
106
107 switch ($next_class) {
108 case "ilstudyprogrammerepositorysearchgui":
109 require_once("./Modules/StudyProgramme/classes/class.ilStudyProgrammeRepositorySearchGUI.php");
110 $rep_search = new ilStudyProgrammeRepositorySearchGUI();
111 $rep_search->setCallback($this, "addUsers");
112
113 $this->ctrl->setReturn($this, "view");
114 $this->ctrl->forwardCommand($rep_search);
115 return;
116 case "ilobjstudyprogrammeindividualplangui":
117 require_once("./Modules/StudyProgramme/classes/class.ilObjStudyProgrammeIndividualPlanGUI.php");
118 $individual_plan_gui = new ilObjStudyProgrammeIndividualPlanGUI( $this, $this->ref_id);
119 $this->ctrl->forwardCommand($individual_plan_gui);
120 return;
121 case false:
122 switch ($cmd) {
123 case "view":
124 case "markAccredited":
125 case "unmarkAccredited":
126 case "removeUser":
127 case "addUsersWithAcknowledgedCourses":
128 $cont = $this->$cmd();
129 break;
130 default:
131 throw new ilException("ilObjStudyProgrammeMembersGUI: ".
132 "Command not supported: $cmd");
133 }
134 break;
135 default:
136 throw new ilException("ilObjStudyProgrammeMembersGUI: Can't forward to next class $next_class");
137 }
138
139 $this->tpl->setContent($cont);
140 }
Base class for ILIAS Exception handling.
Custom repository search gui class for study programme to make it possible to get a handle on users s...
$cmd
Definition: sahs_server.php:35

References $cmd.

◆ getLinkTargetForAction()

ilObjStudyProgrammeMembersGUI::getLinkTargetForAction (   $a_action,
  $a_prgrs_id,
  $a_ass_id 
)

Get the link target for an action on user progress.

Parameters
int$a_actionOne of ilStudyProgrammeUserProgress::ACTION_*
int$a_prgrs_idId of the progress object to act on.
int$a_ass_idId of the assignment object to act on.
Returns
string The link to the action.

Definition at line 322 of file class.ilObjStudyProgrammeMembersGUI.php.

322 {
323 require_once("Modules/StudyProgramme/classes/class.ilStudyProgrammeUserProgress.php");
324
325 switch ($a_action) {
327 $target_name = "markAccredited";
328 break;
330 $target_name = "unmarkAccredited";
331 break;
333 require_once("Modules/StudyProgramme/classes/class.ilObjStudyProgrammeIndividualPlanGUI.php");
334 return ilObjStudyProgrammeIndividualPlanGUI::getLinkTargetView($this->ctrl, $a_ass_id);
336 $target_name = "removeUser";
337 break;
338 default:
339 throw new ilException("Unknown action: $action");
340 }
341
342 $this->ctrl->setParameter($this, "prgrs_id", $a_prgrs_id);
343 $link = $this->ctrl->getLinkTarget($this, $target_name);
344 $this->ctrl->setParameter($this, "prgrs_id", null);
345 return $link;
346 }

References ilStudyProgrammeUserProgress\ACTION_MARK_ACCREDITED, ilStudyProgrammeUserProgress\ACTION_REMOVE_USER, ilStudyProgrammeUserProgress\ACTION_SHOW_INDIVIDUAL_PLAN, ilStudyProgrammeUserProgress\ACTION_UNMARK_ACCREDITED, and ilObjStudyProgrammeIndividualPlanGUI\getLinkTargetView().

+ Here is the call graph for this function:

◆ getProgressObject()

ilObjStudyProgrammeMembersGUI::getProgressObject ( )
protected

Definition at line 276 of file class.ilObjStudyProgrammeMembersGUI.php.

276 {
277 if ($this->progress_object === null) {
278 require_once("Modules/StudyProgramme/classes/class.ilStudyProgrammeUserProgress.php");
279 if (!is_numeric($_GET["prgrs_id"])) {
280 throw new ilException("Expected integer 'prgrs_id'");
281 }
282 $id = (int)$_GET["prgrs_id"];
283 $this->progress_object = ilStudyProgrammeUserProgress::getInstanceById($id);
284 }
285 return $this->progress_object;
286 }
$_GET["client_id"]
static getInstanceById($a_prgrs_id)
Get an instance by progress id.

References $_GET, and ilStudyProgrammeUserProgress\getInstanceById().

Referenced by markAccredited(), removeUser(), and unmarkAccredited().

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

◆ getStudyProgramme()

ilObjStudyProgrammeMembersGUI::getStudyProgramme (   $a_ref_id = null)

Definition at line 306 of file class.ilObjStudyProgrammeMembersGUI.php.

306 {
307 if ($a_ref_id === null) {
308 $a_ref_id = $this->ref_id;
309 }
310 require_once("Modules/StudyProgramme/classes/class.ilObjStudyProgramme.php");
312 }
static getInstanceByRefId($a_ref_id)
Get an instance of ilObjStudyProgramme, use cache.
$ref_id
Definition: sahs_server.php:39

References $ref_id, and ilObjStudyProgramme\getInstanceByRefId().

Referenced by _addUsers(), addUsers(), addUsersWithAcknowledgedCourses(), and view().

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

◆ initSearchGUI()

ilObjStudyProgrammeMembersGUI::initSearchGUI ( )
protected

Definition at line 293 of file class.ilObjStudyProgrammeMembersGUI.php.

293 {
294 require_once("./Modules/StudyProgramme/classes/class.ilStudyProgrammeRepositorySearchGUI.php");
296 $this,
297 $this->toolbar,
298 array(
299 "auto_complete_name" => $this->lng->txt("user"),
300 "submit_name" => $this->lng->txt("add"),
301 "add_search" => true
302 )
303 );
304 }
static fillAutoCompleteToolbar($parent_object, ilToolbarGUI $toolbar=null, $a_options=array(), $a_sticky=false)
This is just the same as in the parent class, except for the hardcoded class name.

References ilStudyProgrammeRepositorySearchGUI\fillAutoCompleteToolbar().

Referenced by view().

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

◆ markAccredited()

ilObjStudyProgrammeMembersGUI::markAccredited ( )

Definition at line 247 of file class.ilObjStudyProgrammeMembersGUI.php.

247 {
248 require_once("Modules/StudyProgramme/classes/class.ilStudyProgrammeUserProgress.php");
249 $prgrs = $this->getProgressObject();
250 $prgrs->markAccredited($this->user->getId());
251 $this->showSuccessMessage("mark_accredited_success");
252 $this->ctrl->redirect($this, "view");
253 }

References getProgressObject(), showSuccessMessage(), and user().

+ Here is the call graph for this function:

◆ removeUser()

ilObjStudyProgrammeMembersGUI::removeUser ( )

Definition at line 263 of file class.ilObjStudyProgrammeMembersGUI.php.

263 {
264 require_once("Modules/StudyProgramme/classes/class.ilStudyProgrammeUserProgress.php");
265 $prgrs = $this->getProgressObject();
266 $ass = $prgrs->getAssignment();
267 $prg = $ass->getStudyProgramme();
268 if ($prg->getRefId() != $this->ref_id) {
269 throw new ilException("Can only remove users from the node they where assigned to.");
270 }
271 $ass->deassign();
272 $this->showSuccessMessage("remove_user_success");
273 $this->ctrl->redirect($this, "view");
274 }

References getProgressObject(), and showSuccessMessage().

+ Here is the call graph for this function:

◆ showSuccessMessage()

ilObjStudyProgrammeMembersGUI::showSuccessMessage (   $a_lng_var)
protected

Definition at line 288 of file class.ilObjStudyProgrammeMembersGUI.php.

288 {
289 require_once("Services/Utilities/classes/class.ilUtil.php");
290 ilUtil::sendSuccess($this->lng->txt("prg_$a_lng_var"), true);
291 }

References ilUtil\sendSuccess().

Referenced by markAccredited(), removeUser(), and unmarkAccredited().

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

◆ unmarkAccredited()

ilObjStudyProgrammeMembersGUI::unmarkAccredited ( )

Definition at line 255 of file class.ilObjStudyProgrammeMembersGUI.php.

255 {
256 require_once("Modules/StudyProgramme/classes/class.ilStudyProgrammeUserProgress.php");
257 $prgrs = $this->getProgressObject();
258 $prgrs->unmarkAccredited();
259 $this->showSuccessMessage("unmark_accredited_success");
260 $this->ctrl->redirect($this, "view");
261 }

References getProgressObject(), and showSuccessMessage().

+ Here is the call graph for this function:

◆ view()

ilObjStudyProgrammeMembersGUI::view ( )
protected

Definition at line 142 of file class.ilObjStudyProgrammeMembersGUI.php.

142 {
143 require_once("Modules/StudyProgramme/classes/class.ilStudyProgrammeMembersTableGUI.php");
144
145 if ($this->getStudyProgramme()->isActive()) {
146 $this->initSearchGUI();
147 }
148
149 if (!$this->getStudyProgramme()->isActive()) {
150 ilUtil::sendInfo($this->lng->txt("prg_no_members_not_active"));
151 }
152
153 $prg_id = ilObject::_lookupObjId($this->ref_id);
154 $table = new ilStudyProgrammeMembersTableGUI($prg_id, $this->ref_id, $this, "view");
155 return $table->getHTML();
156 }
static _lookupObjId($a_id)
Class ilObjStudyProgrammeMembersTableGUI.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References ilObject\_lookupObjId(), getStudyProgramme(), initSearchGUI(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ viewCompletedCourses()

ilObjStudyProgrammeMembersGUI::viewCompletedCourses (   $a_completed_courses,
  $a_users 
)

Definition at line 180 of file class.ilObjStudyProgrammeMembersGUI.php.

180 {
181 require_once("Modules/StudyProgramme/classes/class.ilStudyProgrammeAcknowledgeCompletedCoursesTableGUI.php");
182
183 $tpl = new ilTemplate("tpl.acknowledge_completed_courses.html", true, true, "Modules/StudyProgramme");
184 $tpl->setVariable("TITLE", $this->lng->txt("prg_acknowledge_completed_courses"));
185 $tpl->setVariable("CAPTION_ADD", $this->lng->txt("btn_next"));
186 $tpl->setVariable("CAPTION_CANCEL", $this->lng->txt("cancel"));
187 $tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
188 $tpl->setVariable("ADD_CMD", "addUsersWithAcknowledgedCourses");
189 $tpl->setVariable("CANCEL_CMD", "view");
190
191 foreach ($a_completed_courses as $user_id => $completed_courses) {
192 $names = ilObjUser::_lookupName($user_id);
193 $tpl->setCurrentBlock("usr_section");
194 $tpl->setVariable("FIRSTNAME", $names["firstname"]);
195 $tpl->setVariable("LASTNAME", $names["lastname"]);
196 $table = new ilStudyProgrammeAcknowledgeCompletedCoursesTableGUI($this, $user_id, $completed_courses);
197 $tpl->setVariable("TABLE", $table->getHTML());
198 $tpl->parseCurrentBlock();
199 }
200
201 foreach ($a_users as $usr_id) {
202 $tpl->setCurrentBlock("usr_ids_section");
203 $tpl->setVariable("USR_ID", $usr_id);
204 $tpl->parseCurrentBlock();
205 }
206
207 $this->tpl->setContent($tpl->get());
208 }
static _lookupName($a_user_id)
lookup user name
TableGUI class for acknowledgement of completed courses for new members of a study programme.
special template class to simplify handling of ITX/PEAR

References $names, $tpl, and ilObjUser\_lookupName().

Referenced by addUsers().

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

Field Documentation

◆ $ctrl

ilObjStudyProgrammeMembersGUI::$ctrl

Definition at line 20 of file class.ilObjStudyProgrammeMembersGUI.php.

◆ $ilAccess

ilObjStudyProgrammeMembersGUI::$ilAccess
protected

Definition at line 30 of file class.ilObjStudyProgrammeMembersGUI.php.

Referenced by __construct().

◆ $ilias

ilObjStudyProgrammeMembersGUI::$ilias

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

Referenced by __construct().

◆ $ilLog

ilObjStudyProgrammeMembersGUI::$ilLog
protected

Definition at line 40 of file class.ilObjStudyProgrammeMembersGUI.php.

Referenced by __construct().

◆ $lng

ilObjStudyProgrammeMembersGUI::$lng

Definition at line 50 of file class.ilObjStudyProgrammeMembersGUI.php.

Referenced by __construct().

◆ $object

ilObjStudyProgrammeMembersGUI::$object

Definition at line 35 of file class.ilObjStudyProgrammeMembersGUI.php.

◆ $parent_gui

ilObjStudyProgrammeMembersGUI::$parent_gui
protected

Definition at line 62 of file class.ilObjStudyProgrammeMembersGUI.php.

◆ $toolbar

ilObjStudyProgrammeMembersGUI::$toolbar

Definition at line 55 of file class.ilObjStudyProgrammeMembersGUI.php.

◆ $tpl

ilObjStudyProgrammeMembersGUI::$tpl

Definition at line 25 of file class.ilObjStudyProgrammeMembersGUI.php.

Referenced by __construct(), and viewCompletedCourses().

◆ $user

ilObjStudyProgrammeMembersGUI::$user

Definition at line 60 of file class.ilObjStudyProgrammeMembersGUI.php.


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