include 'no_access.php'; exit; } $html_handler_course = new koala_html_course($course); $html_handler_course->set_context("tutorials", array('subcontext' => 'tutorial', 'tutorial' => $lms_tutorial)); if ($_SERVER["REQUEST_METHOD"] == "POST") { if (is_array($_POST["remove"])) { $id = key($_POST["remove"]); $member_to_kick = steam_factory::username_to_object($GLOBALS["STEAM"]->get_id(), $id); $tutorial->remove_member($member_to_kick); $portal->set_confirmation(str_replace("%NAME", h($member_to_kick->get_full_name()), gettext("User %NAME successfully removed from tutorial members."))); $cache = get_cache_function($tutorial->get_id(), CACHE_LIFETIME_STATIC); $cache->drop("lms_steam::group_get_members", $tutorial->get_id()); } } if ($lms_tutorial->is_password_protected()) { $participant_mgmnt = gettext("password protected tutorial"); } else { if ($lms_tutorial->is_moderated() && !$lms_tutorial->is_password_protected()) { $participant_mgmnt = gettext("moderated tutorial"); } else { if ($lms_tutorial->is_private() && !$lms_tutorial->is_password_protected()) { $participant_mgmnt = gettext("private tutorial"); } else { $participant_mgmnt = gettext("public tutorial"); } } } $content = new HTML_TEMPLATE_IT(); $content->loadTemplateFile(PATH_EXTENSIONS . "tutorials/templates/tutorial.template.html"); $content->setVariable("VALUE_CONTAINER_DESC", h($tutorial->get_attribute("OBJ_DESC")) . " (" . $participant_mgmnt . ")");
function get_context_menu($context, $params = array()) { if (!is_array($params) || !isset($params["owner"])) { throw new Exception("No 'owner' param provided.", E_PARAMETER); } $course = $params["owner"]; if (!$course instanceof koala_group_course) { throw new Exception("The 'owner' param is not a koala_group_course.", E_PARAMETER); } $subcontext = $context; if (isset($params["subcontext"])) { $subcontext = $params["subcontext"]; } $current_user = lms_steam::get_current_user(); $context_menu_entry = array(); $path = $course->get_url(); switch ($subcontext) { case "tutorials": if ($course->is_admin($current_user)) { $context_menu_entry = array(array("link" => $path . "tutorials/prefs", "name" => gettext("Preferences")), array("link" => $path . "tutorials/new", "name" => gettext("Create new tutorial"))); } break; case "tutorial": if ($course->is_member($current_user) || $course->is_admin($current_user)) { if (isset($GLOBALS["tutorial"]) && $GLOBALS["tutorial"]->get_workroom()->check_access_insert($current_user)) { if ($course->is_admin($current_user)) { $tutorial = new koala_group_tutorial($GLOBALS["tutorial"]); if ($tutorial->is_moderated() && !$tutorial->is_password_protected()) { $context_menu_entry = array(array("link" => $path . "tutorials/" . $GLOBALS["tutorial"]->get_id() . "/edit/", "name" => gettext("Preferences")), array("link" => $path . "tutorials/" . $GLOBALS["tutorial"]->get_id() . "/delete/", "name" => gettext("Delete")), array("link" => PATH_URL . "upload.php?env=" . $GLOBALS["tutorial"]->get_workroom()->get_id(), "name" => gettext("Upload learning material")), array("link" => PATH_URL . "group_add_member.php?group=" . $GLOBALS["tutorial"]->get_id(), "name" => gettext("Add learner")), array("link" => $path . "tutorials/" . $GLOBALS["tutorial"]->get_id() . "/requests/", "name" => gettext("Manage membership requests"))); } else { $context_menu_entry = array(array("link" => $path . "tutorials/" . $GLOBALS["tutorial"]->get_id() . "/edit/", "name" => gettext("Preferences")), array("link" => $path . "tutorials/" . $GLOBALS["tutorial"]->get_id() . "/delete/", "name" => gettext("Delete")), array("link" => PATH_URL . "upload.php?env=" . $GLOBALS["tutorial"]->get_workroom()->get_id(), "name" => gettext("Upload learning material")), array("link" => PATH_URL . "group_add_member.php?group=" . $GLOBALS["tutorial"]->get_id(), "name" => gettext("Add learner"))); } } else { if ($course->is_member($current_user)) { $context_menu_entry = array(array("link" => PATH_URL . "upload.php?env=" . $GLOBALS["tutorial"]->get_workroom()->get_id(), "name" => gettext("Upload learning material"))); } } } } break; } return $context_menu_entry; }