protected function show()
 {
     global $tpl, $lng, $ilToolbar, $ilCtrl;
     include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
     $button = ilLinkButton::getInstance();
     $button->setCaption("prtf_add_portfolio");
     $button->setUrl($ilCtrl->getLinkTargetByClass("ilObjPortfolioGUI", "create"));
     $ilToolbar->addButtonInstance($button);
     include_once "Modules/Portfolio/classes/class.ilPortfolioTableGUI.php";
     $table = new ilPortfolioTableGUI($this, "show", $this->user_id);
     include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
     $tpl->setContent($table->getHTML() . ilDiskQuotaHandler::getStatusLegend());
 }
 function listCodes()
 {
     global $ilAccess, $ilErr, $ilCtrl, $ilToolbar, $lng, $tpl;
     if (!$ilAccess->checkAccess('read', '', $this->ref_id)) {
         $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->MESSAGE);
     }
     include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
     $button = ilLinkButton::getInstance();
     $button->setCaption("user_account_codes_add");
     $button->setUrl($ilCtrl->getLinkTarget($this, "addCodes"));
     $ilToolbar->addButtonInstance($button);
     include_once "./Services/User/classes/class.ilAccountCodesTableGUI.php";
     $ctab = new ilAccountCodesTableGUI($this, "listCodes");
     $tpl->setContent($ctab->getHTML());
 }
 public function build()
 {
     if ($this->isTestResultButtonEnabled()) {
         $link = ilLinkButton::getInstance();
         // always returns a new instance
         $link->setUrl($this->ctrl->getLinkTargetByClass('ilTestEvaluationGUI', 'outUserResultsOverview'));
         $link->setCaption($this->lng->txt("tst_show_results"), false);
         $this->addButtonInstance($link);
         $this->addSeparator();
     }
     $this->setFormAction($this->ctrl->getFormAction($this->parentGUI));
     $select = new ilSelectInputGUI($this->lng->txt("tst_analysis"), self::SKILL_PROFILE_PARAM);
     $select->setOptions($this->buildEvaluationModeOptionsArray());
     $select->setValue($this->getSelectedEvaluationMode());
     $this->addInputItem($select, true);
     $this->addFormButton($this->lng->txt("select"), $this->parentCMD);
 }
 /**
  * Fill table row
  */
 protected function fillRow($member)
 {
     global $lng, $ilCtrl;
     include_once "./Services/Object/classes/class.ilObjectFactory.php";
     $member_id = $member["usr_id"];
     if (!($mem_obj = ilObjectFactory::getInstanceByObjId($member_id, false))) {
         continue;
     }
     // name and login
     $this->tpl->setVariable("TXT_NAME", $member["name"]);
     $this->tpl->setVariable("TXT_LOGIN", "[" . $member["login"] . "]");
     // image
     $this->tpl->setVariable("USR_IMAGE", $mem_obj->getPersonalPicturePath("xxsmall"));
     $this->tpl->setVariable("USR_ALT", $lng->txt("personal_picture"));
     // submission:
     // see if files have been resubmmited after solved
     $last_sub = ilExAssignment::getLastSubmission($this->ass_id, $member_id);
     if ($last_sub) {
         $last_sub = ilDatePresentation::formatDate(new ilDateTime($last_sub, IL_CAL_DATETIME));
     } else {
         $last_sub = "---";
     }
     // nr of submitted files
     $this->tpl->setVariable("TXT_SUBMITTED_FILES", $lng->txt("exc_files_returned"));
     $sub_cnt = count(ilExAssignment::getDeliveredFiles($this->exc_id, $this->ass_id, $member_id));
     $this->tpl->setVariable("VAL_SUBMITTED_FILES", $sub_cnt);
     // download command
     $ilCtrl->setParameter($this->parent_obj, "member_id", $member_id);
     if ($sub_cnt > 0) {
         // #15126
         include_once "./Services/UIComponent/Button/classes/class.ilLinkButton.php";
         $button = ilLinkButton::getInstance();
         $button->setCaption("exc_download_files");
         $button->setUrl($ilCtrl->getLinkTarget($this->parent_obj, "downloadReturned"));
         $button->setOmitPreventDoubleSubmission(true);
         $this->tpl->setVariable("BTN_DOWNLOAD", $button->render());
     }
     $this->tpl->parseCurrentBlock();
 }
 public function build()
 {
     $this->setId('tst_results_toolbar');
     $this->addButton($this->lng->txt('print'), 'javascript:window.print();');
     if (strlen($this->getPdfExportLinkTarget())) {
         require_once 'Services/UIComponent/Button/classes/class.ilLinkButton.php';
         $link = ilLinkButton::getInstance();
         // always returns a new instance
         $link->setUrl($this->getPdfExportLinkTarget());
         $link->setCaption($this->getPdfExportLabel(), false);
         $link->setOmitPreventDoubleSubmission(true);
         $this->addButtonInstance($link);
     }
     if (strlen($this->getCertificateLinkTarget())) {
         $this->addButton($this->lng->txt('certificate'), $this->getCertificateLinkTarget());
     }
     if (strlen($this->getShowBestSolutionsLinkTarget())) {
         $this->addSeparator();
         $this->addButton($this->lng->txt('tst_btn_show_best_solutions'), $this->getShowBestSolutionsLinkTarget());
     } elseif (strlen($this->getHideBestSolutionsLinkTarget())) {
         $this->addSeparator();
         $this->addButton($this->lng->txt('tst_btn_hide_best_solutions'), $this->getHideBestSolutionsLinkTarget());
     }
     if (count($this->getParticipantSelectorOptions())) {
         $this->addSeparator();
         require_once 'Services/Form/classes/class.ilSelectInputGUI.php';
         $sel = new ilSelectInputGUI('', 'active_id');
         $sel->setOptions($this->getParticipantSelectorOptionsWithHintOption());
         $this->addInputItem($sel);
         require_once 'Services/UIComponent/Button/classes/class.ilLinkButton.php';
         $link = ilLinkButton::getInstance();
         // always returns a new instance
         $link->setUrl('#');
         $link->setId('ilTestResultParticipantJumper');
         $link->setCaption($this->lng->txt('tst_res_jump_to_participant_btn'), false);
         $this->addButtonInstance($link);
         $this->tpl->addJavaScript('Modules/Test/js/ilTestResultParticipantSelector.js');
     }
 }
 /**
  * show record list
  *
  * @access public
  * @param
  * 
  */
 public function showRecords()
 {
     global $ilToolbar;
     $perm = $this->getPermissions()->hasPermissions(ilAdvancedMDPermissionHelper::CONTEXT_MD, $_REQUEST["ref_id"], array(ilAdvancedMDPermissionHelper::ACTION_MD_CREATE_RECORD, ilAdvancedMDPermissionHelper::ACTION_MD_IMPORT_RECORDS));
     if ($perm[ilAdvancedMDPermissionHelper::ACTION_MD_CREATE_RECORD]) {
         include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
         $button = ilLinkButton::getInstance();
         $button->setCaption("add");
         $button->setUrl($this->ctrl->getLinkTarget($this, "createRecord"));
         $ilToolbar->addButtonInstance($button);
         if ($perm[ilAdvancedMDPermissionHelper::ACTION_MD_IMPORT_RECORDS]) {
             $ilToolbar->addSeparator();
         }
     }
     if ($perm[ilAdvancedMDPermissionHelper::ACTION_MD_IMPORT_RECORDS]) {
         include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
         $button = ilLinkButton::getInstance();
         $button->setCaption("import");
         $button->setUrl($this->ctrl->getLinkTarget($this, "importRecords"));
         $ilToolbar->addButtonInstance($button);
     }
     $this->record_objs = $this->getRecordObjects();
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.show_records.html', 'Services/AdvancedMetaData');
     include_once "./Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordTableGUI.php";
     $table_gui = new ilAdvancedMDRecordTableGUI($this, "showRecords", $this->getPermissions());
     $table_gui->setTitle($this->lng->txt("md_record_list_table"));
     $table_gui->parseRecords($this->record_objs);
     // permissions?
     $table_gui->addCommandButton("updateRecords", $this->lng->txt("save"));
     //$table_gui->addCommandButton('createRecord',$this->lng->txt('add'));
     $table_gui->addMultiCommand("exportRecords", $this->lng->txt('export'));
     $table_gui->addMultiCommand("confirmDeleteRecords", $this->lng->txt("delete"));
     $table_gui->setSelectAllCheckbox("record_id");
     $this->tpl->setVariable('RECORD_TABLE', $table_gui->getHTML());
     return true;
 }
 /**
  * @param bool $editComments
  */
 public function renderRecord($editComments = false)
 {
     global $ilTabs, $tpl, $ilCtrl, $lng;
     $rctpl = new ilTemplate("tpl.record_view.html", false, true, "Modules/DataCollection");
     $ilTabs->setTabActive("id_content");
     $view_id = self::_getViewDefinitionId($this->record_obj);
     if (!$view_id) {
         $ilCtrl->redirectByClass("ildatacollectionrecordlistgui", "listRecords");
     }
     // see ilObjDataCollectionGUI->executeCommand about instantiation
     include_once "./Modules/DataCollection/classes/class.ilDataCollectionRecordViewViewdefinitionGUI.php";
     $pageObj = new ilDataCollectionRecordViewViewdefinitionGUI($this->record_obj->getTableId(), $view_id);
     include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
     $pageObj->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(0, "dcl"));
     $html = $pageObj->getHTML();
     $rctpl->addCss("./Services/COPage/css/content.css");
     $rctpl->fillCssFiles();
     $table = ilDataCollectionCache::getTableCache($this->record_obj->getTableId());
     foreach ($table->getRecordFields() as $field) {
         //ILIAS_Ref_Links
         $pattern = '/\\[dcliln field="' . preg_quote($field->getTitle(), "/") . '"\\](.*?)\\[\\/dcliln\\]/';
         if (preg_match($pattern, $html)) {
             $html = preg_replace($pattern, $this->record_obj->getRecordFieldSingleHTML($field->getId(), $this->setOptions("\$1")), $html);
         }
         //DataCollection Ref Links
         $pattern = '/\\[dclrefln field="' . preg_quote($field->getTitle(), "/") . '"\\](.*?)\\[\\/dclrefln\\]/';
         if (preg_match($pattern, $html)) {
             $this->currentField = $field;
             $html = preg_replace_callback($pattern, array($this, "doReplace"), $html);
         }
         $pattern = '/\\[ext tableOf="' . preg_quote($field->getTitle(), "/") . '" field="(.*?)"\\]/';
         if (preg_match($pattern, $html)) {
             $this->currentField = $field;
             $html = preg_replace_callback($pattern, array($this, "doExtReplace"), $html);
         }
         $html = str_ireplace("[" . $field->getTitle() . "]", $this->record_obj->getRecordFieldSingleHTML($field->getId()), $html);
     }
     foreach ($table->getStandardFields() as $field) {
         $html = str_ireplace("[" . $field->getId() . "]", $this->record_obj->getRecordFieldSingleHTML($field->getId()), $html);
     }
     $rctpl->setVariable("CONTENT", $html);
     //Permanent Link
     $perma_link = new ilPermanentLinkGUI("dcl", $_GET["ref_id"], "_" . $_GET['record_id']);
     $tpl->setVariable('PRMLINK', $perma_link->getHTML());
     // Buttons for previous/next records
     if ($this->is_enabled_paging) {
         $prevNextLinks = $this->renderPrevNextLinks();
         $rctpl->setVariable('PREV_NEXT_RECORD_LINKS', $prevNextLinks);
         $ilCtrl->clearParameters($this);
         // #14083
         $rctpl->setVariable('FORM_ACTION', $ilCtrl->getFormAction($this));
         $rctpl->setVariable('RECORD', $lng->txt('dcl_record'));
         $rctpl->setVariable('RECORD_FROM_TOTAL', sprintf($lng->txt('dcl_record_from_total'), $this->current_record_position, count($this->record_ids)));
         $rctpl->setVariable('SELECT_OPTIONS', $this->renderSelectOptions());
     }
     // Edit Button
     if ($this->record_obj->hasPermissionToEdit((int) $_GET['ref_id'])) {
         $button = ilLinkButton::getInstance();
         $ilCtrl->setParameterByClass('ildatacollectionrecordeditgui', 'table_id', $this->table->getId());
         $ilCtrl->setParameterByClass('ildatacollectionrecordeditgui', 'redirect', ilDataCollectionRecordEditGUI::REDIRECT_DETAIL);
         $ilCtrl->saveParameterByClass('ildatacollectionrecordeditgui', 'record_id');
         $button->setUrl($ilCtrl->getLinkTargetByClass('ildatacollectionrecordeditgui', 'edit'));
         $button->setCaption($lng->txt('dcl_edit_record'), false);
         $rctpl->setVariable('EDIT_RECORD_BUTTON', $button->render());
     }
     // Comments
     if ($this->table->getPublicCommentsEnabled()) {
         $rctpl->setVariable('COMMENTS', $this->renderComments($editComments));
     }
     $tpl->setContent($rctpl->get());
 }
 /**
  * show information screen
  */
 function infoScreen()
 {
     global $ilAccess, $ilTabs, $ilUser, $ilToolbar;
     if (!$this->external_rater_360 && !$ilAccess->checkAccess("visible", "", $this->ref_id)) {
         $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"), $this->ilias->error_obj->MESSAGE);
     }
     $ilTabs->activateTab("info_short");
     include_once "./Modules/Survey/classes/class.ilSurveyExecutionGUI.php";
     $output_gui =& new ilSurveyExecutionGUI($this->object);
     include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php";
     $info = new ilInfoScreenGUI($this);
     $info->enablePrivateNotes();
     // "active" survey?
     $canStart = $this->object->canStartSurvey(null, $this->external_rater_360);
     $showButtons = $canStart["result"];
     if (!$showButtons) {
         if ($canStart["edit_settings"] && $ilAccess->checkAccess("write", "", $this->ref_id)) {
             $canStart["messages"][] = "<a href=\"" . $this->ctrl->getLinkTarget($this, "properties") . "\">&raquo; " . $this->lng->txt("survey_edit_settings") . "</a>";
         }
         ilUtil::sendInfo(implode("<br />", $canStart["messages"]));
     }
     $big_button = false;
     if ($showButtons) {
         // closing survey?
         $is_appraisee = false;
         if ($this->object->get360Mode() && $this->object->isAppraisee($ilUser->getId())) {
             $info->addSection($this->lng->txt("survey_360_appraisee_info"));
             $appr_data = $this->object->getAppraiseesData();
             $appr_data = $appr_data[$ilUser->getId()];
             $info->addProperty($this->lng->txt("survey_360_raters_status_info"), $appr_data["finished"]);
             if (!$appr_data["closed"]) {
                 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
                 $button = ilLinkButton::getInstance();
                 $button->setCaption("survey_360_appraisee_close_action");
                 $button->setUrl($this->ctrl->getLinkTargetByClass("ilsurveyparticipantsgui", "confirmappraiseeclose"));
                 $close_button_360 = '<div>' . $button->render() . '</div>';
                 $txt = "survey_360_appraisee_close_action_info";
                 if ($this->object->get360SkillService()) {
                     $txt .= "_skill";
                 }
                 $info->addProperty($this->lng->txt("status"), $close_button_360 . $this->lng->txt($txt));
             } else {
                 ilDatePresentation::setUseRelativeDates(false);
                 $dt = new ilDateTime($appr_data["closed"], IL_CAL_UNIX);
                 $info->addProperty($this->lng->txt("status"), sprintf($this->lng->txt("survey_360_appraisee_close_action_status"), ilDatePresentation::formatDate($dt)));
             }
             $is_appraisee = true;
         }
         // handle code
         // validate incoming
         $code_input = false;
         $anonymous_code = $_POST["anonymous_id"];
         if ($anonymous_code) {
             $code_input = true;
             // if(!$this->object->isUnusedCode($anonymous_code, $ilUser->getId()))
             if (!$this->object->checkSurveyCode($anonymous_code)) {
                 $anonymous_code = null;
             } else {
                 // #15860
                 $this->object->bindSurveyCodeToUser($ilUser->getId(), $anonymous_code);
             }
         }
         if ($anonymous_code) {
             $_SESSION["anonymous_id"][$this->object->getId()] = $anonymous_code;
         } else {
             $anonymous_code = $_SESSION["anonymous_id"][$this->object->getId()];
             if ($anonymous_code) {
                 $code_input = true;
             }
         }
         // try to find code for current (registered) user from existing run
         if ($this->object->getAnonymize() && !$anonymous_code) {
             $anonymous_code = $this->object->findCodeForUser($ilUser->getId());
         }
         // get existing runs for current user, might generate code
         $participant_status = $this->object->getUserSurveyExecutionStatus($anonymous_code);
         if ($participant_status) {
             $anonymous_code = $participant_status["code"];
             $participant_status = $participant_status["runs"];
         }
         // (final) check for proper anonymous code
         if (!$this->object->isAccessibleWithoutCode() && !$is_appraisee && $code_input && (!$anonymous_code || !$this->object->isAnonymousKey($anonymous_code))) {
             $anonymous_code = null;
             ilUtil::sendInfo($this->lng->txt("wrong_survey_code_used"));
         }
         // :TODO: really save in session?
         $_SESSION["anonymous_id"][$this->object->getId()] = $anonymous_code;
         // code is mandatory and not given yet
         if (!$is_appraisee && !$anonymous_code && !$this->object->isAccessibleWithoutCode()) {
             $info->setFormAction($this->ctrl->getFormAction($this, "infoScreen"));
             $info->addSection($this->lng->txt("anonymization"));
             $info->addProperty("", $this->lng->txt("anonymize_anonymous_introduction"));
             $info->addPropertyTextinput($this->lng->txt("enter_anonymous_id"), "anonymous_id", "", 8, "infoScreen", $this->lng->txt("submit"), true);
         } else {
             // trunk/default
             if (!$this->object->get360Mode()) {
                 if ($anonymous_code) {
                     $info->addHiddenElement("anonymous_id", $anonymous_code);
                 }
                 $survey_started = $this->object->isSurveyStarted($ilUser->getId(), $anonymous_code);
                 if ($survey_started === 1) {
                     if ($ilUser->getId() != ANONYMOUS_USER_ID) {
                         if ($this->object->hasViewOwnResults()) {
                             include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
                             $button = ilLinkButton::getInstance();
                             $button->setCaption("svy_view_own_results");
                             $button->setUrl($this->ctrl->getLinkTarget($this, "viewUserResults"));
                             $ilToolbar->addButtonInstance($button);
                         }
                         if ($this->object->hasMailOwnResults()) {
                             if ($this->object->hasViewOwnResults()) {
                                 $ilToolbar->addSeparator();
                             }
                             require_once "Services/Form/classes/class.ilTextInputGUI.php";
                             $mail = new ilTextInputGUI($this->lng->txt("email"), "mail");
                             $mail->setSize(25);
                             $mail->setValue($ilUser->getEmail());
                             $ilToolbar->addInputItem($mail, true);
                             $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "mailUserResults"));
                             include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
                             $button = ilSubmitButton::getInstance();
                             $button->setCaption("svy_mail_own_results");
                             $button->setCommand("mailUserResults");
                             $ilToolbar->addButtonInstance($button);
                         }
                     }
                     ilUtil::sendInfo($this->lng->txt("already_completed_survey"));
                 } elseif ($survey_started === 0) {
                     $big_button = array("resume", $this->lng->txt("resume_survey"));
                 } elseif ($survey_started === FALSE) {
                     $big_button = array("start", $this->lng->txt("start_survey"));
                 }
             } else {
                 $appr_ids = array();
                 // use given code (if proper external one)
                 if ($anonymous_code) {
                     $anonymous_id = $this->object->getAnonymousIdByCode($anonymous_code);
                     if ($anonymous_id) {
                         $appr_ids = $this->object->getAppraiseesToRate(0, $anonymous_id);
                     }
                 }
                 // registered user
                 // if an auto-code was generated, we still have to check for the original user id
                 if (!$appr_ids && $ilUser->getId() != ANONYMOUS_USER_ID) {
                     $appr_ids = $this->object->getAppraiseesToRate($ilUser->getId());
                 }
                 if (sizeof($appr_ids)) {
                     // map existing runs to appraisees
                     $active_appraisees = array();
                     if ($participant_status) {
                         foreach ($participant_status as $item) {
                             $active_appraisees[$item["appr_id"]] = $item["finished"];
                         }
                     }
                     $list = array();
                     foreach ($appr_ids as $appr_id) {
                         if ($this->object->isAppraiseeClosed($appr_id)) {
                             // closed
                             $list[$appr_id] = $this->lng->txt("survey_360_appraisee_is_closed");
                         } else {
                             if (array_key_exists($appr_id, $active_appraisees)) {
                                 // already done
                                 if ($active_appraisees[$appr_id]) {
                                     $list[$appr_id] = $this->lng->txt("already_completed_survey");
                                 } else {
                                     $list[$appr_id] = array("resume", $this->lng->txt("resume_survey"));
                                 }
                             } else {
                                 // start
                                 $list[$appr_id] = array("start", $this->lng->txt("start_survey"));
                             }
                         }
                     }
                     $info->addSection($this->lng->txt("survey_360_rate_other_appraisees"));
                     include_once "Services/User/classes/class.ilUserUtil.php";
                     foreach ($list as $appr_id => $item) {
                         $appr_name = ilUserUtil::getNamePresentation($appr_id, false, false, "", true);
                         if (!is_array($item)) {
                             $info->addProperty($appr_name, $item);
                         } else {
                             $this->ctrl->setParameter($output_gui, "appr_id", $appr_id);
                             $href = $this->ctrl->getLinkTarget($output_gui, $item[0]);
                             $this->ctrl->setParameter($output_gui, "appr_id", "");
                             include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
                             $button = ilLinkButton::getInstance();
                             $button->setCaption($item[1], false);
                             $button->setUrl($href);
                             $big_button_360 = '<div>' . $button->render() . '</div>';
                             $info->addProperty($appr_name, $big_button_360);
                         }
                     }
                 } else {
                     if (!$is_appraisee) {
                         ilUtil::sendFailure($this->lng->txt("survey_360_no_appraisees"));
                     }
                 }
             }
         }
         if ($this->object->get360Mode() && $this->object->get360SelfAppraisee() && !$this->object->isAppraisee($ilUser->getId()) && $ilUser->getId() != ANONYMOUS_USER_ID) {
             $link = $this->ctrl->getLinkTargetByClass("ilsurveyparticipantsgui", "addSelfAppraisee");
             $link = '<a href="' . $link . '">' . $this->lng->txt("survey_360_add_self_appraisee") . '</a>';
             $info->addProperty("&nbsp;", $link);
         }
     }
     if ($big_button) {
         $ilToolbar->setFormAction($this->ctrl->getFormAction($output_gui, "infoScreen"));
         include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
         $button = ilSubmitButton::getInstance();
         $button->setCaption($big_button[1], false);
         $button->setCommand($big_button[0]);
         $button->setPrimary(true);
         $ilToolbar->addButtonInstance($button);
         $ilToolbar->setCloseFormTag(false);
         $info->setOpenFormTag(false);
     }
     /* #12016
     		else
     		{
     			$info->setFormAction($this->ctrl->getFormAction($output_gui, "infoScreen"));
     		}
     		*/
     if (strlen($this->object->getIntroduction())) {
         $introduction = $this->object->getIntroduction();
         $info->addSection($this->lng->txt("introduction"));
         $info->addProperty("", $this->object->prepareTextareaOutput($introduction) . "<br />" . $info->getHiddenToggleButton());
     } else {
         $info->addSection("");
         $info->addProperty("", $info->getHiddenToggleButton());
     }
     $info->hideFurtherSections(false);
     if (!$this->object->get360Mode()) {
         $info->addSection($this->lng->txt("svy_general_properties"));
         $info->addProperty($this->lng->txt("survey_results_anonymization"), !$this->object->hasAnonymizedResults() ? $this->lng->txt("survey_results_personalized_info") : $this->lng->txt("survey_results_anonymized_info"));
         include_once "./Modules/Survey/classes/class.ilObjSurveyAccess.php";
         if ($ilAccess->checkAccess("write", "", $this->ref_id) || ilObjSurveyAccess::_hasEvaluationAccess($this->object->getId(), $ilUser->getId())) {
             $info->addProperty($this->lng->txt("evaluation_access"), $this->lng->txt("evaluation_access_info"));
         }
     }
     $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
     $this->ctrl->forwardCommand($info);
 }
Example #9
0
 /**
  * Questions per page
  *
  * @param
  * @return
  */
 function buildPageViewToolbar($qid = 0)
 {
     if ($this->create_question_mode) {
         return;
     }
     global $ilToolbar, $ilCtrl, $lng;
     require_once 'Services/UIComponent/Button/classes/class.ilLinkButton.php';
     $this->getQuestionsSubTabs();
     $ilCtrl->saveParameter($this, 'q_mode');
     $ilCtrl->setParameterByClass('iltestexpresspageobjectgui', 'test_express_mode', 1);
     $ilCtrl->setParameter($this, 'test_express_mode', 1);
     $ilCtrl->setParameterByClass('iltestexpresspageobjectgui', 'q_id', $_REQUEST['q_id']);
     $ilCtrl->setParameter($this, 'q_id', $_REQUEST['q_id']);
     $ilToolbar->setFormAction($ilCtrl->getFormActionByClass('iltestexpresspageobjectgui', 'edit'));
     if ($this->object->evalTotalPersons() == 0) {
         /*
         include_once 'Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
         $pool = new ilObjQuestionPool();
         $questionTypes = $pool->getQuestionTypes();$options = array();
         foreach($questionTypes as $label => $data) {
         $options[$data['question_type_id']] = $label;
         }
         
         		include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
         		$si = new ilSelectInputGUI($lng->txt("test_add_new_question"), "qtype");
         		$si->setOptions($options);
         		$ilToolbar->addInputItem($si, true);
         /*
         		// use pool
         		if ($this->object->isExpressModeQuestionPoolAllowed()) {
         			include_once("./Services/Form/classes/class.ilCheckboxInputGUI.php");
         			$cb = new ilCheckboxInputGUI($lng->txt("test_use_pool"), "use_pool");
         			$ilToolbar->addInputItem($cb, true);
         		}
         */
         $ilToolbar->addFormButton($lng->txt("ass_create_question"), "addQuestion");
         $ilToolbar->addSeparator();
         if ($this->object->getPoolUsage()) {
             require_once 'Modules/Test/classes/tables/class.ilTestQuestionBrowserTableGUI.php';
             $this->populateQuestionBrowserToolbarButtons($ilToolbar, ilTestQuestionBrowserTableGUI::CONTEXT_PAGE_VIEW);
             $show_separator = true;
         }
     }
     $questions = $this->object->getQuestionTitlesAndIndexes();
     // desc
     $options = array();
     foreach ($questions as $id => $label) {
         $options[$id] = $label . ' [' . $this->lng->txt('question_id_short') . ': ' . $id . ']';
     }
     $optionKeys = array_keys($options);
     if (!$options) {
         $options[] = $lng->txt('none');
     }
     //else if (count($options) > 1) {
     //                    $addSeparator = false;
     //                    if ($optionKeys[0] != $qid) {
     //                        //$ilToolbar->addFormButton($lng->txt("test_prev_question"), "prevQuestion");
     //                        $ilToolbar->addLink($lng->txt("test_prev_question"), $ilCtrl->getLinkTargetByClass('iltestexpresspageobjectgui', 'prevQuestion'));
     //                        $addSeparator = true;
     //                    }
     //		    else {
     //			$ilToolbar->addSpacer(45);
     //		    }
     //
     //                    if ($optionKeys[count($optionKeys)-1] != $qid) {
     //                        //$ilToolbar->addFormButton($lng->txt("test_next_question"), "nextQuestion");
     //                        $ilToolbar->addLink($lng->txt("test_next_question"), $ilCtrl->getLinkTargetByClass('iltestexpresspageobjectgui', 'nextQuestion'));
     //			$addSeparator = true;
     //                    }
     //		    else {
     //			$ilToolbar->addSpacer(45);
     //		    }
     //
     //                    //if ($addSeparator) {
     //                        $ilToolbar->addSeparator();
     //                    //}
     if (count($questions)) {
         if (isset($show_separator) && $show_separator) {
             $ilToolbar->addSeparator();
         }
         $btn = ilLinkButton::getInstance();
         $btn->setCaption("test_prev_question");
         $btn->setUrl($ilCtrl->getLinkTargetByClass('iltestexpresspageobjectgui', 'prevQuestion'));
         $ilToolbar->addButtonInstance($btn);
         if (count($options) <= 1 || $optionKeys[0] == $qid) {
             $btn->setDisabled(true);
         }
         $btn = ilLinkButton::getInstance();
         $btn->setCaption("test_next_question");
         $btn->setUrl($ilCtrl->getLinkTargetByClass('iltestexpresspageobjectgui', 'nextQuestion'));
         $ilToolbar->addButtonInstance($btn);
         if (count($options) <= 1 || $optionKeys[count($optionKeys) - 1] == $qid) {
             $btn->setDisabled(true);
         }
     }
     if (count($questions) > 1) {
         $ilToolbar->addSeparator();
         include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
         $si = new ilSelectInputGUI($lng->txt("test_jump_to"), "q_id");
         $si->addCustomAttribute("onChange=\"forms['ilToolbar'].submit();\"");
         $si->setOptions($options);
         if ($qid) {
             $si->setValue($qid);
         }
         $ilToolbar->addInputItem($si, true);
     }
     $total = $this->object->evalTotalPersons();
     /*if (count($options)) {
     			include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
     			$si = new ilSelectInputGUI($lng->txt("test_jump_to"), "q_id");
     			$si->addCustomAttribute("onChange=\"forms['ilToolbar'].submit();\"");
     			$si->setOptions($options);
     
     			if ($qid) {
     				$si->setValue($qid);
     			}
     
     			$ilToolbar->addInputItem($si, true);
     		}*/
     if (count($questions) && !$total) {
         $ilCtrl->setParameter($this, 'q_id', $_REQUEST['q_id']);
         $ilToolbar->addSeparator();
         $ilToolbar->addButton($lng->txt("test_delete_page"), $ilCtrl->getLinkTarget($this, "removeQuestions"));
     }
     if (count($questions) > 1 && !$total) {
         $ilToolbar->addSeparator();
         $ilToolbar->addButton($lng->txt("test_move_page"), $ilCtrl->getLinkTarget($this, "movePageForm"));
     }
     global $ilAccess, $ilUser;
     $online_access = false;
     if ($this->object->getFixedParticipants()) {
         include_once "./Modules/Test/classes/class.ilObjTestAccess.php";
         $online_access_result = ilObjTestAccess::_lookupOnlineTestAccess($this->object->getId(), $ilUser->getId());
         if ($online_access_result === true) {
             $online_access = true;
         }
     }
     if ($this->object->isOnline() && $this->object->isComplete($this->testQuestionSetConfigFactory->getQuestionSetConfig())) {
         if ((!$this->object->getFixedParticipants() || $online_access) && $ilAccess->checkAccess("read", "", $this->ref_id)) {
             $testSession = $this->testSessionFactory->getSession();
             $executable = $this->object->isExecutable($testSession, $ilUser->getId(), $allowPassIncrease = TRUE);
             if ($executable["executable"]) {
                 $player_factory = new ilTestPlayerFactory($this->object);
                 $player_instance = $player_factory->getPlayerGUI();
                 if ($testSession->getActiveId() > 0) {
                     $ilToolbar->addSeparator();
                     $ilToolbar->addButton($lng->txt('tst_resume_test'), $ilCtrl->getLinkTarget($player_instance, 'resumePlayer'));
                 } else {
                     $ilToolbar->addSeparator();
                     $ilToolbar->addButton($lng->txt('tst_start_test'), $ilCtrl->getLinkTarget($player_instance, 'startTest'));
                 }
             }
         }
     }
 }
 /**
  * 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();
 }
 /**
  * Display all types in a table with actions to edit/delete
  */
 protected function listTypes()
 {
     $button = ilLinkButton::getInstance();
     $button->setCaption('orgu_type_add');
     $button->setUrl($this->ctrl->getLinkTarget($this, 'add'));
     $this->toolbar->addButtonInstance($button);
     $table = new ilOrgUnitTypeTableGUI($this, 'listTypes');
     $this->tpl->setContent($table->getHTML());
 }
 /**
  * Displays a form to manage the user created phrases
  *
  * @access	public
  */
 public function phrases()
 {
     global $rbacsystem, $ilToolbar;
     $this->ctrl->setParameter($this, "p_id", "");
     if ($rbacsystem->checkAccess("write", $this->ref_id)) {
         include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
         $button = ilLinkButton::getInstance();
         $button->setCaption("phrase_new");
         $button->setUrl($this->ctrl->getLinkTarget($this, "newPhrase"));
         $ilToolbar->addButtonInstance($button);
         include_once "./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyPhrasesTableGUI.php";
         $table_gui = new ilSurveyPhrasesTableGUI($this, 'phrases');
         $phrases =& ilSurveyPhrases::_getAvailablePhrases(1);
         $data = array();
         foreach ($phrases as $phrase_id => $phrase_array) {
             $categories =& ilSurveyPhrases::_getCategoriesForPhrase($phrase_id);
             array_push($data, array('phrase_id' => $phrase_id, 'phrase' => $phrase_array["title"], 'answers' => join($categories, ", ")));
         }
         $table_gui->setData($data);
         $this->tpl->setContent($table_gui->getHTML());
     } else {
         ilUtil::sendInfo($this->lng->txt("cannot_manage_phrases"));
     }
 }
 /**
  * Show list of portfolio pages
  */
 public function view()
 {
     global $ilToolbar, $ilSetting, $tree;
     if (!$this->checkPermissionBool("write")) {
         $this->ctrl->redirect($this, "infoScreen");
     }
     $this->tabs_gui->activateTab("pages");
     include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
     $button = ilLinkButton::getInstance();
     $button->setCaption("prtf_add_page");
     $button->setUrl($this->ctrl->getLinkTarget($this, "addPage"));
     $ilToolbar->addButtonInstance($button);
     if (!$ilSetting->get('disable_wsp_blogs')) {
         $button = ilLinkButton::getInstance();
         $button->setCaption("prtf_add_blog");
         $button->setUrl($this->ctrl->getLinkTarget($this, "addBlog"));
         $ilToolbar->addButtonInstance($button);
     }
     $ilToolbar->addSeparator();
     $button = ilLinkButton::getInstance();
     $button->setCaption("export_html");
     $button->setUrl($this->ctrl->getLinkTarget($this, "export"));
     $ilToolbar->addButtonInstance($button);
     include_once "Modules/Portfolio/classes/class.ilPortfolioPageTableGUI.php";
     $table = new ilPortfolioPageTableGUI($this, "view");
     // exercise portfolio?
     include_once "Modules/Exercise/classes/class.ilObjExercise.php";
     $exercises = ilObjExercise::findUserFiles($this->user_id, $this->object->getId());
     if ($exercises) {
         $info = array();
         foreach ($exercises as $exercise) {
             // #9988
             $active_ref = false;
             foreach (ilObject::_getAllReferences($exercise["obj_id"]) as $ref_id) {
                 if (!$tree->isSaved($ref_id)) {
                     $active_ref = true;
                     break;
                 }
             }
             if ($active_ref) {
                 $part = $this->getExerciseInfo($exercise["ass_id"], $table->dataExists());
                 if ($part) {
                     $info[] = $part;
                 }
             }
         }
         if (sizeof($info)) {
             ilUtil::sendInfo(implode("<br />", $info));
         }
     }
     $this->tpl->setContent($table->getHTML());
 }
 /**
  * @param $testSession
  * @param $big_button
  */
 private function populateDeleteDynamicTestResultsButton($testSession, &$big_button)
 {
     require_once 'Modules/Test/classes/confirmations/class.ilTestPassDeletionConfirmationGUI.php';
     require_once 'Services/UIComponent/Button/classes/class.ilLinkButton.php';
     $this->ctrl->setParameterByClass('iltestevaluationgui', 'context', ilTestPassDeletionConfirmationGUI::CONTEXT_INFO_SCREEN);
     $this->ctrl->setParameterByClass('iltestevaluationgui', 'active_id', $testSession->getActiveId());
     $this->ctrl->setParameterByClass('iltestevaluationgui', 'pass', $testSession->getPass());
     $btn = ilLinkButton::getInstance();
     $btn->setCaption('tst_delete_dyn_test_results_btn');
     $btn->setUrl($this->ctrl->getLinkTargetByClass('iltestevaluationgui', 'confirmDeletePass'));
     $btn->setPrimary(false);
     $big_button[] = $btn;
 }
 /**
  * show news
  */
 function showNews()
 {
     global $lng, $ilCtrl, $ilUser;
     // workaround for dynamic mode (if cache is disabled, showNews has no data)
     if (empty(self::$st_data)) {
         $this->setData($this->getNewsData());
     }
     $news_set = new ilSetting("news");
     $enable_internal_rss = $news_set->get("enable_rss_for_internal");
     include_once "./Services/News/classes/class.ilNewsItem.php";
     $news = new ilNewsItem($_GET["news_id"]);
     $tpl = new ilTemplate("tpl.show_news.html", true, true, "Services/News");
     // get current item in data set
     $previous = $next = "";
     reset($this->data);
     $c = current($this->data);
     $curr_cnt = 1;
     while ($c["id"] > 0 && $c["id"] != $_GET["news_id"]) {
         $previous = $c;
         $c = next($this->data);
         $curr_cnt++;
     }
     // collect news items to show
     $news_list = array();
     if (is_array($c["aggregation"])) {
         //$agg_obj_id = ilObject::_lookupObjId($c["agg_ref_id"]);
         //$agg_obj_type = ilObject::_lookupType($agg_obj_id);
         //$agg_obj_title = ilObject::_lookupObjId($agg_obj_id);
         $news_list[] = array("ref_id" => $c["agg_ref_id"], "agg_ref_id" => $c["agg_ref_id"], "aggregation" => $c["aggregation"], "user_id" => "", "content_type" => "text", "mob_id" => 0, "visibility" => "", "content" => "", "content_long" => "", "update_date" => $news->getUpdateDate(), "creation_date" => "", "content_is_lang_var" => false, "loc_context" => $_GET["news_context"], "context_obj_type" => $news->getContextObjType(), "title" => "");
         foreach ($c["aggregation"] as $c_item) {
             ilNewsItem::_setRead($ilUser->getId(), $c_item["id"]);
             $c_item["loc_context"] = $c_item["ref_id"];
             $c_item["loc_stop"] = $_GET["news_context"];
             $news_list[] = $c_item;
         }
     } else {
         $news_list[] = array("ref_id" => $_GET["news_context"], "user_id" => $news->getUserId(), "content_type" => $news->getContentType(), "mob_id" => $news->getMobId(), "visibility" => $news->getVisibility(), "priority" => $news->getPriority(), "content" => $news->getContent(), "content_long" => $news->getContentLong(), "update_date" => $news->getUpdateDate(), "creation_date" => $news->getCreationDate(), "context_sub_obj_type" => $news->getContextSubObjType(), "context_obj_type" => $news->getContextObjType(), "context_sub_obj_id" => $news->getContextSubObjId(), "content_is_lang_var" => $news->getContentIsLangVar(), "content_text_is_lang_var" => $news->getContentTextIsLangVar(), "loc_context" => $_GET["news_context"], "title" => $news->getTitle());
         ilNewsItem::_setRead($ilUser->getId(), $_GET["news_id"]);
     }
     foreach ($news_list as $item) {
         // user
         if ($item["user_id"] > 0 && ilObject::_exists($item["user_id"])) {
             // get login
             if (ilObjUser::_exists($item["user_id"])) {
                 $user = new ilObjUser($item["user_id"]);
                 $displayname = $user->getLogin();
             } else {
                 // this should actually not happen, since news entries
                 // should be deleted when the user is going to be removed
                 $displayname = "&lt;" . strtolower($lng->txt("deleted")) . "&gt;";
             }
             $tpl->setCurrentBlock("user_info");
             $tpl->setVariable("VAL_AUTHOR", $displayname);
             $tpl->setVariable("TXT_AUTHOR", $lng->txt("author"));
             $tpl->parseCurrentBlock();
         }
         // media player
         if ($item["content_type"] == NEWS_AUDIO && $item["mob_id"] > 0 && ilObject::_exists($item["mob_id"])) {
             include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
             include_once "./Services/MediaObjects/classes/class.ilMediaPlayerGUI.php";
             $mob = new ilObjMediaObject($item["mob_id"]);
             $med = $mob->getMediaItem("Standard");
             $mpl = new ilMediaPlayerGUI("news_pl_" . $item["mob_id"]);
             if (strcasecmp("Reference", $med->getLocationType()) == 0) {
                 $mpl->setFile($med->getLocation());
             } else {
                 $mpl->setFile(ilObjMediaObject::_getURL($mob->getId()) . "/" . $med->getLocation());
             }
             $mpl->setDisplayHeight($med->getHeight());
             $tpl->setCurrentBlock("player");
             $tpl->setVariable("PLAYER", $mpl->getMp3PlayerHtml());
             $tpl->parseCurrentBlock();
         }
         // access
         if ($enable_internal_rss && $item["visibility"] != "") {
             $obj_id = ilObject::_lookupObjId($item["ref_id"]);
             $tpl->setCurrentBlock("access");
             $tpl->setVariable("TXT_ACCESS", $lng->txt("news_news_item_visibility"));
             if ($item["visibility"] == NEWS_PUBLIC || $item["priority"] == 0 && ilBlockSetting::_lookup("news", "public_notifications", 0, $obj_id)) {
                 $tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_public"));
             } else {
                 $tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_users"));
             }
             $tpl->parseCurrentBlock();
         }
         // content
         if (trim($item["content"]) != "") {
             $tpl->setCurrentBlock("content");
             $tpl->setVariable("VAL_CONTENT", nl2br($this->makeClickable(ilNewsItem::determineNewsContent($item["context_obj_type"], $item["content"], $item["content_text_is_lang_var"]))));
             //$tpl->setVariable("VAL_CONTENT", nl2br($item["content"]));
             $tpl->parseCurrentBlock();
         }
         if (trim($item["content_long"]) != "") {
             $tpl->setCurrentBlock("long");
             $tpl->setVariable("VAL_LONG_CONTENT", $this->makeClickable($item["content_long"]));
             $tpl->parseCurrentBlock();
         }
         if ($item["update_date"] != $item["creation_date"]) {
             $tpl->setCurrentBlock("ni_update");
             $tpl->setVariable("TXT_LAST_UPDATE", $lng->txt("last_update"));
             $tpl->setVariable("VAL_LAST_UPDATE", ilDatePresentation::formatDate(new ilDateTime($item["update_date"], IL_CAL_DATETIME)));
             $tpl->parseCurrentBlock();
         }
         // creation date
         if ($item["creation_date"] != "") {
             $tpl->setCurrentBlock("ni_update");
             $tpl->setVariable("VAL_CREATION_DATE", ilDatePresentation::formatDate(new ilDateTime($item["creation_date"], IL_CAL_DATETIME)));
             $tpl->setVariable("TXT_CREATED", $lng->txt("created"));
             $tpl->parseCurrentBlock();
         }
         // context / title
         if ($_GET["news_context"] > 0) {
             //$obj_id = ilObject::_lookupObjId($_GET["news_context"]);
             $obj_id = ilObject::_lookupObjId($item["ref_id"]);
             $obj_type = ilObject::_lookupType($obj_id);
             $obj_title = ilObject::_lookupTitle($obj_id);
             // file hack, not nice
             if ($obj_type == "file") {
                 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $item["ref_id"]);
                 $url = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "sendfile");
                 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
                 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
                 $button = ilLinkButton::getInstance();
                 $button->setUrl($url);
                 $button->setCaption("download");
                 $tpl->setCurrentBlock("download");
                 $tpl->setVariable("BUTTON_DOWNLOAD", $button->render());
                 $tpl->parseCurrentBlock();
             }
             // forum hack, not nice
             $add = "";
             if ($obj_type == "frm" && $item["context_sub_obj_type"] == "pos" && $item["context_sub_obj_id"] > 0) {
                 include_once "./Modules/Forum/classes/class.ilObjForumAccess.php";
                 $pos = $item["context_sub_obj_id"];
                 $thread = ilObjForumAccess::_getThreadForPosting($pos);
                 if ($thread > 0) {
                     $add = "_" . $thread . "_" . $pos;
                 }
             }
             // wiki hack, not nice
             if ($obj_type == "wiki" && $item["context_sub_obj_type"] == "wpg" && $item["context_sub_obj_id"] > 0) {
                 include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
                 $wptitle = ilWikiPage::lookupTitle($item["context_sub_obj_id"]);
                 if ($wptitle != "") {
                     $add = "_" . ilWikiUtil::makeUrlTitle($wptitle);
                 }
             }
             $url_target = "./goto.php?client_id=" . rawurlencode(CLIENT_ID) . "&target=" . $obj_type . "_" . $item["ref_id"] . $add;
             // lm page hack, not nice
             if (in_array($obj_type, array("dbk", "lm")) && $item["context_sub_obj_type"] == "pg" && $item["context_sub_obj_id"] > 0) {
                 $url_target = "./goto.php?client_id=" . rawurlencode(CLIENT_ID) . "&target=" . "pg_" . $item["context_sub_obj_id"] . "_" . $item["ref_id"];
             }
             $context_opened = false;
             if ($item["loc_context"] != null && $item["loc_context"] != $item["loc_stop"]) {
                 $tpl->setCurrentBlock("context");
                 $context_opened = true;
                 $cont_loc = new ilLocatorGUI();
                 $cont_loc->addContextItems($item["loc_context"], true, $item["loc_stop"]);
                 $tpl->setVariable("CONTEXT_LOCATOR", $cont_loc->getHTML());
             }
             //var_dump($item);
             if ($item["no_context_title"] !== true) {
                 if (!$context_opened) {
                     $tpl->setCurrentBlock("context");
                 }
                 $tpl->setVariable("HREF_CONTEXT_TITLE", $url_target);
                 $tpl->setVariable("CONTEXT_TITLE", $obj_title);
                 $tpl->setVariable("IMG_CONTEXT_TITLE", ilObject::_getIcon($obj_id, "big", $obj_type));
             }
             if ($context_opened) {
                 $tpl->parseCurrentBlock();
             }
             $tpl->setVariable("HREF_TITLE", $url_target);
         }
         // title
         $tpl->setVariable("VAL_TITLE", ilNewsItem::determineNewsTitle($item["context_obj_type"], $item["title"], $item["content_is_lang_var"], $item["agg_ref_id"], $item["aggregation"]));
         $row_css = $row_css != "tblrow1" ? "tblrow1" : "tblrow2";
         $tpl->setCurrentBlock("item");
         $tpl->setVariable("ITEM_ROW_CSS", $row_css);
         $tpl->parseCurrentBlock();
     }
     include_once "./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php";
     $content_block = new ilPDContentBlockGUI();
     $content_block->setContent($tpl->get());
     if ($this->getProperty("title") != "") {
         $content_block->setTitle($this->getProperty("title"));
     } else {
         $content_block->setTitle($lng->txt("news_internal_news"));
     }
     $this->addCloseCommand($content_block);
     // previous
     if ($previous != "") {
         if ($previous["ref_id"] > 0) {
             $ilCtrl->setParameter($this, "news_context", $previous["ref_id"]);
         }
         $ilCtrl->setParameter($this, "news_id", $previous["id"]);
         $content_block->addFooterLink($lng->txt("previous"), $ilCtrl->getLinkTarget($this, "showNews"), "", "", true);
         $ilCtrl->setParameter($this, "news_context", "");
     }
     // next
     if ($c = next($this->data)) {
         if ($c["ref_id"] > 0) {
             $ilCtrl->setParameter($this, "news_context", $c["ref_id"]);
         }
         $ilCtrl->setParameter($this, "news_id", $c["id"]);
         $content_block->addFooterLink($lng->txt("next"), $ilCtrl->getLinkTarget($this, "showNews"), "", "", true);
     }
     $ilCtrl->setParameter($this, "news_context", "");
     $ilCtrl->setParameter($this, "news_id", "");
     $content_block->setCurrentItemNumber($curr_cnt);
     $content_block->setEnableNumInfo(true);
     $content_block->setData($this->getData());
     return $content_block->getHTML();
 }
 /**
  * info screen
  */
 function outputInfoScreen($a_standard_locator = true)
 {
     global $ilToolbar, $ilAccess, $ilTabs;
     $ilTabs->activateTab('id_info');
     $this->lng->loadLanguageModule("meta");
     include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php";
     $info = new ilInfoScreenGUI($this);
     $info->enablePrivateNotes();
     $info->enableLearningProgress();
     $info->enableNews();
     if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
         $info->enableNewsEditing();
         $news_set = new ilSetting("news");
         $enable_internal_rss = $news_set->get("enable_rss_for_internal");
         if ($enable_internal_rss) {
             $info->setBlockProperty("news", "settings", true);
         }
     }
     // add read / back button
     if ($ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
         // #15127
         include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
         $button = ilLinkButton::getInstance();
         $button->setCaption("view");
         $button->setPrimary(true);
         $button->setUrl("ilias.php?baseClass=ilHTLMPresentationGUI&ref_id=" . $this->object->getRefID());
         $button->setTarget("ilContObj" . $this->object->getId());
         $ilToolbar->addButtonInstance($button);
     }
     // show standard meta data section
     $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
     // forward the command
     $this->ctrl->forwardCommand($info);
 }
 /**
  * list users
  *
  * @access	public
  */
 function viewObject($reset_filter = FALSE)
 {
     global $rbacsystem, $ilUser, $ilToolbar, $tpl, $ilSetting, $lng;
     include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
     $button = ilLinkButton::getInstance();
     $button->setCaption("usr_add");
     $button->setUrl($this->ctrl->getLinkTarget($this, "addUser"));
     $ilToolbar->addButtonInstance($button);
     $button = ilLinkButton::getInstance();
     $button->setCaption("import_users");
     $button->setUrl($this->ctrl->getLinkTarget($this, "importUserForm"));
     $ilToolbar->addButtonInstance($button);
     // alphabetical navigation
     include_once './Services/User/classes/class.ilUserAccountSettings.php';
     $aset = ilUserAccountSettings::getInstance();
     if ((int) $ilSetting->get('user_adm_alpha_nav')) {
         $ilToolbar->addSeparator();
         // alphabetical navigation
         include_once "./Services/Form/classes/class.ilAlphabetInputGUI.php";
         $ai = new ilAlphabetInputGUI("", "first");
         include_once "./Services/User/classes/class.ilObjUser.php";
         $ai->setLetters(ilObjUser::getFirstLettersOfLastnames());
         /*$ai->setLetters(array("A","B","C","D","E","F","G","H","I","J",
         		"K","L","M","N","O","P","Q","R","S","T",
         		"U","V","W","X","Y","Z","1","2","3","4","_",
         		"Ä","Ü","Ö",":",";","+","*","#","§","%","&"));*/
         $ai->setParentCommand($this, "chooseLetter");
         $ai->setHighlighted($_GET["letter"]);
         $ilToolbar->addInputItem($ai, true);
     }
     include_once "./Services/User/classes/class.ilUserTableGUI.php";
     $utab = new ilUserTableGUI($this, "view");
     $tpl->setContent($utab->getHTML());
 }
 function view()
 {
     global $tree, $ilUser, $ilCtrl, $lng, $tpl, $ilToolbar;
     include_once "./Services/UIComponent/Button/classes/class.ilLinkButton.php";
     $but = ilLinkButton::getInstance();
     $but->setUrl($ilCtrl->getLinkTargetByClass("ilobjmediaobjectgui", "create"));
     $but->setCaption("cont_create_mob");
     $ilToolbar->addButtonInstance($but);
     include_once "./Services/Clipboard/classes/class.ilClipboardTableGUI.php";
     $table_gui = new ilClipboardTableGUI($this, "view");
     $tpl->setContent($table_gui->getHTML());
 }
Example #19
0
 /**
  * show information screen
  */
 function infoScreenForward()
 {
     global $ilTabs, $ilErr, $ilToolbar;
     $ilTabs->activateTab("id_info");
     if (!$this->checkPermissionBool("visible")) {
         $ilErr->raiseError($this->lng->txt("msg_no_perm_read"));
     }
     include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php";
     $info = new ilInfoScreenGUI($this);
     if ($this->checkPermissionBool("read", "sendfile")) {
         // #9876
         $this->lng->loadLanguageModule("file");
         // #14378
         include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
         $button = ilLinkButton::getInstance();
         $button->setCaption("file_download");
         $button->setPrimary(true);
         // get permanent download link for repository
         if ($this->id_type == self::REPOSITORY_NODE_ID) {
             $button->setUrl(ilObjFileAccess::_getPermanentDownloadLink($this->node_id));
         } else {
             $button->setUrl($this->ctrl->getLinkTarget($this, "sendfile"));
         }
         $ilToolbar->addButtonInstance($button);
     }
     $info->enablePrivateNotes();
     if ($this->checkPermissionBool("read")) {
         $info->enableNews();
     }
     // no news editing for files, just notifications
     $info->enableNewsEditing(false);
     if ($this->checkPermissionBool("write")) {
         $news_set = new ilSetting("news");
         $enable_internal_rss = $news_set->get("enable_rss_for_internal");
         if ($enable_internal_rss) {
             $info->setBlockProperty("news", "settings", true);
             $info->setBlockProperty("news", "public_notifications_option", true);
         }
     }
     // standard meta data
     $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
     $info->addSection($this->lng->txt("file_info"));
     $info->addProperty($this->lng->txt("filename"), $this->object->getFileName());
     // BEGIN WebDAV Guess file type.
     $info->addProperty($this->lng->txt("type"), $this->object->guessFileType());
     // END WebDAV Guess file type.
     $info->addProperty($this->lng->txt("size"), ilFormat::formatSize(ilObjFile::_lookupFileSize($this->object->getId()), 'long'));
     $info->addProperty($this->lng->txt("version"), $this->object->getVersion());
     // using getVersions function instead of ilHistory direct
     $uploader = $this->object->getVersions();
     $uploader = array_shift($uploader);
     $uploader = $uploader["user_id"];
     $this->lng->loadLanguageModule("file");
     include_once "Services/User/classes/class.ilUserUtil.php";
     $info->addProperty($this->lng->txt("file_uploaded_by"), ilUserUtil::getNamePresentation($uploader));
     // download link added in repository
     if ($this->id_type == self::REPOSITORY_NODE_ID && $this->checkPermissionBool("read", "sendfile")) {
         $tpl = new ilTemplate("tpl.download_link.html", true, true, "Modules/File");
         $tpl->setVariable("LINK", ilObjFileAccess::_getPermanentDownloadLink($this->node_id));
         $info->addProperty($this->lng->txt("download_link"), $tpl->get());
     }
     if ($this->id_type == self::WORKSPACE_NODE_ID) {
         $info->addProperty($this->lng->txt("perma_link"), $this->getPermanentLinkWidget());
     }
     // display previews
     include_once "./Services/Preview/classes/class.ilPreview.php";
     if (!$this->ctrl->isAsynch() && ilPreview::hasPreview($this->object->getId(), $this->object->getType()) && $this->checkPermissionBool("read")) {
         include_once "./Services/Preview/classes/class.ilPreviewGUI.php";
         // get context for access checks later on
         $context;
         switch ($this->id_type) {
             case self::WORKSPACE_NODE_ID:
             case self::WORKSPACE_OBJECT_ID:
                 $context = ilPreviewGUI::CONTEXT_WORKSPACE;
                 break;
             default:
                 $context = ilPreviewGUI::CONTEXT_REPOSITORY;
                 break;
         }
         $preview = new ilPreviewGUI($this->node_id, $context, $this->object->getId(), $this->access_handler);
         $info->addProperty($this->lng->txt("preview"), $preview->getInlineHTML());
     }
     // forward the command
     // $this->ctrl->setCmd("showSummary");
     // $this->ctrl->setCmdClass("ilinfoscreengui");
     $this->ctrl->forwardCommand($info);
 }
 /**
  * Add new item selection to current page incl. toolbar (trigger) and overlay
  */
 public function render()
 {
     global $ilToolbar, $tpl, $lng;
     if ($this->mode == ilObjectDefinition::MODE_WORKSPACE) {
         if (!$this->parsePersonalWorkspace()) {
             return;
         }
     } else {
         if (!$this->parseRepository()) {
             return;
         }
     }
     $ov_id = "il_add_new_item_ov";
     $ov_trigger_id = $ov_id . "_tr";
     include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php";
     $adv = new ilAdvancedSelectionListGUI();
     $adv->setListTitle($lng->txt("cntr_add_new_item"));
     $this->getHTML();
     $adv->setGroupedList($this->gl);
     $adv->setStyle(ilAdvancedSelectionListGUI::STYLE_EMPH);
     $tpl->setVariable("SELECT_OBJTYPE_REPOS", $adv->getHTML());
     //$ilToolbar->addDropDown($lng->txt("cntr_add_new_item"), $this->getHTML());
     return;
     // toolbar
     include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
     $button = ilLinkButton::getInstance();
     $button->setId($ov_trigger_id);
     $button->setCaption("cntr_add_new_item");
     $button->setPrimary(true);
     $ilToolbar->addButtonInstance($button);
     // css?
     $tpl->setVariable("SELECT_OBJTYPE_REPOS", '<div id="' . $ov_id . '" style="display:none;" class="ilOverlay">' . $this->getHTML() . '</div>');
 }
 /**
  * Show server info
  */
 function showServerInfoObject()
 {
     /**
      * @var $ilToolbar ilToolbarGUI
      * @var $lng       ilLanguage
      * @var $ilCtrl    ilCtrl
      * @var $tpl       ilTemplate
      */
     global $tpl, $ilCtrl, $ilToolbar, $lng;
     require_once 'Services/UIComponent/Button/classes/class.ilLinkButton.php';
     $button = ilLinkButton::getInstance();
     $button->setCaption('vc_information');
     $button->setUrl($this->ctrl->getLinkTarget($this, 'showVcsInformation'));
     $ilToolbar->addButtonInstance($button);
     $this->initServerInfoForm();
     $this->setServerInfoSubTabs("server_data");
     $btpl = new ilTemplate("tpl.server_data.html", true, true, "Modules/SystemFolder");
     $btpl->setVariable("FORM", $this->form->getHTML());
     $btpl->setVariable("PHP_INFO_TARGET", $ilCtrl->getLinkTarget($this, "showPHPInfo"));
     $tpl->setContent($btpl->get());
 }
 function viewUserResults()
 {
     global $ilToolbar;
     if (!$this->object->hasViewOwnResults()) {
         $this->backToRepository();
     }
     $this->checkAuth(false, true);
     include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
     $button = ilLinkButton::getInstance();
     $button->setCaption("btn_back");
     $button->setUrl($this->ctrl->getLinkTarget($this, "runShowFinishedPage"));
     $ilToolbar->addButtonInstance($button);
     $survey_gui = new ilObjSurveyGUI();
     $html = $survey_gui->getUserResultsTable($_SESSION["finished_id"][$this->object->getId()]);
     $this->tpl->setContent($html);
 }
 /**
  * @param ilObjBibliographic   $bibl_obj
  * @param ilBibliographicEntry $entry
  *
  * @return string
  */
 public function getButton(ilObjBibliographic $bibl_obj, ilBibliographicEntry $entry)
 {
     if ($this->getImg()) {
         require_once './Services/UIComponent/Button/classes/class.ilImageLinkButton.php';
         $button = ilImageLinkButton::getInstance();
         $button->setUrl($this->generateLibraryLink($entry, $bibl_obj->getFiletype()));
         $button->setImage($this->getImg(), false);
         $button->setTarget('_blank');
         return $button->render();
     } else {
         require_once './Services/UIComponent/Button/classes/class.ilLinkButton.php';
         $button = ilLinkButton::getInstance();
         $button->setUrl($this->generateLibraryLink($entry, $bibl_obj->getFiletype()));
         $button->setTarget('_blank');
         $button->setCaption('bibl_link_online');
         return $button->render();
     }
 }
 function getExerciseInfo($a_assignment_id, $a_add_submit = false)
 {
     include_once "Modules/Exercise/classes/class.ilExAssignment.php";
     $ass = new ilExAssignment($a_assignment_id);
     $exercise_id = $ass->getExerciseId();
     if (!$exercise_id) {
         return;
     }
     // is the assignment still open?
     $times_up = false;
     if ($ass->getDeadline() && $ass->getDeadline() - time() <= 0) {
         $times_up = true;
     }
     // exercise goto
     include_once "./Services/Link/classes/class.ilLink.php";
     $exc_ref_id = array_shift(ilObject::_getAllReferences($exercise_id));
     $exc_link = ilLink::_getStaticLink($exc_ref_id, "exc");
     $info = sprintf($this->lng->txt("prtf_exercise_info"), $ass->getTitle(), "<a href=\"" . $exc_link . "\">" . ilObject::_lookupTitle($exercise_id) . "</a>");
     // submit button
     if ($a_add_submit && !$times_up) {
         $this->ctrl->setParameter($this, "exc", $exercise_id);
         $this->ctrl->setParameter($this, "ass", $a_assignment_id);
         $submit_link = $this->ctrl->getLinkTarget($this, "finalize");
         $this->ctrl->setParameter($this, "ass", "");
         $this->ctrl->setParameter($this, "exc", "");
         include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
         $button = ilLinkButton::getInstance();
         $button->setCaption("prtf_finalize_portfolio");
         $button->setPrimary(true);
         $button->setUrl($submit_link);
         $info .= " " . $button->render();
     }
     // submitted files
     $submitted = ilExAssignment::getDeliveredFiles($exercise_id, $a_assignment_id, $this->user_id, true);
     if ($submitted) {
         $submitted = array_pop($submitted);
         $this->ctrl->setParameter($this, "ass", $a_assignment_id);
         $dl_link = $this->ctrl->getLinkTarget($this, "downloadExcSubFile");
         $this->ctrl->setParameter($this, "ass", "");
         $rel = ilDatePresentation::useRelativeDates();
         ilDatePresentation::setUseRelativeDates(false);
         include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
         $button = ilLinkButton::getInstance();
         $button->setCaption("download");
         $button->setUrl($dl_link);
         $info .= "<br />" . sprintf($this->lng->txt("prtf_exercise_submitted_info"), ilDatePresentation::formatDate(new ilDateTime($submitted["ts"], IL_CAL_DATETIME)), $button->render());
         ilDatePresentation::setUseRelativeDates($rel);
     }
     // work instructions incl. files
     $tooltip = "";
     $ass = $ass->getInstruction();
     if ($ass) {
         $tooltip .= nl2br($ass);
     }
     $ass_files = ilExAssignment::getFiles($exercise_id, $a_assignment_id);
     if (count($ass_files) > 0) {
         $tooltip .= "<br /><br />";
         foreach ($ass_files as $file) {
             $this->ctrl->setParameter($this, "ass", $a_assignment_id);
             $this->ctrl->setParameter($this, "file", urlencode($file["name"]));
             $dl_link = $this->ctrl->getLinkTarget($this, "downloadExcAssFile");
             $this->ctrl->setParameter($this, "file", "");
             $this->ctrl->setParameter($this, "ass", "");
             $tooltip .= $file["name"] . ": <a href=\"" . $dl_link . "\">" . $this->lng->txt("download") . "</a>";
         }
     }
     if ($tooltip) {
         $ol_id = "exc_ass_" . $a_assignment_id;
         include_once "Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php";
         $overlay = new ilOverlayGUI($ol_id);
         // overlay
         $overlay->setAnchor($ol_id . "_tr");
         $overlay->setTrigger($ol_id . "_tr", "click", $ol_id . "_tr");
         $overlay->setAutoHide(false);
         // $overlay->setCloseElementId($cl_id);
         $overlay->add();
         // trigger
         $overlay->addTrigger($ol_id . "_tr", "click", $ol_id . "_tr");
         $info .= "<div id=\"" . $ol_id . "_tr\"><a href=\"#\">" . $this->lng->txt("exc_instruction") . "</a></div>" . "<div id=\"" . $ol_id . "\" style=\"display:none; background-color:white; border: 1px solid #bbb; padding: 10px;\">" . $tooltip . "</div>";
     }
     return $info;
 }
 /**
  * Print the survey evaluation for a selected user
  *
  * Print the survey evaluation for a selected user
  *
  * @access private
  */
 function evaluationuser()
 {
     global $ilAccess, $ilToolbar;
     if (!$ilAccess->checkAccess("write", "", $this->object->getRefId())) {
         ilUtil::sendFailure($this->lng->txt("no_permission"), TRUE);
         $this->ctrl->redirectByClass("ilObjSurveyGUI", "infoScreen");
     }
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "evaluationuser"));
     if ($this->object->get360Mode()) {
         $appr_id = $this->getAppraiseeId();
         $this->addApprSelectionToToolbar();
     }
     $tabledata = null;
     if (!$this->object->get360Mode() || $appr_id) {
         $format = new ilSelectInputGUI("", "export_format");
         $format->setOptions(array(self::TYPE_XLS => $this->lng->txt('exp_type_excel'), self::TYPE_SPSS => $this->lng->txt('exp_type_csv')));
         $ilToolbar->addInputItem($format);
         $label = new ilSelectInputGUI("", "export_label");
         $label->setOptions(array('label_only' => $this->lng->txt('export_label_only'), 'title_only' => $this->lng->txt('export_title_only'), 'title_label' => $this->lng->txt('export_title_label')));
         $ilToolbar->addInputItem($label);
         include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
         $button = ilSubmitButton::getInstance();
         $button->setCaption("export");
         $button->setCommand('exportevaluationuser');
         $button->setOmitPreventDoubleSubmission(true);
         $ilToolbar->addButtonInstance($button);
         $ilToolbar->addSeparator();
         include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
         $button = ilLinkButton::getInstance();
         $button->setCaption("print");
         $button->setOnClick("window.print(); return false;");
         $button->setOmitPreventDoubleSubmission(true);
         $ilToolbar->addButtonInstance($button);
         $finished_ids = null;
         if ($appr_id) {
             $finished_ids = $this->object->getFinishedIdsForAppraiseeId($appr_id);
             if (!sizeof($finished_ids)) {
                 $finished_ids = array(-1);
             }
         }
         $userResults =& $this->object->getUserSpecificResults($finished_ids);
         $questions =& $this->object->getSurveyQuestions(true);
         $participants =& $this->object->getSurveyParticipants($finished_ids);
         $tabledata = array();
         $counter = -1;
         foreach ($participants as $data) {
             $questioncounter = 1;
             $question = "";
             $results = "";
             $first = true;
             foreach ($questions as $question_id => $question_data) {
                 $found = $userResults[$question_id][$data["active_id"]];
                 $text = "";
                 if (is_array($found)) {
                     $text = implode("<br />", $found);
                 } else {
                     $text = $found;
                 }
                 if (strlen($text) == 0) {
                     $text = ilObjSurvey::getSurveySkippedValue();
                 }
                 $wt = $this->object->getWorkingtimeForParticipant($data['active_id']);
                 if ($first) {
                     if ($data["finished"]) {
                         $finished = $data["finished_tstamp"];
                     } else {
                         $finished = false;
                     }
                     $tabledata[++$counter] = array('username' => $data["sortname"], 'question' => $questioncounter++ . ". " . $question_data["title"], 'results' => $text, 'workingtime' => $wt, 'finished' => $finished);
                     $first = false;
                 } else {
                     $tabledata[$counter]["subitems"][] = array('username' => " ", 'question' => $questioncounter++ . ". " . $question_data["title"], 'results' => $text, 'workingtime' => null, 'finished' => null);
                 }
             }
         }
     }
     $this->tpl->addCss("./Modules/Survey/templates/default/survey_print.css", "print");
     $this->tpl->setCurrentBlock("generic_css");
     $this->tpl->setVariable("LOCATION_GENERIC_STYLESHEET", "./Modules/Survey/templates/default/evaluation_print.css");
     $this->tpl->setVariable("MEDIA_GENERIC_STYLESHEET", "print");
     $this->tpl->parseCurrentBlock();
     include_once "./Modules/Survey/classes/tables/class.ilSurveyResultsUserTableGUI.php";
     $table_gui = new ilSurveyResultsUserTableGUI($this, 'evaluationuser', $this->object->hasAnonymizedResults());
     $table_gui->setData($tabledata);
     $this->tpl->setContent($table_gui->getHTML());
 }
 /**
  * Creates a print view of the survey questions
  *
  * @access public
  */
 function printViewObject()
 {
     global $ilToolbar;
     $this->questionsSubtabs("print");
     include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
     $button = ilLinkButton::getInstance();
     $button->setCaption("print");
     $button->setOnClick("window.print(); return false;");
     $button->setOmitPreventDoubleSubmission(true);
     $ilToolbar->addButtonInstance($button);
     include_once './Services/WebServices/RPC/classes/class.ilRPCServerSettings.php';
     if (ilRPCServerSettings::getInstance()->isEnabled()) {
         $this->ctrl->setParameter($this, "pdf", "1");
         $pdf_url = $this->ctrl->getLinkTarget($this, "printView");
         $this->ctrl->setParameter($this, "pdf", "");
         $button = ilLinkButton::getInstance();
         $button->setCaption("pdf_export");
         $button->setUrl($pdf_url);
         $button->setOmitPreventDoubleSubmission(true);
         $ilToolbar->addButtonInstance($button);
     }
     $template = new ilTemplate("tpl.il_svy_svy_printview.html", TRUE, TRUE, "Modules/Survey");
     $pages =& $this->object->getSurveyPages();
     foreach ($pages as $page) {
         if (count($page) > 0) {
             foreach ($page as $question) {
                 $questionGUI = $this->object->getQuestionGUI($question["type_tag"], $question["question_id"]);
                 if (is_object($questionGUI)) {
                     if (strlen($question["heading"])) {
                         $template->setCurrentBlock("textblock");
                         $template->setVariable("TEXTBLOCK", $question["heading"]);
                         $template->parseCurrentBlock();
                     }
                     $template->setCurrentBlock("question");
                     $template->setVariable("QUESTION_DATA", $questionGUI->getPrintView($this->object->getShowQuestionTitles(), $question["questionblock_show_questiontext"], $this->object->getSurveyId()));
                     $template->parseCurrentBlock();
                 }
             }
             if (count($page) > 1 && $page[0]["questionblock_show_blocktitle"]) {
                 $template->setCurrentBlock("page");
                 $template->setVariable("BLOCKTITLE", $page[0]["questionblock_title"]);
                 $template->parseCurrentBlock();
             } else {
                 $template->setCurrentBlock("page");
                 $template->parseCurrentBlock();
             }
         }
     }
     $this->tpl->addCss("./Modules/Survey/templates/default/survey_print.css", "print");
     if (array_key_exists("pdf", $_GET) && $_GET["pdf"] == 1) {
         $printbody = new ilTemplate("tpl.il_as_tst_print_body.html", TRUE, TRUE, "Modules/Test");
         $printbody->setVariable("TITLE", sprintf($this->lng->txt("tst_result_user_name"), $uname));
         $printbody->setVariable("ADM_CONTENT", $template->get());
         $printoutput = $printbody->get();
         $printoutput = preg_replace("/href=\".*?\"/", "", $printoutput);
         $fo = $this->object->processPrintoutput2FO($printoutput);
         // #11436
         if (!$fo || !$this->object->deliverPDFfromFO($fo)) {
             ilUtil::sendFailure($this->lng->txt("msg_failed"), true);
             $this->ctrl->redirect($this, "printView");
         }
     } else {
         $this->tpl->setVariable("ADM_CONTENT", $template->get());
     }
 }
 public function listRecords()
 {
     global $tpl, $lng, $ilToolbar;
     /**
      * @var $ilToolbar ilToolbarGUI
      * @var $ilToolbar ilToolbarGUI
      */
     // Show tables
     require_once "./Modules/DataCollection/classes/class.ilDataCollectionTable.php";
     if (ilObjDataCollection::_hasWriteAccess($this->parent_obj->ref_id)) {
         $tables = $this->parent_obj->object->getTables();
     } else {
         $tables = $this->parent_obj->object->getVisibleTables();
     }
     $options = array();
     foreach ($tables as $table) {
         $options[$table->getId()] = $table->getTitle();
     }
     $tpl->addCss("./Modules/DataCollection/css/dcl_reference_hover.css");
     $list = new ilDataCollectionRecordListTableGUI($this, "listRecords", $this->table_obj, $this->mode);
     $list->setExternalSegmentation(true);
     $list->setExternalSorting(true);
     $list->determineLimit();
     $list->determineOffsetAndOrder();
     $data = $this->table_obj->getPartialRecords($list->getOrderField(), $list->getOrderDirection(), $list->getLimit(), $list->getOffset(), $list->getFilter());
     $records = $data['records'];
     $total = $data['total'];
     $list->setMaxCount($total);
     $list->setRecordData($records);
     if (count($options) > 0) {
         include_once './Services/Form/classes/class.ilSelectInputGUI.php';
         $table_selection = new ilSelectInputGUI('', 'table_id');
         $table_selection->setOptions($options);
         $table_selection->setValue($this->table_id);
         $ilToolbar->setFormAction($this->ctrl->getFormActionByClass("ilDataCollectionRecordListGUI", "doTableSwitch"));
         $ilToolbar->addText($lng->txt("dcl_table"));
         $ilToolbar->addInputItem($table_selection);
         $ilToolbar->addFormButton($lng->txt('change'), 'doTableSwitch');
         $ilToolbar->addSeparator();
     }
     $permission_to_add_or_import = $this->table_obj->hasPermissionToAddRecord($this->parent_obj->ref_id) and $this->table_obj->hasCustomFields();
     if ($permission_to_add_or_import) {
         $this->ctrl->setParameterByClass("ildatacollectionrecordeditgui", "record_id", NULL);
         $add_new = ilLinkButton::getInstance();
         $add_new->setCaption("dcl_add_new_record");
         $add_new->setUrl($this->ctrl->getFormActionByClass("ildatacollectionrecordeditgui", "create"));
         //			$add_new->addCSSClass('emphsubmit');
         $ilToolbar->addButtonInstance($add_new);
     }
     if ($this->table_obj->getExportEnabled() or $this->table_obj->hasPermissionToFields($this->parent_obj->ref_id)) {
         $export = ilDataCollectionLinkButton::getInstance();
         $export->setCaption("dcl_export_table_excel");
         $export->setUrl($this->ctrl->getFormActionByClass("ildatacollectionrecordlistgui", "exportExcel"));
         if (count($this->table_obj->getExportableFields()) == 0 or $total == 0) {
             $export->setUseWrapper(true);
             $export->setDisabled(true);
             $export->addAttribute('data-toggle', 'datacollection-tooltip', true);
             $export->addAttribute('data-placement', 'bottom', true);
             $export->addAttribute('title', $lng->txt('dcl_no_exportable_fields_or_no_data'), true);
         }
         $ilToolbar->addButtonInstance($export);
     }
     if ($permission_to_add_or_import) {
         $this->ctrl->setParameterByClass("ildatacollectionrecordeditgui", "record_id", NULL);
         $import = ilLinkButton::getInstance();
         $import->setCaption("dcl_import_records .xls");
         $import->setUrl($this->ctrl->getFormActionByClass("ildatacollectionrecordlistgui", "showImportExcel"));
         $ilToolbar->addButtonInstance($import);
     }
     // requested not to implement this way...
     //$tpl->addJavaScript("Modules/DataCollection/js/fastTableSwitcher.js");
     if (count($this->table_obj->getRecordFields()) == 0) {
         ilUtil::sendInfo($lng->txt("dcl_no_fields_yet") . " " . ($this->table_obj->hasPermissionToFields($this->parent_obj->ref_id) ? $lng->txt("dcl_create_fields") : ""));
     }
     $tpl->getStandardTemplate();
     $tpl->setPermanentLink("dcl", $this->parent_obj->ref_id);
     if ($desc = $this->table_obj->getDescription()) {
         $desc = "<div class='ilDclTableDescription'>{$desc}</div>";
     }
     $tpl->setContent($desc . $list->getHTML());
 }
 /**
  * upload file
  */
 function uploadFile()
 {
     global $lng;
     // determine directory
     $cur_subdir = str_replace(".", "", ilUtil::stripSlashes($_GET["cdir"]));
     $cur_dir = !empty($cur_subdir) ? $this->main_dir . "/" . $cur_subdir : $this->main_dir;
     $tgt_file = null;
     if (is_file($_FILES["new_file"]["tmp_name"])) {
         $tgt_file = $cur_dir . "/" . ilUtil::stripSlashes($_FILES["new_file"]["name"]);
         move_uploaded_file($_FILES["new_file"]["tmp_name"], $tgt_file);
     } elseif ($_POST["uploaded_file"]) {
         include_once 'Services/FileSystem/classes/class.ilUploadFiles.php';
         // check if the file is in the ftp directory and readable
         if (ilUploadFiles::_checkUploadFile($_POST["uploaded_file"])) {
             $tgt_file = $cur_dir . "/" . ilUtil::stripSlashes($_POST["uploaded_file"]);
             // copy uploaded file to data directory
             ilUploadFiles::_copyUploadFile($_POST["uploaded_file"], $tgt_file);
         }
     } else {
         if (trim($_FILES["new_file"]["name"]) == "") {
             ilUtil::sendFailure($lng->txt("cont_enter_a_file"), true);
         }
     }
     if ($tgt_file && is_file($tgt_file)) {
         $unzip = null;
         // extract zip?
         include_once "./Services/Utilities/classes/class.ilMimeTypeUtil.php";
         if (ilMimeTypeUtil::getMimeType($tgt_file) == "application/zip") {
             $this->ctrl->setParameter($this, "upfile", basename($tgt_file));
             $url = $this->ctrl->getLinkTarget($this, "unzipFile");
             $this->ctrl->setParameter($this, "upfile", "");
             include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
             $unzip = ilLinkButton::getInstance();
             $unzip->setCaption("unzip");
             $unzip->setUrl($url);
             $unzip = " " . $unzip->render();
         }
         ilUtil::sendSuccess($lng->txt("cont_file_created") . $unzip, true);
         $this->setPerformedCommand("create_file", array("name" => substr($tgt_file, strlen($this->main_dir) + 1)));
     }
     $this->ctrl->saveParameter($this, "cdir");
     ilUtil::renameExecutables($this->main_dir);
     $this->ctrl->redirect($this, "listFiles");
 }
Example #29
0
 /**
  * Show multi-feedback screen
  *
  * @param
  * @return
  */
 function showMultiFeedbackObject(ilPropertyFormGUI $a_form = null)
 {
     global $ilTabs, $ilToolbar, $lng, $tpl;
     $ass_id = (int) $_GET["ass_id"];
     ilUtil::sendInfo($lng->txt("exc_multi_feedb_info"));
     $ilTabs->activateTab("grades");
     $this->checkPermission("write");
     $this->addSubmissionSubTabs("assignment");
     // #13719
     include_once "./Services/UIComponent/Button/classes/class.ilLinkButton.php";
     $button = ilLinkButton::getInstance();
     $button->setCaption("exc_download_zip_structure");
     $button->setUrl($this->ctrl->getLinkTarget($this, "downloadMultiFeedbackZip"));
     $button->setOmitPreventDoubleSubmission(true);
     $ilToolbar->addButtonInstance($button);
     if (!$a_form) {
         $a_form = $this->initMultiFeedbackForm($ass_id);
     }
     $tpl->setContent($a_form->getHTML());
 }
 function __showTimingsPanel()
 {
     global $ilAccess, $ilToolbar;
     if (!$ilAccess->checkAccess('write', '', $this->container_obj->getRefId())) {
         return true;
     }
     include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
     $btn = ilLinkButton::getInstance();
     if (!$_SESSION['crs_timings_panel'][$this->course_obj->getId()]) {
         $btn->setCaption("timings_timings_on");
         $btn->setUrl($this->ctrl->getLinkTarget($this, 'timingsOn'));
     } else {
         $btn->setCaption("timings_timings_off");
         $btn->setUrl($this->ctrl->getLinkTarget($this, 'timingsOff'));
     }
     $ilToolbar->addButtonInstance($btn);
 }