} else { $nr_show = $no_tutorials; } $start = $portal->set_paginator($content, $nr_show, $no_tutorials, '(' . $paginator_text . ')', is_string($sort) ? '?sort=' . $sort : ''); if ($nr_show == $no_tutorials || $start + 10 > $no_tutorials) { $end = $no_tutorials; } else { $end = $start + 10; } $content->setVariable("LABEL_GROUPS", gettext("Tutorials for the course") . " " . h($course->get_attribute("OBJ_DESC")) . " (" . str_replace(array("%a", "%z", "%s"), array($start + 1, $end, $no_tutorials), gettext("%a-%z out of %s")) . ")"); $content->setVariable("LABEL_NAME_DESCRIPTION", gettext("Tutorial No, description, long description")); $content->setVariable("LABEL_MEMBERS", gettext("# lns")); $content->setVariable("LABEL_COMMUNICATION", gettext("Communication")); for ($i = $start; $i < $end; $i++) { $tutorial = $tutorials[$i]; $lms_tutorial = new koala_group_tutorial($tutorial); $password_protected = $result[$tnr[$tutorial->get_id()]["has_password"]]; if ($password_protected) { $participant_mgmnt = gettext("password protected tutorial"); } else { if ($lms_tutorial->is_moderated() && !$password_protected) { $participant_mgmnt = gettext("moderated tutorial"); } else { if ($lms_tutorial->is_private() && !$password_protected) { $participant_mgmnt = gettext("private tutorial"); } else { $participant_mgmnt = gettext("public tutorial"); } } } $content->setCurrentBlock("BLOCK_GROUP");
// broken access settings, and user doesn't have the permissions to fix it: $mailto = 'mailto:' . SUPPORT_EMAIL . '?subject=KoaLA:%20Invalid%20participant%20management&body=' . rawurlencode("\nLink: " . get_current_URL() . "\nCreator: " . $creator->get_identifier() . "\n"); $content->setCurrentBlock('BLOCK_ACCESSMERGEL'); $content->setVariable('LABEL_ACCESSMERGEL', str_replace('%MAILTO', $mailto, gettext("There is a problem with the access settings. Please <a href=\"%MAILTO\">contact the support team</a> to fix it by setting the access rights again."))); $content->parse('BLOCK_ACCESSMERGEL'); } else { if (!empty($values['access'])) { $current_access = $values['access']; } else { if (isset($tutorial)) { $current_access = $tutorial->get_attribute(KOALA_ACCESS); } else { $current_access = PERMISSION_TUTORIAL_MATERIALS_COURSE; } } $access = koala_group_tutorial::get_workroom_access_descriptions(); foreach ($access as $key => $array) { if ($key == PERMISSION_UNDEFINED && $current_access != PERMISSION_UNDEFINED) { continue; } $content->setCurrentBlock('ACCESS'); $content->setVariable('LABEL', $array['summary_short'] . ': ' . $array['label']); $content->setVariable('VALUE', $key); if ($key == $current_access) { $content->setVariable('CHECK', "checked=\"checked\""); } $content->parse('ACCESS'); } } $content->parse('BLOCK_ACCESS'); if (isset($tutorial)) {
<?php require_once PATH_EXTENSIONS . "tutorials/classes/koala_group_tutorial.class.php"; include_once PATH_LIB . "format_handling.inc.php"; if (!isset($portal) || !is_object($portal)) { $portal = lms_portal::get_instance(); $portal->initialize(GUEST_NOT_ALLOWED); } $current_user = $user = lms_steam::get_current_user(); $lms_tutorial = new koala_group_tutorial($tutorial); if (!$tutorial->get_workroom()->check_access_read($current_user)) { $headline = $lms_tutorial->get_link_path(); 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()) {
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; }