コード例 #1
0
 /**
  * set all template variables (images, scripts, target frames, ...)
  */
 function setTemplateVars()
 {
     global $rbacsystem, $lng, $ilias, $tree, $ilUser, $ilSetting, $ilPluginAdmin;
     if ($this->logo_only) {
         $this->tpl->setVariable("HEADER_URL", $this->getHeaderURL());
         $this->tpl->setVariable("HEADER_ICON", ilUtil::getImagePath("HeaderIcon.svg"));
         return;
     }
     // get user interface plugins
     $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
     if ($this->getMode() != self::MODE_TOPBAR_REDUCED && $this->getMode() != self::MODE_TOPBAR_MEMBERVIEW) {
         // search
         include_once 'Services/Search/classes/class.ilSearchSettings.php';
         if ($rbacsystem->checkAccess('search', ilSearchSettings::_getSearchSettingRefId())) {
             include_once './Services/Search/classes/class.ilMainMenuSearchGUI.php';
             $main_search = new ilMainMenuSearchGUI();
             $html = "";
             // user interface plugin slot + default rendering
             include_once "./Services/UIComponent/classes/class.ilUIHookProcessor.php";
             $uip = new ilUIHookProcessor("Services/MainMenu", "main_menu_search", array("main_menu_gui" => $this, "main_menu_search_gui" => $main_search));
             if (!$uip->replaced()) {
                 $html = $main_search->getHTML();
             }
             $html = $uip->getHTML($html);
             if (strlen($html)) {
                 $this->tpl->setVariable('SEARCHBOX', $html);
             }
         }
         $this->renderStatusBox($this->tpl);
         // online help
         $this->renderHelpButtons();
     }
     if ($this->getMode() == self::MODE_FULL) {
         $mmle_html = "";
         // user interface plugin slot + default rendering
         include_once "./Services/UIComponent/classes/class.ilUIHookProcessor.php";
         $uip = new ilUIHookProcessor("Services/MainMenu", "main_menu_list_entries", array("main_menu_gui" => $this));
         if (!$uip->replaced()) {
             $mmle_tpl = new ilTemplate("tpl.main_menu_list_entries.html", true, true, "Services/MainMenu");
             $mmle_html = $this->renderMainMenuListEntries($mmle_tpl);
         }
         $mmle_html = $uip->getHTML($mmle_html);
         $this->tpl->setVariable("MAIN_MENU_LIST_ENTRIES", $mmle_html);
     }
     if ($this->getMode() != self::MODE_TOPBAR_MEMBERVIEW) {
         $link_dir = defined("ILIAS_MODULE") ? "../" : "";
         // login stuff
         if ($_SESSION["AccountId"] == ANONYMOUS_USER_ID) {
             include_once 'Services/Registration/classes/class.ilRegistrationSettingsGUI.php';
             if (ilRegistrationSettings::_lookupRegistrationType() != IL_REG_DISABLED) {
                 $this->tpl->setCurrentBlock("registration_link");
                 $this->tpl->setVariable("TXT_REGISTER", $lng->txt("register"));
                 $this->tpl->setVariable("LINK_REGISTER", $link_dir . "register.php?client_id=" . rawurlencode(CLIENT_ID) . "&lang=" . $ilias->account->getCurrentLanguage());
                 $this->tpl->parseCurrentBlock();
             }
             // language selection
             $selection = self::getLanguageSelection();
             if ($selection) {
                 // bs-patch start
                 global $ilUser, $lng;
                 $this->tpl->setVariable("TXT_LANGSELECT", $lng->txt("language"));
                 // bs-patch end
                 $this->tpl->setVariable("LANG_SELECT", $selection);
             }
             $this->tpl->setCurrentBlock("userisanonymous");
             $this->tpl->setVariable("TXT_NOT_LOGGED_IN", $lng->txt("not_logged_in"));
             $this->tpl->setVariable("TXT_LOGIN", $lng->txt("log_in"));
             // #13058
             $target_str = $this->getLoginTargetPar() != "" ? $this->getLoginTargetPar() : ilTemplate::buildLoginTarget();
             $this->tpl->setVariable("LINK_LOGIN", $link_dir . "login.php?target=" . $target_str . "&client_id=" . rawurlencode(CLIENT_ID) . "&cmd=force_login&lang=" . $ilias->account->getCurrentLanguage());
             $this->tpl->parseCurrentBlock();
         } else {
             if ($this->getMode() != self::MODE_TOPBAR_REDUCED) {
                 $notificationSettings = new ilSetting('notifications');
                 $chatSettings = new ilSetting('chatroom');
                 /**
                  * @var $tpl ilTemplate
                  */
                 global $tpl;
                 if ($chatSettings->get('chat_enabled') && $notificationSettings->get('enable_osd')) {
                     $this->tpl->touchBlock('osd_enabled');
                     $this->tpl->touchBlock('osd_container');
                     include_once "Services/jQuery/classes/class.iljQueryUtil.php";
                     iljQueryUtil::initjQuery();
                     include_once 'Services/MediaObjects/classes/class.ilPlayerUtil.php';
                     ilPlayerUtil::initMediaElementJs();
                     $tpl->addJavaScript('Services/Notifications/templates/default/notifications.js');
                     $tpl->addCSS('Services/Notifications/templates/default/osd.css');
                     require_once 'Services/Notifications/classes/class.ilNotificationOSDHandler.php';
                     require_once 'Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php';
                     $notifications = ilNotificationOSDHandler::getNotificationsForUser($ilUser->getId());
                     $this->tpl->setVariable('NOTIFICATION_CLOSE_HTML', json_encode(ilGlyphGUI::get(ilGlyphGUI::CLOSE, $lng->txt('close'))));
                     $this->tpl->setVariable('INITIAL_NOTIFICATIONS', json_encode($notifications));
                     $this->tpl->setVariable('OSD_POLLING_INTERVALL', $notificationSettings->get('osd_polling_intervall') ? $notificationSettings->get('osd_polling_intervall') : '5');
                     $this->tpl->setVariable('OSD_PLAY_SOUND', $chatSettings->get('play_invitation_sound') && $ilUser->getPref('chat_play_invitation_sound') ? 'true' : 'false');
                     foreach ($notifications as $notification) {
                         if ($notification['type'] == 'osd_maint') {
                             continue;
                         }
                         $this->tpl->setCurrentBlock('osd_notification_item');
                         $this->tpl->setVariable('NOTIFICATION_ICON_PATH', $notification['data']->iconPath);
                         $this->tpl->setVariable('NOTIFICATION_TITLE', $notification['data']->title);
                         $this->tpl->setVariable('NOTIFICATION_LINK', $notification['data']->link);
                         $this->tpl->setVariable('NOTIFICATION_LINKTARGET', $notification['data']->linktarget);
                         $this->tpl->setVariable('NOTIFICATION_ID', $notification['notification_osd_id']);
                         $this->tpl->setVariable('NOTIFICATION_SHORT_DESCRIPTION', $notification['data']->shortDescription);
                         $this->tpl->parseCurrentBlock();
                     }
                 }
             }
             $this->tpl->setCurrentBlock("userisloggedin");
             $this->tpl->setVariable("TXT_LOGIN_AS", $lng->txt("login_as"));
             $user_img_src = $ilias->account->getPersonalPicturePath("small", true);
             $user_img_alt = $ilias->account->getFullname();
             $this->tpl->setVariable("USER_IMG", ilUtil::img($user_img_src, $user_img_alt));
             $this->tpl->setVariable("USR_LINK_PROFILE", "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToProfile");
             $this->tpl->setVariable("USR_TXT_PROFILE", $lng->txt("personal_profile"));
             $this->tpl->setVariable("USR_LINK_SETTINGS", "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToSettings");
             $this->tpl->setVariable("USR_TXT_SETTINGS", $lng->txt("personal_settings"));
             $this->tpl->setVariable("TXT_LOGOUT2", $lng->txt("logout"));
             $this->tpl->setVariable("LINK_LOGOUT2", $link_dir . "logout.php?lang=" . $ilias->account->getCurrentLanguage());
             $this->tpl->setVariable("USERNAME", $ilias->account->getFullname());
             $this->tpl->setVariable("LOGIN", $ilias->account->getLogin());
             $this->tpl->setVariable("MATRICULATION", $ilias->account->getMatriculation());
             $this->tpl->setVariable("EMAIL", $ilias->account->getEmail());
             $this->tpl->parseCurrentBlock();
         }
     } else {
         // member view info
         $this->tpl->setVariable("TOPBAR_CLASS", " ilMemberViewMainHeader");
         $this->tpl->setVariable("MEMBER_VIEW_INFO", $lng->txt("mem_view_long"));
     }
     if (!$this->topbar_back_url) {
         include_once "./Modules/SystemFolder/classes/class.ilObjSystemFolder.php";
         $header_top_title = ilObjSystemFolder::_getHeaderTitle();
         if (trim($header_top_title) != "" && $this->tpl->blockExists("header_top_title")) {
             $this->tpl->setCurrentBlock("header_top_title");
             $this->tpl->setVariable("TXT_HEADER_TITLE", $header_top_title);
             $this->tpl->parseCurrentBlock();
         }
     } else {
         $this->tpl->setCurrentBlock("header_back_bl");
         $this->tpl->setVariable("URL_HEADER_BACK", $this->topbar_back_url);
         $this->tpl->setVariable("TXT_HEADER_BACK", $this->topbar_back_caption ? $this->topbar_back_caption : $lng->txt("back"));
         $this->tpl->parseCurrentBlock();
     }
     $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
     if ($this->getMode() == self::MODE_FULL) {
         // $this->tpl->setVariable("TXT_LOGOUT", $lng->txt("logout"));
         $this->tpl->setVariable("HEADER_URL", $this->getHeaderURL());
         $this->tpl->setVariable("HEADER_ICON", ilUtil::getImagePath("HeaderIcon.svg"));
     }
     include_once "./Modules/SystemFolder/classes/class.ilObjSystemFolder.php";
     // set link to return to desktop, not depending on a specific position in the hierarchy
     //$this->tpl->setVariable("SCRIPT_START", $this->getScriptTarget("start.php"));
     /*
     else
     {
     	$this->tpl->setVariable("HEADER_URL", $this->getHeaderURL());
     	$this->tpl->setVariable("HEADER_ICON", ilUtil::getImagePath("HeaderIcon.svg"));
     }
     */
     $this->tpl->setVariable("TXT_MAIN_MENU", $lng->txt("main_menu"));
     $this->tpl->parseCurrentBlock();
 }
コード例 #2
0
 /**
  * Get prepared main template
  *
  * @param
  * @return
  */
 function getPreparedMainTemplate($a_tpl = "")
 {
     global $ilUser;
     include_once "./Services/MediaObjects/classes/class.ilPlayerUtil.php";
     if ($a_tpl != "") {
         $tpl = $a_tpl;
     } else {
         // template workaround: reset of template
         $tpl = new ilTemplate("tpl.main.html", true, true);
     }
     // scripts needed
     $scripts = array("./js/yahoo/yahoo-min.js", "./js/yahoo/yahoo-dom-event.js", "./js/yahoo/animation-min.js", "./js/yahoo/container-min.js", "./js/Basic.js", "./js/jquery.js", "./js/jquery-ui-min.js", "./js/ilOverlay.js", "./js/accordion.js", "./js/ilCOPagePres.js", "./js/ilTooltip.js", "./js/maphilight.js");
     $scripts = array_merge($scripts, ilPlayerUtil::getJsFilePaths());
     $mathJaxSetting = new ilSetting("MathJax");
     $use_mathjax = $mathJaxSetting->get("enable");
     if ($use_mathjax) {
         $scripts[] = $mathJaxSetting->get("path_to_mathjax");
     }
     foreach ($scripts as $script) {
         $tpl->setCurrentBlock("js_file");
         $tpl->setVariable("JS_FILE", $script);
         $tpl->parseCurrentBlock();
     }
     // css files needed
     $style_name = $ilUser->prefs["style"] . ".css";
     $css_files = array("./css/accordion.css", "./css/container.css", "./content_style/content.css", "./style/" . $style_name);
     $css_files = array_merge($css_files, ilPlayerUtil::getCssFilePaths());
     foreach ($css_files as $css) {
         $tpl->setCurrentBlock("css_file");
         $tpl->setVariable("CSS_FILE", $css);
         $tpl->parseCurrentBlock();
     }
     return $tpl;
 }
コード例 #3
0
 function exportMediaFullscreen($a_target_dir, $pg_obj)
 {
     $subdir = "il_" . IL_INST_ID . "_mob_" . $this->getId();
     $a_target_dir = $a_target_dir . "/objects/" . $subdir;
     ilUtil::makeDir($a_target_dir);
     $tpl = new ilTemplate("tpl.fullscreen.html", true, true, "Modules/LearningModule");
     $tpl->setCurrentBlock("ilMedia");
     //$int_links = $page_object->getInternalLinks();
     $med_links = ilMediaItem::_getMapAreasIntLinks($this->getId());
     // @todo
     //$link_xml = $this->getLinkXML($med_links, $this->getLayoutLinkTargets());
     require_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
     //$media_obj = new ilObjMediaObject($_GET["mob_id"]);
     require_once "./Services/COPage/classes/class.ilPageObject.php";
     $xml = "<dummy>";
     // todo: we get always the first alias now (problem if mob is used multiple
     // times in page)
     $xml .= $pg_obj->getMediaAliasElement($this->getId());
     $xml .= $this->getXML(IL_MODE_OUTPUT);
     //$xml.= $link_xml;
     $xml .= "</dummy>";
     //die(htmlspecialchars($xml));
     $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
     $args = array('/_xml' => $xml, '/_xsl' => $xsl);
     $xh = xslt_create();
     //echo "<b>XML:</b>".htmlentities($xml);
     // determine target frames for internal links
     $wb_path = "";
     $enlarge_path = "";
     $params = array('mode' => "fullscreen", 'enlarge_path' => $enlarge_path, 'link_params' => "ref_id=" . $_GET["ref_id"], 'fullscreen_link' => "", 'ref_id' => $_GET["ref_id"], 'webspace_path' => $wb_path);
     $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args, $params);
     //echo xslt_error($xh);
     xslt_free($xh);
     // unmask user html
     include_once "./Services/MediaObjects/classes/class.ilPlayerUtil.php";
     $tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "../../css/style.css");
     $tpl->setVariable("LOCATION_STYLESHEET", "../../css/system.css");
     $tpl->setVariable("MEDIA_CONTENT", $output);
     $output = $tpl->get();
     //$output = preg_replace("/\/mobs\/mm_(\d+)\/([^\"]+)/i","$2",$output);
     $output = preg_replace("/mobs\\/mm_(\\d+)\\/([^\"]+)/i", "\$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=../objects/" . $subdir . "/", $output);
     //die(htmlspecialchars($output));
     fwrite(fopen($a_target_dir . '/fullscreen.html', 'w'), $output);
 }
コード例 #4
0
 /**
  * set all template variables (images, scripts, target frames, ...)
  */
 function setTemplateVars()
 {
     global $rbacsystem, $lng, $ilias, $tree, $ilUser, $ilSetting, $ilPluginAdmin;
     if ($this->logo_only) {
         $this->tpl->setVariable("HEADER_ICON", ilUtil::getImagePath("HeaderIcon.png"));
         return;
     }
     // get user interface plugins
     $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
     // search
     include_once 'Services/Search/classes/class.ilSearchSettings.php';
     if ($rbacsystem->checkAccess('search', ilSearchSettings::_getSearchSettingRefId())) {
         include_once './Services/Search/classes/class.ilMainMenuSearchGUI.php';
         $main_search = new ilMainMenuSearchGUI();
         $html = "";
         // user interface plugin slot + default rendering
         include_once "./Services/UIComponent/classes/class.ilUIHookProcessor.php";
         $uip = new ilUIHookProcessor("Services/MainMenu", "main_menu_search", array("main_menu_gui" => $this, "main_menu_search_gui" => $main_search));
         if (!$uip->replaced()) {
             $html = $main_search->getHTML();
         }
         $html = $uip->getHTML($html);
         if (strlen($html)) {
             $this->tpl->setVariable('SEARCHBOX', $html);
         }
     }
     $this->renderStatusBox($this->tpl);
     // online help
     $this->renderHelpButtons();
     $mmle_html = "";
     // user interface plugin slot + default rendering
     include_once "./Services/UIComponent/classes/class.ilUIHookProcessor.php";
     $uip = new ilUIHookProcessor("Services/MainMenu", "main_menu_list_entries", array("main_menu_gui" => $this));
     if (!$uip->replaced()) {
         $mmle_tpl = new ilTemplate("tpl.main_menu_list_entries.html", true, true, "Services/MainMenu");
         $mmle_html = $this->renderMainMenuListEntries($mmle_tpl);
     }
     $mmle_html = $uip->getHTML($mmle_html);
     $this->tpl->setVariable("MAIN_MENU_LIST_ENTRIES", $mmle_html);
     $link_dir = defined("ILIAS_MODULE") ? "../" : "";
     if (!$this->small) {
         // login stuff
         if ($_SESSION["AccountId"] == ANONYMOUS_USER_ID) {
             include_once 'Services/Registration/classes/class.ilRegistrationSettingsGUI.php';
             if (ilRegistrationSettings::_lookupRegistrationType() != IL_REG_DISABLED) {
                 $this->tpl->setCurrentBlock("registration_link");
                 $this->tpl->setVariable("TXT_REGISTER", $lng->txt("register"));
                 $this->tpl->setVariable("LINK_REGISTER", $link_dir . "register.php?client_id=" . rawurlencode(CLIENT_ID) . "&lang=" . $ilias->account->getCurrentLanguage());
                 $this->tpl->parseCurrentBlock();
             }
             // language selection
             $selection = self::getLanguageSelection();
             if ($selection) {
                 $this->tpl->setVariable("LANG_SELECT", $selection);
             }
             $this->tpl->setCurrentBlock("userisanonymous");
             $this->tpl->setVariable("TXT_NOT_LOGGED_IN", $lng->txt("not_logged_in"));
             $this->tpl->setVariable("TXT_LOGIN", $lng->txt("log_in"));
             $target_str = "";
             if ($this->getLoginTargetPar() != "") {
                 $target_str = $this->getLoginTargetPar();
             } else {
                 if ($_GET["ref_id"] != "") {
                     if ($tree->isInTree($_GET["ref_id"]) && $_GET["ref_id"] != $tree->getRootId()) {
                         $obj_id = ilObject::_lookupObjId($_GET["ref_id"]);
                         $type = ilObject::_lookupType($obj_id);
                         $target_str = $type . "_" . $_GET["ref_id"];
                     }
                 }
             }
             $this->tpl->setVariable("LINK_LOGIN", $link_dir . "login.php?target=" . $target_str . "&client_id=" . rawurlencode(CLIENT_ID) . "&cmd=force_login&lang=" . $ilias->account->getCurrentLanguage());
             $this->tpl->parseCurrentBlock();
         } else {
             $notificationSettings = new ilSetting('notifications');
             $chatSettings = new ilSetting('chatroom');
             /**
              * @var $tpl ilTemplate
              */
             global $tpl;
             if ($chatSettings->get('chat_enabled') && $notificationSettings->get('enable_osd')) {
                 $this->tpl->touchBlock('osd_enabled');
                 $this->tpl->touchBlock('osd_container');
                 include_once "Services/jQuery/classes/class.iljQueryUtil.php";
                 iljQueryUtil::initjQuery();
                 include_once 'Services/MediaObjects/classes/class.ilPlayerUtil.php';
                 ilPlayerUtil::initMediaElementJs();
                 $tpl->addJavaScript('Services/Notifications/templates/default/notifications.js');
                 $tpl->addCSS('Services/Notifications/templates/default/osd.css');
                 require_once 'Services/Notifications/classes/class.ilNotificationOSDHandler.php';
                 $notifications = ilNotificationOSDHandler::getNotificationsForUser($ilUser->getId());
                 $this->tpl->setVariable('INITIAL_NOTIFICATIONS', json_encode($notifications));
                 $this->tpl->setVariable('OSD_POLLING_INTERVALL', $notificationSettings->get('osd_polling_intervall') ? $notificationSettings->get('osd_polling_intervall') : '5');
                 $this->tpl->setVariable('OSD_PLAY_SOUND', $chatSettings->get('play_invitation_sound') ? 'true' : 'false');
                 foreach ($notifications as $notification) {
                     if ($notification['type'] == 'osd_maint') {
                         continue;
                     }
                     $this->tpl->setCurrentBlock('osd_notification_item');
                     $this->tpl->setVariable('NOTIFICATION_ICON_PATH', $notification['data']->iconPath);
                     $this->tpl->setVariable('NOTIFICATION_TITLE', $notification['data']->title);
                     $this->tpl->setVariable('NOTIFICATION_LINK', $notification['data']->link);
                     $this->tpl->setVariable('NOTIFICATION_LINKTARGET', $notification['data']->linktarget);
                     $this->tpl->setVariable('NOTIFICATION_ID', $notification['notification_osd_id']);
                     $this->tpl->setVariable('NOTIFICATION_SHORT_DESCRIPTION', $notification['data']->shortDescription);
                     $this->tpl->parseCurrentBlock();
                 }
             }
             $this->tpl->setCurrentBlock("userisloggedin");
             $this->tpl->setVariable("TXT_LOGIN_AS", $lng->txt("login_as"));
             $this->tpl->setVariable("TXT_LOGOUT2", $lng->txt("logout"));
             $this->tpl->setVariable("LINK_LOGOUT2", $link_dir . "logout.php?lang=" . $ilias->account->getCurrentLanguage());
             $this->tpl->setVariable("USERNAME", $ilias->account->getFullname());
             $this->tpl->parseCurrentBlock();
         }
         include_once "./Modules/SystemFolder/classes/class.ilObjSystemFolder.php";
         $header_top_title = ilObjSystemFolder::_getHeaderTitle();
         if (trim($header_top_title) != "" && $this->tpl->blockExists("header_top_title")) {
             $this->tpl->setCurrentBlock("header_top_title");
             $this->tpl->setVariable("TXT_HEADER_TITLE", $header_top_title);
             $this->tpl->parseCurrentBlock();
         }
         $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
         $this->tpl->setVariable("TXT_LOGOUT", $lng->txt("logout"));
         $this->tpl->setVariable("HEADER_ICON", ilUtil::getImagePath("HeaderIcon.png"));
         $this->tpl->setVariable("HEADER_BG_IMAGE", ilUtil::getImagePath("HeaderBackground.png"));
         include_once "./Modules/SystemFolder/classes/class.ilObjSystemFolder.php";
         // set link to return to desktop, not depending on a specific position in the hierarchy
         //$this->tpl->setVariable("SCRIPT_START", $this->getScriptTarget("start.php"));
     } else {
         $this->tpl->setVariable("HEADER_ICON", ilUtil::getImagePath("HeaderIcon.png"));
     }
     $this->tpl->setVariable("TXT_MAIN_MENU", $lng->txt("main_menu"));
     $this->tpl->parseCurrentBlock();
 }
コード例 #5
0
 /**
  * Get supplying export files
  *
  * @param
  * @return
  */
 static function getSupplyingExportFiles($a_target_dir = ".")
 {
     include_once "./Services/YUI/classes/class.ilYuiUtil.php";
     include_once "./Services/jQuery/classes/class.iljQueryUtil.php";
     include_once "./Services/MediaObjects/classes/class.ilPlayerUtil.php";
     $scripts = array(array("source" => ilYuiUtil::getLocalPath('yahoo/yahoo-min.js'), "target" => $a_target_dir . '/js/yahoo/yahoo-min.js', "type" => "js"), array("source" => ilYuiUtil::getLocalPath('yahoo-dom-event/yahoo-dom-event.js'), "target" => $a_target_dir . '/js/yahoo/yahoo-dom-event.js', "type" => "js"), array("source" => ilYuiUtil::getLocalPath('animation/animation-min.js'), "target" => $a_target_dir . '/js/yahoo/animation-min.js', "type" => "js"), array("source" => './Services/JavaScript/js/Basic.js', "target" => $a_target_dir . '/js/Basic.js', "type" => "js"), array("source" => './Services/Accordion/js/accordion.js', "target" => $a_target_dir . '/js/accordion.js', "type" => "js"), array("source" => './Services/Accordion/css/accordion.css', "target" => $a_target_dir . '/css/accordion.css', "type" => "css"), array("source" => iljQueryUtil::getLocaljQueryPath(), "target" => $a_target_dir . '/js/jquery.js', "type" => "js"), array("source" => iljQueryUtil::getLocalMaphilightPath(), "target" => $a_target_dir . '/js/maphilight.js', "type" => "js"), array("source" => iljQueryUtil::getLocaljQueryUIPath(), "target" => $a_target_dir . '/js/jquery-ui-min.js', "type" => "js"), array("source" => './Services/COPage/js/ilCOPagePres.js', "target" => $a_target_dir . '/js/ilCOPagePres.js', "type" => "js"), array("source" => './Modules/Scorm2004/scripts/questions/pure.js', "target" => $a_target_dir . '/js/pure.js', "type" => "js"), array("source" => './Modules/Scorm2004/scripts/questions/question_handling.js', "target" => $a_target_dir . '/js/question_handling.js', "type" => "js"), array("source" => './Modules/Scorm2004/templates/default/question_handling.css', "target" => $a_target_dir . '/css/question_handling.css', "type" => "css"), array("source" => ilPlayerUtil::getLocalMediaElementJsPath(), "target" => $a_target_dir . "/" . ilPlayerUtil::getLocalMediaElementJsPath(), "type" => "js"), array("source" => ilPlayerUtil::getLocalMediaElementCssPath(), "target" => $a_target_dir . "/" . ilPlayerUtil::getLocalMediaElementCssPath(), "type" => "css"));
     $mathJaxSetting = new ilSetting("MathJax");
     $use_mathjax = $mathJaxSetting->get("enable");
     if ($use_mathjax) {
         $scripts[] = array("source" => "", "target" => $mathJaxSetting->get("path_to_mathjax"), "type" => "js");
     }
     return $scripts;
 }
コード例 #6
0
 /**
  * display content of page
  */
 function showPage()
 {
     global $tree, $ilUser, $lng, $ilCtrl, $ilSetting, $ilTabs;
     // jquery and jquery ui are always provided for components
     include_once "./Services/jQuery/classes/class.iljQueryUtil.php";
     iljQueryUtil::initjQuery();
     iljQueryUtil::initjQueryUI();
     //		$this->initSelfAssessmentRendering();
     include_once "./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php";
     ilObjMediaObjectGUI::includePresentationJS($GLOBALS["tpl"]);
     $GLOBALS["tpl"]->addJavaScript("./Services/COPage/js/ilCOPagePres.js");
     // needed for overlays in iim
     include_once "./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php";
     ilOverlayGUI::initJavascript();
     include_once "./Services/MediaObjects/classes/class.ilPlayerUtil.php";
     ilPlayerUtil::initMediaElementJs($GLOBALS["tpl"]);
     // init template
     //if($this->outputToTemplate())
     //{
     if ($this->getOutputMode() == "edit") {
         //echo ":".$this->getTemplateTargetVar().":";
         $tpl = new ilTemplate("tpl.page_edit_wysiwyg.html", true, true, "Services/COPage");
         //$this->tpl->addBlockFile($this->getTemplateTargetVar(), "adm_content", "tpl.page_edit_wysiwyg.html", "Services/COPage");
         // to do: status dependent class
         $tpl->setVariable("CLASS_PAGE_TD", "ilc_Page");
         // user comment
         if ($this->isEnabledChangeComments()) {
             $tpl->setCurrentBlock("change_comment");
             $tpl->setVariable("TXT_ADD_COMMENT", $this->lng->txt("cont_add_change_comment"));
             $tpl->parseCurrentBlock();
         }
         $tpl->setVariable("WYSIWYG_ACTION", $ilCtrl->getFormActionByClass("ilpageeditorgui", "", "", true));
         // determine media, html and javascript mode
         $sel_media_mode = $ilUser->getPref("ilPageEditor_MediaMode") == "disable" ? "disable" : "enable";
         $sel_html_mode = $ilUser->getPref("ilPageEditor_HTMLMode") == "disable" ? "disable" : "enable";
         $sel_js_mode = "disable";
         //if($ilSetting->get("enable_js_edit", 1))
         //{
         $sel_js_mode = ilPageEditorGUI::_doJSEditing() ? "enable" : "disable";
         //}
         // show prepending html
         $tpl->setVariable("PREPENDING_HTML", $this->getPrependingHtml());
         $tpl->setVariable("TXT_CONFIRM_DELETE", $lng->txt("cont_confirm_delete"));
         // presentation view
         if ($this->getViewPageLink() != "") {
             $ilTabs->addNonTabbedLink("pres_view", $this->lng->txt("cont_presentation_view"), $this->getViewPageLink(), $this->getViewPageTarget());
         }
         // show actions drop down
         $this->addActionsMenu($tpl, $sel_media_mode, $sel_html_mode, $sel_js_mode);
         // get js files for JS enabled editing
         if ($sel_js_mode == "enable") {
             $this->insertHelp($tpl);
             include_once "./Services/YUI/classes/class.ilYuiUtil.php";
             ilYuiUtil::initDragDrop();
             ilYuiUtil::initConnection();
             ilYuiUtil::initPanel(false);
             $GLOBALS["tpl"]->addJavaScript("./Services/COPage/js/ilcopagecallback.js");
             $GLOBALS["tpl"]->addJavascript("Services/COPage/js/page_editing.js");
             include_once './Services/Style/classes/class.ilObjStyleSheet.php';
             $GLOBALS["tpl"]->addOnloadCode("var preloader = new Image();\n\t\t\t\t\t\tpreloader.src = './templates/default/images/loader.svg';\n\t\t\t\t\t\tilCOPage.setContentCss('" . ilObjStyleSheet::getContentStylePath((int) $this->getStyleId()) . ", " . ilUtil::getStyleSheetLocation() . ", ./Services/COPage/css/tiny_extra.css" . "')");
             //$GLOBALS["tpl"]->addJavascript("Services/RTE/tiny_mce_3_3_9_2/il_tiny_mce_src.js");
             $GLOBALS["tpl"]->addJavascript("Services/COPage/tiny/4_1_5/tinymce.js");
             $tpl->touchBlock("init_dragging");
             $cfg = $this->getPageConfig();
             $tpl->setVariable("IL_TINY_MENU", self::getTinyMenu($this->getPageObject()->getParentType(), $cfg->getEnableInternalLinks(), $cfg->getEnableWikiLinks(), $cfg->getEnableKeywords(), $this->getStyleId(), true, true, $cfg->getEnableAnchors()));
             // add int link parts
             include_once "./Services/Link/classes/class.ilInternalLinkGUI.php";
             $tpl->setCurrentBlock("int_link_prep");
             $tpl->setVariable("INT_LINK_PREP", ilInternalLinkGUI::getInitHTML($ilCtrl->getLinkTargetByClass(array("ilpageeditorgui", "ilinternallinkgui"), "", false, true, false)));
             $tpl->parseCurrentBlock();
             include_once "./Services/YUI/classes/class.ilYuiUtil.php";
             ilYuiUtil::initConnection();
             $GLOBALS["tpl"]->addJavaScript("./Services/UIComponent/Explorer/js/ilExplorer.js");
         }
         // multiple actions
         $cnt_pcs = $this->getPageObject()->countPageContents();
         if ($cnt_pcs > 1 || $this->getPageObject()->getParentType() != "qpl" && $cnt_pcs > 0) {
             $tpl->setCurrentBlock("multi_actions");
             if ($sel_js_mode == "enable") {
                 $tpl->setVariable("ONCLICK_DE_ACTIVATE_SELECTED", 'onclick="return ilEditMultiAction(\'activateSelected\');"');
                 $tpl->setVariable("ONCLICK_DELETE_SELECTED", 'onclick="return ilEditMultiAction(\'deleteSelected\');"');
                 $tpl->setVariable("ONCLICK_ASSIGN_CHARACTERISTIC", 'onclick="return ilEditMultiAction(\'assignCharacteristicForm\');"');
                 $tpl->setVariable("ONCLICK_COPY_SELECTED", 'onclick="return ilEditMultiAction(\'copySelected\');"');
                 $tpl->setVariable("ONCLICK_CUT_SELECTED", 'onclick="return ilEditMultiAction(\'cutSelected\');"');
                 $tpl->setVariable("TXT_SELECT_ALL", $this->lng->txt("select_all"));
                 $tpl->setVariable("ONCLICK_SELECT_ALL", 'onclick="return ilEditMultiAction(\'selectAll\');"');
             }
             $tpl->setVariable("TXT_DE_ACTIVATE_SELECTED", $this->lng->txt("cont_ed_enable"));
             $tpl->setVariable("TXT_ASSIGN_CHARACTERISTIC", $this->lng->txt("cont_assign_characteristic"));
             $tpl->setVariable("TXT_DELETE_SELECTED", $this->lng->txt("cont_delete_selected"));
             $tpl->setVariable("TXT_COPY_SELECTED", $this->lng->txt("copy"));
             $tpl->setVariable("TXT_CUT_SELECTED", $this->lng->txt("cut"));
             $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
             $tpl->parseCurrentBlock();
         }
     } else {
         // presentation or preview here
         $tpl = new ilTemplate("tpl.page.html", true, true, "Services/COPage");
         if ($this->getEnabledPageFocus()) {
             $tpl->touchBlock("page_focus");
         }
         include_once "./Services/User/classes/class.ilUserUtil.php";
         // presentation
         if ($this->isPageContainerToBeRendered()) {
             $tpl->touchBlock("page_container_1");
             $tpl->touchBlock("page_container_2");
             $tpl->touchBlock("page_container_3");
         }
         // history
         $c_old_nr = $this->getPageObject()->old_nr;
         if ($c_old_nr > 0 || $this->getCompareMode() || $_GET["history_mode"] == 1) {
             $hist_info = $this->getPageObject()->getHistoryInfo($c_old_nr);
             if (!$this->getCompareMode()) {
                 $ilCtrl->setParameter($this, "history_mode", "1");
                 // previous revision
                 if (is_array($hist_info["previous"])) {
                     $tpl->setCurrentBlock("previous_rev");
                     $tpl->setVariable("TXT_PREV_REV", $lng->txt("cont_previous_rev"));
                     $ilCtrl->setParameter($this, "old_nr", $hist_info["previous"]["nr"]);
                     $tpl->setVariable("HREF_PREV", $ilCtrl->getLinkTarget($this, "preview"));
                     $tpl->parseCurrentBlock();
                 } else {
                     $tpl->setCurrentBlock("previous_rev_disabled");
                     $tpl->setVariable("TXT_PREV_REV", $lng->txt("cont_previous_rev"));
                     $tpl->parseCurrentBlock();
                 }
                 // next revision
                 if ($c_old_nr > 0) {
                     $tpl->setCurrentBlock("next_rev");
                     $tpl->setVariable("TXT_NEXT_REV", $lng->txt("cont_next_rev"));
                     $ilCtrl->setParameter($this, "old_nr", $hist_info["next"]["nr"]);
                     $tpl->setVariable("HREF_NEXT", $ilCtrl->getLinkTarget($this, "preview"));
                     $tpl->parseCurrentBlock();
                     // latest revision
                     $tpl->setCurrentBlock("latest_rev");
                     $tpl->setVariable("TXT_LATEST_REV", $lng->txt("cont_latest_rev"));
                     $ilCtrl->setParameter($this, "old_nr", "");
                     $tpl->setVariable("HREF_LATEST", $ilCtrl->getLinkTarget($this, "preview"));
                     $tpl->parseCurrentBlock();
                 }
                 $ilCtrl->setParameter($this, "history_mode", "");
                 // rollback
                 if ($c_old_nr > 0 && $ilUser->getId() != ANONYMOUS_USER_ID) {
                     $tpl->setCurrentBlock("rollback");
                     $ilCtrl->setParameter($this, "old_nr", $c_old_nr);
                     $tpl->setVariable("HREF_ROLLBACK", $ilCtrl->getLinkTarget($this, "rollbackConfirmation"));
                     $ilCtrl->setParameter($this, "old_nr", "");
                     $tpl->setVariable("TXT_ROLLBACK", $lng->txt("cont_rollback"));
                     $tpl->parseCurrentBlock();
                 }
             }
             $tpl->setCurrentBlock("hist_nav");
             $tpl->setVariable("TXT_REVISION", $lng->txt("cont_revision"));
             $tpl->setVariable("VAL_REVISION_DATE", ilDatePresentation::formatDate(new ilDateTime($hist_info["current"]["hdate"], IL_CAL_DATETIME)));
             $tpl->setVariable("VAL_REV_USER", ilUserUtil::getNamePresentation($hist_info["current"]["user_id"]));
             $tpl->parseCurrentBlock();
         }
     }
     if ($this->getOutputMode() != IL_PAGE_PRESENTATION && $this->getOutputMode() != IL_PAGE_OFFLINE && $this->getOutputMode() != IL_PAGE_PREVIEW && $this->getOutputMode() != IL_PAGE_PRINT) {
         $tpl->setVariable("FORMACTION", $this->ctrl->getFormActionByClass("ilpageeditorgui"));
     }
     // output media object edit list (of media links)
     if ($this->getOutputMode() == "edit") {
         $links = ilInternalLink::_getTargetsOfSource($this->obj->getParentType() . ":pg", $this->obj->getId(), $this->obj->getLanguage());
         $mob_links = array();
         foreach ($links as $link) {
             if ($link["type"] == "mob") {
                 if (ilObject::_exists($link["id"]) && ilObject::_lookupType($link["id"]) == "mob") {
                     $mob_links[$link["id"]] = ilObject::_lookupTitle($link["id"]) . " [" . $link["id"] . "]";
                 }
             }
         }
         // linked media objects
         if (count($mob_links) > 0) {
             $tpl->setCurrentBlock("med_link");
             $tpl->setVariable("TXT_LINKED_MOBS", $this->lng->txt("cont_linked_mobs"));
             $tpl->setVariable("SEL_MED_LINKS", ilUtil::formSelect(0, "mob_id", $mob_links, false, true));
             $tpl->setVariable("TXT_EDIT_MEDIA", $this->lng->txt("cont_edit_mob"));
             $tpl->setVariable("TXT_COPY_TO_CLIPBOARD", $this->lng->txt("cont_copy_to_clipboard"));
             //$this->tpl->setVariable("TXT_COPY_TO_POOL", $this->lng->txt("cont_copy_to_mediapool"));
             $tpl->parseCurrentBlock();
         }
         // content snippets used
         include_once "./Services/COPage/classes/class.ilPCContentInclude.php";
         $snippets = ilPCContentInclude::collectContentIncludes($this->getPageObject(), $this->getPageObject()->getDomDoc());
         if (count($snippets) > 0) {
             foreach ($snippets as $s) {
                 include_once "./Modules/MediaPool/classes/class.ilMediaPoolPage.php";
                 $sn_arr[$s["id"]] = ilMediaPoolPage::lookupTitle($s["id"]);
             }
             $tpl->setCurrentBlock("med_link");
             $tpl->setVariable("TXT_CONTENT_SNIPPETS_USED", $this->lng->txt("cont_snippets_used"));
             $tpl->setVariable("SEL_SNIPPETS", ilUtil::formSelect(0, "ci_id", $sn_arr, false, true));
             $tpl->setVariable("TXT_SHOW_INFO", $this->lng->txt("cont_show_info"));
             $tpl->parseCurrentBlock();
         }
         // scheduled activation?
         if (!$this->getPageObject()->getActive() && $this->getPageObject()->getActivationStart() != "" && $this->getPageConfig()->getEnableScheduledActivation()) {
             $tpl->setCurrentBlock("activation_txt");
             $tpl->setVariable("TXT_SCHEDULED_ACTIVATION", $lng->txt("cont_scheduled_activation"));
             $tpl->setVariable("SA_FROM", ilDatePresentation::formatDate(new ilDateTime($this->getPageObject()->getActivationStart(), IL_CAL_DATETIME)));
             $tpl->setVariable("SA_TO", ilDatePresentation::formatDate(new ilDateTime($this->getPageObject()->getActivationEnd(), IL_CAL_DATETIME)));
             $tpl->parseCurrentBlock();
         }
     }
     if ($_GET["reloadTree"] == "y") {
         $tpl->setCurrentBlock("reload_tree");
         if ($this->obj->getParentType() == "dbk") {
             $tpl->setVariable("LINK_TREE", $this->ctrl->getLinkTargetByClass("ilobjdlbookgui", "explorer", "", false, false));
         } else {
             $tpl->setVariable("LINK_TREE", $this->ctrl->getLinkTargetByClass("ilobjlearningmodulegui", "explorer", "", false, false));
         }
         $tpl->parseCurrentBlock();
     }
     //		}
     // get content
     $builded = $this->obj->buildDom();
     // manage hierarchical ids
     if ($this->getOutputMode() == "edit") {
         // add pc ids, if necessary
         if (!$this->obj->checkPCIds()) {
             $this->obj->insertPCIds();
             $this->obj->update(true, true);
         }
         $this->obj->addFileSizes();
         $this->obj->addHierIDs();
         $hids = $this->obj->getHierIds();
         $row1_ids = $this->obj->getFirstRowIds();
         $col1_ids = $this->obj->getFirstColumnIds();
         $litem_ids = $this->obj->getListItemIds();
         $fitem_ids = $this->obj->getFileItemIds();
         // standard menues
         $hids = $this->obj->getHierIds();
         foreach ($hids as $hid) {
             $tpl->setCurrentBlock("add_dhtml");
             $tpl->setVariable("CONTEXTMENU", "contextmenu_" . $hid);
             $tpl->parseCurrentBlock();
         }
         // column menues for tables
         foreach ($col1_ids as $hid) {
             $tpl->setCurrentBlock("add_dhtml");
             $tpl->setVariable("CONTEXTMENU", "contextmenu_r" . $hid);
             $tpl->parseCurrentBlock();
         }
         // row menues for tables
         foreach ($row1_ids as $hid) {
             $tpl->setCurrentBlock("add_dhtml");
             $tpl->setVariable("CONTEXTMENU", "contextmenu_c" . $hid);
             $tpl->parseCurrentBlock();
         }
         // list item menues
         foreach ($litem_ids as $hid) {
             $tpl->setCurrentBlock("add_dhtml");
             $tpl->setVariable("CONTEXTMENU", "contextmenu_i" . $hid);
             $tpl->parseCurrentBlock();
         }
         // file item menues
         foreach ($fitem_ids as $hid) {
             $tpl->setCurrentBlock("add_dhtml");
             $tpl->setVariable("CONTEXTMENU", "contextmenu_i" . $hid);
             $tpl->parseCurrentBlock();
         }
     } else {
         $this->obj->addFileSizes();
     }
     //echo "<br>-".htmlentities($this->obj->getXMLContent())."-<br><br>";
     //echo "<br>-".htmlentities($this->getLinkXML())."-";
     // set default link xml, if nothing was set yet
     if (!$this->link_xml_set) {
         $this->setDefaultLinkXml();
     }
     //$content = $this->obj->getXMLFromDom(false, true, true,
     //	$this->getLinkXML().$this->getQuestionXML().$this->getComponentPluginsXML());
     $link_xml = $this->getLinkXML();
     // disable/enable auto margins
     if ($this->getStyleId() > 0) {
         if (ilObject::_lookupType($this->getStyleId()) == "sty") {
             include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
             $style = new ilObjStyleSheet($this->getStyleId());
             $template_xml = $style->getTemplateXML();
             $disable_auto_margins = "n";
             if ($style->lookupStyleSetting("disable_auto_margins")) {
                 $disable_auto_margins = "y";
             }
         }
     }
     if ($this->getAbstractOnly()) {
         $content = "<dummy><PageObject><PageContent><Paragraph>" . $this->obj->getFirstParagraphText() . $link_xml . "</Paragraph></PageContent></PageObject></dummy>";
     } else {
         $content = $this->obj->getXMLFromDom(false, true, true, $link_xml . $this->getQuestionXML() . $template_xml . $this->getComponentPluginsXML());
     }
     // check validation errors
     if ($builded !== true) {
         $this->displayValidationError($builded);
     } else {
         $this->displayValidationError($_SESSION["il_pg_error"]);
     }
     unset($_SESSION["il_pg_error"]);
     if (isset($_SESSION["citation_error"])) {
         ilUtil::sendFailure($this->lng->txt("cont_citation_selection_not_valid"));
         ilSession::clear("citation_error");
     }
     // get title
     $pg_title = $this->getPresentationTitle();
     $col_path = ilUtil::getImagePath("col.svg");
     $row_path = ilUtil::getImagePath("row.svg");
     $item_path = ilUtil::getImagePath("item.svg");
     if ($this->getOutputMode() != "offline") {
         $enlarge_path = ilUtil::getImagePath("enlarge.svg");
         $wb_path = ilUtil::getWebspaceDir("output") . "/";
     } else {
         $enlarge_path = "images/enlarge.svg";
         $wb_path = "";
     }
     $pg_title_class = $this->getOutputMode() == "print" ? "ilc_PrintPageTitle" : "";
     // page splitting only for learning modules and
     // digital books
     $enable_split_new = $this->obj->getParentType() == "lm" || $this->obj->getParentType() == "dbk" ? "y" : "n";
     // page splitting to next page only for learning modules and
     // digital books if next page exists in tree
     if (($this->obj->getParentType() == "lm" || $this->obj->getParentType() == "dbk") && ilObjContentObject::hasSuccessorPage($this->obj->getParentId(), $this->obj->getId())) {
         $enable_split_next = "y";
     } else {
         $enable_split_next = "n";
     }
     $img_path = ilUtil::getImagePath("", false, $this->getOutputMode(), $this->getOutputMode() == "offline");
     if ($this->getPageConfig()->getEnablePCType("Tabs")) {
         //include_once("./Services/YUI/classes/class.ilYuiUtil.php");
         //ilYuiUtil::initTabView();
         include_once "./Services/Accordion/classes/class.ilAccordionGUI.php";
         ilAccordionGUI::addJavaScript();
         ilAccordionGUI::addCss();
     }
     $file_download_link = $this->determineFileDownloadLink();
     $fullscreen_link = $this->determineFullscreenLink();
     $this->sourcecode_download_script = $this->determineSourcecodeDownloadScript();
     // default values for various parameters (should be used by
     // all instances in the future)
     $media_mode = $this->getOutputMode() == "edit" ? $ilUser->getPref("ilPageEditor_MediaMode") : "enable";
     include_once "./Modules/LearningModule/classes/class.ilEditClipboard.php";
     $paste = ilEditClipboard::getAction() == "copy" && $this->getOutputMode() == "edit";
     include_once "./Services/MediaObjects/classes/class.ilPlayerUtil.php";
     $flv_video_player = $this->getOutputMode() != "offline" ? ilPlayerUtil::getFlashVideoPlayerFilename(true) : ilPlayerUtil::getFlashVideoPlayerFilename(true);
     $cfg = $this->getPageConfig();
     // added UTF-8 encoding otherwise umlaute are converted too
     include_once "./Services/Maps/classes/class.ilMapUtil.php";
     $params = array('mode' => $this->getOutputMode(), 'pg_title' => htmlentities($pg_title, ENT_QUOTES, "UTF-8"), 'enable_placeholder' => $cfg->getEnablePCType("PlaceHolder") ? "y" : "n", 'pg_id' => $this->obj->getId(), 'pg_title_class' => $pg_title_class, 'webspace_path' => $wb_path, 'enlarge_path' => $enlarge_path, 'img_col' => $col_path, 'img_row' => $row_path, 'img_item' => $item_path, 'enable_split_new' => $enable_split_new, 'enable_split_next' => $enable_split_next, 'link_params' => $this->link_params, 'file_download_link' => $file_download_link, 'fullscreen_link' => $fullscreen_link, 'img_path' => $img_path, 'parent_id' => $this->obj->getParentId(), 'download_script' => $this->sourcecode_download_script, 'encoded_download_script' => urlencode($this->sourcecode_download_script), 'bib_id' => $this->getBibId(), 'citation' => (int) $this->isEnabledCitation(), 'pagebreak' => $this->lng->txt('dgl_pagebreak'), 'page' => $this->lng->txt('page'), 'citate_page' => $this->lng->txt('citate_page'), 'citate_from' => $this->lng->txt('citate_from'), 'citate_to' => $this->lng->txt('citate_to'), 'citate' => $this->lng->txt('citate'), 'enable_rep_objects' => $cfg->getEnablePCType("Resources") ? "y" : "n", 'enable_login_page' => $cfg->getEnablePCType("LoginPageElement") ? "y" : "n", 'enable_map' => $cfg->getEnablePCType("Map") && ilMapUtil::isActivated() ? "y" : "n", 'enable_tabs' => $cfg->getEnablePCType("Tabs") ? "y" : "n", 'enable_sa_qst' => $cfg->getEnableSelfAssessment() ? "y" : "n", 'enable_file_list' => $cfg->getEnablePCType("FileList") ? "y" : "n", 'enable_content_includes' => $cfg->getEnablePCType("ContentInclude") ? "y" : "n", 'enable_content_templates' => count($this->getPageObject()->getContentTemplates()) > 0 ? "y" : "n", 'paste' => $paste ? "y" : "n", 'media_mode' => $media_mode, 'javascript' => $sel_js_mode, 'paragraph_plugins' => $paragraph_plugin_string, 'disable_auto_margins' => $disable_auto_margins, 'page_toc' => $cfg->getEnablePageToc() ? "y" : "n", 'enable_profile' => $cfg->getEnablePCType("Profile") ? "y" : "n", 'enable_verification' => $cfg->getEnablePCType("Verification") ? "y" : "n", 'enable_blog' => $cfg->getEnablePCType("Blog") ? "y" : "n", 'enable_skills' => $cfg->getEnablePCType("Skills") ? "y" : "n", 'enable_qover' => $cfg->getEnablePCType("QuestionOverview") ? "y" : "n", 'enable_consultation_hours' => $cfg->getEnablePCType("ConsultationHours") ? "y" : "n", 'enable_my_courses' => $cfg->getEnablePCType("MyCourses") ? "y" : "n", 'enable_amd_page_list' => $cfg->getEnablePCType("AMDPageList") ? "y" : "n", 'flv_video_player' => $flv_video_player);
     if ($this->link_frame != "") {
         // todo other link types
         $params["pg_frame"] = $this->link_frame;
     }
     //$content = str_replace("&nbsp;", "", $content);
     // this ensures that cache is emptied with every update
     $params["version"] = ILIAS_VERSION;
     // ensure no cache hit, if included files/media objects have been changed
     $params["incl_elements_date"] = $this->obj->getLastUpdateOfIncludedElements();
     // run xslt
     $md5 = md5(serialize($params) . $link_xml . $template_xml);
     //$a = microtime();
     // check cache (same parameters, non-edit mode and rendered time
     // > last change
     if (($this->getOutputMode() == "preview" || $this->getOutputMode() == "presentation") && !$this->getCompareMode() && !$this->getAbstractOnly() && $md5 == $this->obj->getRenderMd5() && $this->obj->getLastChange() < $this->obj->getRenderedTime() && $this->obj->getRenderedTime() != "" && $this->obj->old_nr == 0) {
         // cache hit
         $output = $this->obj->getRenderedContent();
     } else {
         $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
         $args = array('/_xml' => $content, '/_xsl' => $xsl);
         $xh = xslt_create();
         //		echo "<b>XSLT</b>:".htmlentities($xsl).":<br>";
         //		echo "mode:".$this->getOutputMode().":<br>";
         $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args, $params);
         if (($this->getOutputMode() == "presentation" || $this->getOutputMode() == "preview") && !$this->getAbstractOnly() && $this->obj->old_nr == 0) {
             //echo "writerenderedcontent";
             $this->obj->writeRenderedContent($output, $md5);
         }
         //echo xslt_error($xh);
         xslt_free($xh);
     }
     //$b = microtime();
     //echo "$a - $b";
     //echo "<pre>".htmlentities($output)."</pre>";
     // unmask user html
     if (($this->getOutputMode() != "edit" || $ilUser->getPref("ilPageEditor_HTMLMode") != "disable") && !$this->getPageConfig()->getPreventHTMLUnmasking()) {
         $output = str_replace("&lt;", "<", $output);
         $output = str_replace("&gt;", ">", $output);
     }
     $output = str_replace("&amp;", "&", $output);
     $output = ilUtil::insertLatexImages($output);
     // insert page snippets
     $output = $this->insertContentIncludes($output);
     // insert resource blocks
     $output = $this->insertResources($output);
     // insert page toc
     if ($this->getPageConfig()->getEnablePageToc()) {
         $output = $this->insertPageToc($output);
     }
     // insert advanced output trigger
     $output = $this->insertAdvTrigger($output);
     // workaround for preventing template engine
     // from hiding paragraph text that is enclosed
     // in curly brackets (e.g. "{a}", see ilLMEditorGUI::executeCommand())
     $output = $this->replaceCurlyBrackets($output);
     // remove all newlines (important for code / pre output)
     $output = str_replace("\n", "", $output);
     //echo htmlentities($output);
     $output = $this->postOutputProcessing($output);
     //echo htmlentities($output);
     if ($this->getOutputMode() == "edit" && !$this->getPageObject()->getActive($this->getPageConfig()->getEnableScheduledActivation())) {
         $output = '<div class="il_editarea_disabled">' . $output . '</div>';
     }
     // for all page components...
     include_once "./Services/COPage/classes/class.ilCOPagePCDef.php";
     $defs = ilCOPagePCDef::getPCDefinitions();
     foreach ($defs as $def) {
         ilCOPagePCDef::requirePCClassByName($def["name"]);
         $pc_class = $def["pc_class"];
         $pc_obj = new $pc_class($this->getPageObject());
         // post xsl page content modification by pc elements
         $output = $pc_obj->modifyPageContentPostXsl($output, $this->getOutputMode());
         // javascript files
         $js_files = $pc_obj->getJavascriptFiles($this->getOutputMode());
         foreach ($js_files as $js) {
             $GLOBALS["tpl"]->addJavascript($js);
         }
         // css files
         $css_files = $pc_obj->getCssFiles($this->getOutputMode());
         foreach ($css_files as $css) {
             $GLOBALS["tpl"]->addCss($css);
         }
         // onload code
         $onload_code = $pc_obj->getOnloadCode($this->getOutputMode());
         foreach ($onload_code as $code) {
             $GLOBALS["tpl"]->addOnloadCode($code);
         }
     }
     //		$output = $this->selfAssessmentRendering($output);
     // output
     if ($ilCtrl->isAsynch() && !$this->getRawPageContent() && $this->getOutputMode() == "edit") {
         // e.g. ###3:110dad8bad6df8620071a0a693a2d328###
         if ($_GET["updated_pc_id_str"] != "") {
             echo $_GET["updated_pc_id_str"];
         }
         $tpl->setVariable($this->getTemplateOutputVar(), $output);
         $tpl->setCurrentBlock("edit_page");
         $tpl->parseCurrentBlock();
         echo $tpl->get("edit_page");
         exit;
     }
     if ($this->outputToTemplate()) {
         $tpl->setVariable($this->getTemplateOutputVar(), $output);
         $this->tpl->setVariable($this->getTemplateTargetVar(), $tpl->get());
         return $output;
     } else {
         if ($this->getRawPageContent()) {
             return $output;
         } else {
             $tpl->setVariable($this->getTemplateOutputVar(), $output);
             return $tpl->get();
         }
     }
 }
 /**
  * Prepare HTML exporter
  *
  * @param
  * @return
  */
 function prepareHTMLExporter($a_target_dir)
 {
     // system style html exporter
     include_once "./Services/Style/classes/class.ilSystemStyleHTMLExport.php";
     $this->sys_style_html_export = new ilSystemStyleHTMLExport($a_target_dir);
     $this->sys_style_html_export->export();
     // init co page html exporter
     include_once "./Services/COPage/classes/class.ilCOPageHTMLExport.php";
     $this->co_page_html_export = new ilCOPageHTMLExport($a_target_dir);
     $this->co_page_html_export->setContentStyleId($this->getStyleSheetId());
     $this->co_page_html_export->createDirectories();
     $this->co_page_html_export->exportStyles();
     $this->co_page_html_export->exportSupportScripts();
     include_once "./Services/MediaObjects/classes/class.ilPlayerUtil.php";
     $this->flv_dir = $a_target_dir . "/" . ilPlayerUtil::getFlashVideoPlayerDirectory();
     ilUtil::makeDir($a_target_dir . '/css/yahoo');
     ilUtil::makeDir($a_target_dir . '/objects');
     ilUtil::makeDir($a_target_dir . '/players');
     ilUtil::makeDir($this->flv_dir);
     include_once "./Services/MediaObjects/classes/class.ilPlayerUtil.php";
     //		copy(ilPlayerUtil::getFlashVideoPlayerFilename(true),
     //			$a_target_dir.'/js/'.ilPlayerUtil::getFlashVideoPlayerFilename());
     ilPlayerUtil::copyPlayerFilesToTargetDirectory($this->flv_dir);
     copy('./Services/MediaObjects/flash_mp3_player/mp3player.swf', $a_target_dir . '/players/mp3player.swf');
     copy('./Modules/Scorm2004/scripts/scorm_2004.js', $a_target_dir . '/js/scorm.js');
     copy('./Modules/Scorm2004/scripts/pager.js', $a_target_dir . '/js/pager.js');
     copy('./Modules/Scorm2004/scripts/questions/pure.js', $a_target_dir . '/js/pure.js');
     copy('./Modules/Scorm2004/scripts/questions/question_handling.js', $a_target_dir . '/js/question_handling.js');
 }
コード例 #8
0
 /**
  * Get Html for MP3 Player
  */
 function getMp3PlayerHtml($a_preview = false)
 {
     global $tpl, $lng;
     include_once "./Services/YUI/classes/class.ilYuiUtil.php";
     ilYuiUtil::initConnection();
     $tpl->addJavascript("./Services/MediaObjects/js/MediaObjects.js");
     if (!self::$lightbox_initialized && $a_preview) {
         include_once "./Services/UIComponent/Lightbox/classes/class.ilLightboxGUI.php";
         $lb = new ilLightboxGUI("media_lightbox");
         $lb->setWidth("660px");
         $lb->addLightbox();
         self::$lightbox_initialized = true;
     }
     require_once 'Services/MediaObjects/classes/class.ilObjMediaObject.php';
     include_once "./Services/MediaObjects/classes/class.ilExternalMediaAnalyzer.php";
     // youtube
     /*		if (ilExternalMediaAnalyzer::isYouTube($this->getFile()))
     		{
     			$p = ilExternalMediaAnalyzer::extractYouTubeParameters($this->getFile());
     			$html = '<object width="320" height="240">'.
     				'<param name="movie" value="http://www.youtube.com/v/'.$p["v"].'?fs=1">'.
     				'</param><param name="allowFullScreen" value="true"></param>'.
     				'<param name="allowscriptaccess" value="always">'.
     				'</param><embed src="http://www.youtube.com/v/'.$p["v"].'?fs=1" '.
     				'type="application/x-shockwave-flash" allowscriptaccess="always" '.
     				'allowfullscreen="true" width="320" height="240"></embed></object>';
     			return $html;
     		}
     
     		// vimeo
     		if (ilExternalMediaAnalyzer::isVimeo($this->getFile()))
     		{
     			$p = ilExternalMediaAnalyzer::extractVimeoParameters($this->getFile());
     
     			$html = '<iframe src="http://player.vimeo.com/video/'.$p["id"].'" width="320" height="240" '.
     				'frameborder="0"></iframe>';
     
     			return $html;
     		}
     */
     $mimeType = $this->mimeType == "" ? ilObjMediaObject::getMimeType(basename($this->getFile())) : $this->mimeType;
     include_once "./Services/MediaObjects/classes/class.ilPlayerUtil.php";
     // video tag
     if (in_array($mimeType, array("video/mp4", "video/m4v", "video/rtmp", "video/x-flv", "video/webm", "video/youtube", "video/vimeo", "video/ogg"))) {
         ilPlayerUtil::initMediaElementJs();
         if ($mimeType == "video/quicktime") {
             $mimeType = "video/mov";
         }
         $mp_tpl = new ilTemplate("tpl.flv_player.html", true, true, "Services/MediaObjects");
         // preview
         if ($a_preview) {
             if ($this->getDownloadLink() != "") {
                 $mp_tpl->setCurrentBlock("download");
                 $mp_tpl->setVariable("TXT_DOWNLOAD", $lng->txt("download"));
                 $mp_tpl->setVariable("HREF_DOWNLOAD", $this->getDownloadLink());
                 $mp_tpl->parseCurrentBlock();
             }
             $mp_tpl->setCurrentBlock("preview");
             if ($this->getVideoPreviewPic() != "") {
                 $mp_tpl->setVariable("IMG_SRC", $this->getVideoPreviewPic());
             } else {
                 $mp_tpl->setVariable("IMG_SRC", ilUtil::getImagePath("mcst_preview.svg"));
             }
             $mp_tpl->setVariable("IMG_ALT", $this->video_preview_pic_alt);
             $mp_tpl->setVariable("PTITLE", $this->getTitle());
             $mp_tpl->parseCurrentBlock();
         }
         // sources
         $mp_tpl->setCurrentBlock("source");
         $mp_tpl->setVariable("FILE", $this->getFile());
         $mp_tpl->setVariable("MIME", $mimeType);
         $mp_tpl->parseCurrentBlock();
         if (in_array($this->getAlternativeVideoMimeType(), array("video/mp4", "video/webm"))) {
             $mp_tpl->setCurrentBlock("source");
             $mp_tpl->setVariable("FILE", $this->getAlternativeVideoFile());
             $mp_tpl->setVariable("MIME", $this->getAlternativeVideoMimeType());
             $mp_tpl->parseCurrentBlock();
         }
         $mp_tpl->setCurrentBlock("mejs_video");
         if ($a_preview) {
             $mp_tpl->setVariable("CLASS", "ilNoDisplay");
         }
         $mp_tpl->setVariable("PLAYER_NR", $this->id . "_" . $this->current_nr);
         $mp_tpl->setVariable("EVENT_URL", $this->event_callback_url);
         $height = $this->getDisplayHeight();
         $width = $this->getDisplayWidth();
         if (is_int(strpos($mimeType, "audio/mpeg"))) {
             $height = "30";
         }
         $mp_tpl->setVariable("DISPLAY_HEIGHT", $height);
         $mp_tpl->setVariable("DISPLAY_WIDTH", $width);
         $mp_tpl->setVariable("PREVIEW_PIC", $this->getVideoPreviewPic());
         $mp_tpl->setVariable("SWF_FILE", ilPlayerUtil::getFlashVideoPlayerFilename(true));
         $mp_tpl->setVariable("FFILE", $this->getFile());
         $mp_tpl->setVariable("TITLE", $this->getTitle());
         $mp_tpl->setVariable("DESCRIPTION", $this->getDescription());
         include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php";
         if ($a_preview) {
             $mp_tpl->setVariable("CLOSE", ilGlyphGUI::get(ilGlyphGUI::CLOSE));
         }
         $mp_tpl->parseCurrentBlock();
         $r = $mp_tpl->get();
         if (!$a_preview) {
             $tpl->addOnLoadCode("new MediaElementPlayer('#player_" . $this->id . "_" . $this->current_nr . "');");
         }
         //echo htmlentities($r);
         return $r;
     }
     // audio/mpeg
     if (is_int(strpos($mimeType, "audio/mpeg")) || in_array($mimeType, array("application/ogg", "audio/ogg"))) {
         ilPlayerUtil::initMediaElementJs();
         $mp_tpl = new ilTemplate("tpl.flv_player.html", true, true, "Services/MediaObjects");
         $preview_output = false;
         if ($this->getVideoPreviewPic() != "" || $this->getForceAudioPreview()) {
             if ($this->getDownloadLink() != "") {
                 $mp_tpl->setCurrentBlock("adownload");
                 $mp_tpl->setVariable("TXT_DOWNLOAD", $lng->txt("download"));
                 $mp_tpl->setVariable("HREF_DOWNLOAD", $this->getDownloadLink());
                 $mp_tpl->parseCurrentBlock();
             }
             $mp_tpl->setCurrentBlock("apreview");
             if ($this->getVideoPreviewPic() != "") {
                 $mp_tpl->setVariable("IMG_SRC", $this->getVideoPreviewPic());
             } else {
                 $mp_tpl->setVariable("IMG_SRC", ilUtil::getImagePath("mcst_preview.svg"));
             }
             $mp_tpl->setVariable("PTITLE", $this->getTitle());
             $mp_tpl->parseCurrentBlock();
             $preview_output = true;
         }
         $mp_tpl->setCurrentBlock("audio");
         if ($preview_output) {
             $mp_tpl->setVariable("ASTYLE", "margin-top:-30px");
         }
         $mp_tpl->setVariable("AFILE", $this->getFile());
         $mp_tpl->setVariable("APLAYER_NR", $this->id . "_" . $this->current_nr);
         $mp_tpl->setVariable("AEVENT_URL", $this->event_callback_url);
         $mp_tpl->setVariable("AHEIGHT", "30");
         $mp_tpl->setVariable("AWIDTH", "320");
         $mp_tpl->parseCurrentBlock();
         return $mp_tpl->get();
     }
     // images
     if (is_int(strpos($mimeType, "image/"))) {
         $mp_tpl = new ilTemplate("tpl.flv_player.html", true, true, "Services/MediaObjects");
         if ($this->getDownloadLink() != "") {
             $mp_tpl->setCurrentBlock("idownload");
             $mp_tpl->setVariable("TXT_DOWNLOAD", $lng->txt("download"));
             $mp_tpl->setVariable("HREF_DOWNLOAD", $this->getDownloadLink());
             $mp_tpl->parseCurrentBlock();
         }
         $mp_tpl->setCurrentBlock("ipreview");
         if ($this->getVideoPreviewPic() != "") {
             $mp_tpl->setVariable("IMG_SRC", $this->getVideoPreviewPic());
         } else {
             $mp_tpl->setVariable("IMG_SRC", $this->getFile());
         }
         $mp_tpl->setVariable("PTITLE", $this->getTitle());
         $mp_tpl->parseCurrentBlock();
         $mp_tpl->setCurrentBlock("image");
         $mp_tpl->setVariable("IFILE", $this->getFile());
         $mp_tpl->setVariable("IPLAYER_NR", $this->id . "_" . $this->current_nr);
         $mp_tpl->setVariable("ITITLE", $this->getTitle());
         $mp_tpl->setVariable("IDESCRIPTION", $this->getDescription());
         include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php";
         $mp_tpl->setVariable("ICLOSE", ilGlyphGUI::get(ilGlyphGUI::CLOSE));
         $height = $this->getDisplayHeight();
         $width = $this->getDisplayWidth();
         $mp_tpl->setVariable("IHEIGHT", $height);
         $mp_tpl->setVariable("IWIDTH", $width);
         $mp_tpl->parseCurrentBlock();
         return $mp_tpl->get();
     }
     // fallback, no preview mode
     $mimeType = $this->mimeType == "" ? ilObjMediaObject::getMimeType(basename($this->getFile())) : $this->mimeType;
     if (strpos($mimeType, "flv") === false && strpos($mimeType, "audio/mpeg") === false && strpos($mimeType, "image/png") === false && strpos($mimeType, "image/gif") === false) {
         $html = '<embed src="' . $this->getFile() . '" ' . 'type="' . $mimeType . '" ' . 'ShowControls="1" ' . 'autoplay="false" autostart="false" ' . 'width="320" height="240" scale="aspect" ></embed>';
         return $html;
     }
     return;
     $tpl->addJavaScript("./Services/MediaObjects/flash_flv_player/swfobject.js");
     $mp_tpl = new ilTemplate("tpl.flv_player.html", true, true, "Services/MediaObjects");
     $mp_tpl->setCurrentBlock("default");
     $mp_tpl->setVariable("FILE", urlencode($this->getFile()));
     $mp_tpl->setVariable("PLAYER_NR", $this->current_nr);
     $mp_tpl->setVariable("DISPLAY_HEIGHT", strpos($mimeType, "audio/mpeg") === false ? "240" : "20");
     $mp_tpl->setVariable("DISPLAY_WIDTH", "320");
     $mp_tpl->parseCurrentBlock();
     return $mp_tpl->get();
 }
コード例 #9
0
 /**
  * Include media object presentation JS
  */
 function includePresentationJS($a_tpl = null)
 {
     global $tpl;
     if ($a_tpl == null) {
         $a_tpl = $tpl;
     }
     include_once "./Services/jQuery/classes/class.iljQueryUtil.php";
     iljQueryUtil::initjQUery($a_tpl);
     include_once "./Services/jQuery/classes/class.iljQueryUtil.php";
     $a_tpl->addJavascript(iljQueryUtil::getLocalMaphilightPath());
     $a_tpl->addJavascript("./Services/COPage/js/ilCOPagePres.js");
     include_once "./Services/MediaObjects/classes/class.ilPlayerUtil.php";
     ilPlayerUtil::initMediaElementJs($a_tpl);
 }