/**
  * get the HTML pages of a card from the glossary
  * Each page is an assoc array with title and html code
  * The first page is assumed to be the question
  * 
  * @return array ( array ("title" => string, "html" => string), ...)
  */
 function getGlossaryTermPages()
 {
     require_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php";
     require_once "./Modules/Glossary/classes/class.ilGlossaryDefinition.php";
     require_once "./Services/COPage/classes/class.ilPageObjectGUI.php";
     $term = new ilGlossaryTerm($this->card->getTermId());
     $defs = ilGlossaryDefinition::getDefinitionList($term->getId());
     // get the term page
     $term_page = array("title" => $this->plugin->txt("glossary_term"), "html" => $term->getTerm());
     // get the definition pages
     $i = 1;
     $def_pages = array();
     $def_title = count($defs) > 1 ? $this->plugin->txt("glossary_definition_x") : $this->plugin->txt("glossary_definition");
     foreach ($defs as $definition) {
         $page_gui = new ilPageObjectGUI("gdf", $definition["id"]);
         $page_gui->setTemplateOutput(false);
         $page_gui->setOutputMode(IL_PAGE_PRESENTATION);
         $page_gui->setEnabledTabs(false);
         $def_pages[] = array("title" => sprintf($def_title, $i++), "html" => $page_gui->getHTML());
     }
     // return the pages according to the glossary mode
     switch ($this->object->getGlossaryMode()) {
         case ilObjFlashcards::GLOSSARY_MODE_TERM_DEFINITIONS:
             return array_merge(array($term_page), $def_pages);
         case ilObjFlashcards::GLOSSARY_MODE_DEFINITION_TERM:
             return array_merge($def_pages, array($term_page));
         case ilObjFlashcards::GLOSSARY_MODE_DEFINITIONS:
             $def_pages[0]["title"] = $this->plugin->txt("question");
             $answer_title = count($def_pages) > 2 ? $this->plugin->txt("answer_x") : $this->plugin->txt("answer");
             for ($i = 1; $i < count($def_pages); $i++) {
                 $def_pages[$i]["title"] = sprintf($answer_title, $i);
             }
             return $def_pages;
     }
 }
 public function forwardToPageObject()
 {
     global $lng, $ilTabs;
     $ilTabs->clearTargets();
     $ilTabs->setBackTarget($lng->txt('back'), $this->ctrl->getLinkTarget($this), '_top');
     // page object
     include_once 'Services/COPage/classes/class.ilPageObject.php';
     include_once 'Services/COPage/classes/class.ilPageObjectGUI.php';
     $lng->loadLanguageModule('content');
     include_once './Services/Style/classes/class.ilObjStyleSheet.php';
     $this->tpl->setVariable('LOCATION_CONTENT_STYLESHEET', ilObjStyleSheet::getContentStylePath(0));
     if (!ilPageObject::_exists('shop', self::SHOP_PAGE_EDITOR_PAGE_ID)) {
         // doesn't exist -> create new one
         $new_page_object = new ilPageObject('shop');
         $new_page_object->setParentId(0);
         $new_page_object->setId(self::SHOP_PAGE_EDITOR_PAGE_ID);
         $new_page_object->createFromXML();
     }
     $this->ctrl->setReturnByClass('ilpageobjectgui', 'edit');
     $page_gui = new ilPageObjectGUI('shop', self::SHOP_PAGE_EDITOR_PAGE_ID);
     $page_gui->setIntLinkHelpDefault('StructureObject', self::SHOP_PAGE_EDITOR_PAGE_ID);
     $page_gui->setTemplateTargetVar('ADM_CONTENT');
     $page_gui->setLinkXML('');
     $page_gui->setFileDownloadLink($this->ctrl->getLinkTargetByClass(array('ilpageobjectgui'), 'downloadFile'));
     $page_gui->setFullscreenLink($this->ctrl->getLinkTargetByClass(array('ilpageobjectgui'), 'displayMediaFullscreen'));
     $page_gui->setSourcecodeDownloadScript($this->ctrl->getLinkTargetByClass(array('ilpageobjectgui'), 'download_paragraph'));
     $page_gui->setPresentationTitle('');
     $page_gui->setTemplateOutput(false);
     $page_gui->setHeader('');
     $page_gui->setEnabledRepositoryObjects(false);
     $page_gui->setEnabledFileLists(true);
     $page_gui->setEnabledMaps(true);
     $page_gui->setEnabledPCTabs(true);
     return $this->ctrl->forwardCommand($page_gui);
 }
 /**
  * list definitions
  */
 function listDefinitions()
 {
     global $ilTabs;
     $this->getTemplate();
     $this->displayLocator();
     $this->setTabs();
     $ilTabs->activateTab("definitions");
     require_once "./Services/COPage/classes/class.ilPageObjectGUI.php";
     // content style
     $this->tpl->setCurrentBlock("ContentStyle");
     $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath($this->glossary->getStyleSheetId()));
     $this->tpl->parseCurrentBlock();
     // syntax style
     $this->tpl->setCurrentBlock("SyntaxStyle");
     $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
     $this->tpl->parseCurrentBlock();
     // load template for table
     $this->tpl->addBlockfile("ADM_CONTENT", "def_list", "tpl.glossary_definition_list.html", true);
     //$this->tpl->addBlockfile("CONTENT", "def_list", "tpl.glossary_definition_list.html", true);
     //ilUtil::sendInfo();
     $this->tpl->addBlockfile("STATUSLINE", "statusline", "tpl.statusline.html");
     $this->tpl->setTitle($this->lng->txt("cont_term") . ": " . $this->term->getTerm());
     $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_term_b.png"));
     $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
     $this->tpl->setCurrentBlock("add_def");
     $this->tpl->setVariable("TXT_ADD_DEFINITION", $this->lng->txt("cont_add_definition"));
     $this->tpl->setVariable("BTN_ADD", "addDefinition");
     $this->tpl->parseCurrentBlock();
     $this->tpl->setCurrentBlock("def_list");
     $defs = ilGlossaryDefinition::getDefinitionList($_GET["term_id"]);
     $this->tpl->setVariable("TXT_TERM", $this->term->getTerm());
     for ($j = 0; $j < count($defs); $j++) {
         $def = $defs[$j];
         $page_gui = new ilPageObjectGUI("gdf", $def["id"]);
         $page_gui->setStyleId($this->glossary->getStyleSheetId());
         $page_gui->setSourcecodeDownloadScript("ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=" . $_GET["ref_id"]);
         $page_gui->setTemplateOutput(false);
         $output = $page_gui->preview();
         if (count($defs) > 1) {
             $this->tpl->setCurrentBlock("definition_header");
             $this->tpl->setVariable("TXT_DEFINITION", $this->lng->txt("cont_definition") . " " . ($j + 1));
             $this->tpl->parseCurrentBlock();
         }
         if ($j > 0) {
             $this->tpl->setCurrentBlock("up");
             $this->tpl->setVariable("TXT_UP", $this->lng->txt("up"));
             $this->ctrl->setParameter($this, "def", $def["id"]);
             $this->tpl->setVariable("LINK_UP", $this->ctrl->getLinkTarget($this, "moveUp"));
             $this->tpl->parseCurrentBlock();
         }
         if ($j + 1 < count($defs)) {
             $this->tpl->setCurrentBlock("down");
             $this->tpl->setVariable("TXT_DOWN", $this->lng->txt("down"));
             $this->ctrl->setParameter($this, "def", $def["id"]);
             $this->tpl->setVariable("LINK_DOWN", $this->ctrl->getLinkTarget($this, "moveDown"));
             $this->tpl->parseCurrentBlock();
         }
         $this->tpl->setCurrentBlock("submit_btns");
         $this->tpl->setVariable("TXT_EDIT", $this->lng->txt("edit"));
         $this->ctrl->setParameter($this, "def", $def["id"]);
         $this->ctrl->setParameterByClass("ilTermDefinitionEditorGUI", "def", $def["id"]);
         $this->tpl->setVariable("LINK_EDIT", $this->ctrl->getLinkTargetByClass(array("ilTermDefinitionEditorGUI", "ilPageObjectGUI"), "edit"));
         $this->tpl->setVariable("TXT_DELETE", $this->lng->txt("delete"));
         $this->tpl->setVariable("LINK_DELETE", $this->ctrl->getLinkTarget($this, "confirmDefinitionDeletion"));
         $this->tpl->parseCurrentBlock();
         $this->tpl->setCurrentBlock("definition");
         $this->tpl->setVariable("PAGE_CONTENT", $output);
         $this->tpl->parseCurrentBlock();
     }
     //$this->tpl->setCurrentBlock("def_list");
     //$this->tpl->parseCurrentBlock();
     $this->quickList();
 }
 private function __getAbstractHTML($a_payment_object_id)
 {
     // page object
     include_once 'Services/COPage/classes/class.ilPageObject.php';
     include_once 'Services/COPage/classes/class.ilPageObjectGUI.php';
     // if page does not exist, return nothing
     if (!ilPageObject::_exists('shop', $a_payment_object_id)) {
         return '';
     }
     include_once 'Services/Style/classes/class.ilObjStyleSheet.php';
     // get page object
     $page_gui = new ilPageObjectGUI('shop', $a_payment_object_id);
     $page_gui->setIntLinkHelpDefault('StructureObject', $a_payment_object_id);
     $page_gui->setLinkXML('');
     $page_gui->setFileDownloadLink($this->ctrl->getLinkTargetByClass('ilPageObjectGUI', 'downloadFile'));
     $page_gui->setFullscreenLink($this->ctrl->getLinkTargetByClass('ilPageObjectGUI', 'displayMediaFullscreen'));
     $page_gui->setSourcecodeDownloadScript($this->ctrl->getLinkTargetByClass('ilPageObjectGUI', 'download_paragraph'));
     $page_gui->setPresentationTitle('');
     $page_gui->setTemplateOutput(false);
     $page_gui->setHeader('');
     $page_gui->setEnabledRepositoryObjects(false);
     $page_gui->setEnabledFileLists(false);
     $page_gui->setEnabledPCTabs(true);
     $page_gui->setEnabledMaps(true);
     return $page_gui->showPage();
 }
 /**
  * Get HTML of ILIAS login page editor
  * @return string html
  */
 protected function getLoginPageEditorHTML()
 {
     global $lng, $tpl;
     include_once './Services/Authentication/classes/class.ilAuthLoginPageEditorSettings.php';
     $lpe = ilAuthLoginPageEditorSettings::getInstance();
     $active_lang = $lpe->getIliasEditorLanguage($lng->getLangKey());
     if (!$active_lang) {
         return '';
     }
     // if page does not exist, return nothing
     include_once './Services/COPage/classes/class.ilPageUtil.php';
     if (!ilPageUtil::_existsAndNotEmpty('auth', ilLanguage::lookupId($active_lang))) {
         return '';
     }
     include_once './Services/COPage/classes/class.ilPageObject.php';
     include_once './Services/COPage/classes/class.ilPageObjectGUI.php';
     include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
     $tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0));
     $tpl->setCurrentBlock("SyntaxStyle");
     $tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
     $tpl->parseCurrentBlock();
     // get page object
     $page_gui = new ilPageObjectGUI('auth', ilLanguage::lookupId($active_lang));
     /*
     		include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
     		$page_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(
     			$this->object->getStyleSheetId(), $this->object->getType()));
     */
     include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
     $page_gui->setStyleId(0, 'auth');
     $page_gui->setIntLinkHelpDefault("RepositoryItem", $active_lang);
     //$page_gui->setFileDownloadLink($this->ctrl->getLinkTarget($this, "downloadFile"));
     //$page_gui->setFullscreenLink($this->ctrl->getLinkTarget($this, "showMediaFullscreen"));
     //$page_gui->setLinkParams($this->ctrl->getUrlParameterString()); // todo
     //		$page_gui->setSourcecodeDownloadScript($this->ctrl->getLinkTarget($this, ""));
     $page_gui->setPresentationTitle("");
     $page_gui->setTemplateOutput(false);
     $page_gui->setHeader("");
     $page_gui->setEnabledRepositoryObjects(true);
     $page_gui->setEnabledLoginPage(true);
     $page_gui->setEnabledFileLists(false);
     $page_gui->setEnabledPCTabs(false);
     $page_gui->setEnabledMaps(true);
     $ret = $page_gui->showPage();
     return $ret;
 }
 /**
  * Forward to page editor
  */
 protected function forwardToPageObject()
 {
     global $lng, $tpl;
     $key = (int) $_REQUEST['key'];
     $this->ctrl->saveParameter($this, 'key', $key);
     include_once "./Services/COPage/classes/class.ilPageObject.php";
     include_once "./Services/COPage/classes/class.ilPageObjectGUI.php";
     include_once './Services/Style/classes/class.ilObjStyleSheet.php';
     $lng->loadLanguageModule("content");
     if (!ilPageObject::_exists('auth', $key)) {
         // doesn't exist -> create new one
         $new_page_object = new ilPageObject('auth');
         $new_page_object->setParentId($key);
         $new_page_object->setId($key);
         $new_page_object->createFromXML();
     }
     include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
     $tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0));
     $tpl->setCurrentBlock("SyntaxStyle");
     $tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
     $tpl->parseCurrentBlock();
     $this->ctrl->setReturnByClass('ilpageobjectgui', "edit");
     $page_gui = new ilPageObjectGUI('auth', $key);
     $page_gui->setIntLinkHelpDefault("RepositoryItem", $key);
     $page_gui->setTemplateTargetVar("ADM_CONTENT");
     $page_gui->setLinkXML($link_xml);
     //$page_gui->enableChangeComments($this->content_object->isActiveHistoryUserComments());
     //$page_gui->setFileDownloadLink($this->ctrl->getLinkTarget($this, "downloadFile"));
     //$page_gui->setFullscreenLink($this->ctrl->getLinkTarget($this, "showMediaFullscreen"));
     //$page_gui->setLinkParams($this->ctrl->getUrlParameterString()); // todo
     //		$page_gui->setSourcecodeDownloadScript($this->ctrl->getLinkTarget($this, ""));
     $page_gui->setPresentationTitle("");
     $page_gui->setTemplateOutput(false);
     //$page_gui->setLocator($contObjLocator);
     $page_gui->setHeader("");
     $page_gui->setEnabledRepositoryObjects(true);
     $page_gui->setEnabledLoginPage(true);
     $page_gui->setEnabledFileLists(false);
     $page_gui->setEnabledMaps(true);
     $page_gui->setEnabledPCTabs(true);
     $page_gui->setEnabledInternalLinks(true);
     // style tab
     //$page_gui->setTabHook($this, "addPageTabs");
     if ($this->ctrl->getCmd() == 'editPage') {
         $this->ctrl->setCmd('edit');
     }
     $html = $this->ctrl->forwardCommand($page_gui);
     $tpl->setContent($html);
 }