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; }
/** * Init member view * @return */ public function initMemberView() { include_once './Services/Container/classes/class.ilMemberViewSettings.php'; $settings = ilMemberViewSettings::getInstance(); if ($settings->isEnabled() and isset($_GET['mv'])) { $settings->toggleActivation((int) $_GET['ref_id'], (int) $_GET['mv']); } if (!$settings->isActive()) { $this->mem_view['active'] = false; $this->mem_view['items'] = array(); $this->mem_view['role'] = 0; } else { global $tree; $this->mem_view['active'] = true; $this->mem_view['items'] = $tree->getSubTreeIds($settings->getContainer()); $this->mem_view['items'] = array_merge($this->mem_view['items'], array($settings->getContainer())); include_once './Services/Membership/classes/class.ilParticipants.php'; $this->mem_view['role'] = ilParticipants::getDefaultMemberRole($settings->getContainer()); } return true; }
/** * add user * * @access protected * @param * @return */ protected function add() { global $ilUser, $tree, $ilCtrl; // TODO: language vars // set aggreement accepted $this->setAccepted(true); include_once './Modules/Course/classes/class.ilCourseWaitingList.php'; $free = max(0, $this->container->getSubscriptionMaxMembers() - $this->participants->getCountMembers()); $waiting_list = new ilCourseWaitingList($this->container->getId()); if ($this->container->isSubscriptionMembershipLimited() and $this->container->enabledWaitingList() and (!$free or $waiting_list->getCountUsers())) { $waiting_list->addToList($ilUser->getId()); $info = sprintf($this->lng->txt('crs_added_to_list'), $waiting_list->getPosition($ilUser->getId())); ilUtil::sendSuccess($info, true); $this->participants->sendNotification($this->participants->NOTIFY_SUBSCRIPTION_REQUEST, $ilUser->getId()); $this->participants->sendNotification($this->participants->NOTIFY_WAITING_LIST, $ilUser->getId()); $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $tree->getParentId($this->container->getRefId())); $ilCtrl->redirectByClass("ilrepositorygui", ""); } switch ($this->container->getSubscriptionType()) { case IL_CRS_SUBSCRIPTION_CONFIRMATION: $this->participants->addSubscriber($ilUser->getId()); $this->participants->updateSubscriptionTime($ilUser->getId(), time()); $this->participants->updateSubject($ilUser->getId(), ilUtil::stripSlashes($_POST['subject'])); $this->participants->sendNotification($this->participants->NOTIFY_SUBSCRIPTION_REQUEST, $ilUser->getId()); ilUtil::sendSuccess($this->lng->txt("application_completed"), true); $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $tree->getParentId($this->container->getRefId())); $ilCtrl->redirectByClass("ilrepositorygui", ""); break; default: if ($this->container->isSubscriptionMembershipLimited() && $this->container->getSubscriptionMaxMembers()) { $success = $GLOBALS['rbacadmin']->assignUserLimited(ilParticipants::getDefaultMemberRole($this->container->getRefId()), $ilUser->getId(), $this->container->getSubscriptionMaxMembers(), array(ilParticipants::getDefaultMemberRole($this->container->getRefId()))); if (!$success) { ilUtil::sendFailure($this->lng->txt('crs_subscription_failed_limit')); $this->show(); return FALSE; } } $this->participants->add($ilUser->getId(), IL_CRS_MEMBER); $this->participants->sendNotification($this->participants->NOTIFY_ADMINS, $ilUser->getId()); $this->participants->sendNotification($this->participants->NOTIFY_REGISTERED, $ilUser->getId()); include_once './Modules/Forum/classes/class.ilForumNotification.php'; ilForumNotification::checkForumsExistsInsert($this->container->getRefId(), $ilUser->getId()); if ($this->container->getType() == "crs") { $this->container->checkLPStatusSync($ilUser->getId()); } if (!$_SESSION["pending_goto"]) { ilUtil::sendSuccess($this->lng->txt("crs_subscription_successful"), true); $this->ctrl->returnToParent($this); } else { $tgt = $_SESSION["pending_goto"]; unset($_SESSION["pending_goto"]); ilUtil::redirect($tgt); } break; } }