ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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.

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

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
+ 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.

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

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  }
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
+ Here is the call graph for this function:

◆ buildFrame()

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

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

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

Referenced by manage(), and view().

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.
+ 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.

References $ret.

Referenced by updateFromInput().

219  : array
220  {
221  $params = [
222  self::POST_VAR_STATUS,
223  self::POST_VAR_DEADLINE,
224  self::POST_VAR_REQUIRED_POINTS
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
+ 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  }

◆ getAssignmentId()

ilObjStudyProgrammeIndividualPlanGUI::getAssignmentId ( )
protected

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

References $_GET.

Referenced by getAssignmentObject(), and updateFromInput().

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"]
+ Here is the caller graph for this function:

◆ getAssignmentObject()

ilObjStudyProgrammeIndividualPlanGUI::getAssignmentObject ( )
protected

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

References getAssignmentId().

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

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  }
+ 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.

Referenced by buildFrame().

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  }
+ 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.

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

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  }
+ 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.

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

99  : void
100  {
101  $this->ref_id = $a_ref_id;
103  $this->permissions = ilStudyProgrammeDIC::specificDicFor($this->object)['permissionhelper'];
104  }
static getInstanceByRefId($a_ref_id)
static specificDicFor(\ilObjStudyProgramme $prg)
+ Here is the call graph for this function:

◆ showSuccessMessage()

ilObjStudyProgrammeIndividualPlanGUI::showSuccessMessage (   $a_lng_var)
protected

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

Referenced by updateFromCurrentPlan().

335  {
336  ilUtil::sendSuccess($this->lng->txt("prg_$a_lng_var"), true);
337  }
+ 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.

References user().

Referenced by updateFromInput().

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  }
user()
Definition: user.php:4
+ 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.

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

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  }
user()
Definition: user.php:4
+ Here is the call graph for this function:

◆ updateFromInput()

ilObjStudyProgrammeIndividualPlanGUI::updateFromInput ( )
protected

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

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

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  }
updateDeadlines(array $deadlines, ilPRGMessageCollection $msgs)
updateStatus(array $progress_updates, ilPRGMessageCollection $msgs)
updateRequiredPoints(array $required_points, ilPRGMessageCollection $msgs)
$_POST["username"]
+ 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.

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

Referenced by updateFromInput().

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)
user()
Definition: user.php:4
+ 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.

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

Referenced by updateFromInput().

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 
266  if ($cur_status == ilStudyProgrammeProgress::STATUS_ACCREDITED) {
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 
282  case self::MANUAL_STATUS_NONE:
283  break;
284 
285  default:
286  $msgs->add(false, 'msg_impossible_target_status', $progress_id);
287  }
288  }
289  }
add(bool $success, string $message, string $record_identitifer)
user()
Definition: user.php:4
+ 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.

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

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 
161  $gui = new ilStudyProgrammeIndividualPlanProgressListGUI($progress);
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  }
+ 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

◆ POST_VAR_DEADLINE

const ilObjStudyProgrammeIndividualPlanGUI::POST_VAR_DEADLINE = "deadline"

◆ POST_VAR_REQUIRED_POINTS

const ilObjStudyProgrammeIndividualPlanGUI::POST_VAR_REQUIRED_POINTS = "required_points"

◆ POST_VAR_STATUS

const ilObjStudyProgrammeIndividualPlanGUI::POST_VAR_STATUS = "status"

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