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

Class ilObjStudyProgrammeIndividualPlanGUI. More...

+ Collaboration diagram for ilObjStudyProgrammeIndividualPlanGUI:

Public Member Functions

 __construct (\ilGlobalTemplateInterface $tpl, \ilCtrl $ilCtrl, \ilLanguage $lng, \ilObjUser $ilUser, ilStudyProgrammeProgressRepository $progress_repository, ilStudyProgrammeAssignmentRepository $assignment_repository, ilPRGMessagePrinter $messages)
 
 setParentGUI ($a_parent_gui)
 
 setRefId (int $ref_id)
 
 executeCommand ()
 
 appendIndividualPlanActions (ilTable2GUI $a_table)
 
 getLinkTargetView ($a_ass_id)
 

Data Fields

const POST_VAR_STATUS = "status"
 
const POST_VAR_REQUIRED_POINTS = "required_points"
 
const POST_VAR_DEADLINE = "deadline"
 
const MANUAL_STATUS_NONE = -1
 
 $ctrl
 
 $tpl
 
 $object
 
 $lng
 
 $user
 

Protected Member Functions

 getAssignmentId ()
 
 getAssignmentObject ()
 
 view ()
 
 manage ()
 
 updateFromCurrentPlan ()
 
 digestInput (array $post)
 
 updateFromInput ()
 
 updateStatus (array $progress_updates, ilPRGMessageCollection $msgs)
 
 updateDeadlines (array $deadlines, ilPRGMessageCollection $msgs)
 
 updateRequiredPoints (array $required_points, ilPRGMessageCollection $msgs)
 
 showSuccessMessage ($a_lng_var)
 
 buildFrame ($tab, $content)
 
 getLinkTargetForSubTab ($a_tab, $a_ass_id)
 

Protected Attributes

 $parent_gui
 
 $progress_repository
 
 $assignment_repository
 
 $messages
 
 $permissions
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjStudyProgrammeIndividualPlanGUI::__construct ( \ilGlobalTemplateInterface  $tpl,
\ilCtrl  $ilCtrl,
\ilLanguage  $lng,
\ilObjUser  $ilUser,
ilStudyProgrammeProgressRepository  $progress_repository,
ilStudyProgrammeAssignmentRepository  $assignment_repository,
ilPRGMessagePrinter  $messages 
)

Definition at line 66 of file class.ilObjStudyProgrammeIndividualPlanGUI.php.

74 {
75 $this->tpl = $tpl;
76 $this->ctrl = $ilCtrl;
77 $this->lng = $lng;
78 $this->user = $ilUser;
79
80 $this->assignment_object = null;
81
82 $this->progress_repository = $progress_repository;
83 $this->assignment_repository = $assignment_repository;
84 $this->messages = $messages;
85
86 $this->object = null;
87 $this->permissions = null;
88
89 $lng->loadLanguageModule("prg");
90
91 $this->tpl->addCss("Modules/StudyProgramme/templates/css/ilStudyProgramme.css");
92 }
user()
Definition: user.php:4
$ilUser
Definition: imgupload.php:18

References $assignment_repository, $ilUser, $lng, $messages, $progress_repository, $tpl, and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ appendIndividualPlanActions()

ilObjStudyProgrammeIndividualPlanGUI::appendIndividualPlanActions ( ilTable2GUI  $a_table)

Definition at line 374 of file class.ilObjStudyProgrammeIndividualPlanGUI.php.

375 {
376 $a_table->setFormAction($this->ctrl->getFormAction($this));
377 $a_table->addCommandButton("updateFromCurrentPlan", $this->lng->txt("prg_update_from_current_plan"));
378 $a_table->addCommandButton("updateFromInput", $this->lng->txt("save"));
379 }
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.

References ilTable2GUI\addCommandButton(), and ilTable2GUI\setFormAction().

+ Here is the call graph for this function:

◆ buildFrame()

ilObjStudyProgrammeIndividualPlanGUI::buildFrame (   $tab,
  $content 
)
protected

Definition at line 339 of file class.ilObjStudyProgrammeIndividualPlanGUI.php.

340 {
341 $tabs = [];
342 if ($this->permissions->may(ilOrgUnitOperation::OP_VIEW_INDIVIDUAL_PLAN)) {
343 $tabs[] = 'view';
344 }
345 if ($this->permissions->may(ilOrgUnitOperation::OP_EDIT_INDIVIDUAL_PLAN)) {
346 $tabs[] = 'manage';
347 }
348
349 $tpl = new ilTemplate("tpl.indivdual_plan_frame.html", true, true, "Modules/StudyProgramme");
350 $ass = $this->getAssignmentObject();
351 $user_id = $ass->getUserId();
352 $tpl->setVariable("USERNAME", ilObjUser::_lookupFullname($user_id));
353
354 foreach ($tabs as $_tab) {
355 $tpl->setCurrentBlock("sub_tab");
356 $tpl->setVariable("CLASS", $_tab == $tab ? "active" : "");
357 $tpl->setVariable("LINK", $this->getLinkTargetForSubTab($_tab, $ass->getId()));
358 $tpl->setVariable("TITLE", $this->lng->txt("prg_$_tab"));
359 $tpl->parseCurrentBlock();
360 }
361 $tpl->setVariable("CONTENT", $content);
362
363 return $tpl->get();
364 }
static _lookupFullname($a_user_id)
Lookup Full Name.
special template class to simplify handling of ITX/PEAR

References $tpl, ilObjUser\_lookupFullname(), getAssignmentObject(), getLinkTargetForSubTab(), ilOrgUnitOperation\OP_EDIT_INDIVIDUAL_PLAN, and ilOrgUnitOperation\OP_VIEW_INDIVIDUAL_PLAN.

Referenced by manage(), and view().

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

◆ digestInput()

ilObjStudyProgrammeIndividualPlanGUI::digestInput ( array  $post)
protected

Definition at line 219 of file class.ilObjStudyProgrammeIndividualPlanGUI.php.

219 : array
220 {
221 $params = [
225 ];
226
227 $ret = [];
228 foreach ($params as $postvar) {
229 $ret[$postvar] = [];
230 if (array_key_exists($postvar, $post)) {
231 $ret[$postvar] = $post[$postvar];
232 krsort($ret[$postvar], SORT_NUMERIC);
233 }
234 }
235 return $ret;
236 }
$ret
Definition: parser.php:6

References $ret, POST_VAR_DEADLINE, POST_VAR_REQUIRED_POINTS, and POST_VAR_STATUS.

Referenced by updateFromInput().

+ Here is the caller graph for this function:

◆ executeCommand()

ilObjStudyProgrammeIndividualPlanGUI::executeCommand ( )

Definition at line 106 of file class.ilObjStudyProgrammeIndividualPlanGUI.php.

107 {
108 $cmd = $this->ctrl->getCmd();
109
110 if ($cmd == "") {
111 $cmd = "view";
112 }
113
114 switch ($cmd) {
115 case "view":
116 case "manage":
117 case "updateFromCurrentPlan":
118 case "updateFromInput":
119 $cont = $this->$cmd();
120 break;
121 default:
122 throw new ilException("ilObjStudyProgrammeMembersGUI: " .
123 "Command not supported: $cmd");
124 }
125
126 $this->tpl->setContent($cont);
127 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ getAssignmentId()

ilObjStudyProgrammeIndividualPlanGUI::getAssignmentId ( )
protected

Definition at line 129 of file class.ilObjStudyProgrammeIndividualPlanGUI.php.

130 {
131 if (!is_numeric($_GET["ass_id"])) {
132 throw new ilException("Expected integer 'ass_id'");
133 }
134 return (int) $_GET["ass_id"];
135 }
$_GET["client_id"]

References $_GET.

Referenced by getAssignmentObject(), and updateFromInput().

+ Here is the caller graph for this function:

◆ getAssignmentObject()

ilObjStudyProgrammeIndividualPlanGUI::getAssignmentObject ( )
protected

Definition at line 137 of file class.ilObjStudyProgrammeIndividualPlanGUI.php.

138 {
139 if ($this->assignment_object === null) {
140 $id = $this->getAssignmentId();
141 $this->assignment_object = $this->assignment_repository->getInstanceById((int) $id);
142 }
143 return $this->assignment_object;
144 }

References getAssignmentId().

Referenced by buildFrame(), manage(), updateFromCurrentPlan(), and view().

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

◆ getLinkTargetForSubTab()

ilObjStudyProgrammeIndividualPlanGUI::getLinkTargetForSubTab (   $a_tab,
  $a_ass_id 
)
protected

Definition at line 366 of file class.ilObjStudyProgrammeIndividualPlanGUI.php.

367 {
368 $this->ctrl->setParameter($this, "ass_id", $a_ass_id);
369 $lnk = $this->ctrl->getLinkTarget($this, $a_tab);
370 $this->ctrl->setParameter($this, "ass_id", null);
371 return $lnk;
372 }

Referenced by buildFrame().

+ Here is the caller graph for this function:

◆ getLinkTargetView()

ilObjStudyProgrammeIndividualPlanGUI::getLinkTargetView (   $a_ass_id)

Definition at line 381 of file class.ilObjStudyProgrammeIndividualPlanGUI.php.

382 {
383 $cl = "ilObjStudyProgrammeIndividualPlanGUI";
384 $this->ctrl->setParameterByClass($cl, "ass_id", $a_ass_id);
385 $link = $this->ctrl->getLinkTargetByClass($cl, "view");
386 $this->ctrl->setParameterByClass($cl, "ass_id", null);
387 return $link;
388 }

◆ manage()

ilObjStudyProgrammeIndividualPlanGUI::manage ( )
protected

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

171 {
172 $ass = $this->getAssignmentObject();
173
174 if (!in_array(
175 $ass->getUserId(),
176 $this->permissions->getUserIdsSusceptibleTo(ilOrgUnitOperation::OP_EDIT_INDIVIDUAL_PLAN)
177 )) {
179 "may not access individual plan of user"
180 );
181 }
182
183
184 $this->ctrl->setParameter($this, "ass_id", $ass->getId());
185 $this->ctrl->setParameter($this, "cmd", "manage");
186 $table = new ilStudyProgrammeIndividualPlanTableGUI($this, $ass, $this->progress_repository);
187 $frame = $this->buildFrame("manage", $table->getHTML());
188 $this->ctrl->setParameter($this, "ass_id", null);
189 return $frame;
190 }

References buildFrame(), getAssignmentObject(), and ilOrgUnitOperation\OP_EDIT_INDIVIDUAL_PLAN.

+ Here is the call graph for this function:

◆ setParentGUI()

ilObjStudyProgrammeIndividualPlanGUI::setParentGUI (   $a_parent_gui)

Definition at line 94 of file class.ilObjStudyProgrammeIndividualPlanGUI.php.

95 {
96 $this->parent_gui = $a_parent_gui;
97 }

◆ setRefId()

ilObjStudyProgrammeIndividualPlanGUI::setRefId ( int  $ref_id)

Definition at line 99 of file class.ilObjStudyProgrammeIndividualPlanGUI.php.

99 : void
100 {
101 $this->ref_id = $a_ref_id;
102 $this->object = \ilObjStudyProgramme::getInstanceByRefId($ref_id);
103 $this->permissions = ilStudyProgrammeDIC::specificDicFor($this->object)['permissionhelper'];
104 }
static getInstanceByRefId($a_ref_id)
static specificDicFor(\ilObjStudyProgramme $prg)

References ilObjStudyProgramme\getInstanceByRefId(), and ilStudyProgrammeDIC\specificDicFor().

+ Here is the call graph for this function:

◆ showSuccessMessage()

ilObjStudyProgrammeIndividualPlanGUI::showSuccessMessage (   $a_lng_var)
protected

Definition at line 334 of file class.ilObjStudyProgrammeIndividualPlanGUI.php.

335 {
336 ilUtil::sendSuccess($this->lng->txt("prg_$a_lng_var"), true);
337 }

Referenced by updateFromCurrentPlan().

+ Here is the caller graph for this function:

◆ updateDeadlines()

ilObjStudyProgrammeIndividualPlanGUI::updateDeadlines ( array  $deadlines,
ilPRGMessageCollection  $msgs 
)
protected

Definition at line 291 of file class.ilObjStudyProgrammeIndividualPlanGUI.php.

292 {
293 $programme = $this->parent_gui->getStudyProgramme();
294 $acting_user_id = (int) $this->user->getId();
295
296 foreach ($deadlines as $progress_id => $deadline) {
297 if (trim($deadline) === '') {
298 $deadline = null;
299 } else {
300 $deadline = DateTimeImmutable::createFromFormat('d.m.Y', $deadline);
301 }
302
303 $progress = $this->progress_repository->get($progress_id);
304 $cur_deadline = $progress->getDeadline();
305
306 if ($deadline != $cur_deadline) {
307 $programme->changeProgressDeadline($progress_id, $acting_user_id, $msgs, $deadline);
308 }
309 }
310 }

References user().

Referenced by updateFromInput().

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

◆ updateFromCurrentPlan()

ilObjStudyProgrammeIndividualPlanGUI::updateFromCurrentPlan ( )
protected

Definition at line 192 of file class.ilObjStudyProgrammeIndividualPlanGUI.php.

193 {
194 $ass = $this->getAssignmentObject();
195
196 if (!in_array(
197 $ass->getUserId(),
198 $this->permissions->getUserIdsSusceptibleTo(ilOrgUnitOperation::OP_EDIT_INDIVIDUAL_PLAN)
199 )) {
201 "may not access individual plan of user"
202 );
203 }
204
205 $prg = $this->parent_gui->getStudyProgramme();
206 $progress = $prg->getProgressForAssignment($ass->getId());
207 $msgs = $this->messages->getMessageCollection('msg_update_individual_plan');
208 $this->object->updatePlanFromRepository(
209 $progress->getId(),
210 $this->user->getId(),
211 $msgs
212 );
213
214 $this->ctrl->setParameter($this, "ass_id", $ass->getId());
215 $this->showSuccessMessage("update_from_plan_successful");
216 $this->ctrl->redirect($this, "manage");
217 }

References getAssignmentObject(), ilOrgUnitOperation\OP_EDIT_INDIVIDUAL_PLAN, and showSuccessMessage().

+ Here is the call graph for this function:

◆ updateFromInput()

ilObjStudyProgrammeIndividualPlanGUI::updateFromInput ( )
protected

Definition at line 238 of file class.ilObjStudyProgrammeIndividualPlanGUI.php.

239 {
240 $values = $this->digestInput($_POST);
241 $msgs = $this->messages->getMessageCollection('msg_update_individual_plan');
242 $this->updateStatus($values[self::POST_VAR_STATUS], $msgs);
243 $this->updateDeadlines($values[self::POST_VAR_DEADLINE], $msgs);
244 $this->updateRequiredPoints($values[self::POST_VAR_REQUIRED_POINTS], $msgs);
245
246 if ($msgs->hasAnyMessages()) {
247 $this->messages->showMessages($msgs);
248 }
249
250 $this->ctrl->setParameter($this, "ass_id", $this->getAssignmentId());
251 $this->ctrl->redirect($this, "manage");
252 }
$_POST["username"]
updateDeadlines(array $deadlines, ilPRGMessageCollection $msgs)
updateRequiredPoints(array $required_points, ilPRGMessageCollection $msgs)
updateStatus(array $progress_updates, ilPRGMessageCollection $msgs)

References $_POST, digestInput(), getAssignmentId(), updateDeadlines(), updateRequiredPoints(), and updateStatus().

+ Here is the call graph for this function:

◆ updateRequiredPoints()

ilObjStudyProgrammeIndividualPlanGUI::updateRequiredPoints ( array  $required_points,
ilPRGMessageCollection  $msgs 
)
protected

Definition at line 312 of file class.ilObjStudyProgrammeIndividualPlanGUI.php.

313 {
314 $programme = $this->parent_gui->getStudyProgramme();
315 $acting_user_id = (int) $this->user->getId();
316
317 foreach ($required_points as $progress_id => $points) {
318 $points = (int) $points;
319
320 if ($points < 0) {
321 $msgs->add(false, 'msg_points_must_be_positive', $progress_id);
322 continue;
323 }
324
325 $progress = $this->progress_repository->get($progress_id);
326 $cur_points = $progress->getAmountOfPoints();
327
328 if ($points != $cur_points) {
329 $programme->changeAmountOfPoints($progress_id, $acting_user_id, $msgs, $points);
330 }
331 }
332 }
add(bool $success, string $message, string $record_identitifer)

References ilPRGMessageCollection\add(), and user().

Referenced by updateFromInput().

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

◆ updateStatus()

ilObjStudyProgrammeIndividualPlanGUI::updateStatus ( array  $progress_updates,
ilPRGMessageCollection  $msgs 
)
protected

Definition at line 254 of file class.ilObjStudyProgrammeIndividualPlanGUI.php.

255 {
256 $programme = $this->parent_gui->getStudyProgramme();
257 $acting_user_id = (int) $this->user->getId();
258
259 foreach ($progress_updates as $progress_id => $target_status) {
260 switch ($target_status) {
262
263 $progress = $this->progress_repository->get($progress_id);
264 $cur_status = $progress->getStatus();
265
267 $programme->unmarkAccredited($progress_id, $acting_user_id, $msgs);
268 }
270 $programme->markRelevant($progress_id, $acting_user_id, $msgs);
271 }
272 break;
273
275 $programme->markAccredited($progress_id, $acting_user_id, $msgs);
276 break;
277
279 $programme->markNotRelevant($progress_id, $acting_user_id, $msgs);
280 break;
281
283 break;
284
285 default:
286 $msgs->add(false, 'msg_impossible_target_status', $progress_id);
287 }
288 }
289 }

References ilPRGMessageCollection\add(), MANUAL_STATUS_NONE, ilStudyProgrammeProgress\STATUS_ACCREDITED, ilStudyProgrammeProgress\STATUS_IN_PROGRESS, ilStudyProgrammeProgress\STATUS_NOT_RELEVANT, and user().

Referenced by updateFromInput().

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

◆ view()

ilObjStudyProgrammeIndividualPlanGUI::view ( )
protected

Definition at line 146 of file class.ilObjStudyProgrammeIndividualPlanGUI.php.

147 {
148 $ass = $this->getAssignmentObject();
149
150 if (!in_array(
151 $ass->getUserId(),
152 $this->permissions->getUserIdsSusceptibleTo(ilOrgUnitOperation::OP_VIEW_INDIVIDUAL_PLAN)
153 )) {
155 "may not access individual plan of user"
156 );
157 }
158 $prg = ilObjStudyProgramme::getInstanceByObjId($ass->getRootId());
159 $progress = $prg->getProgressForAssignment($ass->getId());
160
162 $gui->setOnlyRelevant(true);
163 // Wrap a frame around the original gui element to correct rendering.
164 $tpl = new ilTemplate("tpl.individual_plan_tree_frame.html", false, false, "Modules/StudyProgramme");
165 $tpl->setVariable("CONTENT", $gui->getHTML());
166 return $this->buildFrame("view", $tpl->get());
167 }

References $tpl, buildFrame(), getAssignmentObject(), ilObjStudyProgramme\getInstanceByObjId(), and ilOrgUnitOperation\OP_VIEW_INDIVIDUAL_PLAN.

+ Here is the call graph for this function:

Field Documentation

◆ $assignment_repository

ilObjStudyProgrammeIndividualPlanGUI::$assignment_repository
protected

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

Referenced by __construct().

◆ $ctrl

ilObjStudyProgrammeIndividualPlanGUI::$ctrl

◆ $lng

ilObjStudyProgrammeIndividualPlanGUI::$lng

Definition at line 37 of file class.ilObjStudyProgrammeIndividualPlanGUI.php.

Referenced by __construct().

◆ $messages

ilObjStudyProgrammeIndividualPlanGUI::$messages
protected

Definition at line 59 of file class.ilObjStudyProgrammeIndividualPlanGUI.php.

Referenced by __construct().

◆ $object

ilObjStudyProgrammeIndividualPlanGUI::$object

◆ $parent_gui

ilObjStudyProgrammeIndividualPlanGUI::$parent_gui
protected

◆ $permissions

ilObjStudyProgrammeIndividualPlanGUI::$permissions
protected

◆ $progress_repository

ilObjStudyProgrammeIndividualPlanGUI::$progress_repository
protected

Definition at line 49 of file class.ilObjStudyProgrammeIndividualPlanGUI.php.

Referenced by __construct().

◆ $tpl

ilObjStudyProgrammeIndividualPlanGUI::$tpl

Definition at line 27 of file class.ilObjStudyProgrammeIndividualPlanGUI.php.

Referenced by __construct(), buildFrame(), and view().

◆ $user

ilObjStudyProgrammeIndividualPlanGUI::$user

◆ MANUAL_STATUS_NONE

const ilObjStudyProgrammeIndividualPlanGUI::MANUAL_STATUS_NONE = -1

Definition at line 17 of file class.ilObjStudyProgrammeIndividualPlanGUI.php.

Referenced by updateStatus().

◆ POST_VAR_DEADLINE

const ilObjStudyProgrammeIndividualPlanGUI::POST_VAR_DEADLINE = "deadline"

Definition at line 16 of file class.ilObjStudyProgrammeIndividualPlanGUI.php.

Referenced by digestInput().

◆ POST_VAR_REQUIRED_POINTS

const ilObjStudyProgrammeIndividualPlanGUI::POST_VAR_REQUIRED_POINTS = "required_points"

Definition at line 15 of file class.ilObjStudyProgrammeIndividualPlanGUI.php.

Referenced by digestInput().

◆ POST_VAR_STATUS

const ilObjStudyProgrammeIndividualPlanGUI::POST_VAR_STATUS = "status"

Definition at line 14 of file class.ilObjStudyProgrammeIndividualPlanGUI.php.

Referenced by digestInput().


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