Esempio n. 1
0
 /**
  * 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;
     }
 }
 /**
  * Constructor
  */
 function __construct($a_id = 0, $a_old_nr = 0)
 {
     global $tpl;
     parent::__construct("qht", $a_id, $a_old_nr);
     $this->setTemplateTargetVar('ADM_CONTENT');
     $this->setTemplateOutput(true);
 }
 public function showPage()
 {
     $presentationTitlePossiblyWithHTML = $this->getPresentationTitle();
     $this->setPresentationTitle(self::TEMP_PRESENTATION_TITLE_PLACEHOLDER);
     $presentation = parent::showPage();
     $presentation = str_replace(self::TEMP_PRESENTATION_TITLE_PLACEHOLDER, $presentationTitlePossiblyWithHTML, $presentation);
     $presentation = preg_replace("/src=\"\\.\\//ims", "src=\"" . ILIAS_HTTP_PATH . "/", $presentation);
     return $presentation;
 }
 /**
  * execute command
  */
 function &executeCommand()
 {
     global $ilCtrl;
     $next_class = $this->ctrl->getNextClass($this);
     $cmd = $this->ctrl->getCmd();
     switch ($next_class) {
         case 'ilmdeditorgui':
             return parent::executeCommand();
             break;
         case "ilpageobjectgui":
             die("ilPageLayoutGUI forward to ilpageobjectgui error.");
             return;
         default:
             $html = parent::executeCommand();
             return $html;
     }
 }
Esempio n. 5
0
 /**
  * execute command
  */
 function executeCommand()
 {
     global $ilCtrl, $ilLocator, $lng;
     if ($_REQUEST["baseClass"] == "ilImprintGUI") {
         $this->renderFullscreen();
     }
     $next_class = $ilCtrl->getNextClass($this);
     $title = $lng->txt("adm_imprint");
     switch ($next_class) {
         case "ilpageobjectgui":
             die("Deprecated. ilImprintGUI gui forwarding to ilpageobject");
             return;
         default:
             $this->setPresentationTitle($title);
             $ilLocator->addItem($title, $ilCtrl->getLinkTarget($this, "preview"));
             return parent::executeCommand();
     }
 }
 /**
  * execute command
  */
 function executeCommand()
 {
     global $ilCtrl, $ilLocator, $lng;
     if ($_REQUEST["baseClass"] == "ilImprintGUI") {
         $this->renderFullscreen();
     }
     $next_class = $ilCtrl->getNextClass($this);
     $title = $lng->txt("adm_imprint");
     switch ($next_class) {
         case "ilpageobjectgui":
             $page_gui = new ilPageObjectGUI("impr", $this->getPageObject()->getId(), $this->getPageObject()->old_nr);
             $this->setPresentationTitle($title);
             return $ilCtrl->forwardCommand($page_gui);
         default:
             $this->setPresentationTitle($title);
             $ilLocator->addItem($title, $ilCtrl->getLinkTarget($this, "preview"));
             return parent::executeCommand();
     }
 }
 /**
  * execute command
  */
 function &executeCommand()
 {
     global $ilCtrl;
     $next_class = $this->ctrl->getNextClass($this);
     $cmd = $this->ctrl->getCmd();
     switch ($next_class) {
         case 'ilmdeditorgui':
             return parent::executeCommand();
             break;
         case "ilpageobjectgui":
             // "stys" was "sahs" before
             $page_gui = new ilPageObjectGUI("stys", $this->getPageObject()->getId(), $this->getPageObject()->old_nr);
             $page_gui->setStyleId($this->getStyleId());
             $html = $ilCtrl->forwardCommand($page_gui);
             return $html;
         default:
             $html = parent::executeCommand();
             return $html;
     }
 }
Esempio n. 8
0
 /**
  * Process answer
  */
 function processAnswer()
 {
     global $ilUser, $ilDB, $lng, $ilPluginAdmin, $ilLog;
     parent::processAnswer();
     //
     // Send notifications to authors that want to be informed on blocked users
     //
     $parent_id = ilPageObject::lookupParentId((int) $_GET["page_id"], "lm");
     // is restriction mode set?
     include_once "./Modules/LearningModule/classes/class.ilObjContentObject.php";
     if (ilObjContentObject::_lookupRestrictForwardNavigation($parent_id)) {
         // check if user is blocked
         $id = ilUtil::stripSlashes($_POST["id"]);
         include_once "./Services/COPage/classes/class.ilPageQuestionProcessor.php";
         $as = ilPageQuestionProcessor::getAnswerStatus($id, $ilUser->getId());
         // get question information
         include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionList.php";
         $qlist = new ilAssQuestionList($ilDB, $lng, $ilPluginAdmin);
         $qlist->setParentObjId(0);
         $qlist->addFieldFilter("question_id", array($id));
         $qlist->load();
         $qdata = $qlist->getQuestionDataArray();
         // has the user been blocked?
         if ($as["try"] >= $qdata[$as["qst_id"]]["nr_of_tries"] && $qdata[$as["qst_id"]]["nr_of_tries"] > 0 && !$as["passed"]) {
             include_once "./Services/Notification/classes/class.ilNotification.php";
             $users = ilNotification::getNotificationsForObject(ilNotification::TYPE_LM_BLOCKED_USERS, $parent_id);
             if (count($users) > 0) {
                 include_once "./Modules/LearningModule/classes/class.ilLMMailNotification.php";
                 $not = new ilLMMailNotification();
                 $not->setType(ilLMMailNotification::TYPE_USER_BLOCKED);
                 $not->setQuestionId($id);
                 $not->setRefId((int) $_GET["ref_id"]);
                 $not->setRecipients($users);
                 $not->send();
             }
         }
     }
 }
Esempio n. 9
0
 /**
  * Get tabs
  * 
  * @param string $a_activate
  */
 function getTabs($a_activate = "")
 {
     global $ilCtrl;
     $ilCtrl->setParameterByClass("ilobjbloggui", "blpg", $this->getBlogPosting()->getId());
     parent::getTabs($a_activate);
 }
 /**
  * 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();
 }
 /**
  * Output post processing
  *
  * @param
  * @return
  */
 function outputPostProcessing($a_output)
 {
     // for question html get the page gui object
     include_once "./Services/COPage/classes/class.ilPageObjectGUI.php";
     $pg_gui = new ilPageObjectGUI($this->page->getParentType(), $this->page->getId());
     $pg_gui->setOutputMode(IL_PAGE_PREVIEW);
     $pg_gui->setEnabledSelfAssessment(true);
     $pg_gui->initSelfAssessmentRendering(true);
     $qhtml = $pg_gui->getQuestionHTML();
     if (is_array($qhtml)) {
         foreach ($qhtml as $k => $h) {
             $a_output = str_replace($pg_gui->pl_start . "Question;il__qst_{$k}" . $pg_gui->pl_end, " " . $h, $a_output);
         }
     }
     $a_output = $pg_gui->selfAssessmentRendering($a_output);
     return $a_output;
 }
 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();
 }
 function &executeCommand()
 {
     global $ilCtrl, $ilTabs, $ilUser, $lng;
     $next_class = $this->ctrl->getNextClass($this);
     $cmd = $this->ctrl->getCmd();
     switch ($next_class) {
         case 'ilobjquestionpoolgui':
             $nodeParts = explode(':', $_GET['cmdNode']);
             $params = array('ref_id' => $_GET['ref_id'], 'calling_test' => $_GET['ref_id'], 'q_id' => $_GET['q_id'], 'cmd' => $_GET['cmd'], 'cmdClass' => $_GET['cmdClass'], 'cmdNode' => $nodeParts[count($nodeParts) - 2] . ':' . $nodeParts[count($nodeParts) - 1], 'baseClass' => 'ilObjQuestionPoolGUI', 'test_express_mode' => '1');
             ilUtil::redirect('ilias.php?' . http_build_query($params, null, '&'));
             break;
         case "ilpageeditorgui":
             if (!$this->getEnableEditing()) {
                 ilUtil::sendFailure($lng->txt("permission_denied"), true);
                 $ilCtrl->redirect($this, "preview");
             }
             $page_editor =& new ilPageEditorGUI($this->getPageObject(), $this);
             $page_editor->setLocator($this->locator);
             $page_editor->setHeader($this->getHeader());
             $page_editor->setPageBackTitle($this->page_back_title);
             $page_editor->setEnableInternalLinks($this->getEnabledInternalLinks());
             $page_editor->setEnableKeywords($this->getEnableKeywords());
             $page_editor->setIntLinkHelpDefault($this->int_link_def_type, $this->int_link_def_id);
             $page_editor->setIntLinkReturn($this->int_link_return);
             $this->ctrl->saveParameterByClass('ilpageeditorgui', 'q_mode');
             $ret =& $this->ctrl->forwardCommand($page_editor);
             break;
         case '':
         case 'iltestexpresspageobjectgui':
             include_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
             if ($cmd == 'view') {
                 $cmd = 'showPage';
             }
             $q_gui =& assQuestionGUI::_getQuestionGUI('', $_REQUEST["q_id"]);
             if ($q_gui->object) {
                 $obj = ilObjectFactory::getInstanceByRefId($_REQUEST['ref_id']);
                 $q_gui->object->setObjId($obj->getId());
             }
             if (in_array($cmd, array('handleToolbarCommand', 'addQuestion', 'questions', 'insertQuestions', 'browseForQuestions', 'filterAvailableQuestions', 'resetfilterAvailableQuestions'))) {
                 return $this->{$cmd}();
             } else {
                 if ($q_gui->object) {
                     $total = $this->test_object->evalTotalPersons();
                     $this->setOutputMode($total == 0 ? IL_PAGE_EDIT : IL_PAGE_PREVIEW);
                     if ($total != 0) {
                         $link = $ilCtrl->getLinkTargetByClass('ilobjtestgui', "participants");
                         $link = "<a href=\"" . $link . "\">" . $lng->txt("test_has_datasets_warning_page_view_link") . "</a>";
                         ilUtil::sendInfo($lng->txt("test_has_datasets_warning_page_view") . " " . $link);
                     }
                     if (in_array($cmd, array('view', 'showPage')) || $cmd == 'edit' && $this->test_object->evalTotalPersons()) {
                         return $this->showPage();
                     }
                     return parent::executeCommand();
                 }
             }
             break;
         default:
             $qtype = $_REQUEST['qtype'];
             $type = ilObjQuestionPool::getQuestionTypeByTypeId($qtype);
             if (!$_GET['q_id']) {
                 $q_gui = $this->addPageOfQuestions(preg_replace('/(.*?)gui/i', '$1', $_GET['sel_question_types']));
                 $q_gui->setQuestionTabs();
                 $ret = $this->ctrl->forwardCommand($q_gui);
                 break;
             } else {
             }
             $this->ctrl->setReturn($this, "questions");
             include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
             $q_gui =& assQuestionGUI::_getQuestionGUI($type, $_GET["q_id"]);
             if ($q_gui->object) {
                 $obj = ilObjectFactory::getInstanceByRefId($_GET['ref_id']);
                 $q_gui->object->setObjId($obj->getId());
             }
             $this->ctrl->saveParameterByClass('ilpageeditorgui', 'q_id');
             $this->ctrl->saveParameterByClass('ilpageeditorgui', 'q_mode');
             $q_gui->setQuestionTabs();
             $ret =& $this->ctrl->forwardCommand($q_gui);
             break;
     }
 }
 function getTabs($a_activate = "")
 {
     global $ilTabs, $ilCtrl;
     parent::getTabs($a_activate);
 }
 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);
 }
 /**
  * Set all tabs
  *
  * @param
  * @return
  */
 function getTabs($a_activate = "")
 {
     global $ilTabs, $ilCtrl;
     if (!$this->embedded) {
         parent::getTabs($a_activate);
     }
 }
 /**
  * Export HTML pages of SCO
  */
 function exportHTMLPageObjects($a_inst, $a_target_dir, &$expLog, $mode, $a_asset_type = "sco", $a_one_file = "", $a_sco_tpl = null)
 {
     global $tpl, $ilCtrl, $ilBench, $ilLog, $lng;
     include_once "./Modules/Scorm2004/classes/class.ilSCORM2004PageGUI.php";
     include_once "./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModuleGUI.php";
     include_once "./Services/MetaData/classes/class.ilMD.php";
     $output = "";
     $tree = new ilTree($this->slm_id);
     $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
     $tree->setTreeTablePK("slm_id");
     // @todo
     // Why is that much HTML code in an application class?
     // Please extract all this HTML to a tpl.<t_name>.html file and use
     // placeholders and the template engine to insert data.
     //
     // There copy/paste code residenting in ilSCORM2004ScoGUI. This
     // should be merged.
     //
     // alex, 4 Apr 09
     //
     //		if ($a_one_file == "")
     //		{
     $sco_tpl = new ilTemplate("tpl.sco.html", true, true, "Modules/Scorm2004");
     //		}
     //		else
     //		{
     //			$sco_tpl = $a_sco_tpl;
     //		}
     if ($mode != 'pdf' && $a_one_file == "") {
         include_once "./Services/COPage/classes/class.ilCOPageHTMLExport.php";
         $pg_exp = new ilCOPageHTMLExport($a_target_dir);
         $pg_exp->getPreparedMainTemplate($sco_tpl);
         // init and question lang vars
         $lk = ilObjSAHSLearningModule::getAffectiveLocalization($this->slm_id);
         $sco_tpl->setCurrentBlock("init");
         $sco_tpl->setVariable("TXT_INIT_CODE", ilPageObjectGUI::getJSTextInitCode($lk));
         $sco_tpl->parseCurrentBlock();
         // (additional) style sheets needed
         $styles = array("./css/yahoo/container.css", "./css/question_handling.css");
         foreach ($styles as $style) {
             $sco_tpl->setCurrentBlock("css_file");
             $sco_tpl->setVariable("CSS_FILE", $style);
             $sco_tpl->parseCurrentBlock();
         }
         // (additional) scripts needed
         $scripts = array("./js/scorm.js", "./js/pager.js", "./js/pure.js", "./js/questions_" . $this->getId() . ".js");
         foreach ($scripts as $script) {
             $sco_tpl->setCurrentBlock("js_file");
             $sco_tpl->setVariable("JS_FILE", $script);
             $sco_tpl->parseCurrentBlock();
         }
         if ($a_asset_type != "entry_asset" && $a_asset_type != "final_asset") {
             self::renderNavigation($sco_tpl, "./images/spacer.png", $lk);
         }
         $sco_tpl->touchBlock("finish");
     }
     // render head
     $sco_tpl->setCurrentBlock("head");
     $sco_tpl->setVariable("SCO_TITLE", $this->getTitle());
     $sco_tpl->parseCurrentBlock();
     $sco_tpl->touchBlock("tail");
     // meta page (meta info at SCO beginning)
     self::renderMetaPage($sco_tpl, $this, $a_asset_type, $mode);
     if ($a_one_file != "") {
         fputs($a_one_file, "<a name='sco" . $this->getId() . "'></a>");
         fputs($a_one_file, $sco_tpl->get("meta_page"));
     }
     //notify Question Exporter of new SCO
     require_once './Modules/Scorm2004/classes/class.ilQuestionExporter.php';
     ilQuestionExporter::indicateNewSco();
     // init export (this initialises glossary template)
     ilSCORM2004PageGUI::initExport();
     $terms = array();
     $terms = $this->getGlossaryTermIds();
     include_once "./Modules/Scorm2004/classes/class.ilSCORM2004ScoGUI.php";
     $pages = $tree->getSubTree($tree->getNodeData($this->getId()), true, 'page');
     $sco_q_ids = array();
     foreach ($pages as $page) {
         //echo(print_r($page));
         $page_obj = new ilSCORM2004PageGUI($this->getType(), $page["obj_id"], 0, $this->slm_object->getId());
         $page_obj->setPresentationTitle($page["title"]);
         $page_obj->setOutputMode(IL_PAGE_OFFLINE);
         $page_obj->setStyleId($this->slm_object->getStyleSheetId());
         if (count($terms) > 1) {
             $page_obj->setGlossaryOverviewInfo(ilSCORM2004ScoGUI::getGlossaryOverviewId(), $this);
         }
         $page_output = $page_obj->showPage("export");
         // collect media objects
         $mob_ids = $page_obj->getSCORM2004Page()->collectMediaObjects(false);
         foreach ($mob_ids as $mob_id) {
             $this->mob_ids[$mob_id] = $mob_id;
             $media_obj = new ilObjMediaObject($mob_id);
             if ($media_obj->hasFullscreenItem()) {
                 $media_obj->exportMediaFullscreen($a_target_dir, $page_obj->getPageObject());
             }
         }
         // collect glossary items
         $int_links = $page_obj->getPageObject()->getInternalLinks(true);
         include_once "./Services/COPage/classes/class.ilInternalLink.php";
         include_once "./Modules/Glossary/classes/class.ilGlossaryDefinition.php";
         include_once "./Services/COPage/classes/class.ilPageObject.php";
         if (is_array($int_links)) {
             foreach ($int_links as $k => $e) {
                 // glossary link
                 if ($e["Type"] == "GlossaryItem") {
                     $karr = explode(":", $k);
                     $tid = ilInternalLink::_extractObjIdOfTarget($karr[0]);
                     $dids = ilGlossaryDefinition::getDefinitionList($tid);
                     foreach ($dids as $did) {
                         $def_pg = new ilPageObject("gdf", $did["id"]);
                         $def_pg->buildDom();
                         $mob_ids = $def_pg->collectMediaObjects(false);
                         foreach ($mob_ids as $mob_id) {
                             $this->mob_ids[$mob_id] = $mob_id;
                             //echo "<br>-$mob_id-";
                             $media_obj = new ilObjMediaObject($mob_id);
                             if ($media_obj->hasFullscreenItem()) {
                                 $media_obj->exportMediaFullscreen($a_target_dir, $def_pg);
                             }
                         }
                         $file_ids = $def_pg->collectFileItems();
                         foreach ($file_ids as $file_id) {
                             $this->file_ids[$file_id] = $file_id;
                         }
                     }
                 }
             }
         }
         //exit;
         // collect all file items
         $file_ids = $page_obj->getSCORM2004Page()->collectFileItems();
         foreach ($file_ids as $file_id) {
             $this->file_ids[$file_id] = $file_id;
         }
         if ($mode == 'pdf') {
             $q_ids = ilSCORM2004Page::_getQuestionIdsForPage("sahs", $page["obj_id"]);
             foreach ($q_ids as $q_id) {
                 include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
                 $q_gui =& assQuestionGUI::_getQuestionGUI("", $q_id);
                 $q_gui->outAdditionalOutput();
                 $html = $q_gui->getPreview(TRUE);
                 $page_output = preg_replace("/{{{{{Question;il__qst_" . $q_id . "}}}}}/i", $html, $page_output);
             }
             $sco_tpl->touchBlock("pdf_pg_break");
         }
         $sco_tpl->setCurrentBlock("page");
         $sco_tpl->setVariable("PAGE", $page_output);
         $sco_tpl->parseCurrentBlock();
         // get all question ids of the sco
         if ($a_one_file != "") {
             $q_ids = ilSCORM2004Page::_getQuestionIdsForPage("sahs", $page["obj_id"]);
             foreach ($q_ids as $i) {
                 if (!in_array($i, $sco_q_ids)) {
                     $sco_q_ids[] = $i;
                 }
             }
         }
     }
     // glossary
     if ($mode != 'pdf') {
         $sco_tpl->setVariable("GLOSSARY_HTML", ilSCORM2004PageGUI::getGlossaryHTML($this));
     }
     if ($a_one_file == "") {
         $output = $sco_tpl->get();
     } else {
         $output = $sco_tpl->get("page");
     }
     if ($mode == 'pdf') {
         $output = preg_replace("/<div class=\"ilc_page_title_PageTitle\">(.*?)<\\/div>/i", "<h2>\$1</h2>", $output);
     }
     //$output = preg_replace("/\.\/mobs\/mm_(\d+)\/([^\"]+)/i","./objects/il_".IL_INST_ID."_mob_$1/$2",$output);
     $output = preg_replace("/mobs\\/mm_(\\d+)\\/([^\"]+)/i", "./objects/il_" . IL_INST_ID . "_mob_\$1/\$2", $output);
     $output = preg_replace("/\\.\\/files\\/file_(\\d+)\\/([^\"]+)/i", "./objects/il_" . IL_INST_ID . "_file_\$1/\$2", $output);
     $output = preg_replace("/\\.\\/Services\\/MediaObjects\\/flash_mp3_player/i", "./players", $output);
     //		$output = preg_replace("/\.\/".str_replace("/", "\/", ilPlayerUtil::getFlashVideoPlayerDirectory())."/i","./players",$output);
     $output = preg_replace("/file=..\\/..\\/..\\/.\\//i", "file=../", $output);
     if ($mode != 'pdf') {
         $output = preg_replace_callback("/href=\"&mob_id=(\\d+)&pg_id=(\\d+)\"/", array(get_class($this), 'fixFullscreeenLink'), $output);
         // this one is for fullscreen in glossary entries
         $output = preg_replace_callback("/href=\"fullscreen_(\\d+)\\.html\"/", array(get_class($this), 'fixFullscreeenLink'), $output);
         $output = preg_replace_callback("/{{{{{(Question;)(il__qst_[0-9]+)}}}}}/", array(get_class($this), 'insertQuestion'), $output);
         //			$output = preg_replace("/&#123;/","",$output);
         //			$output = preg_replace("/&#125;/","",$output);
         $q_handling = file_get_contents('./Modules/Scorm2004/scripts/questions/question_handling.js');
         fputs(fopen($a_target_dir . '/js/questions_' . $this->getId() . '.js', 'w+'), ilQuestionExporter::questionsJS() . $q_handling);
         copy("./Modules/Scorm2004/templates/default/question_handling.css", $a_target_dir . '/css/question_handling.css');
         // hack to get the question js into the file and to display the correct answers
         if ($a_one_file != "") {
             $output = '<script type="text/javascript">' . ilQuestionExporter::questionsJS() . '</script>' . $output;
             if (count($sco_q_ids) > 0) {
                 $output .= '<script type="text/javascript">';
                 foreach ($sco_q_ids as $i) {
                     if ($i > 0) {
                         $output .= "ilias.questions.showCorrectAnswers(" . $i . "); \n";
                     }
                 }
                 $output .= '</script>';
             }
         }
         foreach (ilQuestionExporter::getMobs() as $mob_id) {
             $this->mob_ids[$mob_id] = $mob_id;
         }
     }
     $this->q_media = ilQuestionExporter::getFiles();
     //questions export end
     if ($a_one_file != "") {
         fputs($a_one_file, $output);
     } else {
         fputs(fopen($a_target_dir . '/index.html', 'w+'), $output);
     }
     $this->exportFileItems($a_target_dir, $expLog);
 }
 /**
  * Constructor
  */
 function __construct($a_id = 0, $a_old_nr = 0, $a_lang = "")
 {
     parent::__construct("cstr", $a_id, $a_old_nr, false, $a_lang);
 }
 /**
  * Constructor
  *
  * @param int $a_id
  * @param int $a_old_nr
  *
  * @return \ilAssQuestionPageGUI
  */
 public function __construct($a_id = 0, $a_old_nr = 0)
 {
     parent::__construct('qpl', $a_id, $a_old_nr);
     $this->setEnabledPageFocus(false);
 }
Esempio n. 20
0
 /**
  * Constructor
  */
 function __construct($a_id = 0, $a_old_nr = 0)
 {
     global $tpl;
     parent::__construct("shop", $a_id, $a_old_nr);
     $this->setTemplateOutput(false);
 }
 /**
  * Edit data of table
  */
 function editData()
 {
     global $lng, $ilCtrl;
     if (!ilPageEditorGUI::_doJSEditing()) {
         return $this->editDataCl();
     }
     //var_dump($_GET);
     //var_dump($_POST);
     $this->setTabs();
     $this->displayValidationError();
     include_once "./Services/COPage/classes/class.ilPCParagraph.php";
     $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.tabledata2.html", "Services/COPage");
     $dtpl = $this->tpl;
     //$dtpl = new ilTemplate("tpl.tabledata.html", true, true, "Services/COPage");
     $dtpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "tableAction"));
     //		$dtpl->setVariable("BB_MENU", $this->getBBMenu("cell_0_0"));
     //		$this->tpl->addJavascript("./Services/COPage/phpBB/3_0_5/editor.js");
     //		$this->tpl->addJavascript("./Services/COPage/js/page_editing.js");
     $this->tpl->setVariable("WYSIWYG_ACTION", $ilCtrl->getFormAction($this, "updateJS"));
     // get all rows
     $xpc = xpath_new_context($this->dom);
     $path = "//PageContent[@HierId='" . $this->getHierId() . "']" . "/Table/TableRow";
     $res =& xpath_eval($xpc, $path);
     for ($i = 0; $i < count($res->nodeset); $i++) {
         $xpc2 = xpath_new_context($this->dom);
         $path2 = "//PageContent[@HierId='" . $this->getHierId() . "']" . "/Table/TableRow[{$i}+1]/TableData";
         $res2 =& xpath_eval($xpc2, $path2);
         // if this is the first row -> col icons
         if ($i == 0) {
             for ($j = 0; $j < count($res2->nodeset); $j++) {
                 if ($j == 0) {
                     $dtpl->touchBlock("empty_td");
                 }
                 if ($j == 0) {
                     if (count($res2->nodeset) == 1) {
                         $move_type = "none";
                     } else {
                         $move_type = "forward";
                     }
                 } else {
                     if ($j == count($res2->nodeset) - 1) {
                         $move_type = "backward";
                     } else {
                         $move_type = "both";
                     }
                 }
                 $dtpl->setCurrentBlock("col_icon");
                 $dtpl->setVariable("COL_ICON_ALT", $lng->txt("content_column"));
                 $dtpl->setVariable("COL_ICON", ilUtil::getImagePath("col.png"));
                 $dtpl->setVariable("COL_ONCLICK", "COL_" . $move_type);
                 $dtpl->setVariable("NR", $j);
                 $dtpl->parseCurrentBlock();
             }
             $dtpl->setCurrentBlock("row");
             $dtpl->parseCurrentBlock();
         }
         for ($j = 0; $j < count($res2->nodeset); $j++) {
             // first col: row icons
             if ($j == 0) {
                 if ($i == 0) {
                     if (count($res->nodeset) == 1) {
                         $move_type = "none";
                     } else {
                         $move_type = "forward";
                     }
                 } else {
                     if ($i == count($res->nodeset) - 1) {
                         $move_type = "backward";
                     } else {
                         $move_type = "both";
                     }
                 }
                 $dtpl->setCurrentBlock("row_icon");
                 $dtpl->setVariable("ROW_ICON_ALT", $lng->txt("content_row"));
                 $dtpl->setVariable("ROW_ICON", ilUtil::getImagePath("row.png"));
                 $dtpl->setVariable("ROW_ONCLICK", "ROW_" . $move_type);
                 $dtpl->setVariable("NR", $i);
                 $dtpl->parseCurrentBlock();
             }
             // cell
             if ($res2->nodeset[$j]->get_attribute("Hidden") != "Y") {
                 $dtpl->setCurrentBlock("cell");
                 if (is_array($_POST["cmd"]) && key($_POST["cmd"]) == "update") {
                     $s_text = ilUtil::stripSlashes("cell_" . $i . "_" . $j, false);
                 } else {
                     $s_text = ilPCParagraph::xml2output($this->content_obj->getCellText($i, $j), true, false);
                     include_once "./Services/COPage/classes/class.ilPCParagraphGUI.php";
                     $s_text = ilPCParagraphGUI::xml2outputJS($s_text, "TableContent", $this->content_obj->readPCId() . "_" . $i . "_" . $j);
                 }
                 $dtpl->setVariable("PAR_TA_NAME", "cell[" . $i . "][" . $j . "]");
                 $dtpl->setVariable("PAR_TA_ID", "cell_" . $i . "_" . $j);
                 $dtpl->setVariable("PAR_TA_CONTENT", $s_text);
                 $cs = $res2->nodeset[$j]->get_attribute("ColSpan");
                 $rs = $res2->nodeset[$j]->get_attribute("RowSpan");
                 $dtpl->setVariable("WIDTH", "140");
                 $dtpl->setVariable("HEIGHT", "80");
                 if ($cs > 1) {
                     $dtpl->setVariable("COLSPAN", 'colspan="' . $cs . '"');
                     $dtpl->setVariable("WIDTH", 140 + ($cs - 1) * 146);
                 }
                 if ($rs > 1) {
                     $dtpl->setVariable("ROWSPAN", 'rowspan="' . $rs . '"');
                     $dtpl->setVariable("HEIGHT", 80 + ($rs - 1) * 86);
                 }
                 $dtpl->parseCurrentBlock();
             }
         }
         $dtpl->setCurrentBlock("row");
         $dtpl->parseCurrentBlock();
     }
     // init menues
     $types = array("row", "col");
     $moves = array("none", "backward", "both", "forward");
     $commands = array("row" => array("newRowAfter" => "cont_ed_new_row_after", "newRowBefore" => "cont_ed_new_row_before", "moveRowUp" => "cont_ed_row_up", "moveRowDown" => "cont_ed_row_down", "deleteRow" => "cont_ed_delete_row"), "col" => array("newColAfter" => "cont_ed_new_col_after", "newColBefore" => "cont_ed_new_col_before", "moveColLeft" => "cont_ed_col_left", "moveColRight" => "cont_ed_col_right", "deleteCol" => "cont_ed_delete_col"));
     foreach ($types as $type) {
         foreach ($moves as $move) {
             foreach ($commands[$type] as $command => $lang_var) {
                 if ($move == "none" && substr($command, 0, 4) == "move") {
                     continue;
                 }
                 if ($move == "backward" && in_array($command, array("movedown", "moveright")) || $move == "forward" && in_array($command, array("moveup", "moveleft"))) {
                     continue;
                 }
                 $this->tpl->setCurrentBlock("menu_item");
                 $this->tpl->setVariable("MENU_ITEM_TITLE", $lng->txt($lang_var));
                 $this->tpl->setVariable("CMD", $command);
                 $this->tpl->setVariable("TYPE", $type);
                 $this->tpl->parseCurrentBlock();
             }
             $this->tpl->setCurrentBlock("menu");
             $this->tpl->setVariable("TYPE", $type);
             $this->tpl->setVariable("MOVE", $move);
             $this->tpl->parseCurrentBlock();
         }
     }
     $this->tpl->setVariable("FORMACTION2", $ilCtrl->getFormAction($this, "tableAction"));
     $this->tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_table"));
     // js editing preparation
     include_once "./Services/YUI/classes/class.ilYuiUtil.php";
     ilYuiUtil::initDragDrop();
     ilYuiUtil::initConnection();
     ilYuiUtil::initPanel(false);
     $GLOBALS["tpl"]->addJavascript("Services/RTE/tiny_mce_3_3_9_2/il_tiny_mce_src.js");
     $GLOBALS["tpl"]->addJavaScript("./Services/COPage/js/ilcopagecallback.js");
     $GLOBALS["tpl"]->addJavascript("Services/COPage/js/page_editing.js");
     $GLOBALS["tpl"]->addOnloadCode("var preloader = new Image();\n\t\t\tpreloader.src = './templates/default/images/loader.gif';\n\t\t\tilCOPage.setContentCss('" . ilObjStyleSheet::getContentStylePath((int) $this->getStyleId()) . ", " . ilUtil::getStyleSheetLocation() . ", ./Services/COPage/css/tiny_extra.css');\n\t\t\tilCOPage.editTD('cell_0_0');\n\t\t\t\t");
     $this->tpl->setVariable("IL_TINY_MENU", ilPageObjectGUI::getTinyMenu($this->pg_obj->getParentType(), false, $this->pg_obj->getParentType() == "wpg", false, $this->getStyleId(), false, true));
 }
Esempio n. 22
0
 /**
  * Constructor
  */
 function __construct($a_id = 0, $a_old_nr = 0, $a_prevent_get_id = false, $a_lang = "")
 {
     parent::__construct("lm", $a_id, $a_old_nr, $a_prevent_get_id, $a_lang);
 }
 public function showPage()
 {
     global $ilCtrl, $lng;
     // :TODO: temporary legend of available placeholders
     if ($this->getOutputMode() == IL_PAGE_EDIT) {
         $legend = ilDataCollectionRecordViewViewdefinition::getAvailablePlaceholders($this->table_id);
         if (sizeof($legend)) {
             $this->setPrependingHtml(" <form action=" . $ilCtrl->getFormAction($this, "confirmDelete") . " method='post'> <input class='submit' type='submit' value='" . $lng->txt("dcl_empty_view") . "'></form> <span class=\"small\">" . $this->lng->txt("dcl_legend_placeholders") . ": " . implode(" ", $legend) . "</span>");
         }
     }
     return parent::showPage();
 }
 /**
  * Constructor
  */
 function __construct($a_id = 0, $a_old_nr = 0, $a_lang = "-")
 {
     global $tpl;
     parent::__construct("cont", $a_id, $a_old_nr, false, $a_lang);
 }
Esempio n. 25
0
 function getTabs($a_activate = "")
 {
     global $ilTabs, $ilCtrl;
     parent::getTabs($a_activate);
     $ilCtrl->setParameterByClass("ilobjwikigui", "wpg_id", ilWikiPage::getPageIdForTitle($this->getPageObject()->getParentId(), ilWikiUtil::makeDbTitle($_GET["page"])));
     $ilCtrl->setParameterByClass("ilobjwikigui", "page", ilWikiUtil::makeUrlTitle($_GET["page"]));
     $ilTabs->addTarget("wiki_what_links_here", $this->ctrl->getLinkTargetByClass("ilwikipagegui", "whatLinksHere"), "whatLinksHere");
     //$ilTabs->addTarget("wiki_print_view",
     //	$this->ctrl->getLinkTargetByClass("ilobjwikigui",
     //	"printViewSelection"), "printViewSelection");
     $ilTabs->addTarget("wiki_print_view", $this->ctrl->getLinkTargetByClass("ilwikipagegui", "printViewSelection"), "printViewSelection");
 }
 /**
  * Set all tabs
  *
  * @param
  * @return
  */
 function getTabs($a_activate = "")
 {
     if (!$this->embedded) {
         parent::getTabs($a_activate);
     }
 }
 /**
  * Show the page
  */
 function showPage($a_mode = "preview")
 {
     global $tpl, $ilCtrl;
     $this->scorm_mode = $a_mode;
     $this->setTemplateOutput(false);
     $output = parent::showPage();
     return $output;
 }
Esempio n. 28
0
 /**
  * Edit
  *
  * @param
  * @return
  */
 function edit()
 {
     global $tpl, $lng;
     self::initEditingJS($tpl);
     return parent::edit();
 }
 /**
  * Compares two revisions of the page
  */
 function compareVersion()
 {
     global $lng;
     if (!$this->getEnableEditing()) {
         return;
     }
     $tpl = new ilTemplate("tpl.page_compare.html", true, true, "Services/COPage");
     $compare = $this->obj->compareVersion($_POST["left"], $_POST["right"]);
     // left page
     $lpage = $compare["l_page"];
     $lpage_gui = new ilPageObjectGUI($lpage->getParentType(), 0);
     $cfg = $lpage_gui->getPageConfig();
     $cfg->setPreventHTMLUnmasking(true);
     $lpage_gui->setOutputMode(IL_PAGE_PREVIEW);
     $lpage_gui->setPageObject($lpage);
     $lpage_gui->setPresentationTitle($this->getPresentationTitle());
     $lpage_gui->setCompareMode(true);
     $lhtml = $lpage_gui->showPage();
     $lhtml = $this->replaceDiffTags($lhtml);
     $lhtml = str_replace("&lt;br /&gt;", "<br />", $lhtml);
     $tpl->setVariable("LEFT", $lhtml);
     // right page
     $rpage = $compare["r_page"];
     $rpage_gui = new ilPageObjectGUI($rpage->getParentType(), 0);
     $cfg = $rpage_gui->getPageConfig();
     $cfg->setPreventHTMLUnmasking(true);
     $rpage_gui->setOutputMode(IL_PAGE_PREVIEW);
     $rpage_gui->setPageObject($rpage);
     $rpage_gui->setPresentationTitle($this->getPresentationTitle());
     $rpage_gui->setCompareMode(true);
     $rhtml = $rpage_gui->showPage();
     $rhtml = $this->replaceDiffTags($rhtml);
     $rhtml = str_replace("&lt;br /&gt;", "<br />", $rhtml);
     $tpl->setVariable("RIGHT", $rhtml);
     $tpl->setVariable("TXT_NEW", $lng->txt("cont_pc_new"));
     $tpl->setVariable("TXT_MODIFIED", $lng->txt("cont_pc_modified"));
     $tpl->setVariable("TXT_DELETED", $lng->txt("cont_pc_deleted"));
     //var_dump($left);
     //var_dump($right);
     return $tpl->get();
 }
Esempio n. 30
0
 /**
  * Constructor
  */
 function __construct($a_id = 0, $a_old_nr = 0)
 {
     global $tpl;
     parent::__construct("auth", $a_id, $a_old_nr);
 }