Esempio n. 1
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;
 }
Esempio n. 2
0
 function executeCommand()
 {
     global $rbacsystem, $ilUser, $ilAccess, $ilErr, $ilTabs, $ilNavigationHistory, $ilCtrl;
     $next_class = $this->ctrl->getNextClass($this);
     $cmd = $this->ctrl->getCmd();
     $this->prepareOutput();
     // show repository tree
     $this->showRepTree(true);
     // add entry to navigation history
     if (!$this->getCreationMode() && $ilAccess->checkAccess('read', '', $_GET['ref_id'])) {
         $link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "frameset");
         $ilNavigationHistory->addItem($_GET['ref_id'], $link, 'crs');
     }
     if (!$this->getCreationMode()) {
         if (IS_PAYMENT_ENABLED) {
             include_once 'Services/Payment/classes/class.ilPaymentObject.php';
             if (ilPaymentObject::_requiresPurchaseToAccess($this->object->getRefId(), $type = isset($_GET['purchasetype']) ? $_GET['purchasetype'] : NULL)) {
                 $ilTabs->setTabActive('info_short');
                 include_once 'Services/Payment/classes/class.ilShopPurchaseGUI.php';
                 $this->ctrl->setReturn($this, '');
                 $pp_gui = new ilShopPurchaseGUI($this->object->getRefId());
                 $this->ctrl->forwardCommand($pp_gui);
                 return true;
             }
         }
     }
     switch ($next_class) {
         case "ilinfoscreengui":
             $this->infoScreen();
             // forwards command
             break;
         case 'ilmdeditorgui':
             if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
                 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
             }
             include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
             $md_gui =& new ilMDEditorGUI($this->object->getId(), 0, $this->object->getType());
             $md_gui->addObserver($this->object, 'MDUpdateListener', 'General');
             $this->ctrl->forwardCommand($md_gui);
             $this->tabs_gui->setTabActive('meta_data');
             break;
         case 'ilcourseregistrationgui':
             $this->ctrl->setReturn($this, 'infoScreen');
             $this->tabs_gui->setTabActive('join');
             include_once './Modules/Course/classes/class.ilCourseRegistrationGUI.php';
             $registration = new ilCourseRegistrationGUI($this->object);
             $this->ctrl->forwardCommand($registration);
             break;
         case 'ilobjectcustomuserfieldsgui':
             include_once './Services/Membership/classes/class.ilObjectCustomUserFieldsGUI.php';
             if (isset($_REQUEST['member_id'])) {
                 $this->ctrl->setReturn($this, 'members');
             }
             $cdf_gui = new ilObjectCustomUserFieldsGUI($this->object->getId());
             $this->setSubTabs('properties');
             $this->tabs_gui->setTabActive('settings');
             $this->ctrl->forwardCommand($cdf_gui);
             break;
         case "ilcourseobjectivesgui":
             include_once './Modules/Course/classes/class.ilCourseObjectivesGUI.php';
             $this->ctrl->setReturn($this, "");
             $reg_gui =& new ilCourseObjectivesGUI($this->object->getRefId());
             $ret =& $this->ctrl->forwardCommand($reg_gui);
             break;
         case 'ilobjcoursegroupinggui':
             include_once './Modules/Course/classes/class.ilObjCourseGroupingGUI.php';
             $this->ctrl->setReturn($this, 'edit');
             $this->setSubTabs('properties');
             $crs_grp_gui =& new ilObjCourseGroupingGUI($this->object, (int) $_GET['obj_id']);
             $this->ctrl->forwardCommand($crs_grp_gui);
             $this->tabs_gui->setTabActive('settings');
             $this->tabs_gui->setSubTabActive('groupings');
             break;
         case "ilcolumngui":
             $this->tabs_gui->setTabActive('none');
             $this->checkPermission("read");
             //$this->prepareOutput();
             //include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
             //$this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
             //	ilObjStyleSheet::getContentStylePath(0));
             //$this->renderObject();
             $this->viewObject();
             break;
         case "ilconditionhandlergui":
             include_once './Services/AccessControl/classes/class.ilConditionHandlerGUI.php';
             // preconditions for whole course
             $this->setSubTabs("properties");
             $this->tabs_gui->setTabActive('settings');
             $new_gui =& new ilConditionHandlerGUI($this);
             $this->ctrl->forwardCommand($new_gui);
             break;
         case "illearningprogressgui":
             include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
             $new_gui =& new ilLearningProgressGUI(ilLearningProgressGUI::LP_CONTEXT_REPOSITORY, $this->object->getRefId(), $_GET['user_id'] ? $_GET['user_id'] : $ilUser->getId());
             $this->ctrl->forwardCommand($new_gui);
             $this->tabs_gui->setTabActive('learning_progress');
             break;
         case 'illicenseoverviewgui':
             include_once "./Services/License/classes/class.ilLicenseOverviewGUI.php";
             $license_gui =& new ilLicenseOverviewGUI($this, ilLicenseOverviewGUI::LIC_MODE_REPOSITORY);
             $ret =& $this->ctrl->forwardCommand($license_gui);
             $this->tabs_gui->setTabActive('licenses');
             break;
         case 'ilpermissiongui':
             include_once "Services/AccessControl/classes/class.ilPermissionGUI.php";
             $this->tabs_gui->setTabActive('perm_settings');
             $perm_gui =& new ilPermissionGUI($this);
             $ret =& $this->ctrl->forwardCommand($perm_gui);
             break;
         case 'ilrepositorysearchgui':
             include_once './Services/Search/classes/class.ilRepositorySearchGUI.php';
             $rep_search =& new ilRepositorySearchGUI();
             if (ilCourseParticipant::_getInstanceByObjId($this->object->getId(), $GLOBALS['ilUser']->getId())->isAdmin() or $this->checkPermissionBool('edit_permission')) {
                 $rep_search->setCallback($this, 'assignMembersObject', $this->getLocalRoles());
             } else {
                 $rep_search->setCallback($this, 'assignMembersObject', array(ilCourseConstants::CRS_MEMBER => $this->lng->txt('crs_member'), ilCourseConstants::CRS_TUTOR => $this->lng->txt('crs_tutor')));
             }
             $this->checkLicenses();
             // Set tabs
             $this->ctrl->setReturn($this, 'members');
             $ret =& $this->ctrl->forwardCommand($rep_search);
             $this->setSubTabs('members');
             $this->tabs_gui->setTabActive('members');
             $this->tabs_gui->setSubTabActive('crs_member_administration');
             break;
         case 'ilcoursecontentinterface':
             $this->initCourseContentInterface();
             $this->cci_obj->cci_setContainer($this);
             $this->ctrl->forwardCommand($this->cci_obj);
             $this->setSubTabs('content');
             $this->tabs_gui->setTabActive('content');
             break;
         case 'ilcoursecontentgui':
             $this->ctrl->setReturn($this, 'members');
             include_once './Modules/Course/classes/class.ilCourseContentGUI.php';
             $course_content_obj = new ilCourseContentGUI($this);
             $this->ctrl->forwardCommand($course_content_obj);
             break;
         case 'ilpublicuserprofilegui':
             $this->tpl->enableDragDropFileUpload(null);
             require_once './Services/User/classes/class.ilPublicUserProfileGUI.php';
             $profile_gui = new ilPublicUserProfileGUI($_GET["user"]);
             $this->setSubTabs('members');
             $this->tabs_gui->setTabActive('members');
             $profile_gui->setBackUrl($ilCtrl->getLinkTarget($this, "membersGallery"));
             $this->tabs_gui->setSubTabActive('crs_members_gallery');
             $html = $this->ctrl->forwardCommand($profile_gui);
             $this->tpl->setVariable("ADM_CONTENT", $html);
             break;
         case 'ilmemberexportgui':
             include_once './Services/Membership/classes/Export/class.ilMemberExportGUI.php';
             $this->setSubTabs('members');
             $this->tabs_gui->setTabActive('members');
             $this->tabs_gui->setSubTabActive('export_members');
             $export = new ilMemberExportGUI($this->object->getRefId());
             $this->ctrl->forwardCommand($export);
             break;
         case 'ilmemberagreementgui':
             include_once 'Services/Membership/classes/class.ilMemberAgreementGUI.php';
             $this->tabs_gui->clearTargets();
             $this->ctrl->setReturn($this, '');
             $agreement = new ilMemberAgreementGUI($this->object->getRefId());
             $this->ctrl->forwardCommand($agreement);
             break;
         case 'ilsessionoverviewgui':
             $this->setSubTabs('members');
             $this->tabs_gui->setTabActive('members');
             $this->tabs_gui->setSubTabActive('events');
             include_once './Modules/Course/classes/class.ilCourseParticipants.php';
             $prt = ilCourseParticipants::_getInstanceByObjId($this->object->getId());
             include_once './Modules/Session/classes/class.ilSessionOverviewGUI.php';
             $overview = new ilSessionOverviewGUI($this->object->getRefId(), $prt);
             $this->ctrl->forwardCommand($overview);
             break;
             // container page editing
         // container page editing
         case "ilcontainerpagegui":
             $ret = $this->forwardToPageObject();
             if ($ret != "") {
                 $this->tpl->setContent($ret);
             }
             break;
         case "ilcontainerstartobjectspagegui":
             // file downloads, etc. (currently not active)
             include_once "Services/Container/classes/class.ilContainerStartObjectsPageGUI.php";
             $pgui = new ilContainerStartObjectsPageGUI($this->object->getId());
             $ret = $this->ctrl->forwardCommand($pgui);
             if ($ret) {
                 $this->tpl->setContent($ret);
             }
             break;
         case 'ilobjectcopygui':
             include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
             $cp = new ilObjectCopyGUI($this);
             $cp->setType('crs');
             $this->ctrl->forwardCommand($cp);
             break;
         case "ilobjstylesheetgui":
             $this->forwardToStyleSheet();
             break;
         case 'ilcourseparticipantsgroupsgui':
             include_once './Modules/Course/classes/class.ilCourseParticipantsGroupsGUI.php';
             $cmg_gui = new ilCourseParticipantsGroupsGUI($this->object->getRefId());
             $this->setSubTabs('members');
             $this->tabs_gui->setTabActive('members');
             $this->ctrl->forwardCommand($cmg_gui);
             break;
         case 'ilexportgui':
             $this->tabs_gui->setTabActive('export');
             include_once './Services/Export/classes/class.ilExportGUI.php';
             $exp = new ilExportGUI($this);
             $exp->addFormat('xml');
             $this->ctrl->forwardCommand($exp);
             break;
         case "ilcommonactiondispatchergui":
             include_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php";
             $gui = ilCommonActionDispatcherGUI::getInstanceFromAjaxCall();
             $this->ctrl->forwardCommand($gui);
             break;
         case 'ildidactictemplategui':
             $this->ctrl->setReturn($this, 'edit');
             include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateGUI.php';
             $did = new ilDidacticTemplateGUI($this);
             $this->ctrl->forwardCommand($did);
             break;
         case "ilcertificategui":
             $this->tabs_gui->activateTab("settings");
             $this->setSubTabs("properties");
             include_once "./Services/Certificate/classes/class.ilCertificateGUI.php";
             include_once "./Modules/Course/classes/class.ilCourseCertificateAdapter.php";
             $output_gui = new ilCertificateGUI(new ilCourseCertificateAdapter($this->object));
             $this->ctrl->forwardCommand($output_gui);
             break;
         case 'ilobjectservicesettingsgui':
             $this->ctrl->setReturn($this, 'edit');
             $this->setSubTabs("properties");
             $this->tabs_gui->activateTab('settings');
             $this->tabs_gui->acltivateSubTab('tool_settings');
             include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
             $service = new ilObjectServiceSettingsGUI($this, $this->object->getId(), array(ilObjectServiceSettingsGUI::CALENDAR_VISIBILITY));
             $this->ctrl->forwardCommand($service);
             break;
         case 'illoeditorgui':
             #$this->tabs_gui->clearTargets();
             #$this->tabs_gui->setBackTarget($this->lng->txt('back'),$this->ctrl->getLinkTarget($this,''));
             $this->tabs_gui->activateTab('crs_objectives');
             include_once './Modules/Course/classes/Objectives/class.ilLOEditorGUI.php';
             $editor = new ilLOEditorGUI($this->object);
             $this->ctrl->forwardCommand($editor);
             break;
         case 'ilcontainerstartobjectsgui':
             $this->ctrl->setReturn($this, 'edit');
             $this->tabs_gui->clearTargets();
             $this->tabs_gui->setBackTarget($this->lng->txt("back_to_crs_content"), $this->ctrl->getLinkTarget($this, "edit"));
             $this->tabs_gui->addTab("start", $this->lng->txt("crs_start_objects"), $this->ctrl->getLinkTargetByClass("ilcontainerstartobjectsgui", "listStructure"));
             include_once './Services/Container/classes/class.ilContainerStartObjectsGUI.php';
             $stgui = new ilContainerStartObjectsGUI($this->object);
             $this->ctrl->forwardCommand($stgui);
             break;
         case 'illomembertestresultgui':
             include_once './Modules/Course/classes/Objectives/class.ilLOMemberTestResultGUI.php';
             $GLOBALS['ilCtrl']->setReturn($this, 'members');
             $GLOBALS['ilTabs']->clearTargets();
             $GLOBALS['ilTabs']->setBackTarget($GLOBALS['lng']->txt('back'), $GLOBALS['ilCtrl']->getLinkTarget($this, 'members'));
             $result_view = new ilLOMemberTestResultGUI($this, $this->object, (int) $_REQUEST['uid']);
             $this->ctrl->forwardCommand($result_view);
             break;
         default:
             /*                if(!$this->creation_mode)
                             {
                                 $this->checkPermission('visible');
                             }*/
             /*
             if(!$this->creation_mode and !$ilAccess->checkAccess('visible','',$this->object->getRefId(),'crs'))
             {
                 $ilErr->raiseError($this->lng->txt("msg_no_perm_read"),$ilErr->MESSAGE);
             }
             */
             // #9401 - see also ilStartupGUI::_checkGoto()
             if ($cmd == 'infoScreenGoto') {
                 if (ilObjCourse::_isActivated($this->object->getId()) && ilObjCourse::_registrationEnabled($this->object->getId())) {
                     $cmd = 'join';
                 } else {
                     $cmd = 'infoScreen';
                 }
             }
             if (!$this->creation_mode) {
                 if ($cmd == "infoScreen") {
                     $this->checkPermission("visible");
                 } else {
                     //						$this->checkPermission("read");
                 }
             }
             if (!$this->creation_mode && $cmd != 'infoScreen' && $cmd != 'sendfile' && $cmd != 'unsubscribe' && $cmd != 'performUnsubscribe' && !$ilAccess->checkAccess("read", '', $this->object->getRefId()) || $cmd == 'join' || $cmd == 'subscribe') {
                 include_once './Modules/Course/classes/class.ilCourseParticipants.php';
                 if ($rbacsystem->checkAccess('join', $this->object->getRefId()) && !ilCourseParticipants::_isParticipant($this->object->getRefId(), $ilUser->getId())) {
                     include_once './Modules/Course/classes/class.ilCourseRegistrationGUI.php';
                     $this->ctrl->redirectByClass("ilCourseRegistrationGUI");
                 } else {
                     $this->infoScreenObject();
                     break;
                 }
             }
             if ($cmd == 'listObjectives') {
                 include_once './Modules/Course/classes/class.ilCourseObjectivesGUI.php';
                 $this->ctrl->setReturn($this, "");
                 $obj_gui =& new ilCourseObjectivesGUI($this->object->getRefId());
                 $ret =& $this->ctrl->forwardCommand($obj_gui);
                 break;
             }
             // Dirty hack for course timings view
             if ($this->forwardToTimingsView()) {
                 break;
             }
             if (!$cmd) {
                 $cmd = 'view';
             }
             $cmd .= 'Object';
             $this->{$cmd}();
             break;
     }
     $this->addHeaderAction();
     return true;
 }