/**
  * get the HTML code for showing the card in a training
  */
 function getCardForTrainingHTML()
 {
     require_once "./Services/Style/classes/class.ilObjStyleSheet.php";
     $this->tpl->addCss(ilObjStyleSheet::getContentStylePath(0));
     // get the card pages to be displayed
     if ($this->card->getTermId()) {
         $pages = $this->getGlossaryTermPages();
     } else {
         // TODO: corrently only glossary cards are supported
         $pages = array();
     }
     require_once "./Services/Accordion/classes/class.ilAccordionGUI.php";
     $question = new ilAccordionGUI();
     $question->setBehaviour(ilAccordionGUI::FORCE_ALL_OPEN);
     $question->setContentClass("xflcFlashcardPage");
     $question->addItem($pages[0]["title"], $pages[0]["html"]);
     $answers = new ilAccordionGUI();
     //$answers->setBehaviour(ilAccordionGUI::FIRST_OPEN);
     $answers->setContentClass("xflcFlashcardPage");
     for ($i = 1; $i < count($pages); $i++) {
         $answers->addItem($pages[$i]["title"], $pages[$i]["html"]);
     }
     return $question->getHTML() . $answers->getHTML();
 }
 /**
  * Show overview of assignments
  */
 function showOverviewObject()
 {
     global $tpl, $ilTabs, $ilUser, $ilToolbar;
     $this->checkPermission("read");
     include_once "./Services/Tracking/classes/class.ilLearningProgress.php";
     ilLearningProgress::_tracProgress($ilUser->getId(), $this->object->getId(), $this->object->getRefId(), 'exc');
     $ilTabs->activateTab("content");
     $this->addContentSubTabs("content");
     // show certificate?
     if ($this->object->hasUserCertificate($ilUser->getId())) {
         include_once "./Modules/Exercise/classes/class.ilExerciseCertificateAdapter.php";
         include_once "./Services/Certificate/classes/class.ilCertificate.php";
         $adapter = new ilExerciseCertificateAdapter($this->object);
         if (ilCertificate::_isComplete($adapter)) {
             $ilToolbar->addButton($this->lng->txt("certificate"), $this->ctrl->getLinkTarget($this, "outCertificate"));
         }
     }
     include_once "./Modules/Exercise/classes/class.ilExAssignment.php";
     include_once "./Services/Accordion/classes/class.ilAccordionGUI.php";
     $acc = new ilAccordionGUI();
     $acc->setId("exc_ow_" . $this->object->getId());
     $ass_data = ilExAssignment::getAssignmentDataOfExercise($this->object->getId());
     include_once "./Modules/Exercise/classes/class.ilExAssignmentGUI.php";
     $ass_gui = new ilExAssignmentGUI($this->object);
     foreach ($ass_data as $ass) {
         // incoming assignment deeplink
         $force_open = false;
         if (isset($_GET["ass_id_goto"]) && (int) $_GET["ass_id_goto"] == $ass["id"]) {
             $force_open = true;
         }
         $acc->addItem($ass_gui->getOverviewHeader($ass), $ass_gui->getOverviewBody($ass), $force_open);
     }
     if (count($ass_data) < 2) {
         $acc->setBehaviour("FirstOpen");
     } else {
         $acc->setUseSessionStorage(true);
     }
     $tpl->setContent($acc->getHTML());
 }
Example #3
0
 /**
  * Get HTML for creation forms (accordion)
  *
  * @param array $a_forms
  */
 protected final function getCreationFormsHTML(array $a_forms)
 {
     global $tpl;
     // #13168- sanity check
     foreach ($a_forms as $id => $form) {
         if (!$form instanceof ilPropertyFormGUI) {
             unset($a_forms[$id]);
         }
     }
     // no accordion if there is just one form
     if (sizeof($a_forms) == 1) {
         $form_type = key($a_forms);
         $a_forms = array_shift($a_forms);
         // see bug #0016217
         if (method_exists($this, "getCreationFormTitle")) {
             $form_title = $this->getCreationFormTitle($form_type);
             if ($form_title != "") {
                 $a_forms->setTitle($form_title);
             }
         }
         return $a_forms->getHTML();
     } else {
         include_once "./Services/Accordion/classes/class.ilAccordionGUI.php";
         $acc = new ilAccordionGUI();
         $acc->setBehaviour(ilAccordionGUI::FIRST_OPEN);
         $cnt = 1;
         foreach ($a_forms as $form_type => $cf) {
             $htpl = new ilTemplate("tpl.creation_acc_head.html", true, true, "Services/Object");
             // using custom form titles (used for repository plugins)
             $form_title = "";
             if (method_exists($this, "getCreationFormTitle")) {
                 $form_title = $this->getCreationFormTitle($form_type);
             }
             if (!$form_title) {
                 $form_title = $cf->getTitle();
             }
             // move title from form to accordion
             $htpl->setVariable("TITLE", $this->lng->txt("option") . " " . $cnt . ": " . $form_title);
             $cf->setTitle(null);
             $cf->setTitleIcon(null);
             $cf->setTableWidth("100%");
             $acc->addItem($htpl->get(), $cf->getHTML());
             $cnt++;
         }
         return "<div class='ilCreationFormSection'>" . $acc->getHTML() . "</div>";
     }
 }
 /**
  * Show overview
  */
 function showOverview()
 {
     global $tpl, $ilTabs;
     $ilTabs->activateTab("overview");
     $this->addOverviewSubTabs("overview");
     include_once "./Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus/classes/class.ilEphAssignment.php";
     include_once "./Services/Accordion/classes/class.ilAccordionGUI.php";
     $acc = new ilAccordionGUI();
     $acc->setBehaviour("OneOpenSession");
     $acc->setId("eph_ow_" . $this->object->getId());
     $ass_data = ilEphAssignment::getAssignmentDataOfEphorus($this->object->getId());
     include_once "./Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus/classes/class.ilEphAssignmentGUI.php";
     $ass_gui = new ilEphAssignmentGUI($this->object);
     foreach ($ass_data as $ass) {
         $acc->addItem($ass_gui->getOverviewHeader($ass), $ass_gui->getOverviewBody($ass));
     }
     $tpl->setContent($acc->getHTML());
 }
 /**
  * show objectives
  *
  * @access public
  * @param object $tpl template object
  * @return
  */
 public function showObjectives($a_tpl, $a_is_order = false)
 {
     global $lng, $ilSetting;
     $this->clearAdminCommandsDetermination();
     // get embedded blocks
     $has_container_page = false;
     if (!$a_is_order) {
         $output_html = $this->getContainerGUI()->getContainerPageHTML();
         if ($output_html != "") {
             $has_container_page = true;
             $this->output_html .= $this->insertPageEmbeddedBlocks($output_html);
         }
         unset($output_html);
     }
     // All objectives
     include_once './Modules/Course/classes/class.ilCourseObjective.php';
     if (!count($objective_ids = ilCourseObjective::_getObjectiveIds($this->getContainerObject()->getId(), true))) {
         return false;
     }
     include_once './Modules/Course/classes/class.ilCourseObjectiveListGUI.php';
     $this->objective_list_gui = new ilCourseObjectiveListGUI();
     $this->objective_list_gui->setContainerObject($this->getContainerGUI());
     if ($ilSetting->get("icon_position_in_lists") == "item_rows") {
         $this->objective_list_gui->enableIcon(true);
     }
     $acc = null;
     if (!$a_is_order) {
         include_once "Services/Accordion/classes/class.ilAccordionGUI.php";
         $acc = new ilAccordionGUI();
         $acc->setUseSessionStorage(true);
         $acc->setAllowMultiOpened(true);
         $acc->setBehaviour(ilAccordionGUI::FIRST_OPEN);
         $acc->setId("crsobjtv_" . $this->container_obj->getId());
     } else {
         $this->renderer->addCustomBlock('lobj', $lng->txt('crs_objectives'));
     }
     $lur_data = $this->parseLOUserResults();
     $has_initial = ilLOSettings::getInstanceByObjId($this->container_obj->getId())->worksWithInitialTest();
     $has_lo_page = false;
     $obj_cnt = 0;
     foreach ($objective_ids as $objective_id) {
         include_once './Modules/Course/classes/Objectives/class.ilLOUtils.php';
         if ($has_initial && (!isset($lur_data[$objective_id]) or ilLOUtils::hasActiveRun($this->container_obj->getId(), ilLOSettings::getInstanceByObjId($this->container_obj->getId())->getInitialTest(), $objective_id))) {
             $lur_data[$objective_id] = array("type" => ilLOSettings::TYPE_TEST_INITIAL);
         }
         if ($html = $this->renderObjective($objective_id, $has_lo_page, $acc, $lur_data[$objective_id])) {
             $this->renderer->addItemToBlock('lobj', 'lobj', $objective_id, $html);
         }
         $obj_cnt++;
     }
     // buttons for showing/hiding all objectives
     if (!$a_is_order && $obj_cnt > 1) {
         $this->showButton("", $lng->txt("crs_show_all_obj"), "", "crs_show_all_obj_btn");
         $this->showButton("", $lng->txt("crs_hide_all_obj"), "", "crs_hide_all_obj_btn");
         $acc->setShowAllElement("crs_show_all_obj_btn");
         $acc->setHideAllElement("crs_hide_all_obj_btn");
     }
     if (!$has_container_page && $has_lo_page) {
         // add core co page css
         include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
         $GLOBALS["tpl"]->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0));
         $GLOBALS["tpl"]->setCurrentBlock("SyntaxStyle");
         $GLOBALS["tpl"]->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
         $GLOBALS["tpl"]->parseCurrentBlock();
     }
     // order/block
     if ($a_is_order) {
         $this->addFooterRow();
         $this->output_html .= $output_html . $this->renderer->getHTML();
         $this->renderer->resetDetails();
     } else {
         $this->output_html .= "<div class='ilCrsObjAcc'>" . $acc->getHTML() . "</div>";
     }
 }
 /**
  * Show template permissions
  * @return void
  */
 protected function permObject($a_show_admin_permissions = false)
 {
     global $ilTabs, $ilErr, $ilToolbar, $objDefinition, $rbacreview;
     $ilTabs->setTabActive('default_perm_settings');
     $this->setSubTabs('default_perm_settings');
     if ($a_show_admin_permissions) {
         $ilTabs->setSubTabActive('rbac_admin_permissions');
     } else {
         $ilTabs->setSubTabActive('rbac_repository_permissions');
     }
     if (!$this->checkAccess('write', 'edit_permission')) {
         $ilErr->raiseError($this->lng->txt('msg_no_perm_perm'), $ilErr->MESSAGE);
         return true;
     }
     // Show copy role button
     $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
     $ilToolbar->addButton($this->lng->txt("adopt_perm_from_template"), $this->ctrl->getLinkTarget($this, 'adoptPerm'));
     if ($rbacreview->isDeleteable($this->object->getId(), $this->rolf_ref_id)) {
         $ilToolbar->addButton($this->lng->txt('rbac_delete_role'), $this->ctrl->getLinkTarget($this, 'confirmDeleteRole'));
     }
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.rbac_template_permissions.html', 'Services/AccessControl');
     $this->tpl->setVariable('PERM_ACTION', $this->ctrl->getFormAction($this));
     include_once './Services/Accordion/classes/class.ilAccordionGUI.php';
     $acc = new ilAccordionGUI();
     $acc->setBehaviour(ilAccordionGUI::FORCE_ALL_OPEN);
     $acc->setId('template_perm_' . $this->getParentRefId());
     if ($this->rolf_ref_id == ROLE_FOLDER_ID) {
         if ($a_show_admin_permissions) {
             $subs = $objDefinition->getSubObjectsRecursively('adm', true, true);
         } else {
             $subs = $objDefinition->getSubObjectsRecursively('root', true, $a_show_admin_permissions);
         }
     } else {
         $subs = $objDefinition->getSubObjectsRecursively($this->getParentType(), true, $a_show_admin_permissions);
     }
     $sorted = array();
     foreach ($subs as $subtype => $def) {
         if ($objDefinition->isPlugin($subtype)) {
             $translation = ilPlugin::lookupTxt("rep_robj", $subtype, "obj_" . $subtype);
         } elseif ($objDefinition->isSystemObject($subtype)) {
             $translation = $this->lng->txt("obj_" . $subtype);
         } else {
             $translation = $this->lng->txt('objs_' . $subtype);
         }
         $sorted[$subtype] = $def;
         $sorted[$subtype]['translation'] = $translation;
     }
     $sorted = ilUtil::sortArray($sorted, 'translation', 'asc', true, true);
     foreach ($sorted as $subtype => $def) {
         if ($objDefinition->isPlugin($subtype)) {
             $translation = ilPlugin::lookupTxt("rep_robj", $subtype, "obj_" . $subtype);
         } elseif ($objDefinition->isSystemObject($subtype)) {
             $translation = $this->lng->txt("obj_" . $subtype);
         } else {
             $translation = $this->lng->txt('objs_' . $subtype);
         }
         include_once 'Services/AccessControl/classes/class.ilObjectRoleTemplatePermissionTableGUI.php';
         $tbl = new ilObjectRoleTemplatePermissionTableGUI($this, 'perm', $this->getParentRefId(), $this->object->getId(), $subtype, $a_show_admin_permissions);
         $tbl->parse();
         $acc->addItem($translation, $tbl->getHTML());
     }
     $this->tpl->setVariable('ACCORDION', $acc->getHTML());
     // Add options table
     include_once './Services/AccessControl/classes/class.ilObjectRoleTemplateOptionsTableGUI.php';
     $options = new ilObjectRoleTemplateOptionsTableGUI($this, 'perm', $this->rolf_ref_id, $this->object->getId(), $a_show_admin_permissions);
     $options->addMultiCommand($a_show_admin_permissions ? 'adminPermSave' : 'permSave', $this->lng->txt('save'));
     $options->parse();
     $this->tpl->setVariable('OPTIONS_TABLE', $options->getHTML());
 }
 /**
  * Show online help
  */
 function showHelp()
 {
     global $ilHelp, $lng, $ilSetting;
     if ($_GET["help_screen_id"] != "") {
         ilSession::set("help_screen_id", $_GET["help_screen_id"]);
         $help_screen_id = $_GET["help_screen_id"];
     } else {
         $help_screen_id = ilSession::get("help_screen_id");
     }
     $this->resetCurrentPage();
     $id_arr = explode(".", $help_screen_id);
     include_once "./Services/Help/classes/class.ilHelpMapping.php";
     $help_arr = ilHelpMapping::getHelpSectionsForId($id_arr[0], $id_arr[1]);
     $hm = (int) $ilSetting->get("help_module");
     if ((OH_REF_ID > 0 || $hm > 0) && count($help_arr) > 0) {
         if (OH_REF_ID > 0) {
             $oh_lm_id = ilObject::_lookupObjId(OH_REF_ID);
         } else {
             include_once "./Services/Help/classes/class.ilObjHelpSettings.php";
             $oh_lm_id = ilObjHelpSettings::lookupModuleLmId($hm);
         }
         include_once "./Services/Accordion/classes/class.ilAccordionGUI.php";
         $acc = new ilAccordionGUI();
         $acc->setId("oh_acc");
         $acc->setBehaviour(ilAccordionGUI::FIRST_OPEN);
         foreach ($help_arr as $h_id) {
             include_once "./Modules/LearningModule/classes/class.ilLMObject.php";
             $st_id = $h_id;
             if (!ilLMObject::_exists($st_id)) {
                 continue;
             }
             $pages = ilLMObject::getPagesOfChapter($oh_lm_id, $st_id);
             include_once "./Services/UIComponent/GroupedList/classes/class.ilGroupedListGUI.php";
             $grp_list = new ilGroupedListGUI();
             foreach ($pages as $pg) {
                 $grp_list->addEntry(ilLMObject::_lookupTitle($pg["child"]), "#", "", "return il.Help.showPage(" . $pg["child"] . ");");
             }
             $acc->addItem(ilLMObject::_lookupTitle($st_id), $grp_list->getHTML());
         }
         $h_tpl = new ilTemplate("tpl.help.html", true, true, "Services/Help");
         $h_tpl->setVariable("HEAD", $lng->txt("help"));
         $h_tpl->setVariable("CONTENT", $acc->getHTML());
         $h_tpl->setVariable("CLOSE_IMG", ilUtil::img(ilUtil::getImagePath("icon_close2_s.png")));
         echo $h_tpl->get();
     }
     exit;
 }