ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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.

References $ilAccess, $ilCtrl, $ilias, $ilLog, $ilUser, $lng, and $tpl.

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

Member Function Documentation

◆ _addUsers()

ilObjStudyProgrammeMembersGUI::_addUsers (   $a_users)
protected

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

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

Referenced by addUsers(), and addUsersWithAcknowledgedCourses().

218  {
219  $prg = $this->getStudyProgramme();
220 
221  $assignments = array();
222 
223  foreach ($a_users as $user_id) {
224  $assignments[$user_id] = $prg->assignUser($user_id);
225  }
226 
227  if (count($a_users) == 1) {
228  ilUtil::sendSuccess($this->lng->txt("prg_added_member"), true);
229  }
230  if (count($a_users) > 1) {
231  ilUtil::sendSuccess($this->lng->txt("prg_added_members"), true);
232  }
233 
234  return $assignments;
235  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addUsers()

ilObjStudyProgrammeMembersGUI::addUsers (   $a_users)

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

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

148  {
149  $prg = $this->getStudyProgramme();
150 
151  $completed_courses = array();
152 
153  foreach ($a_users as $user_id) {
154  $completed_crss = $prg->getCompletedCourses($user_id);
155  if ($completed_crss) {
156  $completed_courses[$user_id] = $completed_crss;
157  }
158  }
159 
160  if (count($completed_courses) > 0) {
161  $this->viewCompletedCourses($completed_courses, $a_users);
162  return true;
163  }
164 
165  $this->_addUsers($a_users);
166 
167  $this->ctrl->redirect($this, "view");
168  }
viewCompletedCourses($a_completed_courses, $a_users)
+ Here is the call graph for this function:

◆ addUsersWithAcknowledgedCourses()

ilObjStudyProgrammeMembersGUI::addUsersWithAcknowledgedCourses ( )

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

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

200  {
201  $users = $_POST["users"];
202  $assignments = $this->_addUsers($users);
203 
204  $completed_programmes = $_POST["courses"];
205  foreach ($completed_programmes as $user_id => $prg_ref_ids) {
206  $ass_id = $assignments[$user_id]->getId();
207  foreach ($prg_ref_ids as $ids) {
208  list($prg_ref_id, $crs_id, $crsr_id) = split(";", $ids);
209  $prg = $this->getStudyProgramme($prg_ref_id);
210  $progress = $prg->getProgressForAssignment($ass_id);
211  $progress->setLPCompleted($crsr_id, $user_id);
212  }
213  }
214 
215  $this->ctrl->redirect($this, "view");
216  }
$_POST['username']
Definition: cron.php:12
+ Here is the call graph for this function:

◆ executeCommand()

ilObjStudyProgrammeMembersGUI::executeCommand ( )

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

References $cmd.

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

◆ 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 312 of file class.ilObjStudyProgrammeMembersGUI.php.

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

312  {
313  require_once("Modules/StudyProgramme/classes/class.ilStudyProgrammeUserProgress.php");
314 
315  switch ($a_action) {
317  $target_name = "markAccredited";
318  break;
320  $target_name = "unmarkAccredited";
321  break;
323  require_once("Modules/StudyProgramme/classes/class.ilObjStudyProgrammeIndividualPlanGUI.php");
324  return ilObjStudyProgrammeIndividualPlanGUI::getLinkTargetView($this->ctrl, $a_ass_id);
326  $target_name = "removeUser";
327  break;
328  default:
329  throw new ilException("Unknown action: $action");
330  }
331 
332  $this->ctrl->setParameter($this, "prgrs_id", $a_prgrs_id);
333  $link = $this->ctrl->getLinkTarget($this, $target_name);
334  $this->ctrl->setParameter($this, "prgrs_id", null);
335  return $link;
336  }
Base class for ILIAS Exception handling.
+ Here is the call graph for this function:

◆ getProgressObject()

ilObjStudyProgrammeMembersGUI::getProgressObject ( )
protected

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

References $_GET, and ilStudyProgrammeUserProgress\getInstanceById().

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

266  {
267  if ($this->progress_object === null) {
268  require_once("Modules/StudyProgramme/classes/class.ilStudyProgrammeUserProgress.php");
269  if (!is_numeric($_GET["prgrs_id"])) {
270  throw new ilException("Expected integer 'prgrs_id'");
271  }
272  $id = (int)$_GET["prgrs_id"];
273  $this->progress_object = ilStudyProgrammeUserProgress::getInstanceById($id);
274  }
275  return $this->progress_object;
276  }
Base class for ILIAS Exception handling.
$_GET["client_id"]
static getInstanceById($a_prgrs_id)
Get an instance by progress id.
+ 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 296 of file class.ilObjStudyProgrammeMembersGUI.php.

References $ref_id, and ilObjStudyProgramme\getInstanceByRefId().

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

296  {
297  if ($a_ref_id === null) {
298  $a_ref_id = $this->ref_id;
299  }
300  require_once("Modules/StudyProgramme/classes/class.ilObjStudyProgramme.php");
301  return ilObjStudyProgramme::getInstanceByRefId($a_ref_id);
302  }
static getInstanceByRefId($a_ref_id)
Get an instance of ilObjStudyProgramme, use cache.
$ref_id
Definition: sahs_server.php:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initSearchGUI()

ilObjStudyProgrammeMembersGUI::initSearchGUI ( )
protected

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

References ilStudyProgrammeRepositorySearchGUI\fillAutoCompleteToolbar().

Referenced by view().

283  {
284  require_once("./Modules/StudyProgramme/classes/class.ilStudyProgrammeRepositorySearchGUI.php");
286  $this,
287  $this->toolbar,
288  array(
289  "auto_complete_name" => $this->lng->txt("user"),
290  "submit_name" => $this->lng->txt("add"),
291  "add_search" => true
292  )
293  );
294  }
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.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ markAccredited()

ilObjStudyProgrammeMembersGUI::markAccredited ( )

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

References getProgressObject(), and showSuccessMessage().

237  {
238  require_once("Modules/StudyProgramme/classes/class.ilStudyProgrammeUserProgress.php");
239  $prgrs = $this->getProgressObject();
240  $prgrs->markAccredited($this->user->getId());
241  $this->showSuccessMessage("mark_accredited_success");
242  $this->ctrl->redirect($this, "view");
243  }
+ Here is the call graph for this function:

◆ removeUser()

ilObjStudyProgrammeMembersGUI::removeUser ( )

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

References $ref_id, getProgressObject(), and showSuccessMessage().

253  {
254  require_once("Modules/StudyProgramme/classes/class.ilStudyProgrammeUserProgress.php");
255  $prgrs = $this->getProgressObject();
256  $ass = $prgrs->getAssignment();
257  $prg = $ass->getStudyProgramme();
258  if ($prg->getRefId() != $this->ref_id) {
259  throw new ilException("Can only remove users from the node they where assigned to.");
260  }
261  $ass->deassign();
262  $this->showSuccessMessage("remove_user_success");
263  $this->ctrl->redirect($this, "view");
264  }
Base class for ILIAS Exception handling.
$ref_id
Definition: sahs_server.php:39
+ Here is the call graph for this function:

◆ showSuccessMessage()

ilObjStudyProgrammeMembersGUI::showSuccessMessage (   $a_lng_var)
protected

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

References ilUtil\sendSuccess().

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

278  {
279  require_once("Services/Utilities/classes/class.ilUtil.php");
280  ilUtil::sendSuccess($this->lng->txt("prg_$a_lng_var"), true);
281  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unmarkAccredited()

ilObjStudyProgrammeMembersGUI::unmarkAccredited ( )

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

References getProgressObject(), and showSuccessMessage().

245  {
246  require_once("Modules/StudyProgramme/classes/class.ilStudyProgrammeUserProgress.php");
247  $prgrs = $this->getProgressObject();
248  $prgrs->unmarkAccredited();
249  $this->showSuccessMessage("unmark_accredited_success");
250  $this->ctrl->redirect($this, "view");
251  }
+ Here is the call graph for this function:

◆ view()

ilObjStudyProgrammeMembersGUI::view ( )
protected

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

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

132  {
133  require_once("Modules/StudyProgramme/classes/class.ilStudyProgrammeMembersTableGUI.php");
134 
135  if ($this->getStudyProgramme()->isActive()) {
136  $this->initSearchGUI();
137  }
138 
139  if (!$this->getStudyProgramme()->isActive()) {
140  ilUtil::sendInfo($this->lng->txt("prg_no_members_not_active"));
141  }
142 
143  $prg_id = ilObject::_lookupObjId($this->ref_id);
144  $table = new ilStudyProgrammeMembersTableGUI($prg_id, $this->ref_id, $this);
145  return $table->getHTML();
146  }
Class ilObjStudyProgrammeMembersTableGUI.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static _lookupObjId($a_id)
+ Here is the call graph for this function:

◆ viewCompletedCourses()

ilObjStudyProgrammeMembersGUI::viewCompletedCourses (   $a_completed_courses,
  $a_users 
)

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

References $tpl, and ilObjUser\_lookupName().

Referenced by addUsers().

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