/**
  * @return ilShibbolethAuthenticationPlugin[]
  */
 protected function getPluginObjects()
 {
     $plugin_objs = array();
     foreach (self::$active_plugins as $plugin_name) {
         $plugin_obj = $this->plugin_admin->getPluginObject(IL_COMP_SERVICE, 'AuthShibboleth', 'shibhk', $plugin_name);
         if ($plugin_obj instanceof ilShibbolethAuthenticationPlugin) {
             $plugin_objs[] = $plugin_obj;
         }
     }
     return $plugin_objs;
 }
예제 #2
0
 /**
  * Constructor
  *
  * @param
  * @return
  */
 function __construct($a_comp, $a_part, $a_pars)
 {
     global $ilPluginAdmin;
     include_once "./Services/UIComponent/classes/class.ilUIHookPluginGUI.php";
     // user interface hook [uihk]
     $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
     $this->replaced = false;
     foreach ($pl_names as $pl) {
         $ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl);
         $gui_class = $ui_plugin->getUIClassInstance();
         $resp = $gui_class->getHTML($a_comp, $a_part, $a_pars);
         if ($resp["mode"] != ilUIHookPluginGUI::KEEP) {
             switch ($resp["mode"]) {
                 case ilUIHookPluginGUI::PREPEND:
                     $this->prepend[] = $resp["html"];
                     break;
                 case ilUIHookPluginGUI::APPEND:
                     $this->append[] = $resp["html"];
                     break;
                 case ilUIHookPluginGUI::REPLACE:
                     if (!$this->replaced) {
                         $this->replace = $resp["html"];
                         $this->replaced = true;
                     }
                     break;
             }
         }
     }
 }
 /**
  * Get singelton instance
  * @global ilPluginAdmin $ilPluginAdmin
  * @return ilFhoevImportPlugin
  */
 public static function getInstance()
 {
     global $ilPluginAdmin;
     if (self::$instance) {
         return self::$instance;
     }
     include_once './Services/Component/classes/class.ilPluginAdmin.php';
     return self::$instance = ilPluginAdmin::getPluginObject(self::CTYPE, self::CNAME, self::SLOT_ID, self::PNAME);
 }
 private function isActiveQuestionType($questionData)
 {
     if (!isset($questionData['plugin'])) {
         return false;
     }
     if (!$questionData['plugin']) {
         return true;
     }
     return $this->pluginAdmin->isActive(IL_COMP_MODULE, 'TestQuestionPool', 'qst', $questionData['type_tag']);
 }
예제 #5
0
 public function __construct(ilTestOutputGUI $testOutputGUI)
 {
     global $lng, $ilCtrl, $tpl, $ilPluginAdmin;
     $this->lng = $lng;
     $this->ilCtrl = $ilCtrl;
     $this->tpl = $tpl;
     $this->ilTestOutputGUI = $testOutputGUI;
     $this->test = $this->ilTestOutputGUI->object;
     $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_MODULE, 'Test', 'tsig');
     $pl = current($pl_names);
     $this->plugin = ilPluginAdmin::getPluginObject(IL_COMP_MODULE, 'Test', 'tsig', $pl);
     $this->plugin->setGUIObject($this);
 }
예제 #6
0
 /**
  * Get array of all acitve plugins for the ilOrgUnitTypeHook plugin slot
  *
  * @return array
  */
 protected function getActivePlugins()
 {
     if ($this->active_plugins === NULL) {
         $active_plugins = $this->pluginAdmin->getActivePluginsForSlot(IL_COMP_MODULE, 'OrgUnit', 'orgutypehk');
         $this->active_plugins = array();
         foreach ($active_plugins as $pl_name) {
             /** @var ilOrgUnitTypeHookPlugin $plugin */
             $plugin = $this->pluginAdmin->getPluginObject(IL_COMP_MODULE, 'OrgUnit', 'orgutypehk', $pl_name);
             $this->active_plugins[] = $plugin;
         }
     }
     return $this->active_plugins;
 }
 /**
  * @return bool
  */
 protected function initViteroPlugin()
 {
     /**
      * @var ilPluginAdmin $ilPluginAdmin
      */
     global $ilPluginAdmin;
     if (!$ilPluginAdmin->isActive(self::VIT_CTYPE, self::VIT_CNAME, self::VIT_SLOT_ID, self::VIT_PNAME)) {
         return false;
     }
     include_once './Services/Component/classes/class.ilPluginAdmin.php';
     $vit = ilPluginAdmin::getPluginObject(self::VIT_CTYPE, self::VIT_CNAME, self::VIT_SLOT_ID, self::VIT_PNAME);
     if (ilComponent::isVersionGreaterString(self::VIT_MIN_VERSION, $vit->getVersion())) {
         return false;
     }
     $this->vitero = $vit;
     return true;
 }
 public function __construct($a_parent_gui, $a_main_obj = null)
 {
     global $ilPluginAdmin;
     parent::__construct($a_parent_gui, $a_main_obj);
     $this->addFormat('xml', $a_parent_gui->lng->txt('ass_create_export_file'), $this, 'createTestExport');
     $this->addFormat('csv', $a_parent_gui->lng->txt('ass_create_export_test_results'), $this, 'createTestResultsExport');
     $this->addFormat('arc', $a_parent_gui->lng->txt('ass_create_export_test_archive'), $this, 'createTestArchiveExport');
     $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_MODULE, 'Test', 'texp');
     foreach ($pl_names as $pl) {
         /**
          * @var $plugin ilTestExportPlugin
          */
         $plugin = ilPluginAdmin::getPluginObject(IL_COMP_MODULE, 'Test', 'texp', $pl);
         $plugin->setTest($this->obj);
         $this->addFormat($plugin->getFormat(), $plugin->getFormatLabel(), $plugin, 'export');
     }
 }
 /**
  * Execute command
  *
  * @access public
  *
  */
 public function executeCommand()
 {
     global $rbacsystem, $ilErr, $ilAccess, $ilCtrl;
     $next_class = $this->ctrl->getNextClass($this);
     $cmd = $this->ctrl->getCmd();
     $this->prepareOutput();
     if (!$ilAccess->checkAccess('read', '', $this->object->getRefId())) {
         $ilErr->raiseError($this->lng->txt('no_permission'), $ilErr->WARNING);
     }
     switch ($next_class) {
         case 'ilpermissiongui':
             $this->tabs_gui->setTabActive('perm_settings');
             include_once "Services/AccessControl/classes/class.ilPermissionGUI.php";
             $perm_gui =& new ilPermissionGUI($this);
             $ret =& $this->ctrl->forwardCommand($perm_gui);
             break;
         default:
             // configure classes
             $config = false;
             if (substr(strtolower($next_class), strlen($next_class) - 9) == "configgui") {
                 $path = $ilCtrl->lookupClassPath(strtolower($next_class));
                 if ($path != "") {
                     include_once $path;
                     $nc = new $next_class();
                     $pl = ilPluginAdmin::getPluginObject($_GET["ctype"], $_GET["cname"], $_GET["slot_id"], $_GET["pname"]);
                     $nc->setPluginObject($pl);
                     $ret = $this->ctrl->forwardCommand($nc);
                     $config = true;
                 }
             }
             if (!$config) {
                 if (!$cmd || $cmd == 'view') {
                     $cmd = "listPlugins";
                 }
                 $this->{$cmd}();
             }
             break;
     }
     return true;
 }
예제 #10
0
 /**
  * Loads the available preview renderers. That is built in renderers and plugins.
  * 
  * @return array The available renderers.
  */
 private static function loadAvailableRenderers()
 {
     // already loaded?
     if (self::$renderers != null) {
         return;
     }
     $r = array();
     // get registered and active plugins
     global $ilPluginAdmin;
     $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "Preview", "pvre");
     foreach ($pl_names as $pl) {
         $plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "Preview", "pvre", $pl);
         $r[] = $plugin->getRendererClassInstance();
     }
     // add default renderers
     include_once "./Services/Preview/classes/class.ilImageMagickRenderer.php";
     $r[] = new ilImageMagickRenderer();
     include_once "./Services/Preview/classes/class.ilGhostscriptRenderer.php";
     if (ilGhostscriptRenderer::isGhostscriptInstalled()) {
         $r[] = new ilGhostscriptRenderer();
     }
     self::$renderers = $r;
 }
 /**
  * provide $styleDefinition object
  */
 protected static function initStyle()
 {
     global $styleDefinition, $ilPluginAdmin;
     // load style definitions
     self::initGlobal("styleDefinition", "ilStyleDefinition", "./Services/Style/classes/class.ilStyleDefinition.php");
     // add user interface hook for style initialisation
     $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
     foreach ($pl_names as $pl) {
         $ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl);
         $gui_class = $ui_plugin->getUIClassInstance();
         $gui_class->modifyGUI("Services/Init", "init_style", array("styleDefinition" => $styleDefinition));
     }
     $styleDefinition->startParsing();
 }
 /**
  * Raise an event. The event is passed to all interested listeners.
  *
  * @param	string	$a_component	component, e.g. "Modules/Forum" or "Services/User"
  * @param	string	$a_event		event e.g. "createUser", "updateUser", "deleteUser", ...
  * @param	array	$a_parameter	parameter array (assoc), array("name" => ..., "phone_office" => ...)
  */
 function raise($a_component, $a_event, $a_parameter = "")
 {
     if (is_array($this->listener[$a_component])) {
         foreach ($this->listener[$a_component] as $listener) {
             // Allow listeners like Services/WebServices/ECS
             $last_slash = strripos($listener, '/');
             $comp = substr($listener, 0, $last_slash);
             $class = 'il' . substr($listener, $last_slash + 1) . 'AppEventListener';
             $file = "./" . $listener . "/classes/class." . $class . ".php";
             // detemine class and file
             #$comp = explode("/", $listener);
             #$class = "il".$comp[1]."AppEventListener";
             #$file = "./".$listener."/classes/class.".$class.".php";
             // if file exists, call listener
             if (is_file($file)) {
                 include_once $file;
                 call_user_func(array($class, 'handleEvent'), $a_component, $a_event, $a_parameter);
             }
         }
     }
     // get all event hook plugins and forward the event to them
     include_once "./Services/Component/classes/class.ilPluginAdmin.php";
     $plugins = ilPluginAdmin::getActivePluginsForSlot("Services", "EventHandling", "evhk");
     foreach ($plugins as $pl) {
         $plugin = ilPluginAdmin::getPluginObject("Services", "EventHandling", "evhk", $pl);
         $plugin->handleEvent($a_component, $a_event, $a_parameter);
     }
 }
예제 #13
0
 /**
  * Reads a template file from the disk.
  *
  * overwrites IT:loadTemplateFile to include the template input hook
  *
  * @param    string      name of the template file
  * @param    bool        how to handle unknown variables.
  * @param    bool        how to handle empty blocks.
  * @access   public
  * @return   boolean    false on failure, otherwise true
  * @see      $template, setTemplate(), $removeUnknownVariables,
  *           $removeEmptyBlocks
  */
 function loadTemplatefile($filename, $removeUnknownVariables = true, $removeEmptyBlocks = true)
 {
     // copied from IT:loadTemplateFile
     $template = '';
     if (!$this->flagCacheTemplatefile || $this->lastTemplatefile != $filename) {
         $template = $this->getFile($filename);
     }
     $this->lastTemplatefile = $filename;
     // copied.
     // new code to include the template input hook:
     global $ilPluginAdmin;
     $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
     foreach ($pl_names as $pl) {
         $ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl);
         $gui_class = $ui_plugin->getUIClassInstance();
         $resp = $gui_class->getHTML("", "template_load", array("tpl_id" => $this->tplIdentifier, "tpl_obj" => $this, "html" => $template));
         if ($resp["mode"] != ilUIHookPluginGUI::KEEP) {
             $template = $gui_class->modifyHTML($template, $resp);
         }
     }
     // new.
     // copied from IT:loadTemplateFile
     return $template != '' ? $this->setTemplate($template, $removeUnknownVariables, $removeEmptyBlocks) : false;
     // copied.
 }
예제 #14
0
 function _checkGoto($a_target)
 {
     global $objDefinition, $ilPluginAdmin, $ilUser;
     if (is_object($ilPluginAdmin)) {
         // get user interface plugins
         $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
         // search
         foreach ($pl_names as $pl) {
             $ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl);
             $gui_class = $ui_plugin->getUIClassInstance();
             $resp = $gui_class->checkGotoHook($a_target);
             if ($resp["target"] !== false) {
                 $a_target = $resp["target"];
                 break;
             }
         }
     }
     if ($a_target == "") {
         return false;
     }
     $t_arr = explode("_", $a_target);
     $type = $t_arr[0];
     if ($type == "git") {
         $type = "glo";
     }
     if ($type == "pg" | $type == "st") {
         $type = "lm";
     }
     $class = $objDefinition->getClassName($type);
     if ($class == "") {
         return false;
     }
     $location = $objDefinition->getLocation($type);
     $full_class = "ilObj" . $class . "Access";
     include_once $location . "/class." . $full_class . ".php";
     $ret = call_user_func(array($full_class, "_checkGoto"), $a_target);
     // if no access and repository object => check for parent course/group
     if (!$ret && !stristr($a_target, "_wsp") && $ilUser->getId() != ANONYMOUS_USER_ID && !$objDefinition->isAdministrationObject($type) && $objDefinition->isRBACObject($type) && $t_arr[1]) {
         global $tree, $rbacsystem, $ilAccess;
         // original type "pg" => pg_<page_id>[_<ref_id>]
         if ($t_arr[0] == "pg") {
             if (isset($t_arr[2])) {
                 $ref_id = $t_arr[2];
             } else {
                 $lm_id = ilLMObject::_lookupContObjID($t_arr[1]);
                 $ref_id = ilObject::_getAllReferences($lm_id);
                 if ($ref_id) {
                     $ref_id = array_shift($ref_id);
                 }
             }
         } else {
             $ref_id = $t_arr[1];
         }
         include_once "Services/Membership/classes/class.ilParticipants.php";
         $block_obj = array();
         // walk path to find parent container
         $path = $tree->getPathId($ref_id);
         array_pop($path);
         foreach ($path as $path_ref_id) {
             $redirect_infopage = false;
             $add_member_role = false;
             $ptype = ilObject::_lookupType($path_ref_id, true);
             $pobj_id = ilObject::_lookupObjId($path_ref_id);
             // core checks: timings/object-specific
             if (!$ilAccess->doActivationCheck("read", "", $path_ref_id, $ilUser->getId(), $pobj_id, $ptype) || !$ilAccess->doStatusCheck("read", "", $path_ref_id, $ilUser->getId(), $pobj_id, $ptype)) {
                 // object in path is inaccessible - aborting
                 return false;
             } else {
                 if ($ptype == "crs") {
                     // check if already participant
                     include_once "Modules/Course/classes/class.ilCourseParticipant.php";
                     $participants = new ilCourseParticipant($pobj_id, $ilUser->getId());
                     if (!$participants->isAssigned()) {
                         // subscription currently possible?
                         include_once "Modules/Course/classes/class.ilObjCourse.php";
                         if (ilObjCourse::_isActivated($pobj_id) && ilObjCourse::_registrationEnabled($pobj_id)) {
                             $block_obj[] = $path_ref_id;
                             $add_member_role = true;
                         } else {
                             $redirect_infopage = true;
                         }
                     }
                 } else {
                     if ($ptype == "grp") {
                         // check if already participant
                         include_once "Modules/Group/classes/class.ilGroupParticipants.php";
                         if (!ilGroupParticipants::_isParticipant($path_ref_id, $ilUser->getId())) {
                             // subscription currently possible?
                             include_once "Modules/Group/classes/class.ilObjGroup.php";
                             $group_obj = new ilObjGroup($path_ref_id);
                             if ($group_obj->isRegistrationEnabled()) {
                                 $block_obj[] = $path_ref_id;
                                 $add_member_role = true;
                             } else {
                                 $redirect_infopage = true;
                             }
                         }
                     }
                 }
             }
             // add members roles for all "blocking" objects
             if ($add_member_role) {
                 // cannot join? goto will never work, so redirect to current object
                 $rbacsystem->resetPACache($ilUser->getId(), $path_ref_id);
                 if (!$rbacsystem->checkAccess("join", $path_ref_id)) {
                     $redirect_infopage = true;
                 } else {
                     $rbacsystem->addTemporaryRole($ilUser->getId(), ilParticipants::getDefaultMemberRole($path_ref_id));
                 }
             }
             // redirect to infopage of 1st blocking object in path
             if ($redirect_infopage) {
                 if ($rbacsystem->checkAccess("visible", $path_ref_id)) {
                     ilUtil::redirect("ilias.php?baseClass=ilRepositoryGUI" . "&ref_id=" . $path_ref_id . "&cmd=infoScreen");
                 } else {
                     return false;
                 }
             }
         }
         // check if access will be possible with all (possible) member roles added
         $rbacsystem->resetPACache($ilUser->getId(), $ref_id);
         if ($rbacsystem->checkAccess("read", $ref_id) && sizeof($block_obj)) {
             // this won't work with lm-pages (see above)
             // include_once "Services/Link/classes/class.ilLink.php";
             // $_SESSION["pending_goto"] = ilLink::_getStaticLink($ref_id, $type);
             // keep original target
             $_SESSION["pending_goto"] = "goto.php?target=" . $a_target;
             // redirect to 1st non-member object in path
             ilUtil::redirect("ilias.php?baseClass=ilRepositoryGUI" . "&ref_id=" . array_shift($block_obj));
         }
     }
     return $ret;
 }
예제 #15
0
 /**
  * Get item list command drop down asynchronously
  */
 function getAsynchItemListObject()
 {
     global $ilCtrl;
     $ref_id = $_GET["cmdrefid"];
     $obj_id = ilObject::_lookupObjId($ref_id);
     $type = ilObject::_lookupType($obj_id);
     // this should be done via container-object->getSubItem in the future
     $data = array("child" => $ref_id, "ref_id" => $ref_id, "obj_id" => $obj_id, "type" => $type);
     include_once 'Services/Object/classes/class.ilObjectListGUIFactory.php';
     $item_list_gui = ilObjectListGUIFactory::_getListGUIByType($type);
     $item_list_gui->setContainerObject($this);
     $item_list_gui->enableComments(true);
     $item_list_gui->enableNotes(true);
     $item_list_gui->enableTags(true);
     $this->modifyItemGUI($item_list_gui, $data, false);
     $html = $item_list_gui->getListItemHTML($ref_id, $obj_id, "", "", true, true);
     // include plugin slot for async item list
     global $ilPluginAdmin;
     $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
     foreach ($pl_names as $pl) {
         $ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl);
         $gui_class = $ui_plugin->getUIClassInstance();
         $resp = $gui_class->getHTML("Services/Container", "async_item_list", array("html" => $html));
         if ($resp["mode"] != ilUIHookPluginGUI::KEEP) {
             $html = $gui_class->modifyHTML($html, $resp);
         }
     }
     echo $html;
     exit;
 }
예제 #16
0
}
require_once "Services/Init/classes/class.ilInitialisation.php";
ilInitialisation::initILIAS();
// special handling for direct navigation request
require_once "./Services/Navigation/classes/class.ilNavigationHistoryGUI.php";
$nav_hist = new ilNavigationHistoryGUI();
$nav_hist->handleNavigationRequest();
// store original parameter before plugin slot may influence it
$orig_target = $_GET['target'];
// user interface plugin slot hook
if (is_object($ilPluginAdmin)) {
    // get user interface plugins
    $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
    // search
    foreach ($pl_names as $pl) {
        $ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl);
        $gui_class = $ui_plugin->getUIClassInstance();
        $gui_class->gotoHook();
    }
}
if (IS_PAYMENT_ENABLED) {
    if (strpos($_GET['target'], 'purchasetypedemo') !== false) {
        $_GET['purchasetype'] = 'demo';
        $_GET['cmd'] = 'showDemoVersion';
        $_GET['target'] = str_replace('purchasetypedemo', '', $_GET['target']);
    } else {
        if (strpos($_GET['target'], 'purchasetypebuy') !== false) {
            $_GET['purchasetype'] = 'buy';
            $_GET['cmd'] = 'showDetails';
            $_GET['target'] = str_replace('purchasetypebuy', '', $_GET['target']);
        }
예제 #17
0
 /**
  * get tabs code as html
  * @param bool choose tabs or sub tabs
  * @param bool manual activation
  * @access Private
  */
 function __getHTML($a_get_sub_tabs, $a_manual, $a_after_tabs_anchor = false)
 {
     global $ilCtrl, $lng, $ilUser, $ilPluginAdmin, $ilHelp;
     // user interface hook [uihk]
     if (!$this->getSetupMode()) {
         $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
         foreach ($pl_names as $pl) {
             $ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl);
             $gui_class = $ui_plugin->getUIClassInstance();
             $resp = $gui_class->modifyGUI("", $a_get_sub_tabs ? "sub_tabs" : "tabs", array("tabs" => $this));
         }
     }
     // user interface hook [uihk]
     if (!$this->getSetupMode()) {
         $cmd = $ilCtrl->getCmd();
         $cmdClass = $ilCtrl->getCmdClass();
     }
     if ($a_get_sub_tabs) {
         $tpl = new ilTemplate("tpl.sub_tabs.html", true, true, "Services/UIComponent/Tabs");
         $pre = "sub";
         $pre2 = "SUB_";
         $sr_pre = "sub_";
     } else {
         $tpl = new ilTemplate("tpl.tabs.html", true, true, "Services/UIComponent/Tabs");
         if ($a_after_tabs_anchor) {
             $tpl->touchBlock("after_tabs");
         }
         $pre = $pre2 = "";
         include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php";
         // back 2 tab
         if ($this->back_2_title != "") {
             $tpl->setCurrentBlock("back_2_tab");
             $tpl->setVariable("BACK_2_ICON", ilGlyphGUI::get(ilGlyphGUI::PREVIOUS, ilGlyphGUI::NO_TEXT));
             $tpl->setVariable("BACK_2_TAB_LINK", $this->back_2_target);
             $tpl->setVariable("BACK_2_TAB_TEXT", $this->back_2_title);
             $tpl->setVariable("BACK_2_TAB_TARGET", $this->back_2_frame);
             $tpl->parseCurrentBlock();
         }
         // back tab
         if ($this->back_title != "") {
             $tpl->setCurrentBlock("back_tab");
             $tpl->setVariable("BACK_ICON", ilGlyphGUI::get(ilGlyphGUI::PREVIOUS, ilGlyphGUI::NO_TEXT));
             $tpl->setVariable("BACK_TAB_LINK", $this->back_target);
             $tpl->setVariable("BACK_TAB_TEXT", $this->back_title);
             $tpl->setVariable("BACK_TAB_TARGET", $this->back_frame);
             $tpl->parseCurrentBlock();
         }
     }
     $targets = $a_get_sub_tabs ? $this->sub_target : $this->target;
     $i = 0;
     // do not display one tab only
     if (count($targets) > 1 || $this->back_title != "" && !$a_get_sub_tabs || count($this->non_tabbed_link) > 0 && !$a_get_sub_tabs) {
         foreach ($targets as $target) {
             $i++;
             if (!is_array($target["cmd"])) {
                 $target["cmd"] = array($target["cmd"]);
             }
             if (!$a_manual && (in_array($cmd, $target["cmd"]) || $target["cmd"][0] == "" && count($target["cmd"]) == 1) && (in_array($cmdClass, $target["cmdClass"]) || !$target["cmdClass"])) {
                 $tabtype = $pre . "tabactive";
             } else {
                 $tabtype = $pre . "tabinactive";
             }
             if ($a_manual && $target["activate"]) {
                 $tabtype = $pre . "tabactive";
             }
             if ($tabtype == "tabactive" || $tabtype == "subtabactive") {
                 $tpl->setCurrentBlock("sel_text");
                 $tpl->setVariable("TXT_SELECTED", $lng->txt("stat_selected"));
                 $tpl->parseCurrentBlock();
                 if (!$this->getSetupMode()) {
                     if ($a_get_sub_tabs) {
                         $part = ilHelpGUI::ID_PART_SUB_SCREEN;
                     } else {
                         $part = ilHelpGUI::ID_PART_SCREEN;
                     }
                     $ilHelp->setDefaultScreenId($part, $target["id"]);
                 }
             }
             $tpl->setCurrentBlock($pre . "tab");
             $tpl->setVariable("ID", $pre . "tab_" . $target["id"]);
             // tooltip
             if (!$this->getSetupMode()) {
                 $ttext = $ilHelp->getTabTooltipText($target["id"]);
                 if ($ttext != "") {
                     include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php";
                     ilTooltipGUI::addTooltip($pre . "tab_" . $target["id"], $ttext, "", "bottom center", "top center", false);
                 }
             }
             // bs-patch: start
             $tabtype = in_array($tabtype, array("tabactive", "subtabactive")) ? "active" : "";
             // bs-patch: end
             $tpl->setVariable($pre2 . "TAB_TYPE", $tabtype);
             if (!$this->getSetupMode()) {
                 $hash = $ilUser->getPref("screen_reader_optimization") ? "#after_" . $sr_pre . "tabs" : "";
             }
             $tpl->setVariable($pre2 . "TAB_LINK", $target["link"] . $hash);
             if ($target["dir_text"]) {
                 $tpl->setVariable($pre2 . "TAB_TEXT", $target["text"]);
             } else {
                 $tpl->setVariable($pre2 . "TAB_TEXT", $lng->txt($target["text"]));
             }
             $tpl->setVariable($pre2 . "TAB_TARGET", $target["frame"]);
             $tpl->parseCurrentBlock();
         }
         if ($a_get_sub_tabs) {
             $tpl->setVariable("TXT_SUBTABS", $lng->txt("subtabs"));
         } else {
             $tpl->setVariable("TXT_TABS", $lng->txt("tabs"));
             // non tabbed links
             include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php";
             foreach ($this->non_tabbed_link as $link) {
                 $tpl->setCurrentBlock("tab");
                 $tpl->setVariable("TAB_TYPE", "nontabbed");
                 $tpl->setVariable("TAB_ICON", " " . ilGlyphGUI::get(ilGlyphGUI::NEXT, ilGlyphGUI::NO_TEXT));
                 $tpl->setVariable("TAB_TEXT", $link["text"]);
                 $tpl->setVariable("TAB_LINK", $link["link"]);
                 $tpl->setVariable("TAB_TARGET", $link["frame"]);
                 $tpl->setVariable("ID", "nontab_" . $link["id"]);
                 $tpl->parseCurrentBlock();
                 // tooltip
                 if (!$this->getSetupMode()) {
                     $ttext = $ilHelp->getTabTooltipText($link["id"]);
                     if ($ttext != "") {
                         include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php";
                         ilTooltipGUI::addTooltip("nontab_" . $link["id"], $ttext, "", "bottom center", "top center", false);
                     }
                 }
             }
         }
         return $tpl->get();
     } else {
         return "";
     }
 }
 /**
  * get lm menu html
  */
 function setilLMMenu($a_offline = false, $a_export_format = "", $a_active = "content", $a_use_global_tabs = false, $a_as_subtabs = false, $a_cur_page = 0)
 {
     global $ilCtrl, $ilUser, $ilAccess, $ilTabs, $rbacsystem, $ilPluginAdmin;
     if ($a_as_subtabs) {
         $addcmd = "addSubTabTarget";
         $getcmd = "getSubTabHTML";
     } else {
         $addcmd = "addTarget";
         $getcmd = "getHTML";
     }
     $active[$a_active] = true;
     if (!$this->object->isActiveLMMenu()) {
         return "";
     }
     if ($a_use_global_tabs) {
         $tabs_gui = $ilTabs;
     } else {
         $tabs_gui = new ilTabsGUI();
     }
     // Determine whether the view of a learning resource should
     // be shown in the frameset of ilias, or in a separate window.
     //$showViewInFrameset = $this->ilias->ini->readVariable("layout","view_target") == "frame";
     $showViewInFrameset = true;
     if ($showViewInFrameset && !$a_offline) {
         $buttonTarget = ilFrameTargetInfo::_getFrame("MainContent");
     } else {
         $buttonTarget = "_top";
     }
     if ($a_export_format == "scorm") {
         $buttonTarget = "";
     }
     include_once "./Services/Payment/classes/class.ilPaymentObject.php";
     $requires_purchase_to_access = ilPaymentObject::_requiresPurchaseToAccess((int) $_GET['ref_id']);
     // content
     if (!$a_offline && $ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
         $ilCtrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
         $tabs_gui->{$addcmd}("content", $ilCtrl->getLinkTargetByClass("illmpresentationgui", "layout"), "", "", $buttonTarget, $active["content"]);
     }
     // table of contents
     if (!$requires_purchase_to_access && $this->object->isActiveTOC() && $ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
         if (!$a_offline) {
             $ilCtrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
             $link = $ilCtrl->getLinkTargetByClass("illmpresentationgui", "showTableOfContents");
         } else {
             $link = "./table_of_contents.html";
         }
         $tabs_gui->{$addcmd}("cont_toc", $link, "", "", $buttonTarget, $active["toc"]);
     }
     // print view
     if (!$requires_purchase_to_access && $this->object->isActivePrintView() && $ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
         if (!$a_offline) {
             $ilCtrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
             $link = $ilCtrl->getLinkTargetByClass("illmpresentationgui", "showPrintViewSelection");
             $tabs_gui->{$addcmd}("cont_print_view", $link, "", "", $buttonTarget, $active["print"]);
         }
     }
     // download
     if (!$requires_purchase_to_access && $ilUser->getId() == ANONYMOUS_USER_ID) {
         $is_public = $this->object->isActiveDownloadsPublic();
     } else {
         if (!$requires_purchase_to_access) {
             $is_public = true;
         }
     }
     if (!$requires_purchase_to_access && $this->object->isActiveDownloads() && !$a_offline && $is_public && $ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
         $ilCtrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
         $link = $ilCtrl->getLinkTargetByClass("illmpresentationgui", "showDownloadList");
         $tabs_gui->{$addcmd}("download", $link, "", "", $buttonTarget, $active["download"]);
     }
     // info button
     if ($a_export_format != "scorm" && !$a_offline) {
         if (!$a_offline) {
             $ilCtrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
             $link = $this->ctrl->getLinkTargetByClass(array("illmpresentationgui", "ilinfoscreengui"), "showSummary");
         } else {
             $link = "./info.html";
         }
         $tabs_gui->{$addcmd}($requires_purchase_to_access ? 'buy' : 'info_short', $link, "", "", $buttonTarget, $active["info"]);
     }
     include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
     if (ilLearningProgressAccess::checkAccess($_GET["ref_id"])) {
         include_once './Services/Object/classes/class.ilObjectLP.php';
         $olp = ilObjectLP::getInstance($this->object->getId());
         if ($olp->getCurrentMode() == ilLPObjSettings::LP_MODE_COLLECTION_MANUAL) {
             $tabs_gui->{$addcmd}("learning_progress", $this->ctrl->getLinkTargetByClass(array("illmpresentationgui", "illearningprogressgui"), "editmanual"), "", "", $buttonTarget, $active["learning_progress"]);
         } else {
             if ($olp->getCurrentMode() == ilLPObjSettings::LP_MODE_COLLECTION_TLT) {
                 $tabs_gui->{$addcmd}("learning_progress", $this->ctrl->getLinkTargetByClass(array("illmpresentationgui", "illearningprogressgui"), "showtlt"), "", "", $buttonTarget, $active["learning_progress"]);
             }
         }
     }
     // edit learning module
     if (!$a_offline && $a_cur_page > 0) {
         if ($rbacsystem->checkAccess("write", $_GET["ref_id"])) {
             //$page_id = $this->getCurrentPageId();
             $page_id = $a_cur_page;
             $tabs_gui->{$addcmd}("edit_page", ILIAS_HTTP_PATH . "/ilias.php?baseClass=ilLMEditorGUI&ref_id=" . $_GET["ref_id"] . "&obj_id=" . $page_id . "&to_page=1", "", "", $buttonTarget, $active["edit_page"]);
         }
     }
     if (!$requires_purchase_to_access) {
         // get user defined menu entries
         $this->__initLMMenuEditor();
         $entries = $this->lmme_obj->getMenuEntries(true);
         if (count($entries) > 0 && $ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
             foreach ($entries as $entry) {
                 // build goto-link for internal resources
                 if ($entry["type"] == "intern") {
                     $entry["link"] = ILIAS_HTTP_PATH . "/goto.php?target=" . $entry["link"];
                 }
                 // add http:// prefix if not exist
                 if (!strstr($entry["link"], '://') && !strstr($entry["link"], 'mailto:')) {
                     $entry["link"] = "http://" . $entry["link"];
                 }
                 if (!strstr($entry["link"], 'mailto:')) {
                     $entry["link"] = ilUtil::appendUrlParameterString($entry["link"], "ref_id=" . $this->ref_id . "&structure_id=" . $this->obj_id);
                 }
                 $tabs_gui->{$addcmd}($entry["title"], $entry["link"], "", "", "_blank", "", true);
             }
         }
     }
     // user interface hook [uihk]
     $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
     $plugin_html = false;
     foreach ($pl_names as $pl) {
         $ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl);
         $gui_class = $ui_plugin->getUIClassInstance();
         $resp = $gui_class->modifyGUI("Modules/LearningModule", "lm_menu_tabs", array("lm_menu_tabs" => $tabs_gui));
     }
     return $tabs_gui->{$getcmd}();
 }
예제 #19
0
 /**
  * http redirect to other script
  *
  * @param	string		$a_script		target script
  * @static
  * 
  */
 public static function redirect($a_script)
 {
     global $log, $PHP_SELF;
     //echo "<br>".$a_script;
     if (!is_int(strpos($a_script, "://"))) {
         if (substr($a_script, 0, 1) != "/" && defined("ILIAS_HTTP_PATH")) {
             if (is_int(strpos($_SERVER["PHP_SELF"], "/setup/"))) {
                 $a_script = "setup/" . $a_script;
             }
             $a_script = ILIAS_HTTP_PATH . "/" . $a_script;
         }
     }
     //echo "<br>".$a_script; exit;
     // include the user interface hook
     global $ilPluginAdmin;
     if (is_object($ilPluginAdmin)) {
         $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
         foreach ($pl_names as $pl) {
             $ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl);
             $gui_class = $ui_plugin->getUIClassInstance();
             $resp = $gui_class->getHTML("Services/Utilities", "redirect", array("html" => $a_script));
             if ($resp["mode"] != ilUIHookPluginGUI::KEEP) {
                 $a_script = $gui_class->modifyHTML($a_script, $resp);
             }
         }
     }
     header("Location: " . $a_script);
     exit;
 }