Ejemplo n.º 1
0
 protected function getItems()
 {
     global $ilUser;
     include_once "Modules/Portfolio/classes/class.ilPortfolioAccessHandler.php";
     $access_handler = new ilPortfolioAccessHandler();
     include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
     $data = ilObjPortfolio::getPortfoliosOfUser($this->user_id);
     $this->shared_objects = $access_handler->getObjectsIShare(false);
     $this->setData($data);
 }
 protected function getItems()
 {
     global $ilUser;
     include_once "Services/Portfolio/classes/class.ilPortfolioAccessHandler.php";
     $access_handler = new ilPortfolioAccessHandler();
     include_once "Services/Portfolio/classes/class.ilObjPortfolio.php";
     $data = ilObjPortfolio::getPortfoliosOfUser($this->user_id);
     // remove all portfolios which are not shared
     if ($this->shared) {
         $other = $access_handler->getSharedObjects($this->user_id);
         foreach ($data as $idx => $item) {
             if (!in_array($item["id"], $other)) {
                 unset($data[$idx]);
             } else {
                 // #9848: flag if current share access is password-protected
                 $perms = $access_handler->getPermissions($item["id"]);
                 $data[$idx]["password"] = !in_array($ilUser->getId(), $perms) && !in_array(ilWorkspaceAccessGUI::PERMISSION_REGISTERED, $perms) && !in_array(ilWorkspaceAccessGUI::PERMISSION_ALL, $perms) && in_array(ilWorkspaceAccessGUI::PERMISSION_ALL_PASSWORD, $perms);
             }
         }
     } else {
         $this->shared_objects = $access_handler->getObjectsIShare();
     }
     $this->setData($data);
 }
 /**
  * Check if current profile portfolio is accessible
  * 
  * @return int
  */
 protected function getProfilePortfolio()
 {
     include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
     $portfolio_id = ilObjPortfolio::getDefaultPortfolio($this->getUserId());
     if ($portfolio_id) {
         include_once './Modules/Portfolio/classes/class.ilPortfolioAccessHandler.php';
         $access_handler = new ilPortfolioAccessHandler();
         if ($access_handler->checkAccess("read", "", $portfolio_id)) {
             return $portfolio_id;
         }
     }
 }
 protected function setDefault($a_prtf_id)
 {
     global $ilCtrl, $lng, $ilUser;
     if ($a_prtf_id && $this->checkAccess("write")) {
         // #12845
         if ($this->access_handler->hasGlobalPermission($a_prtf_id)) {
             $ilUser->setPref("public_profile", "g");
             $ilUser->writePrefs();
         } else {
             if ($this->access_handler->hasRegisteredPermission($a_prtf_id)) {
                 $ilUser->setPref("public_profile", "y");
                 $ilUser->writePrefs();
             } else {
                 return;
             }
         }
         ilObjPortfolio::setUserDefault($this->user_id, $a_prtf_id);
         ilUtil::sendSuccess($lng->txt("settings_saved"), true);
     }
     $ilCtrl->redirect($this, "show");
 }
Ejemplo n.º 5
0
 /**
  * @throws ilException
  */
 protected function generatePortfolio()
 {
     if ($this->getPortfolioTemplateId() < 10) {
         return false;
     }
     // Generate Portfolio from Template
     global $ilUser;
     $tmp_user = $ilUser;
     $source = new ilObjPortfolioTemplate($this->getPortfolioTemplateId(), false);
     $target = new ilObjPortfolio();
     $user = $this->getUsrObject();
     $target->setOwner($user->getId());
     $target->setTitle($this->getReplacesPortfolioTitle());
     $target->setUserDefault($user->getId());
     $target->setOnline(true);
     $target->create();
     include_once "Modules/Portfolio/classes/class.ilPortfolioTemplatePage.php";
     foreach (ilPortfolioTemplatePage::getAllPages($this->getPortfolioTemplateId()) as $page) {
         switch ($page["type"]) {
             case ilPortfolioTemplatePage::TYPE_BLOG_TEMPLATE:
                 $a_recipe[$page["id"]] = array("blog", "create", $this->getBlogName());
                 break;
         }
     }
     $GLOBALS['ilUser'] = $user;
     ilObjPortfolioTemplate::clonePagesAndSettings($source, $target, $a_recipe);
     $GLOBALS['ilUser'] = $tmp_user;
     ilObjPortfolio::setUserDefault($user->getId(), $target->getId());
     $ilPortfolioAccessHandler = new ilPortfolioAccessHandler();
     foreach ($this->getPortfolioAssignedToGroups() as $grp_obj_id) {
         if (ilObject2::_lookupType($grp_obj_id) == 'grp') {
             $ilPortfolioAccessHandler->addPermission($target->getId(), $grp_obj_id);
         }
     }
 }
 /**
  * has profile set to a portfolio?
  * 
  * @return int
  */
 protected function getProfilePortfolio()
 {
     global $ilUser, $ilSetting;
     if ($ilSetting->get('user_portfolios')) {
         include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
         return ilObjPortfolio::getDefaultPortfolio($ilUser->getId());
     }
 }
 protected function setDefault($a_prtf_id)
 {
     global $ilCtrl, $lng;
     if ($a_prtf_id && $this->checkAccess("write")) {
         ilObjPortfolio::setUserDefault($this->user_id, $a_prtf_id);
         ilUtil::sendSuccess($lng->txt("settings_saved"), true);
     }
     $ilCtrl->redirect($this, "show");
 }
Ejemplo n.º 8
0
 protected function createPortfolioObject()
 {
     global $ilUser;
     $this->checkPermission("read");
     include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
     $portfolio = new ilObjPortfolio();
     $portfolio->setTitle($this->object->getTitle() . " - " . $this->ass->getTitle());
     $portfolio->create();
     $this->object->addResourceObject($portfolio->getId(), $this->ass->getId(), $ilUser->getId());
     ilUtil::sendSuccess($this->lng->txt("exc_portfolio_created"), true);
     $this->ctrl->redirect($this, "showOverview");
 }
Ejemplo n.º 9
0
 /**
  * Get assignment body for overview
  */
 function getOverviewBody($a_data)
 {
     global $lng, $ilCtrl, $ilUser;
     $tpl = new ilTemplate("tpl.assignment_body.html", true, true, "Modules/Exercise");
     include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php";
     include_once "./Services/UIComponent/Button/classes/class.ilLinkButton.php";
     if (IS_PAYMENT_ENABLED) {
         include_once './Services/Payment/classes/class.ilPaymentObject.php';
     }
     $info = new ilInfoScreenGUI(null);
     $info->setTableClass("");
     $not_started_yet = false;
     if ($a_data["start_time"] > 0 && time() - $a_data["start_time"] <= 0) {
         $not_started_yet = true;
     }
     if (!$not_started_yet) {
         // instructions
         $info->addSection($lng->txt("exc_instruction"));
         $is_html = strlen($a_data["instruction"]) != strlen(strip_tags($a_data["instruction"]));
         if (!$is_html) {
             $a_data["instruction"] = nl2br(ilUtil::makeClickable($a_data["instruction"], true));
         }
         $info->addProperty("", $a_data["instruction"]);
     }
     // schedule
     $info->addSection($lng->txt("exc_schedule"));
     if ($a_data["start_time"] > 0) {
         $info->addProperty($lng->txt("exc_start_time"), ilDatePresentation::formatDate(new ilDateTime($a_data["start_time"], IL_CAL_UNIX)));
     }
     if ($a_data["deadline"] > 0) {
         $info->addProperty($lng->txt("exc_edit_until"), ilDatePresentation::formatDate(new ilDateTime($a_data["deadline"], IL_CAL_UNIX)));
     }
     $time_str = $this->getTimeString($a_data["deadline"]);
     if (!$not_started_yet) {
         $info->addProperty($lng->txt("exc_time_to_send"), "<b>" . $time_str . "</b>");
     }
     // public submissions
     if ($this->exc->getShowSubmissions()) {
         $ilCtrl->setParameterByClass("ilobjexercisegui", "ass_id", $a_data["id"]);
         if ($a_data["deadline"] - time() <= 0) {
             $button = ilLinkButton::getInstance();
             $button->setCaption("exc_list_submission");
             $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "listPublicSubmissions"));
             $info->addProperty($lng->txt("exc_public_submission"), $button->render());
         } else {
             $info->addProperty($lng->txt("exc_public_submission"), $lng->txt("exc_msg_public_submission"));
         }
         $ilCtrl->setParameterByClass("ilobjexercisegui", "ass_id", $_GET["ass_id"]);
     }
     $ilCtrl->setParameterByClass("ilobjexercisegui", "ass_id", $a_data["id"]);
     if (!$not_started_yet) {
         // download files
         $files = ilExAssignment::getFiles($a_data["exc_id"], $a_data["id"]);
         if (count($files) > 0) {
             $info->addSection($lng->txt("exc_files"));
             foreach ($files as $file) {
                 // if download must be purchased first show a "buy"-button
                 if (IS_PAYMENT_ENABLED && (ilPaymentObject::_isBuyable($_GET['ref_id'], 'download') && !ilPaymentObject::_hasAccess($_GET['ref_id'], '', 'download'))) {
                     $info->addProperty($file["name"], $lng->txt("buy"), $ilCtrl->getLinkTargetByClass("ilShopPurchaseGUI", "showDetails"));
                 } else {
                     $ilCtrl->setParameterByClass("ilobjexercisegui", "file", urlencode($file["name"]));
                     $info->addProperty($file["name"], $lng->txt("download"), $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "downloadFile"));
                     $ilCtrl->setParameterByClass("ilobjexercisegui", "file", "");
                 }
             }
         }
         // submission
         // if submission must be purchased first
         if (IS_PAYMENT_ENABLED && (ilPaymentObject::_isBuyable($_GET['ref_id'], 'upload') && !ilPaymentObject::_hasAccess($_GET['ref_id'], '', 'upload'))) {
             $info->addSection($lng->txt("exc_your_submission"));
             $ilCtrl->clearParameters($this);
             $ilCtrl->setParameter($this, "ref_id", $_GET['ref_id']);
             $ilCtrl->setParameter($this, 'subtype', 'upload');
             $info->addProperty($lng->txt('exc_hand_in'), $lng->txt("buy"), $ilCtrl->getLinkTargetByClass("ilShopPurchaseGUI", "showDetails"));
         } else {
             $info->addSection($lng->txt("exc_your_submission"));
             $delivered_files = ilExAssignment::getDeliveredFiles($a_data["exc_id"], $a_data["id"], $ilUser->getId());
             $times_up = false;
             if ($a_data["deadline"] > 0 && $a_data["deadline"] - time() < 0) {
                 $times_up = true;
             }
             $team_members = null;
             switch ($a_data["type"]) {
                 case ilExAssignment::TYPE_UPLOAD_TEAM:
                     $no_team_yet = false;
                     $team_members = ilExAssignment::getTeamMembersByAssignmentId($a_data["id"], $ilUser->getId());
                     if (sizeof($team_members)) {
                         $team = array();
                         foreach ($team_members as $member_id) {
                             $team[] = ilObjUser::_lookupFullname($member_id);
                         }
                         $team = implode(", ", $team);
                         $button = ilLinkButton::getInstance();
                         $button->setCaption("exc_manage_team");
                         $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "submissionScreenTeam"));
                         $team .= " " . $button->render();
                         $info->addProperty($lng->txt("exc_team_members"), $team);
                     } else {
                         $no_team_yet = true;
                         if (!$times_up) {
                             if (!sizeof($delivered_files)) {
                                 $team_info = $lng->txt("exc_no_team_yet_notice");
                             } else {
                                 $team_info = '<span class="warning">' . $lng->txt("exc_no_team_yet_notice") . '</span>';
                             }
                             $button = ilLinkButton::getInstance();
                             $button->setPrimary(true);
                             $button->setCaption("exc_create_team");
                             $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "createTeam"));
                             $team_info .= " " . $button->render();
                             $team_info .= '<div class="ilFormInfo">' . $lng->txt("exc_no_team_yet_info") . '</div>';
                         } else {
                             $team_info = '<span class="warning">' . $lng->txt("exc_create_team_times_up_warning") . '</span>';
                         }
                         $info->addProperty($lng->txt("exc_team_members"), $team_info);
                     }
                     // fallthrough
                 // fallthrough
                 case ilExAssignment::TYPE_UPLOAD:
                     $titles = array();
                     foreach ($delivered_files as $file) {
                         $titles[] = $file["filetitle"];
                     }
                     $files_str = implode($titles, ", ");
                     if ($files_str == "") {
                         $files_str = $lng->txt("message_no_delivered_files");
                     }
                     // no team == no submission
                     if (!$no_team_yet) {
                         $ilCtrl->setParameterByClass("ilobjexercisegui", "ass_id", $a_data["id"]);
                         if (!$times_up) {
                             $title = count($titles) == 0 ? $lng->txt("exc_hand_in") : $lng->txt("exc_edit_submission");
                             $button = ilLinkButton::getInstance();
                             $button->setPrimary(true);
                             $button->setCaption($title, false);
                             $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "submissionScreen"));
                             $files_str .= " " . $button->render();
                         } else {
                             if (count($titles) > 0) {
                                 $button = ilLinkButton::getInstance();
                                 $button->setCaption("already_delivered_files");
                                 $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "submissionScreen"));
                                 $files_str .= " " . $button->render();
                             }
                         }
                     }
                     $info->addProperty($lng->txt("exc_files_returned"), $files_str);
                     break;
                 case ilExAssignment::TYPE_BLOG:
                     include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
                     $wsp_tree = new ilWorkspaceTree($ilUser->getId());
                     // #12939
                     if (!$wsp_tree->getRootId()) {
                         $wsp_tree->createTreeForUser($ilUser->getId());
                     }
                     $files_str = "";
                     $valid_blog = false;
                     if (sizeof($delivered_files)) {
                         $delivered_files = array_pop($delivered_files);
                         $blog_id = (int) $delivered_files["filetitle"];
                         $node = $wsp_tree->getNodeData($blog_id);
                         if ($node["title"]) {
                             // #10116
                             $ilCtrl->setParameterByClass("ilobjbloggui", "wsp_id", $blog_id);
                             $blog_link = $ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilpersonalworkspacegui", "ilobjbloggui"), "");
                             $ilCtrl->setParameterByClass("ilobjbloggui", "wsp_id", "");
                             $files_str = '<a href="' . $blog_link . '">' . $node["title"] . '</a>';
                             $valid_blog = true;
                         } else {
                             if (substr($delivered_files["filename"], -1) == "/") {
                                 $this->exc->deleteResourceObject($delivered_files["ass_id"], $ilUser->getId(), $delivered_files["returned_id"]);
                             }
                         }
                     }
                     if (!$times_up) {
                         if (!$valid_blog) {
                             $button = ilLinkButton::getInstance();
                             $button->setCaption("exc_create_blog");
                             $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "createBlog"));
                             $files_str .= $button->render();
                         }
                         // #10462
                         $blogs = sizeof($wsp_tree->getObjectsFromType("blog"));
                         if (!$valid_blog && $blogs || $valid_blog && $blogs > 1) {
                             $button = ilLinkButton::getInstance();
                             $button->setCaption("exc_select_blog" . ($valid_blog ? "_change" : ""));
                             $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "selectBlog"));
                             $files_str .= " " . $button->render();
                         }
                     }
                     if ($files_str) {
                         $info->addProperty($lng->txt("exc_blog_returned"), $files_str);
                     }
                     if ($delivered_files && substr($delivered_files["filename"], -1) != "/") {
                         $ilCtrl->setParameterByClass("ilobjexercisegui", "delivered", $delivered_files["returned_id"]);
                         $dl_link = $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "download");
                         $ilCtrl->setParameterByClass("ilobjexercisegui", "delivered", "");
                         $button = ilLinkButton::getInstance();
                         $button->setCaption("download");
                         $button->setUrl($dl_link);
                         $info->addProperty($lng->txt("exc_files_returned"), $button->render());
                     }
                     break;
                 case ilExAssignment::TYPE_PORTFOLIO:
                     include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
                     $files_str = "";
                     $valid_prtf = false;
                     if (sizeof($delivered_files)) {
                         $delivered_files = array_pop($delivered_files);
                         $portfolio_id = (int) $delivered_files["filetitle"];
                         // #11746
                         if (ilObject::_exists($portfolio_id, false, "prtf")) {
                             $portfolio = new ilObjPortfolio($portfolio_id, false);
                             if ($portfolio->getTitle()) {
                                 // #10116 / #12791
                                 $ilCtrl->setParameterByClass("ilobjportfoliogui", "prt_id", $portfolio_id);
                                 $prtf_link = $ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilportfoliorepositorygui", "ilobjportfoliogui"), "view");
                                 $ilCtrl->setParameterByClass("ilobjportfoliogui", "prt_id", "");
                                 $files_str = '<a href="' . $prtf_link . '">' . $portfolio->getTitle() . '</a>';
                                 $valid_prtf = true;
                             }
                         } else {
                             if (substr($delivered_files["filename"], -1) == "/") {
                                 $this->exc->deleteResourceObject($delivered_files["ass_id"], $ilUser->getId(), $delivered_files["returned_id"]);
                             }
                         }
                     }
                     if (!$times_up) {
                         if (!$valid_prtf) {
                             // if there are portfolio templates available show form first
                             include_once "Modules/Portfolio/classes/class.ilObjPortfolioTemplate.php";
                             $has_prtt = sizeof(ilObjPortfolioTemplate::getAvailablePortfolioTemplates()) ? "Template" : "";
                             $button = ilLinkButton::getInstance();
                             $button->setCaption("exc_create_portfolio");
                             $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "createPortfolio" . $has_prtt));
                             $files_str .= $button->render();
                         }
                         // #10462
                         $prtfs = sizeof(ilObjPortfolio::getPortfoliosOfUser($ilUser->getId()));
                         if (!$valid_prtf && $prtfs || $valid_prtf && $prtfs > 1) {
                             $button = ilLinkButton::getInstance();
                             $button->setCaption("exc_select_portfolio" . ($valid_prtf ? "_change" : ""));
                             $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "selectPortfolio"));
                             $files_str .= " " . $button->render();
                         }
                     }
                     if ($files_str) {
                         $info->addProperty($lng->txt("exc_portfolio_returned"), $files_str);
                     }
                     if ($delivered_files && substr($delivered_files["filename"], -1) != "/") {
                         $ilCtrl->setParameterByClass("ilobjexercisegui", "delivered", $delivered_files["returned_id"]);
                         $dl_link = $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "download");
                         $ilCtrl->setParameterByClass("ilobjexercisegui", "delivered", "");
                         $button = ilLinkButton::getInstance();
                         $button->setCaption("download");
                         $button->setUrl($dl_link);
                         $info->addProperty($lng->txt("exc_files_returned"), $button->render());
                     }
                     break;
                 case ilExAssignment::TYPE_TEXT:
                     $ilCtrl->setParameterByClass("ilobjexercisegui", "ass_id", $a_data["id"]);
                     if (!$times_up) {
                         $button = ilLinkButton::getInstance();
                         $button->setPrimary(true);
                         $button->setCaption("exc_text_assignment_edit");
                         $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "editAssignmentText"));
                         $files_str = $button->render();
                     } else {
                         $button = ilLinkButton::getInstance();
                         $button->setCaption("exc_text_assignment_show");
                         $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "showAssignmentText"));
                         $files_str = $button->render();
                     }
                     $info->addProperty($lng->txt("exc_files_returned_text"), $files_str);
                     break;
             }
             $last_sub = ilExAssignment::getLastSubmission($a_data["id"], $ilUser->getId());
             if ($last_sub) {
                 $last_sub = ilDatePresentation::formatDate(new ilDateTime($last_sub, IL_CAL_DATETIME));
             } else {
                 $last_sub = "---";
             }
             if ($last_sub != "---") {
                 $info->addProperty($lng->txt("exc_last_submission"), $last_sub);
             }
             // peer feedback
             if ($times_up && $a_data["peer"]) {
                 $nr_missing_fb = ilExAssignment::getNumberOfMissingFeedbacks($a_data["id"], $a_data["peer_min"]);
                 if (!$a_data["peer_dl"] || $a_data["peer_dl"] > time()) {
                     $dl_info = "";
                     if ($a_data["peer_dl"]) {
                         $dl_info = " (" . sprintf($lng->txt("exc_peer_review_deadline_info_button"), ilDatePresentation::formatDate(new ilDateTime($a_data["peer_dl"], IL_CAL_UNIX))) . ")";
                     }
                     $button = ilLinkButton::getInstance();
                     $button->setPrimary($nr_missing_fb);
                     $button->setCaption($lng->txt("exc_peer_review_give") . $dl_info, false);
                     $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "editPeerReview"));
                     $edit_pc = $button->render();
                 } else {
                     if ($a_data["peer_dl"]) {
                         $edit_pc = $lng->txt("exc_peer_review_deadline_reached");
                     }
                 }
                 if ((!$a_data["peer_dl"] || $a_data["peer_dl"] < time()) && !$nr_missing_fb) {
                     $button = ilLinkButton::getInstance();
                     $button->setCaption("exc_peer_review_show");
                     $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "showPersonalPeerReview"));
                     $view_pc = $button->render();
                 }
                 /*
                 else 
                 {
                 	$view_pc = $lng->txt("exc_peer_review_show_not_rated_yet");
                 }
                 */
                 $info->addProperty($lng->txt("exc_peer_review"), $edit_pc . " " . $view_pc);
             }
             // feedback from tutor
             if ($a_data["type"] == ilExAssignment::TYPE_UPLOAD_TEAM) {
                 $feedback_id = "t" . ilExAssignment::getTeamIdByAssignment($a_data["id"], $ilUser->getId());
             } else {
                 $feedback_id = $ilUser->getId();
             }
             // global feedback / sample solution
             if ($a_data["fb_date"] == ilExAssignment::FEEDBACK_DATE_DEADLINE) {
                 $show_global_feedback = $times_up && $a_data["fb_file"];
             } else {
                 $show_global_feedback = $last_sub != "---" && $a_data["fb_file"];
             }
             $storage = new ilFSStorageExercise($a_data["exc_id"], $a_data["id"]);
             $cnt_files = $storage->countFeedbackFiles($feedback_id);
             $lpcomment = ilExAssignment::lookupCommentForUser($a_data["id"], $ilUser->getId());
             $mark = ilExAssignment::lookupMarkOfUser($a_data["id"], $ilUser->getId());
             $status = ilExAssignment::lookupStatusOfUser($a_data["id"], $ilUser->getId());
             if ($lpcomment != "" || $mark != "" || $status != "notgraded" || $cnt_files > 0 || $show_global_feedback) {
                 $info->addSection($lng->txt("exc_feedback_from_tutor"));
                 if ($lpcomment != "") {
                     $info->addProperty($lng->txt("exc_comment"), $lpcomment);
                 }
                 if ($mark != "") {
                     $info->addProperty($lng->txt("exc_mark"), $mark);
                 }
                 if ($status == "") {
                     //				  $info->addProperty($lng->txt("status"),
                     //						$lng->txt("message_no_delivered_files"));
                 } else {
                     if ($status != "notgraded") {
                         $img = '<img src="' . ilUtil::getImagePath("scorm/" . $status . ".svg") . '" ' . ' alt="' . $lng->txt("exc_" . $status) . '" title="' . $lng->txt("exc_" . $status) . '" />';
                         $info->addProperty($lng->txt("status"), $img . " " . $lng->txt("exc_" . $status));
                     }
                 }
                 if ($cnt_files > 0) {
                     $info->addSection($lng->txt("exc_fb_files") . '<a name="fb' . $a_data["id"] . '"></a>');
                     if ($cnt_files > 0) {
                         $files = $storage->getFeedbackFiles($feedback_id);
                         foreach ($files as $file) {
                             $ilCtrl->setParameterByClass("ilobjexercisegui", "file", urlencode($file));
                             $info->addProperty($file, $lng->txt("download"), $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "downloadFeedbackFile"));
                             $ilCtrl->setParameterByClass("ilobjexercisegui", "file", "");
                         }
                     }
                 }
                 // #15002 - global feedback
                 if ($show_global_feedback) {
                     $info->addSection($lng->txt("exc_global_feedback_file"));
                     $info->addProperty($a_data["fb_file"], $lng->txt("download"), $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "downloadGlobalFeedbackFile"));
                 }
             }
         }
     }
     $tpl->setVariable("CONTENT", $info->getHTML());
     return $tpl->get();
 }
 function copyPage()
 {
     $form = $this->initCopyPageForm();
     if ($form->checkInput()) {
         // existing
         if ($form->getInput("target") == "old") {
             $portfolio_id = $form->getInput("prtf");
         } else {
             $portfolio = new ilObjPortfolio();
             $portfolio->setTitle($form->getInput("title"));
             $portfolio->create();
             $portfolio_id = $portfolio->getId();
         }
         // copy page(s)
         foreach ($_POST["prtf_pages"] as $page_id) {
             $source = $this->getPageInstance($page_id);
             $target = $this->getPageInstance(null, $portfolio_id);
             $target->setXMLContent($source->copyXmlContent(true));
             // copy mobs
             $target->setType($source->getType());
             $target->setTitle($source->getTitle());
             $target->create();
         }
         ilUtil::sendSuccess($this->lng->txt("prtf_pages_copied"), true);
         $this->ctrl->redirect($this, "view");
     }
     $form->setValuesByPost();
     $this->copyPageForm($form);
 }
Ejemplo n.º 11
0
 public function readMemberData($ids, $role = 'admin', $selected_columns = null)
 {
     if ($this->show_tracking) {
         include_once 'Services/Tracking/classes/class.ilLPStatusWrapper.php';
         $completed = ilLPStatusWrapper::_lookupCompletedForObject($this->object->getId());
         $in_progress = ilLPStatusWrapper::_lookupInProgressForObject($this->object->getId());
         $failed = ilLPStatusWrapper::_lookupFailedForObject($this->object->getId());
     }
     include_once './Services/PrivacySecurity/classes/class.ilPrivacySettings.php';
     $privacy = ilPrivacySettings::_getInstance();
     if ($privacy->enabledCourseAccessTimes()) {
         include_once './Services/Tracking/classes/class.ilLearningProgress.php';
         $progress = ilLearningProgress::_lookupProgressByObjId($this->object->getId());
     }
     $do_prtf = is_array($selected_columns) && in_array('prtf', $selected_columns) && is_array($ids);
     if ($do_prtf) {
         include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
         $all_prtf = ilObjPortfolio::getAvailablePortfolioLinksForUserIds($ids, $this->ctrl->getLinkTarget($this, "members"));
     }
     foreach ((array) $ids as $usr_id) {
         $name = ilObjUser::_lookupName($usr_id);
         $tmp_data['firstname'] = $name['firstname'];
         $tmp_data['lastname'] = $name['lastname'];
         $tmp_data['login'] = ilObjUser::_lookupLogin($usr_id);
         $tmp_data['passed'] = $this->object->getMembersObject()->hasPassed($usr_id) ? 1 : 0;
         if ($this->object->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP) {
             $tmp_data['passed_info'] = $this->object->getMembersObject()->getPassedInfo($usr_id);
         }
         $tmp_data['notification'] = $this->object->getMembersObject()->isNotificationEnabled($usr_id) ? 1 : 0;
         $tmp_data['blocked'] = $this->object->getMembersObject()->isBlocked($usr_id) ? 1 : 0;
         $tmp_data['usr_id'] = $usr_id;
         if ($this->show_tracking) {
             if (in_array($usr_id, $completed)) {
                 $tmp_data['progress'] = ilLPStatus::LP_STATUS_COMPLETED;
             } elseif (in_array($usr_id, $in_progress)) {
                 $tmp_data['progress'] = ilLPStatus::LP_STATUS_IN_PROGRESS;
             } elseif (in_array($usr_id, $failed)) {
                 $tmp_data['progress'] = ilLPStatus::LP_STATUS_FAILED;
             } else {
                 $tmp_data['progress'] = ilLPStatus::LP_STATUS_NOT_ATTEMPTED;
             }
         }
         if ($privacy->enabledCourseAccessTimes()) {
             if (isset($progress[$usr_id]['ts']) and $progress[$usr_id]['ts']) {
                 $tmp_data['access_ut'] = $progress[$usr_id]['ts'];
                 $tmp_data['access_time'] = ilDatePresentation::formatDate(new ilDateTime($progress[$usr_id]['ts'], IL_CAL_UNIX));
             } else {
                 $tmp_data['access_ut'] = 0;
                 $tmp_data['access_time'] = $this->lng->txt('no_date');
             }
         }
         if ($do_prtf) {
             $tmp_data['prtf'] = $all_prtf[$usr_id];
         }
         $members[$usr_id] = $tmp_data;
     }
     return $members ? $members : array();
 }
 /**
  * get flat bookmark list for personal desktop
  */
 function fillRow($a_set)
 {
     global $ilUser, $ilCtrl, $lng, $ilSetting, $rbacsetting, $rbacsystem;
     // mail link
     $a_set["mail_to"] = "";
     if ($this->mail_allowed && $rbacsystem->checkAccessOfUser($a_set['id'], 'internal_mail', ilMailGlobalServices::getMailObjectRefId())) {
         $a_set['mail_url'] = ilMailFormCall::getLinkTarget($this->topGuiObj, '', array(), array('type' => 'new', 'rcp_to' => urlencode($a_set['login'])));
     }
     // check for profile
     $a_set["profile"] = in_array(ilObjUser::_lookupPref($a_set["id"], "public_profile"), array("y", "g"));
     // user image
     if ($this->getCurrentDetailLevel() > 2) {
         if ($a_set["mail_url"] != "") {
             $this->tpl->setCurrentBlock("mailto_link");
             $this->tpl->setVariable("TXT_MAIL", $lng->txt("mail"));
             $this->tpl->setVariable("MAIL_URL", $a_set["mail_url"]);
             $this->tpl->parseCurrentBlock();
         }
         $chatSettings = new ilSetting('chatroom');
         if ($chatSettings->get('chat_enabled')) {
             if (!$this->__showActiveChatsOfUser($a_set["id"])) {
                 // Show invite to chat
                 $this->__showChatInvitation($a_set["id"]);
             }
             global $rbacsystem;
             include_once './Modules/Chatroom/classes/class.ilObjChatroom.php';
             if ($a_set["id"] == $ilUser->getId() && $rbacsystem->checkAccess('read', ilObjChatroom::_getPublicRefId())) {
                 $this->tpl->setCurrentBlock('chat_link');
                 $this->tpl->setVariable('TXT_CHAT_INVITE', $lng->txt('chat_enter_public_room'));
                 $this->tpl->setVariable('TXT_CHAT_INVITE_TOOLTIP', $lng->txt('chat_enter_public_room_tooltip'));
                 //					$this->tpl->setVariable('CHAT_LINK','./ilias.php?baseClass=ilChatPresentationGUI&ref_id='.ilObjChat::_getPublicChatRefId());
                 $this->tpl->setVariable('CHAT_LINK', './ilias.php?baseClass=ilRepositoryGUI&cmd=view&ref_id=' . ilObjChatroom::_getPublicRefId());
                 $this->tpl->parseCurrentBlock();
             }
         }
         // user image
         $this->tpl->setCurrentBlock("usr_image");
         $this->tpl->setVariable("USR_IMAGE", ilObjUser::_getPersonalPicturePath($a_set["id"], "xxsmall"));
         $this->tpl->setVariable("USR_ALT", $lng->txt("personal_picture"));
         $this->tpl->parseCurrentBlock();
         $this->tpl->touchBlock("usr_image_space");
         $pd_set = new ilSetting("pd");
         $osi_server = $pd_set->get("osi_host");
         //			if (trim($osi_server) != "")
         //			{
         // instant messengers
         // 1 indicates to use online status check
         $im_arr = array("icq" => 0, "yahoo" => 1, "msn" => 0, "aim" => 0, "skype" => 1, "jabber" => 0, "voip" => 0);
         // use onlinestatus.org
         // when enabled all instant messengers are checked online and ignores settings above
         if (trim($osi_server) != "") {
             $osi_enable = true;
         }
         // removed calls to external servers due to
         // bug 10583, alex 8 Mar 2013
         foreach ($im_arr as $im_name => $im_check) {
             if ($im_id = ilObjUser::_lookupIm($a_set["id"], $im_name)) {
                 $im_url = "";
                 switch ($im_name) {
                     case "icq":
                         $im_url = "http://http://www.icq.com/people/" . $im_id;
                         break;
                     case "yahoo":
                         $im_url = "http://edit.yahoo.com/config/send_webmesg?target=" . $im_id . "&src=pg";
                         break;
                     case "msn":
                         $im_url = "http://messenger.live.com";
                         break;
                     case "aim":
                         //$im_url = "aim:GoIM?screenname=".$im_id;
                         $im_url = "http://aimexpress.aim.com";
                         break;
                     case "skype":
                         $im_url = "skype:" . $im_id . "?call";
                         break;
                 }
                 $im_img = ilUtil::getImagePath($im_name . 'online.png');
                 if ($im_url != "") {
                     $this->tpl->setCurrentBlock("im_link_start");
                     $this->tpl->setVariable("URL_IM", $im_url);
                     $this->tpl->parseCurrentBlock();
                     $this->tpl->touchBlock("im_link_end");
                 }
                 $this->tpl->setCurrentBlock("instant_messengers");
                 $this->tpl->setVariable("IMG_IM_ICON", $im_img);
                 $this->tpl->setVariable("TXT_IM_ICON", $lng->txt("im_" . $im_name));
                 $icon_id = "im_" . $im_name . "_usr_" . $a_set["id"];
                 $this->tpl->setVariable("ICON_ID", $icon_id);
                 include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php";
                 ilTooltipGUI::addTooltip($icon_id, $lng->txt("im_" . $im_name) . ": " . $im_id, "", "top center", "bottom center");
                 $this->tpl->parseCurrentBlock();
             }
         }
         //			}
     }
     // username
     if (!$a_set["profile"]) {
         $this->tpl->setVariable("USR_LOGIN", $a_set["login"]);
     } else {
         if ($this->getCurrentDetailLevel() > 2) {
             $this->tpl->setVariable("USR_LOGIN", "<br />" . $a_set["login"]);
         } else {
             $this->tpl->setVariable("USR_LOGIN", " [" . $a_set["login"] . "]");
         }
     }
     // profile link
     if ($a_set["profile"]) {
         include_once "Services/User/classes/class.ilUserUtil.php";
         $user_name = ilUserUtil::getNamePresentation($a_set["id"], false, false, "", false, true, false);
         $this->tpl->setCurrentBlock("profile_link");
         $this->tpl->setVariable("TXT_VIEW", $lng->txt("profile"));
         // see ilPersonalProfileGUI::getProfilePortfolio()
         $has_prtf = false;
         if ($ilSetting->get('user_portfolios')) {
             include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
             $has_prtf = ilObjPortfolio::getDefaultPortfolio($a_set["id"]);
         }
         if (!$has_prtf) {
             // (simple) profile: center column
             $ilCtrl->setParameter($this, "user", $a_set["id"]);
             $this->tpl->setVariable("LINK_PROFILE", $ilCtrl->getLinkTargetByClass("ilpublicuserprofilegui", "getHTML"));
         } else {
             // portfolio: fullscreen
             include_once "Services/Link/classes/class.ilLink.php";
             $this->tpl->setVariable("LINK_PROFILE", ilLink::_getLink($a_set["id"], "usr"));
             $this->tpl->setVariable("LINK_TARGET", "_blank");
         }
         $this->tpl->setVariable("USR_ID", $a_set["id"]);
         $this->tpl->setVariable("LINK_FULLNAME", $user_name);
         $this->tpl->parseCurrentBlock();
     } else {
         $this->tpl->setVariable("USR_FULLNAME", "");
     }
 }
 /**
  * Get assignment body for overview
  */
 function getOverviewBody($a_data)
 {
     global $lng, $ilCtrl, $ilUser;
     $tpl = new ilTemplate("tpl.assignment_body.html", true, true, "Modules/Exercise");
     include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php";
     if (IS_PAYMENT_ENABLED) {
         include_once './Services/Payment/classes/class.ilPaymentObject.php';
     }
     $info = new ilInfoScreenGUI(null);
     $info->setTableClass("");
     $not_started_yet = false;
     if ($a_data["start_time"] > 0 && time() - $a_data["start_time"] <= 0) {
         $not_started_yet = true;
     }
     if (!$not_started_yet) {
         // instructions
         $info->addSection($lng->txt("exc_instruction"));
         $info->addProperty("", nl2br(ilUtil::makeClickable($a_data["instruction"], true)));
     }
     // schedule
     $info->addSection($lng->txt("exc_schedule"));
     if ($a_data["start_time"] > 0) {
         $info->addProperty($lng->txt("exc_start_time"), ilDatePresentation::formatDate(new ilDateTime($a_data["start_time"], IL_CAL_UNIX)));
     }
     if ($a_data["deadline"] > 0) {
         $info->addProperty($lng->txt("exc_edit_until"), ilDatePresentation::formatDate(new ilDateTime($a_data["deadline"], IL_CAL_UNIX)));
     }
     $time_str = $this->getTimeString($a_data["deadline"]);
     if (!$not_started_yet) {
         $info->addProperty($lng->txt("exc_time_to_send"), "<b>" . $time_str . "</b>");
     }
     // public submissions
     if ($this->exc->getShowSubmissions()) {
         $ilCtrl->setParameterByClass("ilobjexercisegui", "ass_id", $a_data["id"]);
         if ($a_data["deadline"] - time() <= 0) {
             $link = '<a class="submit" href="' . $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "listPublicSubmissions") . '">' . $lng->txt("exc_list_submission") . '</a>';
             $info->addProperty($lng->txt("exc_public_submission"), $link);
         } else {
             $info->addProperty($lng->txt("exc_public_submission"), $lng->txt("exc_msg_public_submission"));
         }
         $ilCtrl->setParameterByClass("ilobjexercisegui", "ass_id", $_GET["ass_id"]);
     }
     $ilCtrl->setParameterByClass("ilobjexercisegui", "ass_id", $a_data["id"]);
     if (!$not_started_yet) {
         // download files
         $files = ilExAssignment::getFiles($a_data["exc_id"], $a_data["id"]);
         if (count($files) > 0) {
             $info->addSection($lng->txt("exc_files"));
             foreach ($files as $file) {
                 // if download must be purchased first show a "buy"-button
                 if (IS_PAYMENT_ENABLED && (ilPaymentObject::_isBuyable($_GET['ref_id'], 'download') && !ilPaymentObject::_hasAccess($_GET['ref_id'], '', 'download'))) {
                     $info->addProperty($file["name"], $lng->txt("buy"), $ilCtrl->getLinkTargetByClass("ilShopPurchaseGUI", "showDetails"));
                 } else {
                     $ilCtrl->setParameterByClass("ilobjexercisegui", "file", urlencode($file["name"]));
                     $info->addProperty($file["name"], $lng->txt("download"), $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "downloadFile"));
                     $ilCtrl->setParameterByClass("ilobjexercisegui", "file", "");
                 }
             }
         }
         // submission
         // if submission must be purchased first
         if (IS_PAYMENT_ENABLED && (ilPaymentObject::_isBuyable($_GET['ref_id'], 'upload') && !ilPaymentObject::_hasAccess($_GET['ref_id'], '', 'upload'))) {
             $info->addSection($lng->txt("exc_your_submission"));
             $ilCtrl->clearParameters($this);
             $ilCtrl->setParameter($this, "ref_id", $_GET['ref_id']);
             $ilCtrl->setParameter($this, 'subtype', 'upload');
             $info->addProperty($lng->txt('exc_hand_in'), $lng->txt("buy"), $ilCtrl->getLinkTargetByClass("ilShopPurchaseGUI", "showDetails"));
         } else {
             $info->addSection($lng->txt("exc_your_submission"));
             $delivered_files = ilExAssignment::getDeliveredFiles($a_data["exc_id"], $a_data["id"], $ilUser->getId());
             $times_up = false;
             if ($a_data["deadline"] > 0 && $a_data["deadline"] - time() < 0) {
                 $times_up = true;
             }
             $team_members = null;
             switch ($a_data["type"]) {
                 case ilExAssignment::TYPE_UPLOAD_TEAM:
                     $team_members = ilExAssignment::getTeamMembersByAssignmentId($a_data["id"], $ilUser->getId());
                     if (sizeof($team_members) > 1) {
                         $team = array();
                         foreach ($team_members as $member_id) {
                             $team[] = ilObjUser::_lookupFullname($member_id);
                         }
                         $info->addProperty($lng->txt("exc_team_members"), implode(", ", $team));
                     }
                     // fallthrough
                 // fallthrough
                 case ilExAssignment::TYPE_UPLOAD:
                     $titles = array();
                     foreach ($delivered_files as $file) {
                         $titles[] = $file["filetitle"];
                     }
                     $files_str = implode($titles, ", ");
                     if ($files_str == "") {
                         $files_str = $lng->txt("message_no_delivered_files");
                     }
                     $ilCtrl->setParameterByClass("ilobjexercisegui", "ass_id", $a_data["id"]);
                     if (!$times_up) {
                         $files_str .= ' <a class="submit" href="' . $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "submissionScreen") . '">' . (count($titles) == 0 ? $lng->txt("exc_hand_in") : $lng->txt("exc_edit_submission")) . '</a>';
                     } else {
                         if (count($titles) > 0) {
                             $files_str .= ' <a class="submit" href="' . $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "submissionScreen") . '">' . $lng->txt("already_delivered_files") . '</a>';
                         }
                     }
                     $info->addProperty($lng->txt("exc_files_returned"), $files_str);
                     break;
                 case ilExAssignment::TYPE_BLOG:
                     $files_str = "";
                     $valid_blog = false;
                     if (sizeof($delivered_files)) {
                         $delivered_files = array_pop($delivered_files);
                         $blog_id = (int) $delivered_files["filetitle"];
                         include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
                         include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
                         $wsp_tree = new ilWorkspaceTree($ilUser->getId());
                         $node = $wsp_tree->getNodeData($blog_id);
                         if ($node["title"]) {
                             // #10116
                             // $blog_link = ilWorkspaceAccessHandler::getGotoLink($blog_id, $node["obj_id"]);
                             $ilCtrl->setParameterByClass("ilobjbloggui", "wsp_id", $blog_id);
                             $blog_link = $ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilpersonalworkspacegui", "ilobjbloggui"), "");
                             $ilCtrl->setParameterByClass("ilobjbloggui", "wsp_id", "");
                             $files_str = '<a href="' . $blog_link . '">' . $node["title"] . '</a>';
                             $valid_blog = true;
                         }
                     }
                     if (!$times_up) {
                         if (!$valid_blog) {
                             $files_str .= '<a class="submit" href="' . $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "createBlog") . '">' . $lng->txt("exc_create_blog") . '</a>';
                         }
                         $files_str .= ' <a class="submit" href="' . $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "selectBlog") . '">' . $lng->txt("exc_select_blog" . ($valid_blog ? "_change" : "")) . '</a>';
                     }
                     if ($files_str) {
                         $info->addProperty($lng->txt("exc_blog_returned"), $files_str);
                     }
                     if ($delivered_files && substr($delivered_files["filename"], -1) != "/") {
                         $ilCtrl->setParameterByClass("ilobjexercisegui", "delivered", $delivered_files["returned_id"]);
                         $dl_link = $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "download");
                         $ilCtrl->setParameterByClass("ilobjexercisegui", "delivered", "");
                         $info->addProperty($lng->txt("exc_files_returned"), "<a href=\"" . $dl_link . "\">" . $lng->txt("download") . "</a>");
                     }
                     break;
                 case ilExAssignment::TYPE_PORTFOLIO:
                     $files_str = "";
                     $valid_prtf = false;
                     if (sizeof($delivered_files)) {
                         $delivered_files = array_pop($delivered_files);
                         $portfolio_id = (int) $delivered_files["filetitle"];
                         include_once "Services/Portfolio/classes/class.ilObjPortfolio.php";
                         include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
                         $portfolio = new ilObjPortfolio($portfolio_id, false);
                         if ($portfolio->getTitle()) {
                             // #10116
                             // $prtf_link = ilWorkspaceAccessHandler::getGotoLink($portfolio_id, $portfolio_id)
                             $ilCtrl->setParameterByClass("ilobjportfoliogui", "prt_id", $portfolio_id);
                             $prtf_link = $ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilobjportfoliogui"), "pages");
                             $ilCtrl->setParameterByClass("ilobjportfoliogui", "prt_id", "");
                             $files_str = '<a href="' . $prtf_link . '">' . $portfolio->getTitle() . '</a>';
                             $valid_prtf = true;
                         }
                     }
                     if (!$times_up) {
                         if (!$valid_prtf) {
                             $files_str .= '<a class="submit" href="' . $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "createPortfolio") . '">' . $lng->txt("exc_create_portfolio") . '</a>';
                         }
                         $files_str .= ' <a class="submit" href="' . $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "selectPortfolio") . '">' . $lng->txt("exc_select_portfolio" . ($valid_prtf ? "_change" : "")) . '</a>';
                     }
                     if ($files_str) {
                         $info->addProperty($lng->txt("exc_portfolio_returned"), $files_str);
                     }
                     if ($delivered_files && substr($delivered_files["filename"], -1) != "/") {
                         $ilCtrl->setParameterByClass("ilobjexercisegui", "delivered", $delivered_files["returned_id"]);
                         $dl_link = $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "download");
                         $ilCtrl->setParameterByClass("ilobjexercisegui", "delivered", "");
                         $info->addProperty($lng->txt("exc_files_returned"), "<a href=\"" . $dl_link . "\">" . $lng->txt("download") . "</a>");
                     }
                     break;
             }
             $last_sub = ilExAssignment::getLastSubmission($a_data["id"], $ilUser->getId());
             if ($last_sub) {
                 $last_sub = ilDatePresentation::formatDate(new ilDateTime($last_sub, IL_CAL_DATETIME));
             } else {
                 $last_sub = "---";
             }
             if ($last_sub != "---") {
                 $info->addProperty($lng->txt("exc_last_submission"), $last_sub);
             }
             // feedback from tutor
             if ($a_data["type"] == ilExAssignment::TYPE_UPLOAD_TEAM) {
                 $feedback_id = "t" . ilExAssignment::getTeamIdByAssignment($a_data["id"], $ilUser->getId());
             } else {
                 $feedback_id = $ilUser->getId();
             }
             $storage = new ilFSStorageExercise($a_data["exc_id"], $a_data["id"]);
             $cnt_files = $storage->countFeedbackFiles($feedback_id);
             $lpcomment = ilExAssignment::lookupCommentForUser($a_data["id"], $ilUser->getId());
             $mark = ilExAssignment::lookupMarkOfUser($a_data["id"], $ilUser->getId());
             $status = ilExAssignment::lookupStatusOfUser($a_data["id"], $ilUser->getId());
             if ($lpcomment != "" || $mark != "" || $status != "notgraded" || $cnt_files > 0) {
                 $info->addSection($lng->txt("exc_feedback_from_tutor"));
                 if ($lpcomment != "") {
                     $info->addProperty($lng->txt("exc_comment"), $lpcomment);
                 }
                 if ($mark != "") {
                     $info->addProperty($lng->txt("exc_mark"), $mark);
                 }
                 if ($status == "") {
                     //				  $info->addProperty($lng->txt("status"),
                     //						$lng->txt("message_no_delivered_files"));
                 } else {
                     if ($status != "notgraded") {
                         $img = '<img border="0" src="' . ilUtil::getImagePath("scorm/" . $status . ".png") . '" ' . ' alt="' . $lng->txt("exc_" . $status) . '" title="' . $lng->txt("exc_" . $status) . '" style="vertical-align:middle;"/>';
                         $info->addProperty($lng->txt("status"), $img . " " . $lng->txt("exc_" . $status));
                     }
                 }
                 if ($cnt_files > 0) {
                     $info->addSection($lng->txt("exc_fb_files"));
                     $files = $storage->getFeedbackFiles($feedback_id);
                     foreach ($files as $file) {
                         $ilCtrl->setParameterByClass("ilobjexercisegui", "file", urlencode($file));
                         $info->addProperty($file, $lng->txt("download"), $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "downloadFeedbackFile"));
                         $ilCtrl->setParameter($this, "file", "");
                     }
                 }
             }
         }
     }
     $tpl->setVariable("CONTENT", $info->getHTML());
     return $tpl->get();
 }
 /**
  * check access for an object
  *
  * @param	integer		$a_user_id
  * @param	string		$a_permission
  * @param	string		$a_cmd
  * @param	int			$a_node_id
  * @param	string		$a_type (optional)
  * @return	bool
  */
 public function checkAccessOfUser($a_user_id, $a_permission, $a_cmd, $a_node_id, $a_type = "")
 {
     global $rbacreview, $ilUser, $ilSetting;
     // #12059
     if (!$ilSetting->get('user_portfolios')) {
         return false;
     }
     // :TODO: create permission for parent node with type ?!
     $pf = new ilObjPortfolio($a_node_id, false);
     if (!$pf->getId()) {
         return false;
     }
     // portfolio owner has all rights
     if ($pf->getOwner() == $a_user_id) {
         return true;
     }
     // #11921
     if (!$pf->isOnline()) {
         return false;
     }
     // other users can only read
     if ($a_permission == "read" || $a_permission == "visible") {
         // get all objects with explicit permission
         $objects = $this->getPermissions($a_node_id);
         if ($objects) {
             include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessGUI.php";
             // check if given user is member of object or has role
             foreach ($objects as $obj_id) {
                 switch ($obj_id) {
                     case ilWorkspaceAccessGUI::PERMISSION_ALL:
                         return true;
                     case ilWorkspaceAccessGUI::PERMISSION_ALL_PASSWORD:
                         // check against input kept in session
                         if (self::getSharedNodePassword($a_node_id) == self::getSharedSessionPassword($a_node_id) || $a_permission == "visible") {
                             return true;
                         }
                         break;
                     case ilWorkspaceAccessGUI::PERMISSION_REGISTERED:
                         if ($ilUser->getId() != ANONYMOUS_USER_ID) {
                             return true;
                         }
                         break;
                     default:
                         switch (ilObject::_lookupType($obj_id)) {
                             case "grp":
                                 // member of group?
                                 if (ilGroupParticipants::_getInstanceByObjId($obj_id)->isAssigned($a_user_id)) {
                                     return true;
                                 }
                                 break;
                             case "crs":
                                 // member of course?
                                 if (ilCourseParticipants::_getInstanceByObjId($obj_id)->isAssigned($a_user_id)) {
                                     return true;
                                 }
                                 break;
                             case "role":
                                 // has role?
                                 if ($rbacreview->isAssigned($a_user_id, $obj_id)) {
                                     return true;
                                 }
                                 break;
                             case "usr":
                                 // direct assignment
                                 if ($a_user_id == $obj_id) {
                                     return true;
                                 }
                                 break;
                         }
                         break;
                 }
             }
         }
     }
     return false;
 }
 function initCopyPageForm()
 {
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt("prtf_copy_page"));
     $tgt = new ilRadioGroupInputGUI($this->lng->txt("target"), "target");
     $tgt->setRequired(true);
     $form->addItem($tgt);
     $all = ilObjPortfolio::getPortfoliosOfUser($this->user_id);
     if (sizeof($all) > 1) {
         $old = new ilRadioOption($this->lng->txt("prtf_existing_portfolio"), "old");
         $tgt->addOption($old);
         $options = array();
         foreach ($all as $item) {
             if ($item["id"] != $this->object->getId()) {
                 $options[$item["id"]] = $item["title"];
             }
         }
         $prtf = new ilSelectInputGUI($this->lng->txt("portfolio"), "prtf");
         $prtf->setRequired(true);
         $prtf->setOptions($options);
         $old->addSubItem($prtf);
     }
     $new = new ilRadioOption($this->lng->txt("prtf_new_portfolio"), "new");
     $tgt->addOption($new);
     // 1st page
     $tf = new ilTextInputGUI($this->lng->txt("title"), "title");
     $tf->setMaxLength(128);
     $tf->setSize(40);
     $tf->setRequired(true);
     $new->addSubItem($tf);
     $form->addCommandButton("copyPage", $this->lng->txt("save"));
     $form->addCommandButton("view", $this->lng->txt("cancel"));
     return $form;
 }
Ejemplo n.º 16
0
 /**
  * deletes a user
  * @access	public
  * @param	integer		user_id
  */
 function delete()
 {
     global $rbacadmin, $ilDB;
     // deassign from ldap groups
     include_once 'Services/LDAP/classes/class.ilLDAPRoleGroupMapping.php';
     $mapping = ilLDAPRoleGroupMapping::_getInstance();
     $mapping->deleteUser($this->getId());
     // remove mailbox / update sent mails
     include_once "Services/Mail/classes/class.ilMailbox.php";
     $mailbox = new ilMailbox($this->getId());
     $mailbox->delete();
     $mailbox->updateMailsOfDeletedUser($this->getLogin());
     // delete feed blocks on personal desktop
     include_once "./Services/Block/classes/class.ilCustomBlock.php";
     $costum_block = new ilCustomBlock();
     $costum_block->setContextObjId($this->getId());
     $costum_block->setContextObjType("user");
     $c_blocks = $costum_block->queryBlocksForContext();
     include_once "./Services/Feeds/classes/class.ilPDExternalFeedBlock.php";
     foreach ($c_blocks as $c_block) {
         if ($c_block["type"] == "pdfeed") {
             $fb = new ilPDExternalFeedBlock($c_block["id"]);
             $fb->delete();
         }
     }
     // delete block settings
     include_once "./Services/Block/classes/class.ilBlockSetting.php";
     ilBlockSetting::_deleteSettingsOfUser($this->getId());
     // delete user_account
     $ilDB->manipulateF("DELETE FROM usr_data WHERE usr_id = %s", array("integer"), array($this->getId()));
     // delete user_prefs
     ilObjUser::_deleteAllPref($this->getId());
     // delete user_session
     include_once "./Services/Authentication/classes/class.ilSession.php";
     ilSession::_destroyByUserId($this->getId());
     // remove user from rbac
     $rbacadmin->removeUser($this->getId());
     // remove bookmarks
     // TODO: move this to class.ilBookmarkFolder
     $q = "DELETE FROM bookmark_tree WHERE tree = " . $ilDB->quote($this->getId(), "integer");
     $ilDB->manipulate($q);
     $q = "DELETE FROM bookmark_data WHERE user_id = " . $ilDB->quote($this->getId(), "integer");
     $ilDB->manipulate($q);
     // DELETE FORUM ENTRIES (not complete in the moment)
     include_once './Modules/Forum/classes/class.ilObjForum.php';
     ilObjForum::_deleteUser($this->getId());
     // Delete link check notify entries
     include_once './Services/LinkChecker/classes/class.ilLinkCheckNotify.php';
     ilLinkCheckNotify::_deleteUser($this->getId());
     // Delete crs entries
     include_once './Modules/Course/classes/class.ilObjCourse.php';
     ilObjCourse::_deleteUser($this->getId());
     // Delete user tracking
     include_once './Services/Tracking/classes/class.ilObjUserTracking.php';
     ilObjUserTracking::_deleteUser($this->getId());
     include_once 'Modules/Session/classes/class.ilEventParticipants.php';
     ilEventParticipants::_deleteByUser($this->getId());
     // Delete Tracking data SCORM 2004 RTE
     include_once 'Modules/Scorm2004/classes/ilSCORM13Package.php';
     ilSCORM13Package::_removeTrackingDataForUser($this->getId());
     // Delete Tracking data SCORM 1.2 RTE
     include_once 'Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php';
     ilObjSCORMLearningModule::_removeTrackingDataForUser($this->getId());
     // remove all notifications
     include_once "./Services/Notification/classes/class.ilNotification.php";
     ilNotification::removeForUser($this->getId());
     // remove portfolios
     include_once "./Modules/Portfolio/classes/class.ilObjPortfolio.php";
     ilObjPortfolio::deleteUserPortfolios($this->getId());
     // remove workspace
     include_once "./Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
     $tree = new ilWorkspaceTree($this->getId());
     $tree->cascadingDelete();
     // remove disk quota entries
     include_once "./Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
     ilDiskQuotaHandler::deleteByOwner($this->getId());
     // Delete user defined field entries
     $this->deleteUserDefinedFieldEntries();
     // Delete clipboard entries
     $this->clipboardDeleteAll();
     // Reset owner
     $this->resetOwner();
     // Trigger deleteUser Event
     global $ilAppEventHandler;
     $ilAppEventHandler->raise('Services/User', 'deleteUser', array('usr_id' => $this->getId()));
     // delete object data
     parent::delete();
     return true;
 }
 protected function afterSave(ilObject $a_new_object)
 {
     if ($_POST["prtf"]) {
         include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
         $source = new ilObjPortfolio($_POST["prtf"], false);
         ilObjPortfolio::clonePagesAndSettings($source, $a_new_object);
     }
     ilUtil::sendSuccess($this->lng->txt("prtf_portfolio_created"), true);
     $this->ctrl->setParameter($this, "prt_id", $a_new_object->getId());
     $this->ctrl->redirect($this, "view");
 }
Ejemplo n.º 18
0
 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");
 }
 protected function cancelPassword()
 {
     global $ilUser;
     if ($ilUser->getId() && $ilUser->getId() != ANONYMOUS_USER_ID) {
         if ($this->node_id) {
             include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
             include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
             $tree = new ilWorkspaceTree($ilUser->getId());
             $owner = $tree->lookupOwner($this->node_id);
             ilUtil::redirect("ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToWorkspace&dsh=" . $owner);
         } else {
             include_once "Services/Portfolio/classes/class.ilObjPortfolio.php";
             $prtf = new ilObjPortfolio($this->portfolio_id, false);
             $owner = $prtf->getOwner();
             ilUtil::redirect("ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToPortfolio&dsh=" . $owner);
         }
     }
 }
 protected function syncProfile($a_node_id)
 {
     global $ilUser;
     // #12845
     include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
     if (ilObjPortfolio::getDefaultPortfolio($ilUser->getId()) == $a_node_id) {
         $has_registered = $this->hasRegisteredPermission($a_node_id);
         $has_global = $this->hasGlobalPermission($a_node_id);
         // not published anymore - remove portfolio as profile
         if (!$has_registered && !$has_global) {
             $ilUser->setPref("public_profile", "n");
             $ilUser->writePrefs();
             ilObjPortfolio::setUserDefault($ilUser->getId());
         } else {
             $new_pref = "y";
             if ($has_global) {
                 $new_pref = "g";
             }
             if ($ilUser->getPref("public_profile") != $new_pref) {
                 $ilUser->setPref("public_profile", $new_pref);
                 $ilUser->writePrefs();
             }
         }
     }
 }