81 $ilToolbar = $DIC[
'ilToolbar'];
82 $ilLocator = $DIC[
'ilLocator'];
89 $this->ref_id = $a_ref_id;
90 $this->parent_gui = $a_parent_gui;
94 $this->ilLocator = $ilLocator;
96 $this->toolbar = $ilToolbar;
102 $this->progress_objects =
array();
104 $this->
object = null;
106 $lng->loadLanguageModule(
"prg");
111 $cmd = $this->ctrl->getCmd();
112 $next_class = $this->ctrl->getNextClass($this);
118 # TODO: Check permission of user!! 120 switch ($next_class) {
121 case "ilstudyprogrammerepositorysearchgui":
122 require_once(
"./Modules/StudyProgramme/classes/class.ilStudyProgrammeRepositorySearchGUI.php");
124 $rep_search->setCallback($this,
"addUsers");
126 $this->ctrl->setReturn($this,
"view");
127 $this->ctrl->forwardCommand($rep_search);
129 case "ilobjstudyprogrammeindividualplangui":
130 require_once(
"./Modules/StudyProgramme/classes/class.ilObjStudyProgrammeIndividualPlanGUI.php");
132 $this->ctrl->forwardCommand($individual_plan_gui);
137 case "markAccredited":
138 case "markAccreditedMulti":
139 case "unmarkAccredited":
140 case "unmarkAccreditedMulti":
142 case "removeUserMulti":
143 case "addUsersWithAcknowledgedCourses":
144 case "markNotRelevantMulti":
145 case "markRelevantMulti":
146 case "updateFromCurrentPlanMulti":
147 $cont = $this->$cmd();
150 throw new ilException(
"ilObjStudyProgrammeMembersGUI: " .
151 "Command not supported: $cmd");
155 throw new ilException(
"ilObjStudyProgrammeMembersGUI: Can't forward to next class $next_class");
158 $this->tpl->setContent($cont);
168 require_once(
"Modules/StudyProgramme/classes/class.ilStudyProgrammeMembersTableGUI.php");
194 $completed_courses =
array();
196 foreach ($a_users as $user_id) {
197 $completed_crss = $prg->getCompletedCourses($user_id);
198 if ($completed_crss) {
199 $completed_courses[$user_id] = $completed_crss;
203 if (count($completed_courses) > 0) {
210 $this->ctrl->redirect($this,
"view");
223 require_once(
"Modules/StudyProgramme/classes/class.ilStudyProgrammeAcknowledgeCompletedCoursesTableGUI.php");
225 $tpl =
new ilTemplate(
"tpl.acknowledge_completed_courses.html",
true,
true,
"Modules/StudyProgramme");
226 $tpl->setVariable(
"TITLE", $this->lng->txt(
"prg_acknowledge_completed_courses"));
227 $tpl->setVariable(
"CAPTION_ADD", $this->lng->txt(
"btn_next"));
228 $tpl->setVariable(
"CAPTION_CANCEL", $this->lng->txt(
"cancel"));
229 $tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
230 $tpl->setVariable(
"ADD_CMD",
"addUsersWithAcknowledgedCourses");
231 $tpl->setVariable(
"CANCEL_CMD",
"view");
233 foreach ($a_completed_courses as $user_id => $completed_courses) {
235 $tpl->setCurrentBlock(
"usr_section");
236 $tpl->setVariable(
"FIRSTNAME",
$names[
"firstname"]);
237 $tpl->setVariable(
"LASTNAME",
$names[
"lastname"]);
239 $tpl->setVariable(
"TABLE",
$table->getHTML());
240 $tpl->parseCurrentBlock();
243 foreach ($a_users as $usr_id) {
244 $tpl->setCurrentBlock(
"usr_ids_section");
245 $tpl->setVariable(
"USR_ID", $usr_id);
246 $tpl->parseCurrentBlock();
249 $this->tpl->setContent(
$tpl->get());
262 $completed_programmes =
$_POST[
"courses"];
263 if (is_array($completed_programmes)) {
264 foreach ($completed_programmes as $user_id => $prg_ref_ids) {
265 $ass_id = $assignments[$user_id]->getId();
266 foreach ($prg_ref_ids as $ids) {
267 list($prg_ref_id, $crs_id, $crsr_id) = explode(
";", $ids);
269 $progress = $prg->getProgressForAssignment($ass_id);
270 $progress->setLPCompleted($crsr_id, $user_id);
275 $this->ctrl->redirect($this,
"view");
289 $assignments =
array();
291 foreach ($a_users as $user_id) {
292 $assignments[$user_id] = $prg->assignUser($user_id);
295 if (count($a_users) == 1) {
298 if (count($a_users) > 1) {
312 $prgrs_ids =
$_POST[
'prgs_ids'];
313 if ($prgrs_ids === null) {
315 $this->ctrl->redirect($this,
"view");
327 require_once(
"Modules/StudyProgramme/classes/class.ilStudyProgrammeUserProgress.php");
331 $this->ctrl->redirect($this,
"view");
342 foreach ($prgrs_ids as
$key => $prgrs_id) {
346 $this->ctrl->redirect($this,
"view");
359 $prgrs->markAccredited($this->
user->getId());
369 require_once(
"Modules/StudyProgramme/classes/class.ilStudyProgrammeUserProgress.php");
373 $this->ctrl->redirect($this,
"view");
386 $prgrs->unmarkAccredited();
397 foreach ($prgrs_ids as
$key => $prgrs_id) {
403 $this->ctrl->redirect($this,
"view");
415 foreach ($prgrs_ids as
$key => $prgrs_id) {
423 $prgrs->markRelevant($this->
user->getId());
427 $this->ctrl->redirect($this,
"view");
439 foreach ($prgrs_ids as
$key => $prgrs_id) {
441 $prgrs->markNotRelevant($this->
user->getId());
445 $this->ctrl->redirect($this,
"view");
456 $not_updated =
array();
458 foreach ($prgrs_ids as
$key => $prgrs_id) {
460 $ass = $prgrs->getAssignment();
461 $prg = $ass->getStudyProgramme();
462 if ($prg->getRefId() != $this->ref_id) {
463 $not_updated[] = $prgrs_id;
467 $ass->updateFromProgram();
470 if (count($not_updated) == count($prgrs_ids)) {
472 } elseif (count($not_updated) > 0) {
478 $this->ctrl->redirect($this,
"view");
488 require_once(
"Modules/StudyProgramme/classes/class.ilStudyProgrammeUserProgress.php");
490 $this->
remove($prgrs_id);
492 $this->ctrl->redirect($this,
"view");
503 $not_removed =
array();
504 foreach ($prgrs_ids as
$key => $prgrs_id) {
506 $this->
remove((int) $prgrs_id);
508 $not_removed[] = $prgrs_id;
511 if (count($not_removed) == count($prgrs_ids)) {
513 } elseif (count($not_removed) > 0) {
518 $this->ctrl->redirect($this,
"view");
528 protected function remove($prgrs_id)
531 $ass = $prgrs->getAssignment();
532 $prg = $ass->getStudyProgramme();
533 if ($prg->getRefId() != $this->ref_id) {
534 throw new ilException(
"Can only remove users from the node they where assigned to.");
548 assert(
'is_int($prgrs_id)');
549 if (!array_key_exists($prgrs_id, $this->progress_objects)) {
550 require_once(
"Modules/StudyProgramme/classes/class.ilStudyProgrammeUserProgress.php");
551 $this->progress_objects[$prgrs_id] = $this->sp_user_progress_db->getInstanceById($prgrs_id);
553 return $this->progress_objects[$prgrs_id];
565 if (!is_numeric(
$_GET[
"prgrs_id"])) {
566 throw new ilException(
"Expected integer 'prgrs_id'");
568 return (
int)
$_GET[
"prgrs_id"];
578 require_once(
"Services/Utilities/classes/class.ilUtil.php");
589 require_once(
"Services/Utilities/classes/class.ilUtil.php");
595 require_once(
"./Modules/StudyProgramme/classes/class.ilStudyProgrammeRepositorySearchGUI.php");
600 "auto_complete_name" => $this->lng->txt(
"user"),
601 "submit_name" => $this->lng->txt(
"add"),
615 if ($a_ref_id === null) {
616 $a_ref_id = $this->ref_id;
618 require_once(
"Modules/StudyProgramme/classes/class.ilObjStudyProgramme.php");
634 $target_name =
"markAccredited";
637 $target_name =
"unmarkAccredited";
640 require_once(
"Modules/StudyProgramme/classes/class.ilObjStudyProgrammeIndividualPlanGUI.php");
643 $target_name =
"removeUser";
649 $this->ctrl->setParameter($this,
"prgrs_id", $a_prgrs_id);
650 $link = $this->ctrl->getLinkTarget($this, $target_name);
651 $this->ctrl->setParameter($this,
"prgrs_id", null);
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
addUsers($a_users)
Assigns a users to SP.
static _lookupName($a_user_id)
lookup user name
markNotRelevantMulti()
Mark SP as not relevant for users.
_addUsers($a_users)
Add users to SP.
Storage implementation for ilStudyProgrammeUserProgress.
markAccreditedMulti()
Mark SP for users accredited.
removeUserMulti()
Remove user from SP.
showInfoMessage($a_lng_var)
Shows ilutil failed message.
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.
removeUser()
Remove single user from SP.
addUsersWithAcknowledgedCourses()
Assign users if they have any completed course.
Class ilObjStudyProgrammeIndividualPlanGUI.
markRelevantMulti()
Mark SP as relevant for users.
Class ilObjStudyProgrammeMembersTableGUI.
static getInstanceByRefId($a_ref_id)
Get an instance of ilObjStudyProgramme, use cache.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
const ACTION_SHOW_INDIVIDUAL_PLAN
getLinkTargetForAction($a_action, $a_prgrs_id, $a_ass_id)
Get the link target for an action on user progress.
const ACTION_UNMARK_ACCREDITED
unmarkAccreditedByProgressId($prgrs_id)
Deaccredited SP.
static getLinkTargetView($ctrl, $a_ass_id)
viewCompletedCourses($a_completed_courses, $a_users)
Shows list of completed courses for each user if he should be assigned.
markAccredited()
Mark SP for single user accredited.
static _lookupObjId($a_id)
special template class to simplify handling of ITX/PEAR
view()
Shows table with all members of the SP.
redirection script todo: (a better solution should control the processing via a xml file) ...
getPrgrsId()
Get current prgrs_id from URL.
Class ilObjStudyProgrammeMembersGUI.
Create styles array
The data for the language used.
__construct($a_parent_gui, $a_ref_id, ilStudyProgrammeUserProgressDB $sp_user_progress_db)
getStudyProgramme($a_ref_id=null)
Get studyprogramm object for ref_id Use this ref_id if argument is null.
getPostPrgsIds()
Get post prgs ids.
getProgressObject($prgrs_id)
Get progress object for prgrs id.
updateFromCurrentPlanMulti()
Update user plan from current SP structure if they has no individual plan.
TableGUI class for acknowledgement of completed courses for new members of a study programme...
Custom repository search gui class for study programme to make it possible to get a handle on users s...
markAccreditedById($prgrs_id)
Accredited SP.
showSuccessMessage($a_lng_var)
Shows ilutil success message.
if(empty($password)) $table
const ACTION_MARK_ACCREDITED
unmarkAccredited()
Unmark SP for single user accredited.
unmarkAccreditedMulti()
Unmark SP for users accredited.