예제 #1
0
파일: tutorials.php 프로젝트: rolwi/koala
     $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");
     if ($tutorial->get_workroom()->check_access_read($current_user)) {
         $content->setVariable("GROUPLINK", "<td><a href=\"" . $backlink . $tutorial->get_id() . "\"><b>" . $lms_tutorial->get_display_name() . "</b></a>" . " (" . $participant_mgmnt . ")" . "<br>" . h($result[$tnr[$tutorial->get_id()]["attributes"]]["OBJ_DESC"]) . "<br><small>" . h($result[$tnr[$tutorial->get_id()]["attributes"]]["TUTORIAL_LONG_DESC"]) . "</small></td>");
     } else {
         $content->setVariable("GROUPLINK", "<td><b>" . $lms_tutorial->get_display_name() . "</b>" . " (" . $participant_mgmnt . ")" . "<br>" . h($result[$tnr[$tutorial->get_id()]["attributes"]]["OBJ_DESC"]) . "<br><small>" . h($result[$tnr[$tutorial->get_id()]["attributes"]]["TUTORIAL_LONG_DESC"]) . "</small></td>");
     }
예제 #2
0
 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;
 }