5 require_once
"./Services/Object/classes/class.ilObjectGUI.php";
33 $this->
ilObjectGUI($a_data,$a_id,$a_call_by_reference,
false);
35 $lng->loadLanguageModule(
"exercise");
36 $lng->loadLanguageModule(
"exc");
37 $this->ctrl->saveParameter($this,
38 array(
"ass_id",
"part_id",
"fsmode"));
40 if (
$_GET[
"ass_id"] > 0)
42 include_once(
"./Modules/Exercise/classes/class.ilExAssignment.php");
49 return $this->files ? $this->files : array();
54 $this->files = $a_files;
61 $next_class = $this->ctrl->getNextClass($this);
62 $cmd = $this->ctrl->getCmd();
68 case "ilfilesystemgui":
69 if(
$_GET[
"fsmode"] ==
"peer")
71 $ilCtrl->saveParameter($this, array(
"fu"));
74 $parts = explode(
"__",
$_GET[
"fu"]);
75 $giver_id = $parts[0];
78 if($giver_id == $ilUser->getId() ||
79 $peer_id == $ilUser->getId())
107 $ilTabs->clearTargets();
108 $ilTabs->setBackTarget($lng->txt(
"back"),
109 $ilCtrl->getLinkTarget($this,
"editPeerReview"));
111 include_once(
"./Modules/Exercise/classes/class.ilFSStorageExercise.php");
115 include_once(
"./Services/FileSystem/classes/class.ilFileSystemGUI.php");
116 $fs_gui =
new ilFileSystemGUI($fstorage->getPeerReviewUploadPath($peer_id, $giver_id));
118 $fs_gui->setAllowDirectories(
false);
119 $fs_gui->setTitle($this->ass->getTitle().
": ".
120 $lng->txt(
"exc_peer_review").
" - ".
121 $lng->txt(
"exc_peer_review_give"));
122 $ret = $this->ctrl->forwardCommand($fs_gui);
124 else if (
$_GET[
"fsmode"] ==
"feedback" ||
125 $_GET[
"fsmode"] ==
"feedbackpart")
128 $ilCtrl->saveParameter($this, array(
"member_id"));
131 $ilTabs->clearTargets();
133 if (
$_GET[
"fsmode"] !=
"feedbackpart")
135 $ilTabs->setBackTarget($lng->txt(
"back"),
136 $ilCtrl->getLinkTarget($this,
"members"));
140 $ilTabs->setBackTarget($lng->txt(
"back"),
141 $ilCtrl->getLinkTarget($this,
"showParticipant"));
146 include_once(
"./Modules/Exercise/classes/class.ilFSStorageExercise.php");
150 include_once(
"./Services/User/classes/class.ilUserUtil.php");
151 $noti_rec_ids = array();
154 $team_id = $this->ass->getTeamId((
int)
$_GET[
"member_id"]);
155 $feedback_id =
"t".$team_id;
157 foreach($this->ass->getTeamMembers($team_id) as $team_user_id)
160 $noti_rec_ids[] = $team_user_id;
162 $fs_title = implode(
" / ", $fs_title);
166 $feedback_id = $noti_rec_ids = (int)
$_GET[
"member_id"];
170 include_once(
"./Services/FileSystem/classes/class.ilFileSystemGUI.php");
171 $fs_gui =
new ilFileSystemGUI($fstorage->getFeedbackPath($feedback_id));
173 $fs_gui->setAllowDirectories(
false);
174 $fs_gui->setTitle($lng->txt(
"exc_fb_files").
" - ".
177 $pcommand = $fs_gui->getLastPerformedCommand();
178 if (is_array($pcommand) && $pcommand[
"cmd"] ==
"create_file")
180 $this->
object->sendFeedbackFileNotification($pcommand[
"name"],
181 $noti_rec_ids, (
int) $_GET[
"ass_id"]);
183 $ret = $this->ctrl->forwardCommand($fs_gui);
188 $ilTabs->activateTab(
"ass_files");
189 include_once(
"./Modules/Exercise/classes/class.ilFSStorageExercise.php");
192 include_once(
"./Services/FileSystem/classes/class.ilFileSystemGUI.php");
194 $fs_gui->
setTitle($lng->txt(
"exc_instruction_files"));
195 $fs_gui->setTableId(
"excassfil".
$_GET[
"ass_id"]);
196 $fs_gui->setAllowDirectories(
false);
197 $ret = $this->ctrl->forwardCommand($fs_gui);
201 case "ilinfoscreengui":
202 $ilTabs->activateTab(
"info");
206 case 'ilpermissiongui':
207 $ilTabs->activateTab(
"permissions");
208 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
210 $ret =& $this->ctrl->forwardCommand($perm_gui);
213 case "illearningprogressgui":
214 $ilTabs->activateTab(
"learning_progress");
215 include_once
'./Services/Tracking/classes/class.ilLearningProgressGUI.php';
218 $this->object->getRefId(),
219 $_GET[
'user_id'] ?
$_GET[
'user_id'] : $ilUser->getId());
220 $this->ctrl->forwardCommand($new_gui);
221 $this->tabs_gui->setTabActive(
'learning_progress');
224 case 'ilrepositorysearchgui':
225 $ilTabs->activateTab(
"grades");
226 include_once(
'./Services/Search/classes/class.ilRepositorySearchGUI.php');
230 $rep_search->setTitle($this->lng->txt(
"exc_add_participant"));
231 $rep_search->setCallback($this,
'addMembersObject');
234 $this->tabs_gui->setTabActive(
'members');
235 $this->ctrl->setReturn($this,
'members');
237 #$this->__setSubTabs('members');
238 #$this->tabs_gui->setSubTabActive('members');
242 $this->ctrl->saveParameterByClass(
'ilRepositorySearchGUI',
'ctx', 1);
244 $rep_search->setTitle($this->lng->txt(
"exc_team_member_add"));
245 $rep_search->setCallback($this,
'addTeamMemberActionObject');
249 $this->ctrl->setReturn($this,
'submissionScreenTeam');
251 $ret =& $this->ctrl->forwardCommand($rep_search);
254 case 'ilobjectcopygui':
255 $ilCtrl->saveParameter($this,
'new_type');
256 $ilCtrl->setReturnByClass(get_class($this),
'create');
258 include_once
'./Services/Object/classes/class.ilObjectCopyGUI.php';
261 $this->ctrl->forwardCommand($cp);
265 $ilTabs->activateTab(
"export");
266 include_once(
"./Services/Export/classes/class.ilExportGUI.php");
268 $exp_gui->addFormat(
"xml");
269 $ret = $this->ctrl->forwardCommand($exp_gui);
272 case 'ilshoppurchasegui':
273 include_once
'./Services/Payment/classes/class.ilShopPurchaseGUI.php';
276 $this->ctrl->forwardCommand($sp);
279 case "ilcommonactiondispatchergui":
280 include_once(
"Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
282 $this->ctrl->forwardCommand($gui);
285 case "ilcertificategui":
287 $this->tabs_gui->activateTab(
"settings");
288 $this->tabs_gui->activateSubTab(
"certificate");
289 include_once
"./Services/Certificate/classes/class.ilCertificateGUI.php";
290 include_once
"./Modules/Exercise/classes/class.ilExerciseCertificateAdapter.php";
292 $this->ctrl->forwardCommand($output_gui);
296 $this->ass->updatePeerReviewTimestamp((
int)
$_REQUEST[
"peer_id"]);
298 include_once(
"./Services/Rating/classes/class.ilRatingGUI.php");
300 $rating_gui->setObject($this->ass->getId(),
"ass",
301 (int)$_REQUEST[
"peer_id"],
"peer");
302 $this->ctrl->forwardCommand($rating_gui);
303 $ilCtrl->redirect($this,
"editPeerReview");
307 $this->ctrl->setParameter($this,
"fsmode",
"");
349 $ilUser->getId(),
$_REQUEST[
"delivered"]);
355 $ilCtrl->redirect($this,
"submissionScreen");
368 $this->tabs_gui->clearTargets();
369 $this->tabs_gui->setBackTarget($this->lng->txt(
"back"),
370 $this->ctrl->getLinkTarget($this,
"submissionScreen"));
375 if (mktime() > $this->ass->getDeadline() && ($this->ass->getDeadline() != 0))
378 $ilCtrl->redirect($this,
"submissionScreen");
381 if (!is_array(
$_POST[
"delivered"]) || count(
$_POST[
"delivered"]) == 0)
384 $ilCtrl->redirect($this,
"submissionScreen");
388 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
390 $cgui->setFormAction($ilCtrl->getFormAction($this));
391 $cgui->setHeaderText($lng->txt(
"info_delete_sure"));
392 $cgui->setCancel($lng->txt(
"cancel"),
"submissionScreen");
393 $cgui->setConfirm($lng->txt(
"delete"),
"deleteDelivered");
398 foreach (
$_POST[
"delivered"] as $i)
402 foreach ($files as $f)
404 if ($f[
"returned_id"] == $i)
406 $title = $f[
"filetitle"];
409 $cgui->addItem(
"delivered[]", $i, $title);
412 $tpl->setContent($cgui->getHTML());
428 if (mktime() > $this->ass->getDeadline() && ($this->ass->getDeadline() != 0))
431 $ilCtrl->redirect($this,
"submissionScreen");
434 if (count(
$_POST[
"delivered"]) && (mktime() < $this->ass->getDeadline() ||
435 $this->ass->getDeadline() == 0))
437 $this->
object->deleteDeliveredFiles($this->object->getId(), (int)
$_GET[
"ass_id"],
438 $_POST[
"delivered"], $ilUser->id);
440 $this->
object->handleSubmission((
int)
$_GET[
'ass_id']);
448 $ilCtrl->redirect($this,
"submissionScreen");
461 $this->tabs_gui->activateTab(
"submissions");
466 if (mktime() > $this->ass->getDeadline() && ($this->ass->getDeadline() != 0))
472 $ilToolbar->addButton($this->lng->txt(
"file_add"),
473 $this->ctrl->getLinkTarget($this,
"uploadForm"));
475 $ilToolbar->addButton($this->lng->txt(
"header_zip"),
476 $this->ctrl->getLinkTarget($this,
"uploadZipForm"));
479 include_once(
"./Modules/Exercise/classes/class.ilExcDeliveredFilesTableGUI.php");
481 $this->tpl->setContent(
$tab->getHTML());
489 if (mktime() < $this->ass->getDeadline() || ($this->ass->getDeadline() == 0))
491 $this->tabs_gui->clearTargets();
492 $this->tabs_gui->setBackTarget($this->lng->txt(
"back"),
493 $this->ctrl->getLinkTarget($this,
"submissionScreen"));
496 $ilHelp->setScreenIdComponent(
"exc");
497 $ilHelp->setScreenId(
"upload_submission");
500 $this->tpl->setContent($this->form->getHTML());
504 $this->ctrl->redirect($this,
"submissionScreen");
513 if (mktime() < $this->ass->getDeadline() || ($this->ass->getDeadline() == 0))
515 $this->tabs_gui->clearTargets();
516 $this->tabs_gui->setBackTarget($this->lng->txt(
"back"),
517 $this->ctrl->getLinkTarget($this,
"submissionScreen"));
520 $this->tpl->setContent($this->form->getHTML());
524 $this->ctrl->redirect($this,
"submissionScreen");
535 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
539 include_once(
"./Services/Form/classes/class.ilFileWizardInputGUI.php");
543 $this->form->addItem($fi);
545 $this->form->addCommandButton(
"deliverFile", $lng->txt(
"upload"));
546 $this->form->addCommandButton(
"submissionScreen", $lng->txt(
"cancel"));
548 $this->form->setTitle($lng->txt(
"file_add"));
549 $this->form->setFormAction($ilCtrl->getFormAction($this));
559 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
563 include_once(
"./Services/Form/classes/class.ilFileInputGUI.php");
566 $this->form->addItem($fi);
568 $this->form->addCommandButton(
"deliverUnzip", $lng->txt(
"upload"));
569 $this->form->addCommandButton(
"submissionScreen", $lng->txt(
"cancel"));
571 $this->form->setTitle($lng->txt(
"header_zip"));
572 $this->form->setFormAction($ilCtrl->getFormAction($this));
585 if (mktime() > $this->ass->getDeadline() && ($this->ass->getDeadline() != 0))
592 foreach ($_FILES[
"deliver"][
"name"] as $k => $v)
595 "name" => $_FILES[
"deliver"][
"name"][$k],
596 "type" => $_FILES[
"deliver"][
"type"][$k],
597 "tmp_name" => $_FILES[
"deliver"][
"tmp_name"][$k],
598 "error" => $_FILES[
"deliver"][
"error"][$k],
599 "size" => $_FILES[
"deliver"][
"size"][$k],
601 if(!$this->object->deliverFile(
$file, (
int)
$_GET[
"ass_id"], $ilUser->id))
616 $this->
object->handleSubmission((
int)$_GET[
'ass_id']);
618 $ilCtrl->redirect($this,
"submissionScreen");
631 if (mktime() > $this->ass->getDeadline() && ($this->ass->getDeadline() != 0))
637 if (preg_match(
"/zip/",$_FILES[
"deliver"][
"type"]) == 1)
639 if($this->object->processUploadedFile($_FILES[
"deliver"][
"tmp_name"],
"deliverFile",
false,
640 (
int)
$_GET[
"ass_id"]))
643 $this->
object->handleSubmission((
int)$_GET[
'ass_id']);
647 $ilCtrl->redirect($this,
"submissionScreen");
665 $this->ctrl->redirect($this,
"view");
672 $feedback_id =
"t".$ass->getTeamId($ilUser->getId());
676 $feedback_id = $ilUser->getId();
680 include_once(
"./Modules/Exercise/classes/class.ilFSStorageExercise.php");
682 $files = $storage->getFeedbackFiles($feedback_id);
684 foreach($files as $fb_file)
686 if($fb_file ==
$file)
694 echo
"FILE DOES NOT EXIST";
699 $not_started_yet =
false;
700 if ($ass->getStartTime() > 0 && time() - $ass->getStartTime() <= 0)
702 $not_started_yet =
true;
706 if (!$not_started_yet)
708 $p = $storage->getFeedbackFilePath($feedback_id,
$file);
730 $this->ctrl->redirect($this,
"view");
734 include_once(
"./Modules/Exercise/classes/class.ilExAssignment.php");
737 foreach($files as $lfile)
739 if($lfile[
"name"] ==
$file)
747 echo
"FILE DOES NOT EXIST";
753 $not_started_yet =
false;
754 if ($ass->getStartTime() > 0 && time() - $ass->getStartTime() <= 0)
756 $not_started_yet =
true;
760 if (!$not_started_yet)
762 include_once(
"./Modules/Exercise/classes/class.ilFSStorageExercise.php");
764 $p = $storage->getAssignmentFilePath(
$file);
773 $a_new_object->saveData();
776 ilUtil::redirect(
"ilias.php?baseClass=ilExerciseHandlerGUI&ref_id=".$a_new_object->
getRefId().
"&cmd=addAssignment");
784 $a_form->
setTitle($this->lng->txt(
"exc_edit_exercise"));
787 $section->setTitle($this->lng->txt(
'exc_passing_exc'));
793 $op1 =
new ilRadioOption($this->lng->txt(
"exc_pass_all"),
"all",
794 $this->lng->txt(
"exc_pass_all_info"));
795 $radg->addOption($op1);
796 $op2 =
new ilRadioOption($this->lng->txt(
"exc_pass_minimum_nr"),
"nr",
797 $this->lng->txt(
"exc_pass_minimum_nr_info"));
798 $radg->addOption($op2);
803 $ni->setMaxLength(4);
804 $ni->setRequired(
true);
805 include_once(
"./Modules/Exercise/classes/class.ilExAssignment.php");
807 $min = max($mand, 1);
808 $ni->setMinValue($min,
true);
809 $ni->setInfo($this->lng->txt(
"exc_min_nr_info"));
810 $op2->addSubItem($ni);
815 $subcompl =
new ilRadioGroupInputGUI($this->lng->txt(
"exc_passed_status_determination"),
"completion_by_submission");
816 $op1 =
new ilRadioOption($this->lng->txt(
"exc_completion_by_tutor"), 0,
"");
817 $subcompl->addOption($op1);
818 $op2 =
new ilRadioOption($this->lng->txt(
"exc_completion_by_submission"), 1,$this->lng->txt(
"exc_completion_by_submission_info"));
819 $subcompl->addOption($op2);
828 $section->setTitle($this->lng->txt(
'exc_publishing'));
832 $cb =
new ilCheckboxInputGUI($this->lng->txt(
"exc_show_submissions"),
"show_submissions");
833 $cb->
setInfo($this->lng->txt(
"exc_show_submissions_info"));
837 $section->setTitle($this->lng->txt(
'exc_notification'));
841 $cbox =
new ilCheckboxInputGUI($this->lng->txt(
"exc_submission_notification"),
"notification");
842 $cbox->
setInfo($this->lng->txt(
"exc_submission_notification_info"));
853 $a_values[
"desc"] = $this->
object->getLongDescription();
854 $a_values[
"show_submissions"] = $this->
object->getShowSubmissions();
855 $a_values[
"pass_mode"] = $this->
object->getPassMode();
856 if ($a_values[
"pass_mode"] ==
"nr")
858 $a_values[
"pass_nr"] = $this->
object->getPassNr();
861 include_once
"./Services/Notification/classes/class.ilNotification.php";
864 $this->
object->getId());
866 $a_values[
'completion_by_submission'] = (int) $this->object->isCompletionBySubmissionEnabled();
872 $this->
object->setShowSubmissions($a_form->
getInput(
"show_submissions"));
873 $this->
object->setPassMode($a_form->
getInput(
"pass_mode"));
874 if ($this->object->getPassMode() ==
"nr")
876 $this->
object->setPassNr($a_form->
getInput(
"pass_nr"));
879 $this->
object->setCompletionBySubmission($a_form->
getInput(
'completion_by_submission') == 1 ?
true :
false);
881 include_once
"./Services/Notification/classes/class.ilNotification.php";
883 $ilUser->getId(), $this->
object->getId(),
884 (bool)$a_form->
getInput(
"notification"));
889 $this->ctrl->redirect($this,
"view");
898 if(!$this->object->addUploadedFile($_FILES[
"zipfile"],
true))
902 $this->ctrl->redirect($this,
"edit");
912 if(!$this->object->addUploadedFile($_FILES[
"file"]))
916 $this->ctrl->redirect($this,
"edit");
929 if (
$_POST[
"downloadReturned"])
931 $this->
object->members_obj->deliverReturnedFiles(key(
$_POST[
"downloadReturned"]));
946 case "redirectFeedbackMail":
950 case "delete_member":
964 $peer_review_mask_filename =
false;
966 if (!$ilAccess->checkAccess(
"write",
"", $this->object->getRefId()))
968 if ($ilAccess->checkAccess(
"read",
"", $this->object->getRefId()) &&
969 $this->object->getShowSubmissions() &&
970 $this->
object->getTimestamp() - time() <= 0)
978 if(!($ilAccess->checkAccess(
"read",
"", $this->object->getRefId()) &&
979 $ass->hasPeerReviewAccess((
int) $_GET[
"member_id"])))
985 $peer_review_mask_filename =
true;
991 $this->object->getId(), (int)
$_GET[
"ass_id"], (
int)
$_GET[
"member_id"],
992 false, $peer_review_mask_filename))
994 $this->ctrl->redirect($this,
"members");
1006 $peer_review_mask_filename =
false;
1008 if (!$ilAccess->checkAccess(
"write",
"", $this->object->getRefId()))
1012 if(!($ilAccess->checkAccess(
"read",
"", $this->object->getRefId()) &&
1013 $ass->hasPeerReviewAccess((
int) $_GET[
"member_id"])))
1019 $peer_review_mask_filename =
true;
1024 $this->object->getId(), (int)
$_GET[
"ass_id"], (
int)
$_GET[
"member_id"],
1025 true, $peer_review_mask_filename))
1027 $this->ctrl->redirect($this,
"members");
1037 if(!strlen(trim(
$_POST[
'user_login'])))
1043 $users = explode(
',',
$_POST[
'user_login']);
1045 $user_ids = array();
1046 foreach($users as $user)
1065 $user_ids[] = $user_id;
1089 if(!count($a_user_ids))
1095 if(!$this->object->members_obj->assignMembers($a_user_ids))
1120 $this->ctrl->redirect($this,
"members");
1132 $ilTabs->activateTab(
"grades");
1134 include_once
'Services/Tracking/classes/class.ilLPMarks.php';
1140 include_once(
"./Modules/Exercise/classes/class.ilExAssignment.php");
1143 if (
$_GET[
"ass_id"] ==
"")
1146 $_GET[
"ass_id"] = $a[
"id"];
1150 if (count($ass) > 1)
1153 foreach ($ass as $a)
1157 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
1161 $ilToolbar->addInputItem(
$si);
1163 $ilToolbar->addFormButton($this->lng->txt(
"exc_select_ass"),
1164 "selectAssignment");
1165 $ilToolbar->addSeparator();
1169 include_once
'./Services/Search/classes/class.ilRepositorySearchGUI.php';
1174 'auto_complete_name' => $lng->txt(
'user'),
1175 'submit_name' => $lng->txt(
'add'),
1176 'add_search' =>
true,
1177 'add_from_container' =>
$_GET[
"ref_id"]
1182 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
1184 $ilToolbar->addSeparator();
1187 $ilToolbar->addButton($this->lng->txt(
"exc_multi_feedback"),
1188 $this->ctrl->getLinkTarget($this,
"showMultiFeedback"));
1190 if (count($ass) > 0)
1193 foreach($ass as $item)
1195 if($item[
"id"] ==
$_GET[
"ass_id"])
1197 $ctype = $item[
"type"];
1202 $ilToolbar->addSeparator();
1203 $ilToolbar->addFormButton($lng->txt(
"exc_list_text_assignment"),
"listTextAssignment");
1207 $ilToolbar->addSeparator();
1208 $ilToolbar->addFormButton($lng->txt(
"download_all_returned_files"),
"downloadAll");
1211 include_once(
"./Modules/Exercise/classes/class.ilExerciseMemberTableGUI.php");
1213 $tpl->setContent($exc_tab->getHTML());
1229 $ilTabs->activateTab(
"grades");
1244 $ilTabs->activateTab(
"grades");
1248 include_once(
"./Modules/Exercise/classes/class.ilExAssignment.php");
1250 $members = $this->
object->members_obj->getMembers();
1252 if (count($members) == 0)
1259 foreach ($members as $mem_id)
1263 include_once(
"./Services/User/classes/class.ilObjUser.php");
1265 $mems[$mem_id] = $name;
1271 if (
$_GET[
"part_id"] ==
"" && count($mems) > 0)
1273 $_GET[
"part_id"] = key($mems);
1277 if (count($mems) > 1)
1280 foreach ($mems as $k => $m)
1283 $m[
"lastname"].
", ".$m[
"firstname"].
" [".$m[
"login"].
"]";
1285 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
1289 $ilToolbar->addInputItem(
$si);
1291 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
1292 $ilToolbar->addFormButton($this->lng->txt(
"exc_select_part"),
1293 "selectParticipant");
1296 if (count($mems) > 0)
1298 include_once(
"./Modules/Exercise/classes/class.ilExParticipantTableGUI.php");
1300 $this->
object,
$_GET[
"part_id"]);
1301 $tpl->setContent($part_tab->getHTML());
1316 $ilTabs->activateTab(
"grades");
1331 $ilTabs->activateTab(
"grades");
1334 include_once(
"./Modules/Exercise/classes/class.ilExAssignment.php");
1336 $mems = $mem_obj->getMembers();
1338 if (count($mems) > 0)
1340 $ilToolbar->addButton($lng->txt(
"exc_export_excel"),
1341 $ilCtrl->getLinkTarget($this,
"exportExcel"));
1344 include_once(
"./Modules/Exercise/classes/class.ilExGradesTableGUI.php");
1346 $this->
object, $mem_obj);
1347 $tpl->setContent($grades_tab->getHTML());
1359 if (
$_GET[
"member_id"] !=
"")
1367 $members = array(
$_GET[
"member_id"]);
1370 else if(count(
$_POST[
"member"]) > 0)
1374 foreach(array_keys(
$_POST[
"member"]) as $user_id)
1378 $members = array_unique($members);
1382 $members = array_keys(
$_POST[
"member"]);
1389 foreach($members as $user_id)
1394 $logins = implode($logins,
",");
1396 require_once
'Services/Mail/classes/class.ilMailFormCall.php';
1401 $this->ctrl->redirect($this,
"members");
1413 foreach($this->object->members_obj->getMembers() as $member_id)
1417 (int)
$_GET[
"ass_id"], $member_id);
1423 $members[$member_id] = $tmp_obj->getFirstname() .
" " . $tmp_obj->getLastname();
1429 (int)
$_GET[
"ass_id"], $members);
1442 include_once
"./Modules/Group/classes/class.ilObjGroup.php";
1444 $all_members = array();
1445 foreach($a_result as $group)
1449 $members = $tmp_grp_obj->getGroupMemberIds();
1450 $all_members = array_merge($all_members,$members);
1453 $all_members = array_unique($all_members);
1454 foreach($all_members as $member)
1456 $result[] = array(
"id" => $member);
1465 include_once
"./Services/Object/classes/class.ilObjectFactory.php";
1467 foreach($a_result as $obj)
1470 $this->tpl->setCurrentBlock(
"OBJ_SELECT_ROW");
1471 $this->tpl->setVariable(
"OBJ_ROW_TITLE",$tmp_obj->getTitle());
1472 $this->tpl->setVariable(
"OBJ_ROW_ID",$tmp_obj->getRefId());
1473 $this->tpl->setVariable(
"OBJ_ROW_DESCRIPTION",$tmp_obj->getDescription());
1474 $this->tpl->parseCurrentBlock();
1478 $this->tpl->setCurrentBlock(
"OBJ_SELECT");
1479 $this->tpl->setVariable(
"OBJ_SELECT_TITLE",$this->lng->txt(
"title"));
1480 $this->tpl->setVariable(
"OBJ_SELECT_DESCRIPTION",$this->lng->txt(
"description"));
1482 $this->tpl->setVariable(
"OBJ_BTN1_VALUE",$this->lng->txt(
"select"));
1483 $this->tpl->setVariable(
"OBJ_BTN2_VALUE",$this->lng->txt(
"cancel"));
1484 $this->tpl->parseCurrentBlock();
1496 if(!count(
$_POST[
"member"]))
1506 foreach(array_keys(
$_POST[
"member"]) as $user_id)
1509 foreach($tmembers as $tuser_id)
1511 $members[$tuser_id] = 1;
1517 $members =
$_POST[
"member"];
1520 $this->
object->sendAssignment($this->object->getId(),
1521 (int)
$_GET[
"ass_id"], $members);
1525 $ilCtrl->redirect($this,
"members");
1536 $ilTabs->activateTab(
"grades");
1538 if (!is_array(
$_POST[
"member"]) || count(
$_POST[
"member"]) == 0)
1541 $ilCtrl->redirect($this,
"members");
1545 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
1547 $cgui->setFormAction($ilCtrl->getFormAction($this));
1548 $cgui->setHeaderText($lng->txt(
"exc_msg_sure_to_deassign_participant"));
1549 $cgui->setCancel($lng->txt(
"cancel"),
"members");
1550 $cgui->setConfirm($lng->txt(
"remove"),
"deassignMembers");
1556 foreach(array_keys(
$_POST[
"member"]) as $user_id)
1559 foreach($tmembers as $tuser_id)
1561 $members[$tuser_id] = 1;
1567 $members =
$_POST[
"member"];
1570 include_once(
"./Services/User/classes/class.ilUserUtil.php");
1571 foreach ($members as $k => $m)
1573 $cgui->addItem(
"member[$k]", $m,
1577 $tpl->setContent($cgui->getHTML());
1590 if(is_array(
$_POST[
"member"]))
1592 foreach(array_keys(
$_POST[
"member"]) as $usr_id)
1594 $this->
object->members_obj->deassignMember((
int) $usr_id);
1597 $ilCtrl->redirect($this,
"members");
1602 $ilCtrl->redirect($this,
"members");
1610 if(!isset(
$_POST[
'comments_value']))
1615 $this->
object->members_obj->setNoticeForMember(
$_GET[
"member_id"],
1644 include_once(
"./Modules/Exercise/classes/class.ilExAssignment.php");
1648 $saved_for = array();
1650 foreach(
$_POST[
"id"] as $key => $value)
1654 if (!$a_force_all &&
$_POST[
"member"][$key] !=
"1")
1661 $saved_for[] = $uname[
"lastname"].
", ".$uname[
"firstname"];
1666 $ass_id = (int)
$_GET[
"ass_id"];
1667 $user_id = (int) $key;
1671 $ass_id = (int) $key;
1672 $user_id = (int)
$_GET[
"part_id"];
1678 $team_id = $this->ass->getTeamId($user_id);
1679 $user_ids = $this->ass->getTeamMembers($team_id);
1681 if (count(
$_POST[
"member"]) > 0)
1683 foreach($user_ids as $user_id)
1685 if($user_id != $key)
1688 $saved_for[] = $uname[
"lastname"].
", ".$uname[
"firstname"];
1695 $user_ids = array($user_id);
1698 foreach($user_ids as $user_id)
1721 if (count($saved_for) > 0)
1723 $save_for_str =
"(".implode($saved_for,
" - ").
")";
1725 if($save_for_str || $a_part_view)
1731 $ilCtrl->redirect($this,
"members");
1735 $ilCtrl->redirect($this,
"showParticipant");
1744 for($i=0; $i<24; $i++)
1746 $hours[$i] = $i < 10 ?
"0".$i : $i;
1751 for($i=0;$i<60;$i++)
1753 $minutes[$i] = $i < 10 ?
"0".$i : $i;
1758 for($i=1; $i<32; $i++)
1760 $days[$i] = $i < 10 ?
"0".$i : $i;
1765 for($i=1; $i<13; $i++)
1767 $month[$i] = $i < 10 ?
"0".$i : $i;
1772 for($i = date(
"Y",time());$i < date(
"Y",time()) + 3;++$i)
1782 foreach($a_result as $user)
1784 if(!$this->object->members_obj->isAssigned($user[
"id"]))
1786 $filtered[] = $user;
1790 return $filtered ? $filtered : array();
1802 $ilTabs->addSubTab(
"assignment", $lng->txt(
"exc_assignment_view"),
1803 $ilCtrl->getLinkTarget($this,
"members"));
1804 $ilTabs->addSubTab(
"participant", $lng->txt(
"exc_participant_view"),
1805 $ilCtrl->getLinkTarget($this,
"showParticipant"));
1806 $ilTabs->addSubTab(
"grades", $lng->txt(
"exc_grades_overview"),
1807 $ilCtrl->getLinkTarget($this,
"showGradesOverview"));
1808 $ilTabs->activateSubTab($a_activate);
1820 $ilTabs->addSubTab(
"content", $lng->txt(
"view"),
1821 $ilCtrl->getLinkTarget($this,
"showOverview"));
1822 if ($ilAccess->checkAccess(
"write",
"", $this->ref_id))
1824 $ilTabs->addSubTab(
"list_assignments", $lng->txt(
"edit"),
1825 $ilCtrl->getLinkTarget($this,
"listAssignments"));
1827 $ilTabs->activateSubTab($a_activate);
1840 $ilHelp->setScreenIdComponent(
"exc");
1842 if ($ilAccess->checkAccess(
"read",
"", $this->object->getRefId()))
1844 $tabs_gui->addTab(
"content",
1845 $lng->txt(
"exc_assignments"),
1846 $this->ctrl->getLinkTarget($this,
"showOverview"));
1849 $next_class = strtolower($this->ctrl->getNextClass());
1850 if ($ilAccess->checkAccess(
"visible",
"", $this->object->getRefId()))
1852 $tabs_gui->addTab(
"info",
1853 $lng->txt(
"info_short"),
1854 $this->ctrl->getLinkTargetByClass(
"ilinfoscreengui",
"showSummary"));
1858 if ($ilAccess->checkAccess(
"write",
"", $this->ref_id))
1864 $tabs_gui->addTab(
"settings",
1865 $lng->txt(
"settings"),
1866 $this->ctrl->getLinkTarget($this,
'edit'));
1868 $tabs_gui->addTab(
"grades",
1869 $lng->txt(
"exc_submissions_and_grades"),
1870 $this->ctrl->getLinkTarget($this,
'members'));
1874 $save_sort_order =
$_GET[
"sort_order"];
1875 $save_sort_by =
$_GET[
"sort_by"];
1876 $save_offset =
$_GET[
"offset"];
1879 include_once
'./Services/Tracking/classes/class.ilLearningProgressAccess.php';
1882 $tabs_gui->addTab(
'learning_progress',
1883 $lng->txt(
'learning_progress'),
1884 $this->ctrl->getLinkTargetByClass(array(
'ilobjexercisegui',
'illearningprogressgui'),
''));
1887 $_GET[
"sort_order"] = $save_sort_order;
1888 $_GET[
"sort_by"] = $save_sort_by;
1889 $_GET[
"offset"] = $save_offset;
1892 if ($ilAccess->checkAccess(
"write",
"", $this->object->getRefId()))
1894 $tabs_gui->addTab(
"export",
1895 $lng->txt(
"export"),
1896 $this->ctrl->getLinkTargetByClass(
"ilexportgui",
""));
1901 if ($ilAccess->checkAccess(
"edit_permission",
"", $this->ref_id))
1903 $tabs_gui->addTab(
'permissions',
1904 $lng->txt(
"perm_settings"),
1905 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"));
1916 $this->ctrl->setCmd(
"showSummary");
1917 $this->ctrl->setCmdClass(
"ilinfoscreengui");
1928 $ilTabs->activateTab(
"info");
1932 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
1935 $info->enablePrivateNotes();
1937 $info->enableNews();
1938 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"]))
1940 $info->enableNewsEditing();
1941 $info->setBlockProperty(
"news",
"settings",
true);
1948 $info->addSection($this->lng->txt(
"exc_overview"));
1949 include_once(
"./Modules/Exercise/classes/class.ilExAssignment.php");
1953 foreach ($ass as $a)
1956 if ($a[
"mandatory"])
1961 $info->addProperty($lng->txt(
"exc_assignments"), $cnt);
1962 $info->addProperty($lng->txt(
"exc_mandatory"), $mcnt);
1963 if ($this->object->getPassMode() !=
"nr")
1965 $info->addProperty($lng->txt(
"exc_pass_mode"),
1966 $lng->txt(
"exc_msg_all_mandatory_ass"));
1970 $info->addProperty($lng->txt(
"exc_pass_mode"),
1971 sprintf($lng->txt(
"exc_msg_min_number_ass"), $this->
object->getPassNr()));
1975 include_once(
"Services/Tracking/classes/class.ilLPMarks.php");
1976 if ($ilAccess->checkAccess(
"read",
"", $this->ref_id))
1981 $st = $this->
object->determinStatusOfUser($ilUser->getId());
1982 $status = $st[
"overall_status"];
1983 if ($lpcomment !=
"" || $mark !=
"" || $status !=
"notgraded")
1985 $info->addSection($this->lng->txt(
"exc_feedback_from_tutor"));
1986 if ($lpcomment !=
"")
1988 $info->addProperty($this->lng->txt(
"exc_comment"),
1993 $info->addProperty($this->lng->txt(
"exc_mark"),
2003 if ($status !=
"notgraded")
2005 $img =
'<img src="'.ilUtil::getImagePath(
"scorm/".$status.
".svg").
'" '.
2006 ' alt="'.$lng->txt(
"exc_".$status).
'" title="'.$lng->txt(
"exc_".$status).
2010 if ($st[
"failed_a_mandatory"])
2012 $add =
" (".$lng->txt(
"exc_msg_failed_mandatory").
")";
2014 else if ($status ==
"failed")
2016 $add =
" (".$lng->txt(
"exc_msg_missed_minimum_number").
")";
2018 $info->addProperty($this->lng->txt(
"status"),
2019 $img.
" ".$this->lng->txt(
"exc_".$status).$add);
2025 $this->ctrl->forwardCommand($info);
2031 $this->tabs_gui->activateSubTab(
"edit");
2037 $this->tabs_gui->addSubTab(
"edit",
2038 $this->lng->txt(
"general_settings"),
2039 $this->ctrl->getLinkTarget($this,
"edit"));
2041 include_once
"Services/Certificate/classes/class.ilCertificate.php";
2044 $this->tabs_gui->addSubTab(
"certificate",
2045 $this->lng->txt(
"certificate"),
2046 $this->ctrl->getLinkTarget($this,
"certificate"));
2055 public static function _goto($a_target, $a_raw)
2060 $parts = explode(
"_", $a_raw);
2061 if(
sizeof($parts) == 2)
2063 $ass_id = (int)$parts[1];
2066 if ($ilAccess->checkAccess(
"read",
"", $a_target))
2070 $_GET[
"ass_id_goto"] = $ass_id;
2072 $_GET[
"ref_id"] = $a_target;
2073 $_GET[
"cmd"] =
"showOverview";
2074 $_GET[
"baseClass"] =
"ilExerciseHandlerGUI";
2075 include(
"ilias.php");
2078 else if ($ilAccess->checkAccess(
"visible",
"", $a_target))
2080 $_GET[
"ref_id"] = $a_target;
2081 $_GET[
"cmd"] =
"infoScreen";
2082 $_GET[
"baseClass"] =
"ilExerciseHandlerGUI";
2083 include(
"ilias.php");
2086 else if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID))
2093 $ilErr->raiseError($lng->txt(
"msg_no_perm_read"), $ilErr->FATAL);
2103 if (is_object($this->
object))
2106 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
"showOverview"),
"",
$_GET[
"ref_id"]);
2123 $ilTabs->activateTab(
"content");
2126 $ilToolbar->addButton($lng->txt(
"exc_add_assignment"),
2127 $ilCtrl->getLinkTarget($this,
"addAssignment"));
2129 include_once(
"./Modules/Exercise/classes/class.ilAssignmentsTableGUI.php");
2131 $tpl->setContent(
$t->getHTML());
2139 global
$tpl, $ilTabs;
2143 $ilTabs->activateTab(
"content");
2147 $tpl->setContent($this->form->getHTML());
2160 $lng->loadLanguageModule(
"form");
2161 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
2163 $this->form->setTableWidth(
"600px");
2164 if ($a_mode ==
"edit")
2166 $this->form->setTitle($lng->txt(
"exc_edit_assignment"));
2170 $this->form->setTitle($lng->txt(
"exc_new_assignment"));
2172 $this->form->setFormAction($ilCtrl->getFormAction($this));
2175 include_once(
"./Modules/Exercise/classes/class.ilExAssignment.php");
2179 if(!$ilSetting->get(
'disable_wsp_blogs'))
2183 if($ilSetting->get(
'user_portfolios'))
2187 if(
sizeof($types) > 1)
2189 $ty =
new ilSelectInputGUI($this->lng->txt(
"exc_assignment_type"),
"type");
2191 $ty->setRequired(
true);
2198 $this->form->addItem($ty);
2203 $ti->setRequired(
true);
2204 $this->form->addItem($ti);
2208 $this->form->addItem($cb);
2212 $edit_date->setShowTime(
true);
2213 $cb->addSubItem($edit_date);
2219 $this->form->addItem($dcb);
2224 $dcb->addSubItem($edit_date);
2228 $cb->
setInfo($this->lng->txt(
"exc_mandatory_info"));
2229 $cb->setChecked(
true);
2230 $this->form->addItem($cb);
2235 $desc_input->setUseRte(
true);
2236 $desc_input->setRteTagSet(
"mini");
2237 $this->form->addItem($desc_input);
2240 if ($a_mode ==
"create")
2244 $this->form->addItem($files);
2249 $peer->
setInfo($this->lng->txt(
"exc_peer_review_ass_setting_info"));
2250 $this->form->addItem($peer);
2252 if ($a_mode ==
"create")
2254 $peer->setInfo($lng->txt(
"exc_peer_review_info"));
2257 $peer_min =
new ilNumberInputGUI($lng->txt(
"exc_peer_review_min_number"),
"peer_min");
2258 $peer_min->
setInfo($lng->txt(
"exc_peer_review_min_number_info"));
2259 $peer_min->setRequired(
true);
2260 $peer_min->setValue(5);
2261 $peer_min->setSize(3);
2262 $peer_min->setValue(2);
2263 $peer->addSubItem($peer_min);
2266 $peer_dl->
setInfo($lng->txt(
"exc_peer_review_deadline_info"));
2267 $peer_dl->enableDateActivation(
"",
"peer_dl_tgl");
2268 $peer_dl->setShowTime(
true);
2269 $peer->addSubItem($peer_dl);
2272 $peer_file->
setInfo($lng->txt(
"exc_peer_review_file_info"));
2273 $peer->addSubItem($peer_file);
2275 $peer_prsl =
new ilCheckboxInputGUI($lng->txt(
"exc_peer_review_personal"),
"peer_prsl");
2276 $peer_prsl->
setInfo($lng->txt(
"exc_peer_review_personal_info"));
2277 $peer->addSubItem($peer_prsl);
2279 if($a_mode !=
"create" &&
2281 $this->ass->getDeadline() && $this->ass->getDeadline() < time())
2283 $peer_prsl->setDisabled(
true);
2290 $this->form->addItem($fb);
2295 $fb->addSubItem($fb_file);
2298 if($a_mode !=
"create" &&
2300 $this->ass->getFeedbackFile())
2302 $fb_file->setRequired(
false);
2309 $fb->addSubItem($fb_date);
2311 $fb_cron =
new ilCheckboxInputGUI($lng->txt(
"exc_global_feedback_file_cron"),
"fb_cron");
2312 $fb_cron->
setInfo($lng->txt(
"exc_global_feedback_file_cron_info"));
2313 $fb->addSubItem($fb_cron);
2316 if ($a_mode ==
"create")
2318 $this->form->addCommandButton(
"saveAssignment", $lng->txt(
"save"));
2319 $this->form->addCommandButton(
"listAssignments", $lng->txt(
"cancel"));
2323 $this->form->addCommandButton(
"updateAssignment", $lng->txt(
"save"));
2324 $this->form->addCommandButton(
"listAssignments", $lng->txt(
"cancel"));
2338 $ilTabs->activateTab(
"content");
2342 if ($this->form->checkInput())
2344 include_once(
"./Modules/Exercise/classes/class.ilExAssignment.php");
2354 $this->form->getItemByPostVar(
"start_time")->getDate();
2356 $this->form->getItemByPostVar(
"deadline")->getDate();
2360 $this->form->getItemByPostVar(
"start_time")
2361 ->setAlert($lng->txt(
"exc_start_date_should_be_before_end_date"));
2362 $this->form->getItemByPostVar(
"deadline")
2363 ->setAlert($lng->txt(
"exc_start_date_should_be_before_end_date"));
2370 $this->form->getItemByPostVar(
"peer")
2371 ->setAlert($lng->txt(
"exc_team_upload_not_supported"));
2375 if(!
$_POST[
"deadline_cb"])
2379 $this->form->getItemByPostVar(
"peer")
2380 ->setAlert($lng->txt(
"exc_needs_deadline"));
2385 $this->form->getItemByPostVar(
"fb")
2386 ->setAlert($lng->txt(
"exc_needs_deadline"));
2396 $peer_dl = $this->form->getItemByPostVar(
"peer_dl")->getDate();
2398 $end_date = $this->form->getItemByPostVar(
"deadline")->getDate();
2402 if ($peer_dl < $end_date)
2404 $this->form->getItemByPostVar(
"peer_dl")
2405 ->setAlert($lng->txt(
"exc_peer_deadline_mismatch"));
2414 $this->form->setValuesByPost();
2415 $tpl->setContent($this->form->getHtml());
2420 $ass->setTitle(
$_POST[
"title"]);
2421 $ass->setInstruction(
$_POST[
"instruction"]);
2422 $ass->setExerciseId($this->object->getId());
2423 $ass->setMandatory(
$_POST[
"mandatory"]);
2424 $ass->setType(
$_POST[
"type"]);
2426 if (
$_POST[
"start_time_cb"])
2429 $this->form->getItemByPostVar(
"start_time")->getDate();
2434 $ass->setStartTime(null);
2438 if (
$_POST[
"deadline_cb"])
2441 $this->form->getItemByPostVar(
"deadline")->getDate();
2446 $ass->setDeadline(null);
2451 $ass->setPeerReview(
$_POST[
"peer"]);
2452 $ass->setPeerReviewMin(
$_POST[
"peer_min"]);
2453 $ass->setPeerReviewFileUpload(
$_POST[
"peer_file"]);
2455 if($ass->getDeadline() && $ass->getDeadline() > time())
2457 $ass->setPeerReviewPersonalized(
$_POST[
"peer_prsl"]);
2460 if(
$_POST[
"peer_dl_tgl"])
2462 $peer_dl = $this->form->getItemByPostVar(
"peer_dl")->getDate();
2463 $ass->setPeerReviewDeadline($peer_dl->get(
IL_CAL_UNIX));
2467 $ass->setPeerReviewDeadline(null);
2471 $ass->setFeedbackCron(
$_POST[
"fb_cron"]);
2472 $ass->setFeedbackDate(
$_POST[
"fb_date"]);
2477 $ass->uploadAssignmentFiles($_FILES[
"files"]);
2479 if($_FILES[
"fb_file"][
"tmp_name"])
2481 $ass->handleFeedbackFileUpload($_FILES[
"fb_file"]);
2491 $ilCtrl->setParameter($this,
"ass_id", $ass->getId());
2492 $ilCtrl->redirect($this,
"adoptTeamAssignmentsForm");
2496 $ilCtrl->redirect($this,
"listAssignments");
2500 $this->form->setValuesByPost();
2501 $tpl->setContent($this->form->getHtml());
2515 $ilTabs->activateTab(
"ass_settings");
2519 $tpl->setContent($this->form->getHTML());
2531 $values[
"title"] = $ass->getTitle();
2532 if ($ass->getStartTime() > 0)
2534 $values[
"start_time_cb"] =
true;
2536 $values[
"mandatory"] = $ass->getMandatory();
2537 $values[
"instruction"] = $ass->getInstruction();
2538 $values[
"type"] = $ass->getType();
2539 if ($ass->getDeadline() > 0)
2541 $values[
"deadline_cb"] =
true;
2545 $this->form->removeItemByPostVar(
"peer");
2546 $this->form->removeItemByPostVar(
"peer_min");
2547 $this->form->removeItemByPostVar(
"peer_dl");
2551 if ($ass->getPeerReviewDeadline() > 0)
2553 $values[
"peer_dl_tgl"] =
true;
2555 $peer_dl = $this->form->getItemByPostVar(
"peer_dl");
2556 $peer_dl->
setDate($peer_dl_date);
2559 $this->form->setValuesByArray($values);
2561 if ($ass->getStartTime() > 0)
2564 $ed_item = $this->form->getItemByPostVar(
"start_time");
2565 $ed_item->
setDate($edit_date);
2568 if($ass->getFeedbackFile())
2570 $this->form->getItemByPostVar(
"fb")->setChecked(
true);
2571 $this->form->getItemByPostVar(
"fb_file")->setValue(basename($ass->getFeedbackFilePath()));
2573 $this->form->getItemByPostVar(
"fb_cron")->setChecked($ass->hasFeedbackCron());
2574 $this->form->getItemByPostVar(
"fb_date")->setValue($ass->getFeedbackDate());
2596 $ed_item->
setDate($edit_date);
2644 $ilTabs->activateTab(
"content");
2647 include_once(
"./Modules/Exercise/classes/class.ilExAssignment.php");
2651 if ($this->form->checkInput())
2654 $protected_peer_review_groups =
false;
2655 if($ass->getPeerReview() &&
2656 $ass->hasPeerReviewGroups())
2658 $protected_peer_review_groups =
true;
2661 $this->form->getItemByPostVar(
"deadline")->setAlert(null);
2662 $this->form->getItemByPostVar(
"peer_min")->setAlert(null);
2669 if(!$protected_peer_review_groups)
2673 if (
$_POST[
"deadline_cb"])
2676 $this->form->getItemByPostVar(
"deadline")->getDate()->get(
IL_CAL_UNIX);
2679 if (
$_POST[
"start_time_cb"] && $end_date)
2683 $this->form->getItemByPostVar(
"start_time")->getDate()->get(
IL_CAL_UNIX);
2684 if ($start_date >= $end_date)
2686 $this->form->getItemByPostVar(
"start_time")
2687 ->setAlert($lng->txt(
"exc_start_date_should_be_before_end_date"));
2688 $this->form->getItemByPostVar(
"deadline")
2689 ->setAlert($lng->txt(
"exc_start_date_should_be_before_end_date"));
2698 $this->form->getItemByPostVar(
"peer")
2699 ->setAlert($lng->txt(
"exc_needs_deadline"));
2704 $this->form->getItemByPostVar(
"fb")
2705 ->setAlert($lng->txt(
"exc_needs_deadline"));
2713 $end_date = $ass->getDeadline();
2720 $peer_dl = $this->form->getItemByPostVar(
"peer_dl")->getDate();
2724 if ($peer_dl < $end_date)
2726 $this->form->getItemByPostVar(
"peer_dl")
2727 ->setAlert($lng->txt(
"exc_peer_deadline_mismatch"));
2735 $this->form->setValuesByPost();
2737 $tpl->setContent($this->form->getHtml());
2741 $ass->setTitle(
$_POST[
"title"]);
2742 $ass->setInstruction(
$_POST[
"instruction"]);
2743 $ass->setExerciseId($this->object->getId());
2744 $ass->setMandatory(
$_POST[
"mandatory"]);
2745 $ass->setType(
$_POST[
"type"]);
2747 if (
$_POST[
"start_time_cb"])
2750 $this->form->getItemByPostVar(
"start_time")->getDate();
2755 $ass->setStartTime(null);
2758 if(!$protected_peer_review_groups)
2761 if (
$_POST[
"deadline_cb"])
2763 $date = $this->form->getItemByPostVar(
"deadline")->getDate();
2768 $ass->setDeadline(null);
2773 $ass->setPeerReview(
$_POST[
"peer"]);
2774 $ass->setPeerReviewMin(
$_POST[
"peer_min"]);
2775 $ass->setPeerReviewFileUpload(
$_POST[
"peer_file"]);
2777 if($ass->getDeadline() && $ass->getDeadline() > time())
2779 $ass->setPeerReviewPersonalized(
$_POST[
"peer_prsl"]);
2784 if(
$_POST[
"peer_dl_tgl"])
2786 $peer_dl = $this->form->getItemByPostVar(
"peer_dl")->getDate();
2787 $ass->setPeerReviewDeadline($peer_dl->get(
IL_CAL_UNIX));
2791 $ass->setPeerReviewDeadline(null);
2795 $this->form->getItemByPostVar(
"fb_file")->getDeletionFlag())
2797 $ass->deleteFeedbackFile();
2798 $ass->setFeedbackFile(null);
2800 else if($_FILES[
"fb_file"][
"tmp_name"])
2802 $ass->handleFeedbackFileUpload($_FILES[
"fb_file"]);
2805 $ass->setFeedbackCron(
$_POST[
"fb_cron"]);
2806 $ass->setFeedbackDate(
$_POST[
"fb_date"]);
2810 $ilCtrl->redirect($this,
"editAssignment");
2814 $this->form->setValuesByPost();
2816 $tpl->setContent($this->form->getHtml());
2830 $ilTabs->activateTab(
"content");
2833 if (!is_array(
$_POST[
"id"]) || count(
$_POST[
"id"]) == 0)
2836 $ilCtrl->redirect($this,
"listAssignments");
2840 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
2842 $cgui->setFormAction($ilCtrl->getFormAction($this));
2843 $cgui->setHeaderText($lng->txt(
"exc_conf_del_assignments"));
2844 $cgui->setCancel($lng->txt(
"cancel"),
"listAssignments");
2845 $cgui->setConfirm($lng->txt(
"delete"),
"deleteAssignments");
2847 include_once(
"./Modules/Exercise/classes/class.ilExAssignment.php");
2849 foreach (
$_POST[
"id"] as $i)
2854 $tpl->setContent($cgui->getHTML());
2868 if (is_array(
$_POST[
"id"]))
2870 include_once(
"./Modules/Exercise/classes/class.ilExAssignment.php");
2871 foreach(
$_POST[
"id"] as $id)
2883 $ilCtrl->redirect($this,
"listAssignments");
2895 include_once(
"./Modules/Exercise/classes/class.ilExAssignment.php");
2899 $ilCtrl->redirect($this,
"listAssignments");
2911 include_once(
"./Modules/Exercise/classes/class.ilExAssignment.php");
2915 $ilCtrl->redirect($this,
"listAssignments");
2925 include_once(
"./Modules/Exercise/classes/class.ilExAssignment.php");
2927 $tpl->setDescription(
"");
2929 $ilTabs->clearTargets();
2930 $ilHelp->setScreenIdComponent(
"exc");
2932 $ilTabs->setBackTarget($lng->txt(
"back"),
2933 $ilCtrl->getLinkTarget($this,
"listAssignments"));
2935 $ilTabs->addTab(
"ass_settings",
2936 $lng->txt(
"settings"),
2937 $ilCtrl->getLinkTarget($this,
"editAssignment"));
2939 $ilTabs->addTab(
"ass_files",
2940 $lng->txt(
"exc_instruction_files"),
2941 $ilCtrl->getLinkTargetByClass(
"ilfilesystemgui",
"listFiles"));
2959 include_once(
"./Services/Tracking/classes/class.ilLearningProgress.php");
2961 $this->
object->getRefId(),
'exc');
2963 $ilTabs->activateTab(
"content");
2967 if($this->object->hasUserCertificate($ilUser->getId()))
2969 include_once
"./Modules/Exercise/classes/class.ilExerciseCertificateAdapter.php";
2970 include_once
"./Services/Certificate/classes/class.ilCertificate.php";
2974 $ilToolbar->addButton($this->lng->txt(
"certificate"),
2975 $this->ctrl->getLinkTarget($this,
"outCertificate"));
2979 include_once(
"./Modules/Exercise/classes/class.ilExAssignment.php");
2980 include_once(
"./Services/Accordion/classes/class.ilAccordionGUI.php");
2982 $acc->setId(
"exc_ow_".$this->object->getId());
2984 include_once(
"./Modules/Exercise/classes/class.ilExAssignmentGUI.php");
2987 foreach ($ass_data as $ass)
2990 $force_open =
false;
2991 if(isset(
$_GET[
"ass_id_goto"]) &&
2992 (
int)
$_GET[
"ass_id_goto"] == $ass[
"id"])
2997 $acc->addItem($ass_gui->getOverviewHeader($ass),
2998 $ass_gui->getOverviewBody($ass),
3002 if (count($ass_data) < 2)
3004 $acc->setBehaviour(
"FirstOpen");
3008 $acc->setUseSessionStorage(
true);
3011 $tpl->setContent($acc->getHTML());
3019 global
$tpl, $ilTabs;
3023 if(!$this->object->getShowSubmissions())
3025 $this->ctrl->redirect($this,
"view");
3028 $ilTabs->activateTab(
"content");
3033 include_once(
"./Modules/Exercise/classes/class.ilPublicSubmissionsTableGUI.php");
3035 $this->
object, (
int)
$_GET[
"ass_id"]);
3036 $tpl->setContent(
$tab->getHTML());
3041 include_once
"Modules/Exercise/classes/class.ilExAssignmentListTextTableGUI.php";
3043 $tpl->setContent($tbl->getHTML());
3053 $this->
object->exportGradesExcel();
3065 include_once
'Services/Tracking/classes/class.ilLPMarks.php';
3067 if (is_array(
$_POST[
"lcomment"]))
3069 foreach (
$_POST[
"lcomment"] as $k => $v)
3071 $marks_obj =
new ilLPMarks($this->object->getId(), (int) $k);
3074 $marks_obj->update();
3078 $ilCtrl->redirect($this,
"showGradesOverview");
3087 include_once
"./Services/Notification/classes/class.ilNotification.php";
3090 include_once
"./Modules/Exercise/classes/class.ilExerciseMailNotification.php";
3093 $not->setAssignmentId($assignment_id);
3094 $not->setRefId($this->ref_id);
3095 $not->setRecipients($users);
3107 $this->tabs_gui->setTabActive(
"content");
3110 if (mktime() > $this->ass->getDeadline() && ($this->ass->getDeadline() != 0))
3115 $tpl =
new ilTemplate(
"tpl.exc_select_resource.html",
true,
true,
"Modules/Exercise");
3116 $tpl->setVariable(
"TXT_TITLE", $this->lng->txt(
"exc_create_blog").
": ".$this->ass->getTitle());
3118 $tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
3119 $tpl->setVariable(
"TXT_SUBMIT", $this->lng->txt(
"save"));
3120 $tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
3121 $tpl->setVariable(
"CMD_SUBMIT",
"saveBlog");
3122 $tpl->setVariable(
"CMD_CANCEL",
"showOverview");
3126 $this->tpl->setContent(
$tpl->get());
3135 $this->tabs_gui->clearTargets();
3136 $this->tabs_gui->setBackTarget($this->lng->txt(
"back"), $this->ctrl->getLinkTarget($this,
"showOverview"));
3141 if (mktime() > $this->ass->getDeadline() && ($this->ass->getDeadline() != 0))
3146 $tpl =
new ilTemplate(
"tpl.exc_select_resource.html",
true,
true,
"Modules/Exercise");
3147 $tpl->setVariable(
"TXT_TITLE", $this->lng->txt(
"exc_select_blog").
": ".$this->ass->getTitle());
3149 $tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
3150 $tpl->setVariable(
"TXT_SUBMIT", $this->lng->txt(
"save"));
3151 $tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
3152 $tpl->setVariable(
"CMD_SUBMIT",
"setSelectedBlog");
3153 $tpl->setVariable(
"CMD_CANCEL",
"showOverview");
3157 $this->tpl->setContent(
$tpl->get());
3170 $parent_node =
$_POST[
"node"];
3172 include_once
"Modules/Blog/classes/class.ilObjBlog.php";
3173 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
3174 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
3177 $blog->setTitle($this->object->getTitle().
" - ".$this->ass->getTitle());
3182 $node_id =
$tree->insertObject($parent_node, $blog->getId());
3185 $access_handler->setPermissions($parent_node, $node_id);
3187 $this->
object->addResourceObject($node_id, $this->ass->getId(), $ilUser->getId());
3190 $this->ctrl->redirect($this,
"showOverview");
3199 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
3202 if($node && $node[
"type"] ==
"blog")
3205 $this->
object->addResourceObject($node[
"wsp_id"], $this->ass->getId(), $ilUser->getId());
3208 $this->ctrl->setParameter($this,
"blog_id", $node[
"wsp_id"]);
3209 $this->ctrl->redirect($this,
"askDirectionSubmission");
3228 foreach($submitted as $item)
3230 $files[] = $item[
"returned_id"];
3240 $this->tabs_gui->setTabActive(
"content");
3243 include_once
"Services/Utilities/classes/class.ilConfirmationGUI.php";
3249 $this->ctrl->setParameter($this,
"blog_id",
$_REQUEST[
"blog_id"]);
3250 $txt = $this->lng->txt(
"exc_direct_submit_blog");
3254 $this->ctrl->setParameter($this,
"prtf_id",
$_REQUEST[
"prtf_id"]);
3255 $txt = $this->lng->txt(
"exc_direct_submit_portfolio");
3257 $conf->setFormAction($this->ctrl->getFormAction($this,
"directSubmit"));
3259 $conf->setHeaderText(
$txt);
3260 $conf->setConfirm($this->lng->txt(
"exc_direct_submit"),
"directSubmit");
3261 $conf->setCancel($this->lng->txt(
"cancel"),
"showOverview");
3263 $tpl->setContent($conf->getHTML());
3276 $this->ctrl->setParameter($this,
"blog_id",
"");
3282 $this->ctrl->setParameter($this,
"prtf_id",
"");
3293 $this->ctrl->redirect($this,
"showOverview");
3306 if($this->
object && $this->ass)
3308 $blog_id = $a_blog_id;
3310 include_once
"Modules/Blog/classes/class.ilObjBlogGUI.php";
3312 if($blog_gui->object)
3314 $file = $blog_gui->buildExportFile();
3322 "tmp_name" =>
$file,
3325 $this->
object->deliverFile($meta, $this->ass->getId(), $ilUser->getId(),
true);
3328 $this->
object->handleSubmission($this->ass->getId());
3346 if($this->
object && $this->ass)
3348 $prtf_id = $a_portfolio_id;
3350 include_once
"Modules/Portfolio/classes/class.ilObjPortfolio.php";
3352 if($prtf->getTitle())
3354 include_once
"Modules/Portfolio/classes/class.ilPortfolioHTMLExport.php";
3356 $file = $export->buildExportFile();
3364 "tmp_name" =>
$file,
3367 $this->
object->deliverFile($meta, $this->ass->getId(), $ilUser->getId(),
true);
3370 $this->
object->handleSubmission($this->ass->getId());
3384 $this->tabs_gui->clearTargets();
3385 $this->tabs_gui->setBackTarget($this->lng->txt(
"back"), $this->ctrl->getLinkTarget($this,
"showOverview"));
3390 if (mktime() > $this->ass->getDeadline() && ($this->ass->getDeadline() != 0))
3395 $tpl =
new ilTemplate(
"tpl.exc_select_resource.html",
true,
true,
"Modules/Exercise");
3397 include_once
"Modules/Portfolio/classes/class.ilObjPortfolio.php";
3401 $tpl->setCurrentBlock(
"item");
3402 foreach($portfolios as $portfolio)
3404 $tpl->setVariable(
"ITEM_ID", $portfolio[
"id"]);
3405 $tpl->setVariable(
"ITEM_TITLE", $portfolio[
"title"]);
3406 $tpl->parseCurrentBlock();
3410 $tpl->setVariable(
"TXT_TITLE", $this->lng->txt(
"exc_select_portfolio").
": ".$this->ass->getTitle());
3411 $tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
3412 $tpl->setVariable(
"TXT_SUBMIT", $this->lng->txt(
"save"));
3413 $tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
3414 $tpl->setVariable(
"CMD_SUBMIT",
"setSelectedPortfolio");
3415 $tpl->setVariable(
"CMD_CANCEL",
"showOverview");
3419 $this->tpl->setContent(
$tpl->get());
3424 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
3426 $form->setTitle($this->lng->txt(
"exc_create_portfolio").
": ".$this->ass->getTitle());
3427 $form->setFormAction($this->ctrl->getFormAction($this,
"setSelectedPortfolioTemplate"));
3431 $prtt->addOption(
new ilRadioOption($this->lng->txt(
"exc_create_portfolio_no_template"), -1));
3432 foreach($a_templates as $id => $title)
3436 $prtt->setValue(-1);
3437 $form->addItem($prtt);
3439 $form->addCommandButton(
"setSelectedPortfolioTemplate", $this->lng->txt(
"save"));
3440 $form->addCommandButton(
"showOverview", $this->lng->txt(
"cancel"));
3449 include_once
"Modules/Portfolio/classes/class.ilObjPortfolioTemplate.php";
3451 if(!
sizeof($templates))
3453 $this->ctrl->redirect($this,
"showOverview");
3456 $this->tabs_gui->clearTargets();
3457 $this->tabs_gui->setBackTarget($this->lng->txt(
"back"), $this->ctrl->getLinkTarget($this,
"showOverview"));
3464 $this->tpl->setContent($a_form->getHTML());
3471 include_once
"Modules/Portfolio/classes/class.ilObjPortfolioTemplate.php";
3473 if(!
sizeof($templates))
3475 $this->ctrl->redirect($this,
"showOverview");
3479 if($form->checkInput())
3481 $prtt = $form->getInput(
"prtt");
3482 if($prtt > 0 && array_key_exists($prtt, $templates))
3484 $title = $this->
object->getTitle().
" - ".$this->ass->getTitle();
3485 $this->ctrl->setParameterByClass(
"ilObjPortfolioGUI",
"exc_id", $this->object->getRefId());
3486 $this->ctrl->setParameterByClass(
"ilObjPortfolioGUI",
"ass_id", $this->ass->getId());
3487 $this->ctrl->setParameterByClass(
"ilObjPortfolioGUI",
"pt", $title);
3488 $this->ctrl->setParameterByClass(
"ilObjPortfolioGUI",
"prtt", $prtt);
3489 $this->ctrl->redirectByClass(array(
"ilPersonalDesktopGUI",
"ilPortfolioRepositoryGUI",
"ilObjPortfolioGUI"),
"createPortfolioFromTemplate");
3498 $form->setValuesByPost();
3508 include_once
"Modules/Portfolio/classes/class.ilObjPortfolio.php";
3510 $portfolio->setTitle($this->object->getTitle().
" - ".$this->ass->getTitle());
3511 $portfolio->create();
3513 $this->
object->addResourceObject($portfolio->getId(), $this->ass->getId(), $ilUser->getId());
3516 $this->ctrl->redirect($this,
"showOverview");
3526 $this->
object->addResourceObject(
$_POST[
"item"], $this->ass->getId(), $ilUser->getId());
3529 $this->ctrl->setParameter($this,
"prtf_id",
$_POST[
"item"]);
3530 $this->ctrl->redirect($this,
"askDirectionSubmission");
3541 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
3542 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
3543 require_once
'Services/PersonalWorkspace/classes/class.ilWorkspaceExplorer.php';
3548 'exc_wspexpand',
$tree, $access_handler);
3549 $exp->setTargetGet(
'wsp_id');
3551 if($a_cmd ==
"selectBlog")
3553 $exp->removeAllFormItemTypes();
3554 $exp->addFilter(
'blog');
3555 $exp->addFormItemForType(
'blog');
3558 if(
$_GET[
'exc_wspexpand'] ==
'')
3561 $expanded =
$tree->readRootId();
3565 $expanded =
$_GET[
'exc_wspexpand'];
3568 $exp->setExpandTarget($this->ctrl->getLinkTarget($this, $a_cmd));
3569 $exp->setPostVar(
'node');
3570 $exp->setExpand($expanded);
3573 return $exp->getOutput();
3579 $this->tabs_gui->activateTab(
"settings");
3580 $this->tabs_gui->activateSubTab(
"certificate");
3582 include_once
"./Services/Certificate/classes/class.ilCertificateGUI.php";
3583 include_once
"./Modules/Exercise/classes/class.ilExerciseCertificateAdapter.php";
3585 $output_gui->certificateEditor();
3592 if($this->object->hasUserCertificate($ilUser->getId()))
3598 include_once
"./Services/Certificate/classes/class.ilCertificate.php";
3599 include_once
"./Modules/Exercise/classes/class.ilExerciseCertificateAdapter.php";
3601 $certificate->outCertificate(array(
"user_id" => $ilUser->getId()));
3612 $this->ctrl->redirect($this,
"submissionScreen");
3615 $this->tabs_gui->clearTargets();
3616 $ilHelp->setScreenIdComponent(
"exc");
3617 $this->tabs_gui->setBackTarget($this->lng->txt(
"back"),
3618 $this->ctrl->getLinkTarget($this, $a_back_cmd));
3622 $this->tabs_gui->addTab(
"submissions", $this->lng->txt(
"files"),
3623 $this->ctrl->getLinkTarget($this,
"submissionScreen"));
3625 $this->tabs_gui->addTab(
"team", $this->lng->txt(
"exc_team"),
3626 $this->ctrl->getLinkTarget($this,
"submissionScreenTeam"));
3628 $this->tabs_gui->addTab(
"log", $this->lng->txt(
"exc_team_log"),
3629 $this->ctrl->getLinkTarget($this,
"submissionScreenTeamLog"));
3631 $this->tabs_gui->activateTab(
"team");
3633 $team_id = $this->ass->getTeamId($ilUser->getId());
3637 $team_id = $this->ass->getTeamId($ilUser->getId(),
true);
3640 if (!$this->object->members_obj->isAssigned($ilUser->getId()))
3642 $this->
object->members_obj->assignMember($ilUser->getId());
3650 $ilHelp->setScreenId(
"submissions");
3669 $read_only = (mktime() > $this->ass->getDeadline() && ($this->ass->getDeadline() != 0));
3677 $this->ctrl->setParameterByClass(
'ilRepositorySearchGUI',
'ctx', 1);
3678 $this->ctrl->setParameter($this,
'ctx', 1);
3681 include_once
'./Services/Search/classes/class.ilRepositorySearchGUI.php';
3686 'auto_complete_name' => $this->lng->txt(
'user'),
3687 'submit_name' => $this->lng->txt(
'add'),
3688 'add_search' =>
true,
3689 'add_from_container' => $this->
object->getRefId()
3694 include_once
"Modules/Exercise/classes/class.ilExAssignmentTeamTableGUI.php";
3698 $this->tpl->setContent($tbl->getHTML());
3707 if(!count($a_user_ids))
3713 $team_id = $this->ass->getTeamId($ilUser->getId());
3714 $has_files = $this->ass->getDeliveredFiles($this->object->getId(),
3715 $this->ass->getId(),
3717 $all_members = $this->ass->getMembersOfAllTeams();
3718 $members = $this->ass->getTeamMembers($team_id);
3720 foreach($a_user_ids as $user_id)
3722 if(!in_array($user_id, $all_members))
3724 $this->ass->addTeamMember($team_id, $user_id, $this->ref_id);
3727 if (!$this->object->members_obj->isAssigned($user_id))
3729 $this->
object->members_obj->assignMember($user_id);
3741 else if(!in_array($user_id, $members))
3748 $this->ctrl->redirect($this,
"submissionScreenTeam");
3760 $team_id = $this->ass->getTeamId($ilUser->getId());
3761 $members = $this->ass->getTeamMembers($team_id);
3763 $ids = (bool)$a_full_delete
3770 $this->ctrl->redirect($this,
"submissionScreenTeam");
3773 $team_deleted =
false;
3774 if(
sizeof($members) <=
sizeof($ids))
3776 if(
sizeof($members) == 1 && $members[0] == $ilUser->getId())
3784 $this->ctrl->redirect($this,
"submissionScreenTeam");
3791 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
3793 $cgui->setFormAction($this->ctrl->getFormAction($this));
3794 $cgui->setHeaderText($this->lng->txt(
"exc_team_member_remove_sure"));
3795 $cgui->setCancel($this->lng->txt(
"cancel"),
"submissionScreenTeam");
3796 $cgui->setConfirm($this->lng->txt(
"remove"),
"removeTeamMember");
3799 $this->ass->getId(), $ilUser->getId());
3801 include_once
"Services/User/classes/class.ilUserUtil.php";
3803 foreach($ids as $id)
3806 foreach ($files as
$file)
3808 if($file[
"owner_id"] == $id)
3810 $details[] = $file[
"filetitle"];
3814 if(
sizeof($details))
3816 $uname .=
": ".implode(
", ", $details);
3818 $cgui->addItem(
"id[]", $id, $uname);
3821 $tpl->setContent($cgui->getHTML());
3827 $team_id = $this->ass->getTeamId($ilUser->getId());
3828 $members = $this->ass->getTeamMembers($team_id);
3830 $ids = (bool)$a_full_delete
3837 $this->ctrl->redirect($this,
"submissionScreenTeam");
3840 $team_deleted = (bool)$a_full_delete;
3843 if(
sizeof($members) <=
sizeof($ids))
3845 if(
sizeof($members) == 1 && $members[0] == $ilUser->getId())
3847 $team_deleted =
true;
3852 $this->ctrl->redirect($this,
"submissionScreenTeam");
3857 foreach($ids as $user_id)
3859 $this->ass->removeTeamMember($team_id, $user_id, $this->ref_id);
3871 $this->ctrl->redirect($this,
"submissionScreenTeam");
3875 $this->ctrl->redirect($this,
"showOverview");
3882 $this->tabs_gui->activateTab(
"log");
3884 include_once
"Modules/Exercise/classes/class.ilExAssignmentTeamLogTableGUI.php";
3888 $this->tpl->setContent($tbl->getHTML());
3893 if(isset(
$_GET[
"lmem"]))
3895 $user_id =
$_GET[
"lmem"];
3900 $user_id =
$_GET[
"lpart"];
3901 $cmd =
"showParticipant";
3905 $this->ass->getTeamId($user_id,
true);
3908 $this->ctrl->redirect($this,
$cmd);
3914 $this->tabs_gui->activateTab(
"grades");
3916 if(isset(
$_GET[
"lmem"]))
3920 $this->tabs_gui->setBackTarget($this->lng->txt(
"back"),
3921 $this->ctrl->getLinkTarget($this,
"members"));
3925 $this->ctrl->saveParameter($this,
"lmem");
3931 $this->tabs_gui->setBackTarget($this->lng->txt(
"back"),
3932 $this->ctrl->getLinkTarget($this,
"showParticipant"));
3936 $this->ctrl->saveParameter($this,
"lpart");
3939 include_once
"Modules/Exercise/classes/class.ilExAssignmentTeamLogTableGUI.php";
3943 $this->tpl->setContent($tbl->getHTML());
3950 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
3952 $form->setTitle($this->lng->txt(
"exc_assignment").
" \"".$a_ass->
getTitle().
"\"");
3959 $form->addItem($text);
3962 $text->setUseRte(
true);
3963 $text->setRTESupport($ilUser->getId(),
"exca~",
"exc_ass");
3966 $text->disableButtons(array(
3983 $form->setFormAction($ilCtrl->getFormAction($this,
"updateAssignmentText"));
3984 $form->addCommandButton(
"updateAssignmentTextAndReturn", $this->lng->txt(
"save_return"));
3985 $form->addCommandButton(
"updateAssignmentText", $this->lng->txt(
"save"));
3990 $form->addItem($text);
3992 if(!$a_peer_review_cmd)
3994 $form->setFormAction($ilCtrl->getFormAction($this,
"showOverview"));
3999 $rating->
setHtml($a_peer_rating_html);
4000 $form->addItem($rating);
4005 $form->addItem($comm);
4007 $form->setFormAction($ilCtrl->getFormAction($this, $a_peer_review_cmd));
4008 $form->addCommandButton($a_peer_review_cmd, $this->lng->txt(
"save"));
4011 $form->addCommandButton($a_cancel_cmd, $this->lng->txt(
"cancel"));
4022 ($this->ass->getDeadline() && $this->ass->getDeadline() - time() < 0))
4024 $ilCtrl->redirect($this,
"showOverview");
4032 $this->tabs_gui->clearTargets();
4033 $this->tabs_gui->setBackTarget($this->lng->txt(
"back"),
4034 $this->ctrl->getLinkTarget($this,
"showOverview"));
4037 $ilHelp->setScreenIdComponent(
"exc");
4038 $ilHelp->setScreenId(
"text_submission");
4040 if($this->ass->getDeadline())
4053 $files = array_shift($files);
4054 if(trim($files[
"atext"]))
4056 $text = $a_form->getItemByPostVar(
"atxt");
4063 $this->tpl->setContent($a_form->getHTML());
4075 $times_up = ($this->ass->getDeadline() && $this->ass->getDeadline() - time() < 0);
4085 $ilCtrl->redirect($this,
"showOverview");
4094 include_once(
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php");
4095 $rte = $form->getItemByPostVar(
"atxt");
4098 if($form->checkInput())
4100 $text = trim($form->getInput(
"atxt"));
4103 $this->ass->getId(), $ilUser->getId());
4105 $returned_id = $this->
object->updateTextSubmission(
4106 $this->ass->getExerciseId(),
4107 $this->ass->getId(),
4119 $this->
object->handleSubmission($this->ass->getId());
4123 include_once
"Services/MediaObjects/classes/class.ilObjMediaObject.php";
4125 foreach(
$mobs as $mob)
4138 $ilCtrl->redirect($this,
"showOverview");
4142 $ilCtrl->redirect($this,
"editAssignmentText");
4146 $form->setValuesByPost();
4157 $ilCtrl->redirect($this,
"showOverview");
4163 if((
int)
$_GET[
"grd"])
4167 if((
int)$_GET[
"grd"] == 1)
4169 $user_id = (int)$_GET[
"member_id"];
4170 $cancel_cmd =
"members";
4174 $user_id = (int)$_GET[
"part_id"];
4175 $cancel_cmd =
"showParticipant";
4179 else if($this->ass->hasPeerReviewAccess((
int)$_GET[
"member_id"]))
4183 $user_id = (int)$_GET[
"member_id"];
4184 $cancel_cmd =
"editPeerReview";
4187 $add_rating =
"updatePeerReviewText";
4188 $ilCtrl->setParameter($this,
"peer_id", $user_id);
4189 include_once
'./Services/Rating/classes/class.ilRatingGUI.php';
4191 $rating->setObject($this->ass->getId(),
"ass", $user_id,
"peer");
4192 $rating->setUserId($ilUser->getId());
4193 $rating =
'<div id="rtr_widget">'.$rating->getHTML(
false,
true,
4194 "il.ExcPeerReview.saveSingleRating(".$user_id.
", %rating%)").
'</div>';
4196 $ilCtrl->setParameter($this,
"ssrtg", 1);
4197 $tpl->addJavaScript(
"Modules/Exercise/js/ilExcPeerReview.js");
4198 $tpl->addOnLoadCode(
"il.ExcPeerReview.setAjax('".
4199 $ilCtrl->getLinkTarget($this,
"updatePeerReviewComments",
"",
true,
false).
4201 $ilCtrl->setParameter($this,
"ssrtg",
"");
4208 $user_id = $ilUser->getId();
4209 $cancel_cmd =
"showOverview";
4212 $this->tabs_gui->clearTargets();
4213 $this->tabs_gui->setBackTarget($this->lng->txt(
"back"), $this->ctrl->getLinkTarget($this, $cancel_cmd));
4217 if(($user_id != $ilUser->getId() || (bool)$_GET[
"grd"]))
4219 if(!stristr($cancel_cmd,
"peer"))
4221 include_once
"Services/User/classes/class.ilUserUtil.php";
4226 if(!$this->ass->hasPeerReviewPersonalized())
4228 $a_form->setDescription($lng->txt(
"id").
": ".(int)$_GET[
"seq"]);
4232 include_once
"Services/User/classes/class.ilUserUtil.php";
4236 foreach($this->ass->getPeerReviewsByPeerId($user_id) as $item)
4238 if($item[
"giver_id"] == $ilUser->getId())
4240 $a_form->getItemByPostVar(
"comm")->setValue($item[
"pcomment"]);
4250 $files = array_shift($files);
4251 if(trim($files[
"atext"]))
4253 $text = $a_form->getItemByPostVar(
"atxt");
4259 $this->tpl->setContent($a_form->getHTML());
4275 $ilCtrl->redirect($this,
"member");
4278 $ilTabs->clearTargets();
4279 $ilTabs->setBackTarget($lng->txt(
"back"),
4280 $ilCtrl->getLinkTarget($this,
"members"));
4282 if($a_show_peer_review)
4284 $cmd =
"listTextAssignmentWithPeerReview";
4288 $cmd =
"listTextAssignment";
4290 include_once
"Modules/Exercise/classes/class.ilExAssignmentListTextTableGUI.php";
4292 $tpl->setContent($tbl->getHTML());
4298 return ($this->ass &&
4299 $this->ass->getPeerReview() &&
4300 $this->ass->getDeadline() &&
4301 $this->ass->getDeadline() < time() &&
4302 (!$this->ass->getPeerReviewDeadline() ||
4303 $this->ass->getPeerReviewDeadline() > time()));
4312 $ilCtrl->redirect($this,
"showOverview");
4317 $this->tabs_gui->clearTargets();
4318 $this->tabs_gui->setBackTarget($this->lng->txt(
"back"), $this->ctrl->getLinkTarget($this,
"showOverview"));
4320 $peer_items = $this->ass->getPeerReviewsByGiver($ilUser->getId());
4321 if(!
sizeof($peer_items))
4324 $ilCtrl->redirect($this,
"showOverview");
4330 $dl = $this->ass->getPeerReviewDeadline();
4331 if(!$dl || $dl < time())
4333 ilUtil::sendInfo(sprintf($this->lng->txt(
"exc_peer_review_missing_info"), $missing));
4337 ilUtil::sendInfo(sprintf($this->lng->txt(
"exc_peer_review_missing_info_deadline"), $missing,
4342 $tpl->addJavaScript(
"Modules/Exercise/js/ilExcPeerReview.js");
4343 $tpl->addOnLoadCode(
"il.ExcPeerReview.setAjax('".
4344 $ilCtrl->getLinkTarget($this,
"updatePeerReviewComments",
"",
true,
false).
4347 include_once
"Modules/Exercise/classes/class.ilExAssignmentPeerReviewTableGUI.php";
4350 $tpl->setContent($tbl->getHTML());
4360 $ilCtrl->redirect($this,
"showOverview");
4365 $peer_items = $this->ass->getPeerReviewsByGiver($ilUser->getId());
4366 if(!
sizeof($peer_items))
4369 $ilCtrl->redirect($this,
"showOverview");
4372 foreach(
$_POST[
"pc"] as $idx => $value)
4374 $parts = explode(
"__", $idx);
4375 if($parts[0] == $ilUser->getId())
4382 $ilCtrl->redirect($this,
"editPeerReview");
4391 !$ilCtrl->isAsynch())
4396 $rating_peer_id =
$_POST[
"rating_peer_id"];
4397 $giver_id = $ilUser->getId();
4400 include_once
'./Services/Rating/classes/class.ilRating.php';
4402 $rating_peer_id,
"peer", $giver_id,
$_POST[
"rating"]);
4405 foreach(
$_POST[
"pc"] as $peer_id => $value)
4416 $ilCtrl->setParameter($this->parent_obj,
"peer_id", $rating_peer_id);
4418 include_once
'./Services/Rating/classes/class.ilRatingGUI.php';
4420 $rating->setObject($this->ass->getId(),
"ass", $rating_peer_id,
"peer");
4421 $rating->setUserId($giver_id);
4425 echo $rating->getHTML(
false,
true,
4426 "il.ExcPeerReview.saveComments(".$rating_peer_id.
", %rating%)");
4430 echo
'<div id="rtr_widget">'.$rating->getHTML(
false,
true,
4431 "il.ExcPeerReview.saveSingleRating(".$rating_peer_id.
", %rating%)").
'</div>';
4434 echo $tpl->getOnLoadCodeForAsynch();
4445 $ilCtrl->redirect($this,
"editPeerReview");
4451 $ilCtrl->redirect($this,
"editPeerReview");
4459 !$this->ass->getPeerReview() ||
4460 !$this->ass->hasPeerReviewFileUpload() ||
4464 $ilCtrl->redirect($this,
"showOverview");
4467 $parts = explode(
"__",
$_GET[
"fu"]);
4468 $giver_id = $parts[0];
4469 $peer_id = $parts[1];
4471 if($giver_id == $ilUser->getId() ||
4472 $peer_id == $ilUser->getId())
4481 $peer_items = $this->ass->getPeerReviewsByPeerId($peer_id,
true);
4482 if(
sizeof($peer_items))
4484 foreach($peer_items as $item)
4486 if($item[
"giver_id"] == $giver_id)
4488 $files = $this->ass->getPeerUploadFiles($peer_id, $giver_id);
4489 foreach($files as
$file)
4491 if(md5($file) == trim(
$_GET[
"fuf"]))
4501 $ilCtrl->redirect($this,
"showOverview");
4509 !$this->ass->getPeerReview() ||
4510 !$this->ass->getDeadline() ||
4511 $this->ass->getDeadline()-time() > 0)
4513 $ilCtrl->redirect($this,
"showOverview");
4517 if((
int)
$_GET[
"grd"])
4521 if((
int)$_GET[
"grd"] == 1)
4523 $user_id = (int)$_GET[
"member_id"];
4524 $cancel_cmd =
"members";
4528 $user_id = (int)$_GET[
"part_id"];
4529 $cancel_cmd =
"showParticipant";
4537 $user_id = $ilUser->getId();
4538 $cancel_cmd =
"showOverview";
4541 $this->tabs_gui->clearTargets();
4542 $this->tabs_gui->setBackTarget($this->lng->txt(
"back"), $this->ctrl->getLinkTarget($this, $cancel_cmd));
4544 $peer_items = $this->ass->getPeerReviewsByPeerId($user_id,
true);
4545 if(!
sizeof($peer_items))
4549 $ilCtrl->redirect($this,
"showOverview");
4552 include_once
"Modules/Exercise/classes/class.ilExAssignmentPeerReviewTableGUI.php";
4554 $this->ass, $user_id, $peer_items,
"exc_peer_review_show", $cancel_cmd,
true);
4556 $tpl->setContent($tbl->getHTML());
4564 !$this->ass->getPeerReview())
4566 $ilCtrl->redirect($this,
"showOverview");
4571 $ilTabs->clearTargets();
4572 $ilTabs->setBackTarget($this->lng->txt(
"back"),
4573 $ilCtrl->getLinkTarget($this,
"listAssignments"));
4575 include_once
"Modules/Exercise/classes/class.ilExAssignmentPeerReviewOverviewTableGUI.php";
4580 $panel_data = $tbl->getPanelInfo();
4581 if(
sizeof($panel_data))
4583 $ptpl =
new ilTemplate(
"tpl.exc_peer_review_overview_panel.html",
true,
true,
"Modules/Exercise");
4584 foreach($panel_data as $item)
4586 $ptpl->setCurrentBlock(
"user_bl");
4587 foreach($item[
"value"] as $user)
4589 $ptpl->setVariable(
"USER", $user);
4590 $ptpl->parseCurrentBlock();
4593 $ptpl->setCurrentBlock(
"item_bl");
4594 $ptpl->setVariable(
"TITLE", $item[
"title"]);
4595 $ptpl->parseCurrentBlock();
4598 include_once
"Services/UIComponent/Panel/classes/class.ilPanelGUI.php";
4600 $panel->setHeading($this->lng->txt(
"exc_peer_review_overview_invalid_users"));
4601 $panel->setBody($ptpl->get());
4602 $panel = $panel->getHTML();
4605 $tpl->setContent($tbl->getHTML().$panel);
4613 !$this->ass->getPeerReview())
4615 $ilCtrl->redirect($this,
"showOverview");
4620 $ilTabs->clearTargets();
4622 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
4624 $cgui->setFormAction($ilCtrl->getFormAction($this));
4625 $cgui->setHeaderText(sprintf($this->lng->txt(
"exc_peer_review_reset_sure"), $this->ass->getTitle()));
4626 $cgui->setCancel($this->lng->txt(
"cancel"),
"showPeerReviewOverview");
4627 $cgui->setConfirm($this->lng->txt(
"delete"),
"resetPeerReview");
4629 $tpl->setContent($cgui->getHTML());
4637 $this->ass->getPeerReview())
4640 $this->ass->resetPeerReviews();
4645 $ilCtrl->redirect($this,
"showPeerReviewOverview");
4655 !$this->ass->getFeedbackFile() ||
4656 ($needs_dl && !$this->ass->getDeadline()) ||
4657 ($needs_dl && $this->ass->getDeadline() > time()) ||
4660 $ilCtrl->redirect($this,
"showOverview");
4674 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
4676 $form->addCommandButton(
"uploadMultiFeedback", $lng->txt(
"upload"));
4677 $form->addCommandButton(
"members", $lng->txt(
"cancel"));
4680 $fi =
new ilFileInputGUI($lng->txt(
"exc_multi_feedback_file"),
"mfzip");
4682 $fi->setRequired(
true);
4683 $form->addItem($fi);
4686 $form->setFormAction($this->ctrl->getFormAction($this,
"uploadMultiFeedback"));
4699 global $ilTabs, $ilToolbar,
$lng,
$tpl;
4701 $ass_id = (int)
$_GET[
"ass_id"];
4705 $ilTabs->activateTab(
"grades");
4710 include_once(
"./Services/UIComponent/Button/classes/class.ilLinkButton.php");
4712 $button->setCaption(
"exc_download_zip_structure");
4713 $button->setUrl($this->ctrl->getLinkTarget($this,
"downloadMultiFeedbackZip"));
4714 $button->setOmitPreventDoubleSubmission(
true);
4715 $ilToolbar->addButtonInstance($button);
4722 $tpl->setContent($a_form->getHTML());
4731 $ass->sendMultiFeedbackStructureFile($this->
object);
4739 $ass_id = (int)
$_GET[
"ass_id"];
4743 if($form->checkInput())
4749 $this->ctrl->redirect($this,
"showMultiFeedbackConfirmationTable");
4754 $this->ctrl->redirect($this,
"showMultiFeedback");
4758 $form->setValuesByPost();
4770 global $ilTabs,
$tpl;
4772 $ilTabs->activateTab(
"grades");
4777 include_once(
"./Modules/Exercise/classes/class.ilFeedbackConfirmationTable2GUI.php");
4779 $tpl->setContent(
$tab->getHTML());
4789 $ass->clearMultiFeedbackDirectory();
4791 $this->ctrl->redirect($this,
"members");
4801 $ass->saveMultiFeedbackFiles(
$_POST[
"file"]);
4804 $this->ctrl->redirect($this,
"members");
4814 $res = array(
"result"=>
false);
4816 if($this->ctrl->isAsynch())
4818 $ass_id = (int)
$_POST[
"ass_id"];
4819 $user_id = (int)
$_POST[
"mem_id"];
4822 if($ass_id && $user_id)
4824 include_once
"Modules/Exercise/classes/class.ilExAssignment.php";
4829 $team_id = $this->ass->getTeamId($user_id);
4830 $user_ids = $this->ass->getTeamMembers($team_id);
4834 $user_ids = array($user_id);
4838 $all_members = $all_members->getMembers();
4840 $reci_ids = array();
4841 foreach($user_ids as $user_id)
4843 if(in_array($user_id, $all_members))
4850 $reci_ids[] = $user_id;
4855 if(
sizeof($reci_ids))
4858 $this->
object->sendFeedbackFileNotification(null, $reci_ids,
4866 echo(json_encode(
$res));
4876 if($this->ass->getDeadline() == 0 ||
4877 mktime() < $this->ass->getDeadline())
4882 $ilTabs->activateTab(
"content");
4885 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
4887 $form->setTitle($lng->txt(
"exc_team_assignment_adopt_user"));
4888 $form->setFormAction($ilCtrl->getFormAction($this,
"createAdoptedTeam"));
4894 $teams->addOption(
new ilRadioOption($lng->txt(
"exc_team_assignment_adopt_none_user"), -1));
4898 include_once
"Services/User/classes/class.ilUserUtil.php";
4903 foreach($item[
"user_team"] as $user_id)
4907 if(array_key_exists($user_id, $current_map))
4909 $members[$user_id] .=
" (".$lng->txt(
"exc_team_assignment_adopt_already_assigned").
")";
4917 $members = implode(
"<br />", $members);
4919 $option->setInfo($members);
4922 $option->setDisabled(
true);
4924 $teams->addOption($option);
4927 $form->addItem($teams);
4929 $form->addCommandButton(
"createAdoptedTeam", $lng->txt(
"save"));
4930 $form->addCommandButton(
"showOverview", $lng->txt(
"cancel"));
4932 $tpl->setContent($form->getHTML());
4936 $this->ass->getTeamId($ilUser->getId(),
true);
4939 if (!$this->object->members_obj->isAssigned($ilUser->getId()))
4941 $this->
object->members_obj->assignMember($ilUser->getId());
4947 $ilCtrl->redirect($this,
"showOverview");
4956 if($this->ass->getDeadline() == 0 ||
4957 mktime() < $this->ass->getDeadline())
4959 $src_ass_id = (int)
$_POST[
"ass_adpt"];
4962 $this->ass->adoptTeams($src_ass_id, $ilUser->getId(),
$this->ref_id);
4966 $this->ass->getTeamId($ilUser->getId(),
true);
4972 $ilCtrl->redirect($this,
"showOverview");
4983 $ilCtrl->redirect($this,
"listAssignments");
4986 $ilTabs->activateTab(
"content");
4989 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
4991 $form->setTitle($lng->txt(
"exc_team_assignment_adopt"));
4992 $form->setFormAction($ilCtrl->getFormAction($this,
"adoptTeamAssignments"));
4997 if(array_key_exists($this->ass->getId(),
$options))
4999 $ilCtrl->redirect($this,
"listAssignments");
5005 $teams->addOption(
new ilRadioOption($lng->txt(
"exc_team_assignment_adopt_none"), -1));
5010 $option->setInfo($lng->txt(
"exc_team_assignment_adopt_teams").
": ".$item[
"teams"]);
5011 $teams->addOption($option);
5014 $form->addItem($teams);
5016 $form->addCommandButton(
"adoptTeamAssignments", $lng->txt(
"save"));
5017 $form->addCommandButton(
"listAssignments", $lng->txt(
"cancel"));
5019 $tpl->setContent($form->getHTML());
5028 $src_ass_id = (int)
$_POST[
"ass_adpt"];
5030 if($this->ass && $src_ass_id > 0)
5033 $this->ass->adoptTeams($src_ass_id);
5038 $ilCtrl->redirect($this,
"listAssignments");