/** * Get current values for assignment from * */ public function getAssignmentValues() { $values = array(); $ass = new ilExAssignment($_GET["ass_id"]); $values["title"] = $ass->getTitle(); if ($ass->getStartTime() > 0) { $values["start_time_cb"] = true; } $values["mandatory"] = $ass->getMandatory(); $values["instruction"] = $ass->getInstruction(); $values["type"] = $ass->getType(); if ($ass->getDeadline() > 0) { $values["deadline_cb"] = true; } if ($this->ass->getType() == ilExAssignment::TYPE_UPLOAD_TEAM) { $this->form->removeItemByPostVar("peer"); $this->form->removeItemByPostVar("peer_min"); $this->form->removeItemByPostVar("peer_dl"); } else { $values["peer"] = $ass->getPeerReview(); $values["peer_min"] = $ass->getPeerReviewMin(); $values["peer_file"] = $ass->hasPeerReviewFileUpload(); $values["peer_prsl"] = $ass->hasPeerReviewPersonalized(); if ($ass->getPeerReviewDeadline() > 0) { $values["peer_dl_tgl"] = true; $peer_dl_date = new ilDateTime($ass->getPeerReviewDeadline(), IL_CAL_UNIX); $peer_dl = $this->form->getItemByPostVar("peer_dl"); $peer_dl->setDate($peer_dl_date); } // #14450 if ($values["peer"] && $ass->hasPeerReviewGroups()) { $this->form->getItemByPostVar("deadline_cb")->setDisabled(true); $this->form->getItemByPostVar("deadline")->setDisabled(true); $this->form->getItemByPostVar("peer")->setDisabled(true); $this->form->getItemByPostVar("peer_min")->setDisabled(true); $this->form->getItemByPostVar("peer_dl")->setDisabled(true); $this->form->getItemByPostVar("peer_file")->setDisabled(true); $this->form->getItemByPostVar("peer_prsl")->setDisabled(true); } } $this->form->setValuesByArray($values); if ($ass->getDeadline() > 0) { $edit_date = new ilDateTime($ass->getDeadline(), IL_CAL_UNIX); $ed_item = $this->form->getItemByPostVar("deadline"); $ed_item->setDate($edit_date); } if ($ass->getStartTime() > 0) { $edit_date = new ilDateTime($ass->getStartTime(), IL_CAL_UNIX); $ed_item = $this->form->getItemByPostVar("start_time"); $ed_item->setDate($edit_date); } if ($ass->getFeedbackFile()) { $this->form->getItemByPostVar("fb")->setChecked(true); $this->form->getItemByPostVar("fb_file")->setValue(basename($ass->getFeedbackFilePath())); } $this->form->getItemByPostVar("fb_cron")->setChecked($ass->hasFeedbackCron()); $this->form->getItemByPostVar("fb_date")->setValue($ass->getFeedbackDate()); // if there are any submissions we cannot change type anymore if (sizeof(ilExAssignment::getAllDeliveredFiles($this->object->getId(), $ass->getId())) || $this->ass->getType() == ilExAssignment::TYPE_UPLOAD_TEAM) { $this->form->getItemByPostVar("type")->setDisabled(true); } }
protected function handleDisabledAssignmentFields(ilExAssignment $a_ass, ilPropertyFormGUI $a_form) { // potentially disabled elements are initialized here to re-use this // method after setValuesByPost() - see updateAssignmentObject() // if there are any submissions we cannot change type anymore if (sizeof(ilExAssignment::getAllDeliveredFiles($this->object->getId(), $a_ass->getId())) || $a_ass->getType() == ilExAssignment::TYPE_UPLOAD_TEAM) { $a_form->getItemByPostVar("type")->setDisabled(true); } if ($a_ass->getDeadline() > 0) { $a_form->getItemByPostVar("deadline_cb")->setChecked(true); $edit_date = new ilDateTime($a_ass->getDeadline(), IL_CAL_UNIX); $ed_item = $a_form->getItemByPostVar("deadline"); $ed_item->setDate($edit_date); } // team assignments do not support peer review if ($a_ass->getType() == ilExAssignment::TYPE_UPLOAD_TEAM) { return; } $a_form->getItemByPostVar("peer")->setChecked($a_ass->getPeerReview()); $a_form->getItemByPostVar("peer_min")->setValue($a_ass->getPeerReviewMin()); $a_form->getItemByPostVar("peer_file")->setChecked($a_ass->hasPeerReviewFileUpload()); $a_form->getItemByPostVar("peer_prsl")->setChecked($a_ass->hasPeerReviewPersonalized()); // with no active peer review there is nothing to protect if (!$a_ass->getPeerReview()) { return; } // #14450 if ($a_ass->hasPeerReviewGroups()) { // deadline(s) are past and must not change $a_form->getItemByPostVar("deadline_cb")->setDisabled(true); $a_form->getItemByPostVar("deadline")->setDisabled(true); // JourFixe, 2015-05-11 - editable again // $a_form->getItemByPostVar("peer_dl")->setDisabled(true); $a_form->getItemByPostVar("peer")->setDisabled(true); $a_form->getItemByPostVar("peer_min")->setDisabled(true); $a_form->getItemByPostVar("peer_file")->setDisabled(true); $a_form->getItemByPostVar("peer_prsl")->setDisabled(true); } }
/** * Get current values for assignment from * */ public function getAssignmentValues() { $values = array(); $ass = new ilExAssignment($_GET["ass_id"]); $values["title"] = $ass->getTitle(); if ($ass->getStartTime() > 0) { $values["start_time_cb"] = true; } $values["mandatory"] = $ass->getMandatory(); $values["instruction"] = $ass->getInstruction(); $values["type"] = $ass->getType(); if ($ass->getDeadline() > 0) { $values["deadline_cb"] = true; } $this->form->setValuesByArray($values); if ($ass->getDeadline() > 0) { $edit_date = new ilDateTime($ass->getDeadline(), IL_CAL_UNIX); $ed_item = $this->form->getItemByPostVar("deadline"); $ed_item->setDate($edit_date); } if ($ass->getStartTime() > 0) { $edit_date = new ilDateTime($ass->getStartTime(), IL_CAL_UNIX); $ed_item = $this->form->getItemByPostVar("start_time"); $ed_item->setDate($edit_date); } // if there are any submissions we cannot change type anymore if (sizeof(ilExAssignment::getAllDeliveredFiles($this->object->getId(), $ass->getId()))) { $this->form->getItemByPostVar("type")->setDisabled(true); } }
/** * was: downloadSelectedFiles($array_file_id,$a_user_id)? */ function downloadSelectedFiles($a_exc_id, $a_ass_id, $a_user_id, $array_file_id) { global $ilDB; if (count($array_file_id)) { // #11785 $is_team = true; $user_ids = self::getTeamMembersByAssignmentId($a_ass_id, $a_user_id); if (!$user_ids) { $is_team = false; $user_ids = array($a_user_id); } $result = $ilDB->query("SELECT * FROM exc_returned WHERE " . $ilDB->in("returned_id", $array_file_id, false, "integer") . " AND " . $ilDB->in("user_id", $user_ids, "", "integer")); if ($ilDB->numRows($result)) { $array_found = array(); while ($row = $ilDB->fetchAssoc($result)) { $row["timestamp"] = $row["ts"]; array_push($array_found, $row); } if (count($array_found) == 1) { // blog/portfolio submission if (is_numeric($array_found[0]["filetitle"])) { $ass = new ilExAssignment($array_found[0]["ass_id"]); if ($ass->getType() == ilExAssignment::TYPE_BLOG || $ass->getType() == ilExAssignment::TYPE_PORTFOLIO) { $user_data = ilObjUser::_lookupName($array_found[0]["user_id"]); $array_found[0]["filetitle"] = ilObject::_lookupTitle($array_found[0]["obj_id"]) . " - " . $ass->getTitle() . " - " . $user_data["firstname"] . " " . $user_data["lastname"] . " (" . $user_data["login"] . ").zip"; } } ilExAssignment::downloadSingleFile($a_exc_id, $a_ass_id, $array_found[0]["user_id"], $array_found[0]["filename"], $array_found[0]["filetitle"]); } else { $filenames = array(); foreach ($array_found as $value) { $filenames[$value["user_id"]][] = basename($value["filename"]); } ilExAssignment::downloadMultipleFiles($a_exc_id, $a_ass_id, $filenames, $is_team ? null : $a_user_id, $is_team); } } } }
protected function createPortfolioFromTemplateProcess($a_process_form = true) { global $ilSetting, $ilUser, $ilAccess; $title = trim($_REQUEST["pt"]); $prtt_id = (int) $_REQUEST["prtt"]; // valid template? include_once "Modules/Portfolio/classes/class.ilObjPortfolioTemplate.php"; $templates = array_keys(ilObjPortfolioTemplate::getAvailablePortfolioTemplates()); if (!sizeof($templates) || !in_array($prtt_id, $templates)) { $this->toRepository(); } unset($templates); // build page recipe (aka import form values) $recipe = null; if ($a_process_form) { $this->ctrl->setParameter($this, "prtt", $prtt_id); $form = $this->initCreatePortfolioFromTemplateForm($prtt_id, $title); if ($form->checkInput()) { include_once "Modules/Portfolio/classes/class.ilPortfolioTemplatePage.php"; foreach (ilPortfolioTemplatePage::getAllPages($prtt_id) as $page) { switch ($page["type"]) { case ilPortfolioTemplatePage::TYPE_BLOG_TEMPLATE: if (!$ilSetting->get('disable_wsp_blogs')) { $field_id = "blog_" . $page["id"]; switch ($form->getInput($field_id)) { case "blog_create": $recipe[$page["id"]] = array("blog", "create", trim($form->getInput($field_id . "_create_title"))); break; case "blog_resuse": $recipe[$page["id"]] = array("blog", "reuse", (int) $form->getInput($field_id . "_reuse_blog")); break; case "blog_ignore": $recipe[$page["id"]] = array("blog", "ignore"); break; } } break; } } $recipe["skills"] = (array) $form->getInput("skill_ids"); } else { $form->setValuesByPost(); return $this->createPortfolioFromTemplate($form); } } $source = new ilObjPortfolioTemplate($prtt_id, false); // create portfolio include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php"; $target = new ilObjPortfolio(); $target->setTitle($title); $target->create(); $target_id = $target->getId(); $source->clonePagesAndSettings($source, $target, $recipe); // link portfolio to exercise assignment $exc_ref_id = (int) $_REQUEST["exc_id"]; $ass_id = (int) $_REQUEST["ass_id"]; if ($exc_ref_id && $ass_id && $ilAccess->checkAccess("read", "", $exc_ref_id)) { include_once "Modules/Exercise/classes/class.ilObjExercise.php"; include_once "Modules/Exercise/classes/class.ilExAssignment.php"; $exc = new ilObjExercise($exc_ref_id); $ass = new ilExAssignment($ass_id); if ($ass->getExerciseId() == $exc->getId() && $ass->getType() == ilExAssignment::TYPE_PORTFOLIO) { $exc->addResourceObject($target_id, $ass_id, $ilUser->getId()); } } ilUtil::sendSuccess($this->lng->txt("prtf_portfolio_created"), true); $this->ctrl->setParameter($this, "prt_id", $target_id); $this->ctrl->redirect($this, "view"); }