ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilExerciseManagementGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once "Modules/Exercise/classes/class.ilExSubmission.php";
5 include_once "Modules/Exercise/classes/class.ilExSubmissionBaseGUI.php";
6 
19 {
23  protected $ctrl;
24 
28  protected $tabs_gui;
29 
33  protected $lng;
34 
38  protected $tpl;
39 
43  protected $ui_factory;
44 
48  protected $ui_renderer;
49 
53  protected $filter;
54 
58  protected $toolbar;
59 
60  protected $exercise; // [ilObjExercise]
61  protected $assignment; // [ilExAssignment]
62 
63  protected $task_factory;
64 
68  protected $user;
69 
70  const VIEW_ASSIGNMENT = 1;
71  const VIEW_PARTICIPANT = 2;
72  const VIEW_GRADES = 3;
73 
74  const FEEDBACK_ONLY_SUBMISSION = "submission_feedback";
75  const FEEDBACK_FULL_SUBMISSION = "submission_only";
76 
77  const GRADE_NOT_GRADED = "notgraded";
78  const GRADE_PASSED = "passed";
79  const GRADE_FAILED = "failed";
80 
87  public function __construct(ilObjExercise $a_exercise, ilExAssignment $a_ass = null)
88  {
89  global $DIC;
90 
91  $this->ui_factory = $DIC->ui()->factory();
92  $this->ui_renderer = $DIC->ui()->renderer();
93  $this->user = $DIC->user();
94  $this->toolbar = $DIC->toolbar();
95 
96  $this->ctrl = $DIC->ctrl();
97  $this->tabs_gui = $DIC->tabs();
98  $this->lng = $DIC->language();
99  $this->tpl = $DIC["tpl"];
100 
101  $this->task_factory = $DIC->backgroundTasks()->taskFactory();
102 
103 
104  $this->exercise = $a_exercise;
105  if ($a_ass) {
106  $this->assignment = $a_ass;
107  $this->ass_id = $this->assignment->getId();
108  }
109 
110  $this->ctrl->saveParameter($this, array("vw", "member_id"));
111  }
112 
113  public function executeCommand()
114  {
116  $lng = $this->lng;
117  $ilTabs = $this->tabs_gui;
118 
119  $class = $ilCtrl->getNextClass($this);
120  //$cmd = $ilCtrl->getCmd("listPublicSubmissions");
121 
122  switch ($class) {
123  case "ilfilesystemgui":
124  $ilTabs->clearTargets();
125  $ilTabs->setBackTarget(
126  $lng->txt("back"),
127  $ilCtrl->getLinkTarget($this, $this->getViewBack())
128  );
129 
130  ilUtil::sendInfo($lng->txt("exc_fb_tutor_info"));
131 
132  include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
133  $fstorage = new ilFSStorageExercise($this->exercise->getId(), $this->assignment->getId());
134  $fstorage->create();
135 
136  $submission = new ilExSubmission($this->assignment, (int) $_GET["member_id"]);
137  $feedback_id = $submission->getFeedbackId();
138  $noti_rec_ids = $submission->getUserIds();
139 
140  include_once("./Services/User/classes/class.ilUserUtil.php");
141  $fs_title = array();
142  foreach ($noti_rec_ids as $rec_id) {
143  $fs_title[] = ilUserUtil::getNamePresentation($rec_id, false, false, "", true);
144  }
145  $fs_title = implode(" / ", $fs_title);
146 
147  include_once("./Services/FileSystem/classes/class.ilFileSystemGUI.php");
148  $fs_gui = new ilFileSystemGUI($fstorage->getFeedbackPath($feedback_id));
149  $fs_gui->setTableId("excfbfil" . $this->assignment->getId() . "_" . $feedback_id);
150  $fs_gui->setAllowDirectories(false);
151  $fs_gui->setTitle($lng->txt("exc_fb_files") . " - " .
152  $this->assignment->getTitle() . " - " .
153  $fs_title);
154  $pcommand = $fs_gui->getLastPerformedCommand();
155  if (is_array($pcommand) && $pcommand["cmd"] == "create_file") {
156  foreach ($noti_rec_ids as $user_id) {
157  $member_status = $this->assignment->getMemberStatus($user_id);
158  $member_status->setFeedback(true);
159  $member_status->update();
160  }
161 
162  $this->exercise->sendFeedbackFileNotification(
163  $pcommand["name"],
164  $noti_rec_ids,
165  $this->assignment->getId()
166  );
167  }
168  $this->ctrl->forwardCommand($fs_gui);
169  break;
170 
171  case 'ilrepositorysearchgui':
172  include_once('./Services/Search/classes/class.ilRepositorySearchGUI.php');
173  $rep_search = new ilRepositorySearchGUI();
174  $ref_id = $this->exercise->getRefId();
175  $rep_search->addUserAccessFilterCallable(function ($a_user_ids) use ($ref_id) {
176  return $GLOBALS['DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
177  'edit_submissions_grades',
178  'edit_submissions_grades',
179  $ref_id,
180  $a_user_ids
181  );
182  });
183  $rep_search->setTitle($this->lng->txt("exc_add_participant"));
184  $rep_search->setCallback($this, 'addMembersObject');
185 
186  // Set tabs
187  $this->addSubTabs("assignment");
188  $this->ctrl->setReturn($this, 'members');
189 
190  $this->ctrl->forwardCommand($rep_search);
191  break;
192 
193  case "ilexsubmissionteamgui":
194  include_once "Modules/Exercise/classes/class.ilExSubmissionTeamGUI.php";
195  $gui = new ilExSubmissionTeamGUI($this->exercise, $this->initSubmission());
196  $ilCtrl->forwardCommand($gui);
197  break;
198 
199  case "ilexsubmissionfilegui":
200  include_once "Modules/Exercise/classes/class.ilExSubmissionFileGUI.php";
201  $gui = new ilExSubmissionFileGUI($this->exercise, $this->initSubmission());
202  $ilCtrl->forwardCommand($gui);
203  break;
204 
205  case "ilexsubmissiontextgui":
206  $ilCtrl->saveParameter($this, array("part_id"));
207  include_once "Modules/Exercise/classes/class.ilExSubmissionTextGUI.php";
208  $gui = new ilExSubmissionTextGUI($this->exercise, $this->initSubmission());
209  $ilCtrl->forwardCommand($gui);
210  break;
211 
212  case "ilexpeerreviewgui":
213  include_once "Modules/Exercise/classes/class.ilExPeerReviewGUI.php";
214  $gui = new ilExPeerReviewGUI($this->assignment, $this->initSubmission());
215  $ilCtrl->forwardCommand($gui);
216  break;
217 
218  default:
219  $cmd = $ilCtrl->getCmd();
220  switch ($cmd) {
221  case 'downloadSubmissions':
222  $cmd = $ilCtrl->getCmd("downloadSubmissions");
223  break;
224  default:
225  $cmd = $ilCtrl->getCmd("listPublicSubmissions");
226  break;
227  }
228  $this->{$cmd . "Object"}();
229  break;
230  }
231  }
232 
233  protected function getViewBack()
234  {
235  switch ($_REQUEST["vw"]) {
236  case self::VIEW_PARTICIPANT:
237  $back_cmd = "showParticipant";
238  break;
239 
240  case self::VIEW_GRADES:
241  $back_cmd = "showGradesOverview";
242  break;
243 
244  default:
245  // case self::VIEW_ASSIGNMENT:
246  $back_cmd = "members";
247  break;
248  }
249  return $back_cmd;
250  }
251 
252  protected function initSubmission()
253  {
254  $back_cmd = $this->getViewBack();
255  $this->ctrl->setReturn($this, $back_cmd);
256 
257  $this->tabs_gui->clearTargets();
258  $this->tabs_gui->setBackTarget(
259  $this->lng->txt("back"),
260  $this->ctrl->getLinkTarget($this, $back_cmd)
261  );
262 
263  include_once "Modules/Exercise/classes/class.ilExSubmission.php";
264  return new ilExSubmission($this->assignment, $_REQUEST["member_id"], null, true);
265  }
266 
272  public function addSubTabs($a_activate)
273  {
274  $ilTabs = $this->tabs_gui;
275  $lng = $this->lng;
277 
278  $ass_id = $_GET["ass_id"];
279  $part_id = $_GET["part_id"];
280 
281  $ilCtrl->setParameter($this, "vw", "");
282  $ilCtrl->setParameter($this, "member_id", "");
283  $ilCtrl->setParameter($this, "ass_id", "");
284  $ilCtrl->setParameter($this, "part_id", "");
285 
286  $ilTabs->addSubTab(
287  "assignment",
288  $lng->txt("exc_assignment_view"),
289  $ilCtrl->getLinkTarget($this, "members")
290  );
291  $ilTabs->addSubTab(
292  "participant",
293  $lng->txt("exc_participant_view"),
294  $ilCtrl->getLinkTarget($this, "showParticipant")
295  );
296  $ilTabs->addSubTab(
297  "grades",
298  $lng->txt("exc_grades_overview"),
299  $ilCtrl->getLinkTarget($this, "showGradesOverview")
300  );
301  $ilTabs->activateSubTab($a_activate);
302 
303  $ilCtrl->setParameter($this, "ass_id", $ass_id);
304  $ilCtrl->setParameter($this, "part_id", $part_id);
305  }
306 
307  public function waitingDownloadObject()
308  {
309  $lng = $this->lng;
311 
312  $ilCtrl->setParameterByClass("ilExSubmissionFileGUI", "member_id", (int) $_GET["member_id"]);
313  $url = $ilCtrl->getLinkTargetByClass(array("ilRepositoryGUI", "ilExerciseHandlerGUI", "ilObjExerciseGUI", "ilExerciseManagementGUI", "ilExSubmissionFileGUI"), "downloadNewReturned");
314  $js_url = $ilCtrl->getLinkTargetByClass(array("ilRepositoryGUI", "ilExerciseHandlerGUI", "ilObjExerciseGUI", "ilExerciseManagementGUI", "ilExSubmissionFileGUI"), "downloadNewReturned", "", "", false);
315  ilUtil::sendInfo($lng->txt("exc_wait_for_files") . "<a href='$url'> " . $lng->txt('exc_download_files') . "</a><script>window.location.href ='" . $js_url . "';</script>");
316  $this->membersObject();
317  }
318 
322  public function membersObject()
323  {
324  $tpl = $this->tpl;
325  $ilToolbar = $this->toolbar;
327  $lng = $this->lng;
328 
329  include_once 'Services/Tracking/classes/class.ilLPMarks.php';
330 
331  $this->addSubTabs("assignment");
332 
333  // assignment selection
334  include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
335  $ass = ilExAssignment::getInstancesByExercise($this->exercise->getId());
336 
337  if (!$this->assignment) {
338  $this->assignment = current($ass);
339  }
340 
341  reset($ass);
342  if (count($ass) > 1) {
343  $options = array();
344  foreach ($ass as $a) {
345  $options[$a->getId()] = $a->getTitle();
346  }
347  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
348  $si = new ilSelectInputGUI($this->lng->txt(""), "ass_id");
349  $si->setOptions($options);
350  $si->setValue($this->assignment->getId());
351  $ilToolbar->addStickyItem($si);
352 
353  include_once("./Services/UIComponent/Button/classes/class.ilSubmitButton.php");
354  $button = ilSubmitButton::getInstance();
355  $button->setCaption("exc_select_ass");
356  $button->setCommand("selectAssignment");
357  $ilToolbar->addStickyItem($button);
358 
359  $ilToolbar->addSeparator();
360  }
361  // #16165 - if only 1 assignment dropdown is not displayed;
362  elseif ($this->assignment) {
363  $ilCtrl->setParameter($this, "ass_id", $this->assignment->getId());
364  }
365 
366  // add member
367  // is only shown if 'edit_submissions_grades' is granted by rbac. positions
368  // access is not sufficient.
369  $has_rbac_access = $GLOBALS['DIC']->access()->checkAccess(
370  'edit_submissions_grades',
371  '',
372  $this->exercise->getRefId()
373  );
374  if ($has_rbac_access) {
375  include_once './Services/Search/classes/class.ilRepositorySearchGUI.php';
377  $this,
378  $ilToolbar,
379  array(
380  'auto_complete_name' => $lng->txt('user'),
381  'submit_name' => $lng->txt('add'),
382  'add_search' => true,
383  'add_from_container' => $this->exercise->getRefId()
384  )
385  );
386  }
387 
388  // #16168 - no assignments
389  if (count($ass) > 0) {
390  if ($has_rbac_access) {
391  $ilToolbar->addSeparator();
392  }
393 
394  // we do not want the ilRepositorySearchGUI form action
395  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
396 
397  $ilCtrl->setParameter($this, "ass_id", $this->assignment->getId());
398 
399  if ($this->assignment->getType() == ilExAssignment::TYPE_UPLOAD_TEAM) {
400  include_once("./Modules/Exercise/classes/class.ilExAssignmentTeam.php");
401  if (ilExAssignmentTeam::getAdoptableGroups($this->exercise->getRefId())) {
402  $ilToolbar->addButton(
403  $this->lng->txt("exc_adopt_group_teams"),
404  $this->ctrl->getLinkTarget($this, "adoptTeamsFromGroup")
405  );
406 
407  $ilToolbar->addSeparator();
408  }
409  } elseif ($this->exercise->hasTutorFeedbackFile()) {
410  if (!$this->assignment->getAssignmentType()->usesTeams()) {
411  // multi-feedback
412  $ilToolbar->addButton(
413  $this->lng->txt("exc_multi_feedback"),
414  $this->ctrl->getLinkTarget($this, "showMultiFeedback")
415  );
416 
417  $ilToolbar->addSeparator();
418  }
419  }
420 
421  if (ilExSubmission::hasAnySubmissions($this->assignment->getId())) {
422  $ass_type = $this->assignment->getType();
423  //todo change addFormButton for addButtonInstance
424  if ($ass_type == ilExAssignment::TYPE_TEXT) {
425  $ilToolbar->addFormButton($lng->txt("exc_list_text_assignment"), "listTextAssignment");
426  }
427  $ilToolbar->addFormButton($lng->txt("download_all_returned_files"), "downloadSubmissions");
428  }
429  $this->ctrl->setParameter($this, "vw", self::VIEW_ASSIGNMENT);
430 
431  include_once("./Modules/Exercise/classes/class.ilExerciseMemberTableGUI.php");
432  $exc_tab = new ilExerciseMemberTableGUI($this, "members", $this->exercise, $this->assignment->getId());
433  $tpl->setContent(
434  $exc_tab->getHTML() .
436  );
437  } else {
438  ilUtil::sendInfo($lng->txt("exc_no_assignments_available"));
439  }
440 
441  $ilCtrl->setParameter($this, "ass_id", "");
442 
443  return;
444  }
445 
446  public function downloadSubmissionsObject()
447  {
448  include_once './Modules/Exercise/classes/BackgroundTasks/class.ilDownloadSubmissionsBackgroundTask.php';
449 
450  $participant_id = $_REQUEST['part_id'];
451 
452  $download_task = new ilDownloadSubmissionsBackgroundTask(
453  (int) $GLOBALS['DIC']->user()->getId(),
454  (int) $this->exercise->getRefId(),
455  (int) $this->exercise->getId(),
456  (int) $this->ass_id,
457  (int) $participant_id
458  );
459 
460  if ($download_task->run()) {
461  ilUtil::sendSuccess($this->lng->txt('exc_down_files_started_bg'), true);
462  }
463 
464  if ($this->assignment) {
465  $this->ctrl->redirect($this, "members");
466  } else {
467  $this->ctrl->redirect($this, "showParticipant");
468  }
469  }
470 
471  public function membersApplyObject()
472  {
473  $this->saveStatusAllObject(null, false);
474  include_once("./Modules/Exercise/classes/class.ilExerciseMemberTableGUI.php");
475  $exc_tab = new ilExerciseMemberTableGUI($this, "members", $this->exercise, $this->assignment->getId());
476  $exc_tab->resetOffset();
477  $exc_tab->writeFilterToSession();
478 
479  $this->membersObject();
480  }
481 
482  public function membersResetObject()
483  {
484  include_once("./Modules/Exercise/classes/class.ilExerciseMemberTableGUI.php");
485  $exc_tab = new ilExerciseMemberTableGUI($this, "members", $this->exercise, $this->assignment->getId());
486  $exc_tab->resetOffset();
487  $exc_tab->resetFilter();
488 
489  $this->membersObject();
490  }
491 
495  public function saveGradesObject()
496  {
498  $lng = $this->lng;
499 
500  include_once 'Services/Tracking/classes/class.ilLPMarks.php';
501 
502  if (is_array($_POST["lcomment"])) {
503  foreach ($_POST["lcomment"] as $k => $v) {
504  $marks_obj = new ilLPMarks($this->exercise->getId(), (int) $k);
505  $marks_obj->setComment(ilUtil::stripSlashes($v));
506  $marks_obj->setMark(ilUtil::stripSlashes($_POST["mark"][$k]));
507  $marks_obj->update();
508  }
509  }
510  ilUtil::sendSuccess($lng->txt("exc_msg_saved_grades"), true);
511  $ilCtrl->redirect($this, "showGradesOverview");
512  }
513 
514 
515  // TEXT ASSIGNMENT ?!
516 
520  public function listTextAssignmentObject()
521  {
522  $this->initFilter();
523 
524  //tabs
525  $this->tabs_gui->clearTargets();
526  $this->tabs_gui->setBackTarget(
527  $this->lng->txt("back"),
528  $this->ctrl->getLinkTarget($this, "members")
529  );
530 
531  $button_print = $this->ui_factory->button()->standard($this->lng->txt('print'), "#")
532  ->withOnLoadCode(function ($id) {
533  return "$('#{$id}').click(function() { window.print(); return false; });";
534  });
535  $this->toolbar->addSeparator();
536  $this->toolbar->addComponent($button_print);
537 
538  //retrieve data
539  $peer_review = new ilExPeerReview($this->assignment);
540  $peer_data = $peer_review->getAllPeerReviews();
541 
542  include_once "Services/User/classes/class.ilUserUtil.php";
543  include_once "Services/RTE/classes/class.ilRTE.php";
544 
545  $report_html = "";
546  //TODO create proper title.
547  $report_title = $this->lng->txt("exc_list_text_assignment") . ": " . $this->assignment->getTitle();
548  $report_html .= "<h1>" . $report_title . "</h1>";
549  $total_reports = 0;
550 
551  $members = ilExSubmission::getAssignmentParticipants($this->exercise->getId(), $this->ass_id);
552  $members_filter = new ilExerciseMembersFilter($this->exercise->getRefId(), $members, $this->user->getId());
553  $members = $members_filter->filterParticipantsByAccess();
554 
555  foreach (ilExSubmission::getAssignmentFilesByUsers($this->exercise->getId(), $this->assignment->getId(), $members) as $file) {
556  if (trim($file["atext"]) && ilObjUser::_exists($file["user_id"])) {
557  $user = new ilObjUser($file["user_id"]);
558  $uname = $user->getFirstname() . " " . $user->getLastname();
559  $data = array(
560  "uid" => $file["user_id"],
561  "uname" => $uname,
562  "udate" => $file["ts"],
563  "utext" => ilRTE::_replaceMediaObjectImageSrc($file["atext"], 1) // mob id to mob src
564  );
565 
566  if (isset($peer_data[$file["user_id"]])) {
567  $data["peer"] = array_keys($peer_data[$file["user_id"]]);
568  }
569 
570  $data["fb_received"] = (is_array($data["peer"]))
571  ? count($data["peer"])
572  : 0;
573  $data["fb_given"] = $peer_review->countGivenFeedback(true, $file["user_id"]);
574 
575  $submission_data = $this->assignment->getExerciseMemberAssignmentData($file["user_id"], $this->filter["status"]);
576 
577  if (is_array($submission_data)) {
578  $data = array_merge($data, $submission_data);
579  $report_html .= $this->getReportPanel($data);
580  $total_reports++;
581  }
582  }
583  }
584  if ($total_reports == 0) {
585  $mtpl = new ilTemplate("tpl.message.html", true, true, "Services/Utilities");
586  $mtpl->setCurrentBlock("info_message");
587  $mtpl->setVariable("TEXT", $this->lng->txt("fiter_no_results"));
588  $mtpl->parseCurrentBlock();
589  $report_html .= $mtpl->get();
590  }
591 
592  $this->tpl->setContent($report_html);
593  }
594 
595  public function getReportPanel($a_data)
596  {
597  $modal = $this->getEvaluationModal($a_data);
598 
599  $this->ctrl->setParameter($this, "member_id", $a_data['uid']);
600  $actions = array(
601  $this->ui_factory->button()->shy($this->lng->txt("grade_evaluate"), "#")->withOnClick($modal->getShowSignal())
602  );
603  if ($this->exercise->hasTutorFeedbackMail()) {
604  $actions[] = $this->ui_factory->button()->shy(
605  $this->lng->txt("exc_tbl_action_feedback_mail"),
606  $this->ctrl->getLinkTarget($this, "redirectFeedbackMail")
607  );
608  }
609  if ($this->exercise->hasTutorFeedbackFile()) {
610  $actions[] = $this->ui_factory->button()->shy(
611  $this->lng->txt("exc_tbl_action_feedback_file"),
612  $this->ctrl->getLinkTargetByClass("ilFileSystemGUI", "listFiles")
613  );
614  }
615 
616  $this->ctrl->setParameter($this, "member_id", "");
617 
618  $actions_dropdown = $this->ui_factory->dropdown()->standard($actions);
619 
620  if ($a_data['status'] == self::GRADE_NOT_GRADED) {
621  $str_status_key = $this->lng->txt('exc_tbl_status');
622  $str_status_value = $this->lng->txt('not_yet');
623  } else {
624  $str_status_key = $this->lng->txt('exc_tbl_status_time');
625  $str_status_value = ilDatePresentation::formatDate(new ilDateTime($a_data["status_time"], IL_CAL_DATETIME));
626  }
627 
628  $str_mark_key = $this->lng->txt("exc_tbl_mark");
629  $str_mark_value = $this->lng->txt('not_yet');
630 
631  if (($a_data['mark'] != "")) {
632  $str_mark_value = $a_data['mark'];
633  }
634 
635  if ($a_data['feedback_time']) {
636  $str_evaluation_key = $this->lng->txt('exc_tbl_feedback_time');
637  $str_evaluation_value = ilDatePresentation::formatDate(new ilDateTime($a_data["feedback_time"], IL_CAL_DATETIME));
638  } else {
639  $str_evaluation_key = $this->lng->txt('exc_settings_feedback');
640  $str_evaluation_value = $this->lng->txt('not_yet');
641  }
642 
643  $card_content = array(
644  $this->lng->txt("exc_tbl_submission_date") => ilDatePresentation::formatDate(new ilDateTime($a_data["udate"], IL_CAL_DATETIME)),
645  $str_status_key => $str_status_value,
646  $str_mark_key => $str_mark_value,
647  $str_evaluation_key => $str_evaluation_value,
648  $this->lng->txt('feedback_given') => $a_data['fb_given'],
649  $this->lng->txt('feedback_received') => $a_data['fb_received']
650  );
651  $card_tpl = new ilTemplate("tpl.exc_report_details_card.html", true, true, "Modules/Exercise");
652  foreach ($card_content as $key => $value) {
653  $card_tpl->setCurrentBlock("assingment_card");
654  $card_tpl->setVariable("ROW_KEY", $key);
655  $card_tpl->setVariable("ROW_VALUE", $value);
656  $card_tpl->parseCurrentBlock();
657  }
658 
659  $main_panel = $this->ui_factory->panel()->sub($a_data['uname'], $this->ui_factory->legacy($a_data['utext']))
660  ->withCard($this->ui_factory->card()->standard($this->lng->txt('text_assignment'))->withSections(array($this->ui_factory->legacy($card_tpl->get()))))->withActions($actions_dropdown);
661 
662  $feedback_tpl = new ilTemplate("tpl.exc_report_feedback.html", true, true, "Modules/Exercise");
663  if (array_key_exists("peer", $a_data) && $this->filter["feedback"] == "submission_feedback") {
664  $feedback_tpl->setCurrentBlock("feedback");
665  foreach ($a_data["peer"] as $peer_id) {
666  if (ilObject::_lookupType($peer_id) == "usr") {
667  $user = new ilObjUser($peer_id);
668  $peer_name = $user->getFirstname() . " " . $user->getLastname();
669  } else {
670  $peer_name = $this->lng->txt("exc_deleted_user");
671  }
672 
673  $feedback_tpl->setCurrentBlock("peer_feedback");
674  $feedback_tpl->setVariable("PEER_NAME", $peer_name);
675 
676  $submission = new ilExSubmission($this->assignment, $a_data["uid"]);
677  $values = $submission->getPeerReview()->getPeerReviewValues($peer_id, $a_data["uid"]);
678 
679  $review_html = "";
680  foreach ($this->assignment->getPeerReviewCriteriaCatalogueItems() as $crit) {
681  $crit_id = $crit->getId()
682  ? $crit->getId()
683  : $crit->getType();
684  $crit->setPeerReviewContext($this->assignment, $peer_id, $a_data["uid"]);
685 
686  $review_html .=
687  '<div class="ilBlockPropertyCaption">' . $crit->getTitle() . '</div>' .
688  '<div style="margin:2px 0;">' . $crit->getHTML($values[$crit_id]) . '</div>';
689  }
690  $feedback_tpl->setVariable("PEER_FEEDBACK", $review_html);
691  $feedback_tpl->parseCurrentBlock();
692  }
693  $feedback_tpl->parseCurrentBlock();
694  }
695  $feedback_tpl->setVariable("GRADE", $this->lng->txt('grade') . ": " . $this->lng->txt('exc_' . $a_data['status']));
696  $feedback_tpl->setVariable("COMMENT", $this->lng->txt('exc_comment') . "<br>" . $a_data['comment']);
697 
698  $feedback_panel = $this->ui_factory->panel()->sub("", $this->ui_factory->legacy($feedback_tpl->get()));
699 
700  $report = $this->ui_factory->panel()->report("", array($main_panel, $feedback_panel));
701 
702  return $this->ui_renderer->render([$modal,$report]);
703  }
704 
705  public function getEvaluationModal($a_data)
706  {
707  $modal_tpl = new ilTemplate("tpl.exc_report_evaluation_modal.html", true, true, "Modules/Exercise");
708  $modal_tpl->setVariable("USER_NAME", $a_data['uname']);
709 
710  $form = new ilPropertyFormGUI();
711  $form->setFormAction($this->ctrl->getFormAction($this, "saveEvaluationFromModal"));
712  $form->setId(uniqid('form'));
713 
714  //Grade
715  $options = array(
716  self::GRADE_NOT_GRADED => $this->lng->txt("exc_notgraded"),
717  self::GRADE_PASSED => $this->lng->txt("exc_passed"),
718  self::GRADE_FAILED => $this->lng->txt("exc_failed")
719  );
720  $si = new ilSelectInputGUI($this->lng->txt("exc_tbl_status"), "grade");
721  $si->setOptions($options);
722  $si->setValue($a_data['status']);
723  $form->addItem($si);
724 
725  //Mark
726  $mark_input = new ilTextInputGUI($this->lng->txt("exc_tbl_mark"), "mark");
727  $mark_input->setValue($a_data['mark']);
728  $mark_input->setMaxLength(32);
729  $mark_input->setSize(4);
730  $form->addItem($mark_input);
731 
732  $item = new ilHiddenInputGUI('mem_id');
733  $item->setValue($a_data['uid']);
734  $form->addItem($item);
735 
736  //TODO: CHECK ilias string utils. ilUtil shortenText with net blank.
737  if ($this->exercise->hasTutorFeedbackText()) {
738  $max_chars = 500;
739 
740  $u_text = strip_tags($a_data["utext"]); //otherwise will get open P
741  $text = $u_text;
742  //show more
743  if (strlen($u_text) > $max_chars) {
744  $text = "<input type='checkbox' class='read-more-state' id='post-1' />";
745  $text .= "<div class='read-more-wrap'>";
746  $text .= mb_substr($u_text, 0, $max_chars);
747  $text .= "<span class='read-more-target'>";
748  $text .= mb_substr($u_text, $max_chars);
749  $text .= "</span></div>";
750  $text .= "<label for='post-1' class='read-more-trigger'></label>";
751  }
752  $modal_tpl->setVariable("USER_TEXT", $text);
753 
754  $ta = new ilTextAreaInputGUI($this->lng->txt("exc_comment"), 'comment');
755  $ta->setInfo($this->lng->txt("exc_comment_for_learner_info"));
756  $ta->setValue($a_data['comment']);
757  $ta->setRows(10);
758  $form->addItem($ta);
759  }
760 
761  $modal_tpl->setVariable("FORM", $form->getHTML());
762 
763  $form_id = 'form_' . $form->getId();
764  $submit_btn = $this->ui_factory->button()->primary($this->lng->txt("save"), '#')
765  ->withOnLoadCode(function ($id) use ($form_id) {
766  return "$('#{$id}').click(function() { $('#{$form_id}').submit(); return false; });";
767  });
768 
769  return $this->ui_factory->modal()->roundtrip(strtoupper($this->lng->txt("grade_evaluate")), $this->ui_factory->legacy($modal_tpl->get()))->withActionButtons([$submit_btn]);
770  }
771 
776  {
777  $comment = trim($_POST['comment']);
778  $user_id = (int) $_POST['mem_id'];
779  $grade = trim($_POST["grade"]);
780  $mark = trim($_POST['mark']);
781 
782  if ($this->assignment->getId() && $user_id) {
783  $member_status = $this->assignment->getMemberStatus($user_id);
784  $member_status->setComment(ilUtil::stripSlashes($comment));
785  $member_status->setStatus($grade);
786  $member_status->setMark($mark);
787  if ($comment != "") {
788  $member_status->setFeedback(true);
789  }
790  $member_status->update();
791  }
792  ilUtil::sendSuccess($this->lng->txt("exc_status_saved"), true);
793  $this->ctrl->redirect($this, "listTextAssignment");
794  }
795 
800  {
801  if (!strlen(trim($_POST['user_login']))) {
802  ilUtil::sendFailure($this->lng->txt('msg_no_search_string'));
803  $this->membersObject();
804  return false;
805  }
806  $users = explode(',', $_POST['user_login']);
807 
808  $user_ids = array();
809  foreach ($users as $user) {
810  $user_id = ilObjUser::_lookupId($user);
811 
812  if (!$user_id) {
813  ilUtil::sendFailure($this->lng->txt('user_not_known'));
814  return $this->membersObject();
815  }
816 
817  $user_ids[] = $user_id;
818  }
819 
820  if (!$this->addMembersObject($user_ids)) {
821  $this->membersObject();
822  return false;
823  }
824  return true;
825  }
826 
830  public function addMembersObject($a_user_ids = array())
831  {
832  if (!count($a_user_ids)) {
833  ilUtil::sendFailure($this->lng->txt("no_checkbox"));
834  return false;
835  }
836 
837  if (!$this->exercise->members_obj->assignMembers($a_user_ids)) {
838  ilUtil::sendFailure($this->lng->txt("exc_members_already_assigned"));
839  return false;
840  } else {
841  /* #16921
842  // #9946 - create team for new user(s) for each team upload assignment
843  foreach(ilExAssignment::getInstancesByExercise($this->exercise->getId()) as $ass)
844  {
845  if($ass->hasTeam())
846  {
847  include_once "Modules/Exercise/classes/class.ilExAssignmentTeam.php";
848  foreach($a_user_ids as $user_id)
849  {
850  // #15915
851  ilExAssignmentTeam::getTeamId($ass->getId(), $user_id, true);
852  }
853  }
854  }
855  */
856 
857  ilUtil::sendSuccess($this->lng->txt("exc_members_assigned"), true);
858  }
859 
860  $this->ctrl->redirect($this, "members");
861  return true;
862  }
863 
864 
868  public function selectAssignmentObject()
869  {
870  $_GET["ass_id"] = ilUtil::stripSlashes($_POST["ass_id"]);
871  $this->membersObject();
872  }
873 
877  public function showParticipantObject()
878  {
879  $tpl = $this->tpl;
880  $ilToolbar = $this->toolbar;
882  $lng = $this->lng;
883 
884  $this->addSubTabs("participant");
885  $this->ctrl->setParameter($this, "ass_id", "");
886 
887  // participant selection
888  include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
889  $ass = ilExAssignment::getAssignmentDataOfExercise($this->exercise->getId());
890  $members = $this->exercise->members_obj->getMembers();
891 
892  $members = $GLOBALS['DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
893  'edit_submissions_grades',
894  'edit_submissions_grades',
895  $this->exercise->getRefId(),
896  $members
897  );
898 
899 
900  if (count($members) == 0) {
901  ilUtil::sendInfo($lng->txt("exc_no_participants"));
902  return;
903  }
904 
905  $mems = array();
906  foreach ($members as $mem_id) {
907  if (ilObject::_lookupType($mem_id) == "usr") {
908  include_once("./Services/User/classes/class.ilObjUser.php");
909  $name = ilObjUser::_lookupName($mem_id);
910  if (trim($name["login"]) != "") { // #20073
911  $mems[$mem_id] = $name;
912  }
913  }
914  }
915 
916  $mems = ilUtil::sortArray($mems, "lastname", "asc", false, true);
917 
918  if ($_GET["part_id"] == "" && count($mems) > 0) {
919  $_GET["part_id"] = key($mems);
920  }
921 
922  $current_participant = $_GET["part_id"];
923 
924  reset($mems);
925  if (count($mems) > 1) {
926  $options = array();
927  foreach ($mems as $k => $m) {
928  $options[$k] =
929  $m["lastname"] . ", " . $m["firstname"] . " [" . $m["login"] . "]";
930  }
931  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
932  $si = new ilSelectInputGUI($this->lng->txt(""), "part_id");
933  $si->setOptions($options);
934  $si->setValue($current_participant);
935  $ilToolbar->addStickyItem($si);
936 
937  include_once("./Services/UIComponent/Button/classes/class.ilSubmitButton.php");
938  $button = ilSubmitButton::getInstance();
939  $button->setCaption("exc_select_part");
940  $button->setCommand("selectParticipant");
941  $ilToolbar->addStickyItem($button);
942  }
943 
944  if (count($mems) > 0) {
945  $this->ctrl->setParameter($this, "vw", self::VIEW_PARTICIPANT);
946  $this->ctrl->setParameter($this, "part_id", $current_participant);
947 
948  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
949  $ilToolbar->addFormButton($lng->txt("download_all_returned_files"), "downloadSubmissions");
950 
951  include_once("./Modules/Exercise/classes/class.ilExParticipantTableGUI.php");
952  $part_tab = new ilExParticipantTableGUI(
953  $this,
954  "showParticipant",
955  $this->exercise,
956  $current_participant
957  );
958  $tpl->setContent($part_tab->getHTML() .
959  $this->initIndividualDeadlineModal());
960  } else {
961  ilUtil::sendInfo($this->lng->txt("exc_no_assignments_available"));
962  }
963  }
964 
965  public function showParticipantApplyObject()
966  {
967  include_once("./Modules/Exercise/classes/class.ilExParticipantTableGUI.php");
968  $exc_tab = new ilExParticipantTableGUI($this, "showParticipant", $this->exercise, $_GET["part_id"]);
969  $exc_tab->resetOffset();
970  $exc_tab->writeFilterToSession();
971 
972  $this->showParticipantObject();
973  }
974 
975  public function showParticipantResetObject()
976  {
977  include_once("./Modules/Exercise/classes/class.ilExParticipantTableGUI.php");
978  $exc_tab = new ilExParticipantTableGUI($this, "showParticipant", $this->exercise, $_GET["part_id"]);
979  $exc_tab->resetOffset();
980  $exc_tab->resetFilter();
981 
982  $this->showParticipantObject();
983  }
984 
988  public function selectParticipantObject()
989  {
990  $_GET["part_id"] = ilUtil::stripSlashes($_POST["part_id"]);
991  $this->showParticipantObject();
992  }
993 
997  public function showGradesOverviewObject()
998  {
999  $tpl = $this->tpl;
1000  $ilToolbar = $this->toolbar;
1001  $ilCtrl = $this->ctrl;
1002  $lng = $this->lng;
1003 
1004  $this->addSubTabs("grades");
1005 
1006  include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
1007  $mem_obj = new ilExerciseMembers($this->exercise);
1008  $mems = $mem_obj->getMembers();
1009 
1010  $mems = $GLOBALS['DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
1011  'edit_submissions_grades',
1012  'edit_submissions_grades',
1013  $this->exercise->getRefId(),
1014  $mems
1015  );
1016  if (count($mems) > 0) {
1017  $ilToolbar->addButton(
1018  $lng->txt("exc_export_excel"),
1019  $ilCtrl->getLinkTarget($this, "exportExcel")
1020  );
1021  }
1022 
1023  $this->ctrl->setParameter($this, "vw", self::VIEW_GRADES);
1024 
1025  include_once("./Modules/Exercise/classes/class.ilExGradesTableGUI.php");
1026  $grades_tab = new ilExGradesTableGUI(
1027  $this,
1028  "showGradesOverview",
1029  $this->exercise,
1030  $mem_obj
1031  );
1032  $tpl->setContent($grades_tab->getHTML());
1033  }
1034 
1038  public function redirectFeedbackMailObject()
1039  {
1040  $members = array();
1041 
1042  if ($_GET["member_id"] != "") {
1043  $submission = new ilExSubmission($this->assignment, $_GET["member_id"]);
1044  $members = $submission->getUserIds();
1045  } elseif ($members = $this->getMultiActionUserIds()) {
1046  $members = array_keys($members);
1047  }
1048 
1049  if ($members) {
1050  $logins = array();
1051  foreach ($members as $user_id) {
1052  $member_status = $this->assignment->getMemberStatus($user_id);
1053  $member_status->setFeedback(true);
1054  $member_status->update();
1055 
1056  $logins[] = ilObjUser::_lookupLogin($user_id);
1057  }
1058  $logins = implode($logins, ",");
1059 
1060  // #16530 - see ilObjCourseGUI::createMailSignature
1061  $sig = chr(13) . chr(10) . chr(13) . chr(10);
1062  $sig .= $this->lng->txt('exc_mail_permanent_link');
1063  $sig .= chr(13) . chr(10) . chr(13) . chr(10);
1064  include_once './Services/Link/classes/class.ilLink.php';
1065  $sig .= ilLink::_getLink($this->exercise->getRefId());
1066  $sig = rawurlencode(base64_encode($sig));
1067 
1068  require_once 'Services/Mail/classes/class.ilMailFormCall.php';
1070  $this,
1071  $this->getViewBack(),
1072  array(),
1073  array(
1074  'type' => 'new',
1075  'rcp_to' => $logins,
1077  )
1078  ));
1079  }
1080  }
1081 
1085  public function downloadAllObject()
1086  {
1087  $members = array();
1088 
1089  foreach ($this->exercise->members_obj->getMembers() as $member_id) {
1090  $submission = new ilExSubmission($this->assignment, $member_id);
1091  $submission->updateTutorDownloadTime();
1092 
1093  // get member object (ilObjUser)
1094  if (ilObject::_exists($member_id)) {
1095  $storage_id = "";
1096  // adding file metadata
1097  foreach ($submission->getFiles() as $file) {
1098  if ($this->assignment->getAssignmentType()->isSubmissionAssignedToTeam()) {
1099  $storage_id = $file["team_id"];
1100  } else {
1101  $storage_id = $file["user_id"];
1102  }
1103 
1104  $members[$storage_id]["files"][$file["returned_id"]] = $file;
1105  }
1106  if ($this->assignment->getAssignmentType()->isSubmissionAssignedToTeam()) {
1107  $name = "Team " . $submission->getTeam()->getId();
1108  } else {
1109  $tmp_obj = ilObjectFactory::getInstanceByObjId($member_id);
1110  $name = $tmp_obj->getFirstname() . " " . $tmp_obj->getLastname();
1111  }
1112  if ($storage_id > 0) {
1113  $members[$storage_id]["name"] = $name;
1114  }
1115  unset($tmp_obj);
1116  }
1117  }
1118 
1119  ilExSubmission::downloadAllAssignmentFiles($this->assignment, $members);
1120  }
1121 
1122  protected function getMultiActionUserIds($a_keep_teams = false)
1123  {
1124  // multi-user
1125  if ($this->assignment) {
1126  if (!$_POST["member"]) {
1127  ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
1128  $this->ctrl->redirect($this, "members");
1129  }
1130 
1131  foreach (array_keys($_POST["member"]) as $user_id) {
1132  $submission = new ilExSubmission($this->assignment, $user_id);
1133  $tmembers = $submission->getUserIds();
1134  if (!(bool) $a_keep_teams) {
1135  foreach ($tmembers as $tuser_id) {
1136  $members[$tuser_id] = 1;
1137  }
1138  } else {
1139  if ($tmembers) {
1140  $members[] = $tmembers;
1141  } else {
1142  // no team yet
1143  $members[] = $user_id;
1144  }
1145  }
1146  }
1147  }
1148  // multi-ass
1149  else {
1150  if (!$_POST["ass"]) {
1151  ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
1152  $this->ctrl->redirect($this, "showParticipant");
1153  }
1154 
1155  $user_id = $_GET["part_id"];
1156 
1157  include_once "Modules/Exercise/classes/class.ilExAssignment.php";
1158  foreach (array_keys($_POST["ass"]) as $ass_id) {
1159  $submission = new ilExSubmission(new ilExAssignment($ass_id), $user_id);
1160  $tmembers = $submission->getUserIds();
1161  if (!(bool) $a_keep_teams) {
1162  foreach ($tmembers as $tuser_id) {
1163  $members[$ass_id][] = $tuser_id;
1164  }
1165  } else {
1166  if ($tmembers) {
1167  $members[$ass_id][] = $tmembers;
1168  } else {
1169  // no team yet
1170  $members[$ass_id][] = $user_id;
1171  }
1172  }
1173  }
1174  }
1175 
1176  return $members;
1177  }
1178 
1182  public function sendMembersObject()
1183  {
1184  $members = $this->getMultiActionUserIds();
1185 
1186  ilUtil::sendSuccess($this->lng->txt("exc_sent"), true);
1187  if ($this->assignment) {
1188  $this->exercise->sendAssignment($this->assignment, array_keys($members));
1189  $this->ctrl->redirect($this, "members");
1190  } else {
1191  foreach ($members as $ass_id => $users) {
1192  $this->exercise->sendAssignment(new ilExAssignment($ass_id), $users);
1193  }
1194  $this->ctrl->setParameter($this, "part_id", $_GET["part_id"]); // #17629
1195  $this->ctrl->redirect($this, "showParticipant");
1196  }
1197  }
1198 
1203  {
1204  $ilCtrl = $this->ctrl;
1205  $tpl = $this->tpl;
1206  $lng = $this->lng;
1207 
1208  $members = $this->getMultiActionUserIds();
1209 
1210  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1211  $cgui = new ilConfirmationGUI();
1212  $cgui->setFormAction($ilCtrl->getFormAction($this));
1213  $cgui->setHeaderText($lng->txt("exc_msg_sure_to_deassign_participant"));
1214  $cgui->setCancel($lng->txt("cancel"), "members");
1215  $cgui->setConfirm($lng->txt("remove"), "deassignMembers");
1216 
1217  include_once("./Services/User/classes/class.ilUserUtil.php");
1218  foreach ($members as $k => $m) {
1219  $cgui->addItem(
1220  "member[$k]",
1221  $m,
1222  ilUserUtil::getNamePresentation((int) $k, false, false, "", true)
1223  );
1224  }
1225 
1226  $tpl->setContent($cgui->getHTML());
1227  }
1228 
1232  public function deassignMembersObject()
1233  {
1234  $ilCtrl = $this->ctrl;
1235  $lng = $this->lng;
1236 
1237  $members = $this->getMultiActionUserIds();
1238 
1239  foreach (array_keys($members) as $usr_id) {
1240  $this->exercise->members_obj->deassignMember((int) $usr_id);
1241  }
1242  ilUtil::sendSuccess($lng->txt("exc_msg_participants_removed"), true);
1243  $ilCtrl->redirect($this, "members");
1244  }
1245 
1246  public function saveCommentsObject()
1247  {
1248  if (!isset($_POST['comments_value'])) {
1249  return;
1250  }
1251 
1252  $this->exercise->members_obj->setNoticeForMember(
1253  $_GET["member_id"],
1254  ilUtil::stripSlashes($_POST["comments_value"])
1255  );
1256  ilUtil::sendSuccess($this->lng->txt("exc_members_comments_saved"));
1257  $this->membersObject();
1258  }
1259 
1263  public function saveStatusParticipantObject(array $a_selected = null)
1264  {
1265  $ilCtrl = $this->ctrl;
1266 
1267  $member_id = (int) $_GET["part_id"];
1268  $data = array();
1269  foreach (array_keys($_POST["id"]) as $ass_id) {
1270  if (is_array($a_selected) &&
1271  !in_array($ass_id, $a_selected)) {
1272  continue;
1273  }
1274 
1275  $data[$ass_id][$member_id] = array(
1276  "status" => ilUtil::stripSlashes($_POST["status"][$ass_id])
1277  );
1278 
1279  if (array_key_exists("mark", $_POST)) {
1280  $data[$ass_id][$member_id]["mark"] = ilUtil::stripSlashes($_POST["mark"][$ass_id]);
1281  }
1282  if (array_key_exists("notice", $_POST)) {
1283  $data[$ass_id][$member_id]["notice"] = ilUtil::stripSlashes($_POST["notice"][$ass_id]);
1284  }
1285  }
1286 
1287  $ilCtrl->setParameter($this, "part_id", $member_id); // #17629
1288  $this->saveStatus($data);
1289  }
1290 
1291 
1292  public function saveStatusAllObject(array $a_selected = null, $a_redirect = true)
1293  {
1294  $user_ids = (array) array_keys((array) $_POST['id']);
1295  $filtered_user_ids = $GLOBALS['DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
1296  'edit_submissions_grades',
1297  'edit_submissions_grades',
1298  $this->exercise->getRefId(),
1299  $user_ids
1300  );
1301 
1302  $data = array();
1303  foreach ($filtered_user_ids as $user_id) {
1304  if (is_array($a_selected) &&
1305  !in_array($user_id, $a_selected)) {
1306  continue;
1307  }
1308 
1309  $data[-1][$user_id] = array(
1310  "status" => ilUtil::stripSlashes($_POST["status"][$user_id])
1311  );
1312 
1313  if (array_key_exists("mark", $_POST)) {
1314  $data[-1][$user_id]["mark"] = ilUtil::stripSlashes($_POST["mark"][$user_id]);
1315  }
1316  if (array_key_exists("notice", $_POST)) {
1317  $data[-1][$user_id]["notice"] = ilUtil::stripSlashes($_POST["notice"][$user_id]);
1318  }
1319  }
1320  $this->saveStatus($data, $a_redirect);
1321  }
1322 
1323  public function saveStatusSelectedObject()
1324  {
1325  $members = $this->getMultiActionUserIds();
1326 
1327  if ($this->assignment) {
1328  $this->saveStatusAllObject(array_keys($members));
1329  } else {
1330  $this->saveStatusParticipantObject(array_keys($members));
1331  }
1332  }
1333 
1337  protected function saveStatus(array $a_data, $a_redirect = true)
1338  {
1339  $ilCtrl = $this->ctrl;
1340 
1341  include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
1342 
1343  $saved_for = array();
1344  foreach ($a_data as $ass_id => $users) {
1345  $ass = ($ass_id < 0)
1346  ? $this->assignment
1347  : new ilExAssignment($ass_id);
1348  foreach ($users as $user_id => $values) {
1349  // this will add team members if available
1350  $submission = new ilExSubmission($ass, $user_id);
1351  foreach ($submission->getUserIds() as $sub_user_id) {
1352  $uname = ilObjUser::_lookupName($sub_user_id);
1353  $saved_for[$sub_user_id] = $uname["lastname"] . ", " . $uname["firstname"];
1354 
1355  $member_status = $ass->getMemberStatus($sub_user_id);
1356 
1357  // see bug #22566
1358  $status = $values["status"];
1359  if ($status == "") {
1360  $status = self::GRADE_NOT_GRADED;
1361  }
1362  $member_status->setStatus($status);
1363  if (array_key_exists("mark", $values)) {
1364  $member_status->setMark($values["mark"]);
1365  }
1366  if (array_key_exists("notice", $values)) {
1367  $member_status->setNotice($values["notice"]);
1368  }
1369  $member_status->update();
1370  }
1371  }
1372  }
1373 
1374  if (count($saved_for) > 0) {
1375  $save_for_str = "(" . implode($saved_for, " - ") . ")";
1376  }
1377 
1378  if ($a_redirect) {
1379  ilUtil::sendSuccess($this->lng->txt("exc_status_saved") . " " . $save_for_str, true);
1380  $ilCtrl->redirect($this, $this->getViewBack());
1381  }
1382  }
1383 
1388  {
1389  $res = array("result" => false);
1390 
1391  if ($this->ctrl->isAsynch()) {
1392  $ass_id = (int) $_POST["ass_id"];
1393  $user_id = (int) $_POST["mem_id"];
1394  $comment = trim($_POST["comm"]);
1395 
1396  if ($ass_id && $user_id) {
1397  $submission = new ilExSubmission($this->assignment, $user_id);
1398  $user_ids = $submission->getUserIds();
1399 
1400  $all_members = new ilExerciseMembers($this->exercise);
1401  $all_members = $all_members->getMembers();
1402 
1403  $reci_ids = array();
1404  foreach ($user_ids as $user_id) {
1405  if (in_array($user_id, $all_members)) {
1406  $member_status = $this->assignment->getMemberStatus($user_id);
1407  $member_status->setComment(ilUtil::stripSlashes($comment));
1408  $member_status->setFeedback(true);
1409  $member_status->update();
1410 
1411  if (trim($comment)) {
1412  $reci_ids[] = $user_id;
1413  }
1414  }
1415  }
1416 
1417  if (sizeof($reci_ids)) {
1418  // send notification
1419  $this->exercise->sendFeedbackFileNotification(
1420  null,
1421  $reci_ids,
1422  $ass_id,
1423  true
1424  );
1425  }
1426 
1427  $res = array("result" => true, "snippet" => nl2br($comment));
1428  }
1429  }
1430 
1431  echo(json_encode($res));
1432  exit();
1433  }
1434 
1438  public function exportExcelObject()
1439  {
1440  $this->exercise->exportGradesExcel();
1441  exit;
1442  }
1443 
1444 
1445  //
1446  // TEAM
1447  //
1448 
1449  public function createTeamsObject()
1450  {
1451  $ilCtrl = $this->ctrl;
1452 
1453  $members = $this->getMultiActionUserIds(true);
1454 
1455  $new_members = array();
1456 
1457  include_once "Modules/Exercise/classes/class.ilExAssignmentTeam.php";
1458  foreach ($members as $group) {
1459  if (is_array($group)) {
1460  $new_members = array_merge($new_members, $group);
1461 
1462  $first_user = $group;
1463  $first_user = array_shift($first_user);
1464  $team = ilExAssignmentTeam::getInstanceByUserId($this->assignment->getId(), $first_user);
1465  foreach ($group as $user_id) {
1466  $team->removeTeamMember($user_id);
1467  }
1468  } else {
1469  $new_members[] = $group;
1470  }
1471  }
1472 
1473  if (sizeof($new_members)) {
1474  // see ilExSubmissionTeamGUI::addTeamMemberActionObject()
1475 
1476  $first_user = array_shift($new_members);
1477  $team = ilExAssignmentTeam::getInstanceByUserId($this->assignment->getId(), $first_user, true);
1478  if (sizeof($new_members)) {
1479  foreach ($new_members as $user_id) {
1480  $team->addTeamMember($user_id);
1481  }
1482  }
1483 
1484  // re-evaluate complete team, as some members might have had submitted
1485  $submission = new ilExSubmission($this->assignment, $first_user);
1486  $this->exercise->processExerciseStatus(
1487  $this->assignment,
1488  $team->getMembers(),
1489  $submission->hasSubmitted(),
1490  $submission->validatePeerReviews()
1491  );
1492  }
1493 
1494  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1495  $ilCtrl->redirect($this, "members");
1496  }
1497 
1498  public function dissolveTeamsObject()
1499  {
1500  $ilCtrl = $this->ctrl;
1501 
1502  $members = $this->getMultiActionUserIds(true);
1503 
1504  include_once "Modules/Exercise/classes/class.ilExAssignmentTeam.php";
1505  foreach ($members as $group) {
1506  // if single member - nothing to do
1507  if (is_array($group)) {
1508  // see ilExSubmissionTeamGUI::removeTeamMemberObject()
1509 
1510  $first_user = $group;
1511  $first_user = array_shift($first_user);
1512  $team = ilExAssignmentTeam::getInstanceByUserId($this->assignment->getId(), $first_user);
1513  foreach ($group as $user_id) {
1514  $team->removeTeamMember($user_id);
1515  }
1516 
1517  // reset ex team members, as any submission is not valid without team
1518  $this->exercise->processExerciseStatus(
1519  $this->assignment,
1520  $group,
1521  false
1522  );
1523  }
1524  }
1525 
1526  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1527  $ilCtrl->redirect($this, "members");
1528  }
1529 
1530  public function adoptTeamsFromGroupObject(ilPropertyFormGUI $a_form = null)
1531  {
1532  $ilCtrl = $this->ctrl;
1533  $ilTabs = $this->tabs_gui;
1534  $lng = $this->lng;
1535  $tpl = $this->tpl;
1536 
1537  $ilTabs->clearTargets();
1538  $ilTabs->setBackTarget(
1539  $lng->txt("back"),
1540  $ilCtrl->getLinkTarget($this, $this->getViewBack())
1541  );
1542 
1543  if (!$a_form) {
1544  $a_form = $this->initGroupForm();
1545  }
1546  $tpl->setContent($a_form->getHTML());
1547  }
1548 
1549  protected function initGroupForm()
1550  {
1551  $lng = $this->lng;
1552 
1553  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1554  $form = new ilPropertyFormGUI();
1555  $form->setTitle($lng->txt("exc_adopt_group_teams") . " - " . $this->assignment->getTitle());
1556  $form->setFormAction($this->ctrl->getFormAction($this, "createTeamsFromGroups"));
1557 
1558  include_once "Modules/Exercise/classes/class.ilExAssignmentTeam.php";
1559  include_once "Services/User/classes/class.ilUserUtil.php";
1560  $all_members = array();
1561  foreach (ilExAssignmentTeam::getGroupMembersMap($this->exercise->getRefId()) as $grp_id => $group) {
1562  if (sizeof($group["members"])) {
1563  $grp_team = new ilCheckboxGroupInputGUI($lng->txt("obj_grp") . " \"" . $group["title"] . "\"", "grpt_" . $grp_id);
1564  $grp_value = $options = array();
1565  foreach ($group["members"] as $user_id) {
1566  $user_name = ilUserUtil::getNamePresentation($user_id, false, false, "", true);
1567  $options[$user_id] = $user_name;
1568  if (!in_array($user_id, $all_members)) {
1569  $grp_value[] = $user_id;
1570  $all_members[] = $user_id;
1571  }
1572  }
1573  asort($options);
1574  foreach ($options as $user_id => $user_name) {
1575  $grp_team->addOption(new ilCheckboxOption($user_name, $user_id));
1576  }
1577  $grp_team->setValue($grp_value);
1578  $form->addItem($grp_team);
1579  } else {
1580  $grp_team = new ilNonEditableValueGUI($group["title"]);
1581  $grp_team->setValue($lng->txt("exc_adopt_group_teams_no_members"));
1582  $form->addItem($grp_team);
1583  }
1584  }
1585 
1586  if (sizeof($all_members)) {
1587  $form->addCommandButton("createTeamsFromGroups", $lng->txt("save"));
1588  }
1589  $form->addCommandButton("members", $lng->txt("cancel"));
1590 
1591  return $form;
1592  }
1593 
1595  {
1596  $lng = $this->lng;
1597 
1598  $form = $this->initGroupForm();
1599  if ($form->checkInput()) {
1600  include_once "Services/User/classes/class.ilUserUtil.php";
1601  $map = ilExAssignmentTeam::getGroupMembersMap($this->exercise->getRefId());
1602  $all_members = $teams = array();
1603  $valid = true;
1604  foreach (array_keys($map) as $grp_id) {
1605  $postvar = "grpt_" . $grp_id;
1606  $members = $_POST[$postvar];
1607  if (is_array($members)) {
1608  $teams[] = $members;
1609  $invalid_team_members = array();
1610 
1611  foreach ($members as $user_id) {
1612  if (!array_key_exists($user_id, $all_members)) {
1613  $all_members[$user_id] = $grp_id;
1614  } else {
1615  // user is selected in multiple groups
1616  $invalid_team_members[] = $user_id;
1617  }
1618  }
1619 
1620  if (sizeof($invalid_team_members)) {
1621  $valid = false;
1622 
1623  $alert = array();
1624  foreach ($invalid_team_members as $user_id) {
1625  $user_name = ilUserUtil::getNamePresentation($user_id, false, false, "", true);
1626  $grp_title = $map[$all_members[$user_id]]["title"];
1627  $alert[] = sprintf($lng->txt("exc_adopt_group_teams_conflict"), $user_name, $grp_title);
1628  }
1629  $input = $form->getItemByPostVar($postvar);
1630  $input->setAlert(implode("<br/>", $alert));
1631  }
1632  }
1633  }
1634  if ($valid) {
1635  if (sizeof($teams)) {
1636  $existing_users = array_keys(ilExAssignmentTeam::getAssignmentTeamMap($this->assignment->getId()));
1637 
1638  // create teams from group selections
1639  $sum = array("added" => 0, "blocked" => 0);
1640  foreach ($teams as $members) {
1641  foreach ($members as $user_id) {
1642  if (!$this->exercise->members_obj->isAssigned($user_id)) {
1643  $this->exercise->members_obj->assignMember($user_id);
1644  }
1645 
1646  if (!in_array($user_id, $existing_users)) {
1647  $sum["added"]++;
1648  } else {
1649  $sum["blocked"]++;
1650  }
1651  }
1652 
1653  $first = array_shift($members);
1654  $team = ilExAssignmentTeam::getInstanceByUserId($this->assignment->getId(), $first, true);
1655 
1656  // getTeamId() does NOT send notification
1657  // $team->sendNotification($this->exercise->getRefId(), $first, "add");
1658 
1659  if (sizeof($members)) {
1660  foreach ($members as $user_id) {
1661  $team->addTeamMember($user_id);
1662  }
1663  }
1664  }
1665 
1666  $mess = array();
1667  if ($sum["added"]) {
1668  $mess[] = sprintf($lng->txt("exc_adopt_group_teams_added"), $sum["added"]);
1669  }
1670  if ($sum["blocked"]) {
1671  $mess[] = sprintf($lng->txt("exc_adopt_group_teams_blocked"), $sum["blocked"]);
1672  }
1673  if ($sum["added"]) {
1674  ilUtil::sendSuccess(implode(" ", $mess), true);
1675  } else {
1676  ilUtil::sendFailure(implode(" ", $mess), true);
1677  }
1678  }
1679  $this->ctrl->redirect($this, "members");
1680  } else {
1681  ilUtil::sendFailure($lng->txt("form_input_not_valid"));
1682  }
1683  }
1684 
1685  $form->setValuesByPost();
1687  }
1688 
1689 
1693 
1694  public function initMultiFeedbackForm($a_ass_id)
1695  {
1696  $lng = $this->lng;
1697 
1698  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1699  $form = new ilPropertyFormGUI();
1700  $form->addCommandButton("uploadMultiFeedback", $lng->txt("upload"));
1701  $form->addCommandButton("members", $lng->txt("cancel"));
1702 
1703  // multi feedback file
1704  $fi = new ilFileInputGUI($lng->txt("exc_multi_feedback_file"), "mfzip");
1705  $fi->setSuffixes(array("zip"));
1706  $fi->setRequired(true);
1707  $form->addItem($fi);
1708 
1709  $form->setTitle(ilExAssignment::lookupTitle($a_ass_id));
1710  $form->setFormAction($this->ctrl->getFormAction($this, "uploadMultiFeedback"));
1711 
1712  return $form;
1713  }
1714 
1721  public function showMultiFeedbackObject(ilPropertyFormGUI $a_form = null)
1722  {
1723  $ilToolbar = $this->toolbar;
1724  $lng = $this->lng;
1725  $tpl = $this->tpl;
1726 
1727  ilUtil::sendInfo($lng->txt("exc_multi_feedb_info"));
1728 
1729  $this->addSubTabs("assignment");
1730 
1731  // #13719
1732  include_once("./Services/UIComponent/Button/classes/class.ilLinkButton.php");
1733  $button = ilLinkButton::getInstance();
1734  $button->setCaption("exc_download_zip_structure");
1735  $button->setUrl($this->ctrl->getLinkTarget($this, "downloadMultiFeedbackZip"));
1736  $button->setOmitPreventDoubleSubmission(true);
1737  $ilToolbar->addButtonInstance($button);
1738 
1739  if (!$a_form) {
1740  $a_form = $this->initMultiFeedbackForm($this->assignment->getId());
1741  }
1742 
1743  $tpl->setContent($a_form->getHTML());
1744  }
1745 
1750  {
1751  $this->assignment->sendMultiFeedbackStructureFile($this->exercise);
1752  }
1753 
1757  public function uploadMultiFeedbackObject()
1758  {
1759  // #11983
1760  $form = $this->initMultiFeedbackForm($this->assignment->getId());
1761  if ($form->checkInput()) {
1762  try {
1763  $this->assignment->uploadMultiFeedbackFile(ilUtil::stripSlashesArray($_FILES["mfzip"]));
1764  $this->ctrl->redirect($this, "showMultiFeedbackConfirmationTable");
1765  } catch (ilExerciseException $e) {
1766  ilUtil::sendFailure($e->getMessage(), true);
1767  $this->ctrl->redirect($this, "showMultiFeedback");
1768  }
1769  }
1770 
1771  $form->setValuesByPost();
1773  }
1774 
1782  {
1783  $tpl = $this->tpl;
1784 
1785  $this->addSubTabs("assignment");
1786 
1787  include_once("./Modules/Exercise/classes/class.ilFeedbackConfirmationTable2GUI.php");
1788  $tab = new ilFeedbackConfirmationTable2GUI($this, "showMultiFeedbackConfirmationTable", $this->assignment);
1789  $tpl->setContent($tab->getHTML());
1790  }
1791 
1795  public function cancelMultiFeedbackObject()
1796  {
1797  $this->assignment->clearMultiFeedbackDirectory();
1798  $this->ctrl->redirect($this, "members");
1799  }
1800 
1804  public function saveMultiFeedbackObject()
1805  {
1806  $this->assignment->saveMultiFeedbackFiles($_POST["file"], $this->exercise);
1807 
1808  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1809  $this->ctrl->redirect($this, "members");
1810  }
1811 
1812 
1813  //
1814  // individual deadlines
1815  //
1816 
1817  protected function initIndividualDeadlineModal()
1818  {
1819  $lng = $this->lng;
1820  $tpl = $this->tpl;
1821 
1822  // prepare modal+
1823  include_once "./Services/UIComponent/Modal/classes/class.ilModalGUI.php";
1824  $modal = ilModalGUI::getInstance();
1825  $modal->setHeading($lng->txt("exc_individual_deadline"));
1826  $modal->setId("ilExcIDl");
1827  $modal->setBody('<div id="ilExcIDlBody"></div>');
1828  $modal = $modal->getHTML();
1829 
1830  $ajax_url = $this->ctrl->getLinkTarget($this, "handleIndividualDeadlineCalls", "", true, false);
1831 
1832  $tpl->addJavaScript("./Modules/Exercise/js/ilExcIDl.js", true, 3);
1833  $tpl->addOnloadCode('il.ExcIDl.init("' . $ajax_url . '");');
1834 
1835  include_once "Services/Calendar/classes/class.ilCalendarUtil.php";
1837 
1838  return $modal;
1839  }
1840 
1841  protected function parseIndividualDeadlineData(array $a_data)
1842  {
1843  if ($a_data) {
1844  $map = array();
1845  $ass_tmp = array();
1846  foreach ($a_data as $item) {
1847  $item = explode("_", $item);
1848  $ass_id = $item[0];
1849  $user_id = $item[1];
1850 
1851  if (!array_key_exists($ass_id, $ass_tmp)) {
1852  if ($this->assignment &&
1853  $ass_id == $this->assignment->getId()) {
1854  $ass_tmp[$ass_id] = $this->assignment;
1855  } else {
1856  $ass_tmp[$ass_id] = new ilExAssignment($ass_id);
1857  }
1858  }
1859 
1860  $map[$ass_id][] = $user_id;
1861  }
1862 
1863  return array($map, $ass_tmp);
1864  }
1865  }
1866 
1868  {
1869  $tpl = $this->tpl;
1870 
1871  $this->ctrl->saveParameter($this, "part_id");
1872 
1873  // we are done
1874  if ((bool) $_GET["dn"]) {
1875  ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
1876  $this->ctrl->redirect($this, $this->assignment
1877  ? "members"
1878  : "showParticipant");
1879  }
1880 
1881  include_once "Modules/Exercise/classes/class.ilExAssignment.php";
1882 
1883  // initial form call
1884  if ($_GET["idlid"]) {
1885  $tmp = $this->parseIndividualDeadlineData(explode(",", $_GET["idlid"]));
1886  if (is_array($tmp)) {
1887  $form = $this->initIndividualDeadlineForm($tmp[1], $tmp[0]);
1888  echo $form->getHTML() .
1889  $tpl->getOnLoadCodeForAsynch();
1890  }
1891  }
1892  // form "submit"
1893  else {
1894  $tmp = array();
1895  foreach (array_keys($_POST) as $id) {
1896  if (substr($id, 0, 3) == "dl_") {
1897  $tmp[] = substr($id, 3);
1898  }
1899  }
1900  $tmp = $this->parseIndividualDeadlineData($tmp);
1901  $ass_map = $tmp[1];
1902  $users = $tmp[0];
1903  unset($tmp);
1904 
1905  $form = $this->initIndividualDeadlineForm($ass_map, $users);
1906  $res = array();
1907  if ($valid = $form->checkInput()) {
1908  foreach ($users as $ass_id => $users) {
1909  $ass = $ass_map[$ass_id];
1910 
1911  // :TODO: should individual deadlines BEFORE extended be possible?
1912  $dl = new ilDateTime($ass->getDeadline(), IL_CAL_UNIX);
1913 
1914  foreach ($users as $user_id) {
1915  $date_field = $form->getItemByPostVar("dl_" . $ass_id . "_" . $user_id);
1916  if (ilDate::_before($date_field->getDate(), $dl)) {
1917  $date_field->setAlert(sprintf($this->lng->txt("exc_individual_deadline_before_global"), ilDatePresentation::formatDate($dl)));
1918  $valid = false;
1919  } else {
1920  $res[$ass_id][$user_id] = $date_field->getDate();
1921  }
1922  }
1923  }
1924  }
1925 
1926  if (!$valid) {
1927  $form->setValuesByPost();
1928  echo $form->getHTML() .
1929  $tpl->getOnLoadCodeForAsynch();
1930  } else {
1931  foreach ($res as $ass_id => $users) {
1932  $ass = $ass_map[$ass_id];
1933 
1934  foreach ($users as $id => $date) {
1935  $ass->setIndividualDeadline($id, $date);
1936  }
1937 
1938  $ass->recalculateLateSubmissions();
1939  }
1940 
1941  echo "ok";
1942  }
1943  }
1944 
1945  exit();
1946  }
1947 
1948  protected function initIndividualDeadlineForm(array $a_ass_map, array $ids)
1949  {
1950  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
1951  $form = new ilPropertyFormGUI();
1952  $form->setFormAction($this->ctrl->getFormAction($this));
1953  $form->setName("ilExcIDlForm");
1954 
1955  include_once "Services/User/classes/class.ilUserUtil.php";
1956  foreach ($ids as $ass_id => $users) {
1957  $ass = $a_ass_map[$ass_id];
1958 
1960  $section->setTitle($ass->getTitle());
1961  $form->addItem($section);
1962 
1963  include_once("./Modules/Exercise/classes/class.ilExAssignmentTeam.php");
1964  $teams = ilExAssignmentTeam::getInstancesFromMap($ass->getId());
1965 
1966  $values = $ass->getIndividualDeadlines();
1967 
1968  foreach ($users as $id) {
1969  // single user
1970  if (is_numeric($id)) {
1972  $name = $name["lastname"] . ", " . $name["firstname"];
1973  }
1974  // team
1975  else {
1976  $name = "";
1977  $team_id = (int) substr($id, 1);
1978  if (array_key_exists($team_id, $teams)) {
1979  $name = array();
1980  foreach ($teams[$team_id]->getMembers() as $member_id) {
1981  $uname = ilObjUser::_lookupName($member_id);
1982  $name[] = $uname["lastname"] . ", " . $uname["firstname"];
1983  }
1984  asort($name);
1985  $name = implode("<br />", $name);
1986  }
1987  }
1988 
1989  $dl = new ilDateTimeInputGUI($name, "dl_" . $ass_id . "_" . $id);
1990  $dl->setShowTime(true);
1991  $dl->setRequired(true);
1992  $form->addItem($dl);
1993 
1994  if (array_key_exists($id, $values)) {
1995  $dl->setDate(new ilDateTime($values[$id], IL_CAL_UNIX));
1996  }
1997  }
1998  }
1999 
2000  $form->addCommandButton("", $this->lng->txt("save"));
2001 
2002  return $form;
2003  }
2004 
2005  protected function setIndividualDeadlineObject()
2006  {
2007  // this will only get called if no selection
2008  ilUtil::sendFailure($this->lng->txt("select_one"));
2009 
2010  if ($this->assignment) {
2011  $this->membersObject();
2012  } else {
2013  $this->showParticipantObject();
2014  }
2015  }
2016 
2017  public function initFilter()
2018  {
2019  $this->lng->loadLanguageModule("search");
2020 
2021  $this->toolbar->setFormAction($this->ctrl->getFormAction($this, "listTextAssignment"));
2022 
2023  // Status
2024 
2025  if ($_POST["filter_status"]) {
2026  $this->filter["status"] = trim(ilUtil::stripSlashes($_POST["filter_status"]));
2027  }
2028 
2029  $si_status = new ilSelectInputGUI($this->lng->txt("exc_tbl_status"), "filter_status");
2030  $options = array(
2031  "" => $this->lng->txt("search_any"),
2032  self::GRADE_NOT_GRADED => $this->lng->txt("exc_notgraded"),
2033  self::GRADE_PASSED => $this->lng->txt("exc_passed"),
2034  self::GRADE_FAILED => $this->lng->txt("exc_failed")
2035  );
2036  $si_status->setOptions($options);
2037  $si_status->setValue($this->filter["status"]);
2038 
2039  $this->toolbar->addInputItem($si_status, true);
2040 
2041  // Submissions and Feedback
2042  #24713
2043  if ($this->assignment->getPeerReview()) {
2044  if ($_POST["filter_feedback"]) {
2045  $this->filter["feedback"] = trim(ilUtil::stripSlashes($_POST["filter_feedback"]));
2046  } else {
2047  $this->filter["feedback"] = "submission_feedback";
2048  }
2049 
2050  $si_feedback = new ilSelectInputGUI($this->lng->txt("feedback"), "filter_feedback");
2051  $options = array(
2052  "submission_feedback" => $this->lng->txt("submissions_feedback"),
2053  "submission_only" => $this->lng->txt("submissions_only")
2054  );
2055  $si_feedback->setOptions($options);
2056  $si_feedback->setValue($this->filter["feedback"]);
2057 
2058  $this->toolbar->addInputItem($si_feedback, true);
2059  }
2060 
2061  //todo: old school here.
2062  include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
2063  $submit = ilSubmitButton::getInstance();
2064  $submit->setCaption("filter");
2065  $submit->setCommand("listTextAssignment");
2066  $this->toolbar->addButtonInstance($submit);
2067  }
2068 }
addMembersObject($a_user_ids=array())
Add new partipant.
static _lookupLogin($a_user_id)
lookup login
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static _lookupName($a_user_id)
lookup user name
deassignMembersObject()
Deassign members from exercise.
showGradesOverviewObject()
Show grades overview.
static getAssignmentDataOfExercise($a_exc_id)
Get assignments data of an exercise in an array.
Exercise assignment.
const IL_CAL_DATETIME
This class represents an option in a checkbox group.
Class ilExerciseMembers.
static getAdoptableGroups($a_exc_ref_id)
static getGroupMembersMap($a_exc_ref_id)
This class represents a selection list property in a property form.
This class represents a property form user interface.
global $DIC
Definition: saml.php:7
static getAssignmentTeamMap($a_ass_id)
Get team structure for assignment.
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
$_GET["client_id"]
static getInstancesFromMap($a_assignment_id)
saveStatusParticipantObject(array $a_selected=null)
Save assignment status (participant view)
This class represents a section header in a property form.
This class represents a file property in a property form.
$valid
static _before(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
compare two dates and check start is before end This method does not consider tz offsets.
Exercise participant table.
saveStatusAllObject(array $a_selected=null, $a_redirect=true)
resetOffset($a_in_determination=false)
Reset offset.
if(!array_key_exists('StateId', $_REQUEST)) $id
static downloadAllAssignmentFiles(ilExAssignment $a_ass, array $members, $to_path)
Download all submitted files of an assignment (all user)
static _lookupId($a_user_str)
Lookup id by login.
showMultiFeedbackObject(ilPropertyFormGUI $a_form=null)
Show multi-feedback screen.
addUserFromAutoCompleteObject()
Add user as member.
Class ilExerciseMembersFilter.
const IL_CAL_UNIX
filterParticipantsByAccess()
Filter manageable members by position or rbac access.
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
static getAssignmentParticipants(int $a_exercise_id, int $a_ass_id)
user()
Definition: user.php:4
This class represents a date/time property in a property form.
static hasAnySubmissions($a_ass_id)
global $ilCtrl
Definition: ilias.php:18
selectParticipantObject()
Select participant.
setInfo($a_info)
Set Information Text.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$section
Definition: Utf8Test.php:83
setTableId($a_val)
Set table id.
This class represents a hidden form property in a property form.
__construct(ilObjExercise $a_exercise, ilExAssignment $a_ass=null)
Constructor.
Exercise peer review.
redirectFeedbackMailObject()
set feedback status for member and redirect to mail screen
Class ilObjExercise.
saveStatus(array $a_data, $a_redirect=true)
Save status of selecte members.
addSubTabs($a_activate)
adds tabs to tab gui object
foreach($_POST as $key=> $value) $res
if(isset($_POST['submit'])) $form
getId()
get object id public
Download submissions and feedback for exercises.
static getInstanceByUserId($a_assignment_id, $a_user_id, $a_create_on_demand=false)
$values
Class ilExPeerReviewGUI.
uploadMultiFeedbackObject()
Upload multi feedback file.
static getInstancesByExercise($a_exc_id)
special template class to simplify handling of ITX/PEAR
$text
Definition: errorreport.php:18
This class represents a text property in a property form.
Date and time handling
downloadMultiFeedbackZipObject()
Download multi-feedback structrue file.
This class represents a property in a property form.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
setOptions($a_options)
Set Options.
static getAssignmentFilesByUsers(int $a_exc_id, int $a_ass_id, array $a_users)
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
$comment
Definition: buildRTE.php:83
static _lookupType($a_id, $a_reference=false)
lookup object type
$users
Definition: authpage.php:44
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
const SIGNATURE_KEY
Session parameter for the hash.
static stripSlashesArray($a_arr, $a_strip_html=true, $a_allow="")
Strip slashes from array.
Class ilExerciseManagementGUI.
confirmDeassignMembersObject()
Confirm deassigning members.
exit
Definition: backend.php:16
static getInstance()
Get instance.
cancelMultiFeedbackObject()
Cancel Multi Feedback.
sendMembersObject()
Send assignment per mail to participants.
This class represents a non editable value in a property form.
membersObject()
All participants and submission of one assignment.
saveEvaluationFromModalObject()
Save assignment submission grade(status) and comment from the roundtrip modal.
static getRedirectTarget($gui, $cmd, array $gui_params=array(), array $mail_params=array(), array $context_params=array())
saveCommentForLearnersObject()
Save comment for learner (asynch)
This class represents a text area property in a property form.
adoptTeamsFromGroupObject(ilPropertyFormGUI $a_form=null)
showMultiFeedbackConfirmationTableObject()
Show multi feedback confirmation table.
Exercise submission //TODO: This class has to much static methods related to delivered "files"...
$url
static fillAutoCompleteToolbar($parent_object, ilToolbarGUI $toolbar=null, $a_options=array(), $a_sticky=false)
fill toolbar with
saveMultiFeedbackObject()
Save multi feedback.
File System Explorer GUI class.
setValue($a_value)
Set Value.
static redirect($a_script)
Exercise participant table.
$key
Definition: croninfo.php:18
setSuffixes($a_suffixes)
Set Accepted Suffixes.
$_POST["username"]
Object-based submissions (ends up as static file)
initIndividualDeadlineForm(array $a_ass_map, array $ids)
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
static lookupTitle($a_id)
Lookup title.
downloadAllObject()
Download all submitted files (of all members).
Confirmation screen class.
$data
Definition: bench.php:6
Exercise exceptions class.