示例#1
0
 function test_groupname_to_object()
 {
     $steam_group = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), "steam");
     $this->assertTrue(is_object($steam_group));
     $this->assertTrue($steam_group instanceof steam_group);
     $this->assertTrue($steam_group->get_name() === "sTeam");
 }
 public function initialize()
 {
     $profile_object = steam_factory::create_object($GLOBALS["STEAM"]->get_id(), "networking profile", CLASS_OBJECT);
     $all_user = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), STEAM_ALL_USER);
     $profile_object->set_sanction_all($all_user);
     $guestbook = steam_factory::create_messageboard($GLOBALS["STEAM"]->get_id(), "guestbook", FALSE, "guestbook of " . $this->steam_user->get_attribute("USER_FIRSTNAME") . " " . $this->steam_user->get_attribute("USER_FULLNAME"));
     $guestbook->set_read_access($all_user);
     $guestbook->set_annotate_access($all_user, TRUE);
     $profile_object->set_attribute("LLMS_GUESTBOOK", $guestbook);
     $this->steam_user->set_attribute("LLMS_NETWORKING_PROFILE", $profile_object);
     $this->profile_object = $profile_object;
 }
示例#3
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $path = $this->params;
     $portal = \lms_portal::get_instance();
     $user = \lms_steam::get_current_user();
     if (!\lms_steam::is_steam_admin($user)) {
         //TODO: REDIRECT!!
     }
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $values = $_POST["values"];
         $start_date = iso_to_unix($values["start"]);
         $end_date = iso_to_unix($values["end"]);
         // TODO PROBLEM CHECKING MISSING
         $courses = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), STEAM_COURSES_GROUP, CLASS_GROUP);
         $all_user = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), STEAM_ALL_USER);
         $new_semester = \steam_factory::create_group($GLOBALS["STEAM"]->get_id(), $values["name"], $courses, FALSE, $values["desc"]);
         $new_semester_admins = \steam_factory::create_group($GLOBALS["STEAM"]->get_id(), "admins", $new_semester, FALSE, "admin group for " . $values["desc"]);
         $new_semester_admins->set_attribute("OBJ_TYPE", "semester_admins");
         $new_semester_admins->add_member($user);
         $new_semester->set_insert_access($new_semester_admins, TRUE);
         $new_semester->set_read_access($all_user, TRUE);
         $new_semester->set_attributes(array("SEMESTER_START_DATE" => $start_date, "SEMESTER_END_DATE" => $end_date));
         // CACHE ZURÜCKSETZEN
         $cache = get_cache_function("ORGANIZATION");
         $cache->drop("lms_steam::get_semesters");
         header("Location: " . PATH_URL . "semester/index/" . $values["name"] . "/all");
     }
     $content = \Semester::getInstance()->loadTemplate("semester_create.template.html");
     $content->setVariable("INFO_TEXT", gettext("So, you want to start a new semester?") . " " . gettext("Please fill out the requested values on the right.") . "<br/><br/>" . str_replace("%SEMESTER", STEAM_CURRENT_SEMESTER, gettext("And don't forget to reset the current semester in the etc/koala.def.php, which is <b>%SEMESTER</b> at the moment.")));
     $content->setVariable("LABEL_NAME", gettext("Shortname"));
     $content->setVariable("INFO_NAME", gettext("IMPORTANT: Don't use any slashes, commas or dots in this name. Keep it short, like 'WS0607' or 'SS06'."));
     $content->setVariable("LABEL_DESC", gettext("Name"));
     $content->setVariable("INFO_DESC", gettext("Examples: 'Wintersemester 06/07', or 'Sommersemester 2006'"));
     $content->setVariable("LABEL_START_DATE", gettext("Starting date of semester"));
     $content->setVariable("LABEL_END_DATE", gettext("Ending date of semester"));
     $content->setVariable("INFO_DATE_FORMAT", gettext("Please type in the date in the following format: YYYY-MM-DD"));
     $content->setVariable("LABEL_CREATE", gettext("Create Semester"));
     /* TODO: Portal anpassen
     		$portal->set_page_main(
     			array(array("link" => PATH_URL.SEMESTER_URL."/", "name" => gettext("Semester")), array("link" => "", "name" => gettext("Create new"))),
     			$content->get(),
     			""
     		);
     		*/
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
示例#4
0
function get_comment_html($document, $url)
{
    $cache = get_cache_function($document->get_id(), 600);
    $user = lms_steam::get_current_user();
    $write_access = $document->check_access(SANCTION_ANNOTATE, $user);
    $template = new HTML_TEMPLATE_IT();
    $template->loadTemplateFile(PATH_TEMPLATES . "comments.template.html");
    $headline = gettext("Add your comment");
    if ($_SERVER["REQUEST_METHOD"] == "POST" && $write_access) {
        $values = $_POST["values"];
        if (!empty($values["preview_comment"])) {
            $template->setCurrentBlock("BLOCK_PREVIEW_COMMENT");
            $template->setVariable("TEXT_COMMENT", $values["comment"]);
            $template->setVariable("PREVIEW", gettext("Preview"));
            $template->setVariable("POST_COMMENT", gettext("Post comment"));
            $template->setVariable("LABEL_PREVIEW_YOUR_COMMENT", gettext("Preview your comment"));
            $template->setVariable("VALUE_PREVIEW_COMMENT", get_formatted_output($values["comment"]));
            $template->parse("BLOCK_PREVIEW_COMMENT");
            $headline = gettext("Change it?");
        }
        if (!empty($values["submit_comment"]) && !empty($values["comment"])) {
            $new_comment = steam_factory::create_textdoc($GLOBALS["STEAM"]->get_id(), $user->get_name() . "-" . time(), $values["comment"]);
            $all_user = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), STEAM_ALL_USER);
            $new_comment->set_acquire($document);
            $new_comment->set_read_access($all_user);
            $document->add_annotation($new_comment);
            $cache->drop("lms_steam::get_annotations", $document->get_id());
        }
    }
    $comments = $cache->call("lms_steam::get_annotations", $document->get_id());
    if (count($comments) > 0) {
        $template->setVariable("LABEL_COMMENTS", gettext("comments"));
    }
    $comments = array_reverse($comments);
    //reverse comment order (oldest first)
    foreach ($comments as $comment) {
        $obj_comment = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $comment["OBJ_ID"]);
        $template->setCurrentBlock("BLOCK_ANNOTATION");
        $template->setVariable("COMMENT_ID", $comment["OBJ_ID"]);
        $template->setVariable("AUTHOR_LINK", PATH_URL . "user/" . $comment["OBJ_CREATOR_LOGIN"] . "/");
        $template->setVariable("AUTHOR_NAME", $comment["OBJ_CREATOR"]);
        $template->setVariable("IMAGE_LINK", PATH_URL . "get_document.php?id=" . $comment["OBJ_ICON"]);
        $template->setVariable("LABEL_SAYS", gettext("says"));
        $template->setVariable("ANNOTATION_COMMENT", get_formatted_output($comment["CONTENT"], 80, "\n"));
        $template->setVariable("HOW_LONG_AGO", how_long_ago($comment["OBJ_CREATION_TIME"]));
        $template->setVariable('LINK_PERMALINK', $url . '/#comment' . $comment['OBJ_ID']);
        $template->setVariable("LABEL_PERMALINK", gettext("permalink"));
        if ($obj_comment->check_access_write($user)) {
            $template->setCurrentBlock("BLOCK_OWN_COMMENT");
            $template->setVariable("LINK_DELETE", $url . "/deletecomment" . $comment["OBJ_ID"] . "/");
            $template->setVariable("LABEL_DELETE", gettext("delete"));
            $template->setVariable("LINK_EDIT", $url . "/editcomment" . $comment["OBJ_ID"] . "/");
            $template->setVariable("LABEL_EDIT", gettext("edit"));
            $template->parse("BLOCK_OWN_COMMENT");
        }
        $template->parse("BLOCK_ANNOTATION");
    }
    if ($write_access) {
        $template->setCurrentBlock("BLOCK_ADD_COMMENT");
        $template->setVariable("LABEL_ADD_YOUR_COMMENT", $headline);
        $template->setVariable("LABEL_PREVIEW", gettext("Preview"));
        $template->setVariable("LABEL_OR", gettext("or"));
        $template->setVariable("LABEL_COMMENT", gettext("Add comment"));
        $template->setVariable("LABEL_BB_BOLD", gettext("B"));
        $template->setVariable("HINT_BB_BOLD", gettext("boldface"));
        $template->setVariable("LABEL_BB_ITALIC", gettext("I"));
        $template->setVariable("HINT_BB_ITALIC", gettext("italic"));
        $template->setVariable("LABEL_BB_UNDERLINE", gettext("U"));
        $template->setVariable("HINT_BB_UNDERLINE", gettext("underline"));
        $template->setVariable("LABEL_BB_STRIKETHROUGH", gettext("S"));
        $template->setVariable("HINT_BB_STRIKETHROUGH", gettext("strikethrough"));
        $template->setVariable("LABEL_BB_IMAGE", gettext("IMG"));
        $template->setVariable("HINT_BB_IMAGE", gettext("image"));
        $template->setVariable("LABEL_BB_URL", gettext("URL"));
        $template->setVariable("HINT_BB_URL", gettext("web link"));
        $template->setVariable("LABEL_BB_MAIL", gettext("MAIL"));
        $template->setVariable("HINT_BB_MAIL", gettext("email link"));
        $template->parse("BLOCK_ADD_COMMENT");
    }
    return $template->get();
}
示例#5
0
 public static function get_menu_html($cacheid, $is_logged_in)
 {
     $koala_html_menu = new koala_html_menu();
     if ($is_logged_in) {
         $user = lms_steam::get_current_user();
         // HOME
         // removed for version 1_5
         //$koala_html_menu->add_menu_entry( array( "name" => gettext( "Home" ), "link" => PATH_URL ) );
         // YOU
         if (YOU_MENU) {
             $koala_html_menu->add_menu_entry(array("name" => MENU_YOU ? gettext("You") : $user->get_attribute("USER_FIRSTNAME") . " " . $user->get_attribute("USER_FULLNAME"), "link" => PATH_URL . "desktop/", "menu" => array(YOUR_DESKTOP ? array("name" => MENU_YOU ? gettext("Your desktop") : "Schreibtisch", "link" => PATH_URL . "desktop/") : "", YOUR_PORTFOLIO ? array("name" => MENU_YOU ? "Mein Portfolio" : "Portfolio", "link" => PATH_URL . "portfolio/") : "", YOUR_DOCUMENTS ? array("name" => MENU_YOU ? gettext("Your documents") : "Dokumente", "link" => PATH_URL . "explorer/") : "", YOUR_PROFILE ? array("name" => MENU_YOU ? gettext("Your profile") : "Profil", "link" => PATH_URL . "user/index/" . $user->get_name() . "/") : "", YOUR_BOOKMARKS ? array("name" => MENU_YOU ? gettext("Meine Lesezeichen") : "Lesezeichen", "link" => PATH_URL . "bookmarks/") : "", YOUR_SCHOOLBOOKMARKS ? array("name" => MENU_YOU ? gettext("Meine Schul-Lesezeichen") : "Schul-Lesezeichen", "link" => PATH_URL . "school/") : "", YOUR_CONTACTS ? array("name" => MENU_YOU ? gettext("Your contacts") : "Kontakte") : "", YOUR_MOKODESK && $user->get_attribute("LARS_DESKTOP") !== 0 ? array("name" => MENU_YOU ? gettext("Mein MokoDesk") : "MokoDesk", "link" => MOKODESK_URL) : "")));
         }
         // COURSES
         if (YOUR_COURSES) {
             $scg = null;
             if (defined("STEAM_COURSES_GROUP")) {
                 $scg = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), STEAM_COURSES_GROUP, CLASS_GROUP);
             }
             if ($scg instanceof steam_group) {
                 $current_semester = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $scg->get_groupname() . "." . STEAM_CURRENT_SEMESTER);
                 if (!is_object($current_semester)) {
                     throw new Exception("cant find current_semester. please check setting of CURRENT_SEMESTER in koala.def.php", E_CONFIGURATION);
                 }
                 $cache = get_cache_function($user->get_name());
                 $courses = $cache->call("lms_steam::user_get_booked_courses", $user->get_id());
                 //COURSES SUBMENU
                 $submenu = array(YOUR_COURSES ? array("name" => gettext("Your courses"), "link" => PATH_URL . SEMESTER_URL . "/?filter=booked") : "", ALL_COURSES && (!ADMIN_ONLY_ALL_COURSES || ADMIN_ONLY_ALL_COURSES && lms_steam::is_koala_admin($user)) ? array("name" => gettext("Browse courses"), "link" => PATH_URL . SEMESTER_URL . "/") : "");
                 if (count($courses) > 0) {
                     $submenu[] = koala_html_menu::get_separator();
                 }
                 foreach ($courses as $course) {
                     $submenu[] = array("name" => $course["COURSE_NAME"], "link" => $course["COURSE_LINK"]);
                 }
                 if (COURSES_MENU) {
                     if (ADD_COURSE) {
                         $koala_html_menu->add_menu_entry(array("name" => gettext("Courses"), "link" => PATH_URL . SEMESTER_URL . "/?filter=booked", "menu" => $submenu));
                     } else {
                         $koala_html_menu->add_menu_entry(array("name" => gettext("Courses"), "menu" => $submenu));
                     }
                 }
             }
         }
         // CONTACTS
         if (CONTACTS_MENU) {
             $koala_html_menu->add_menu_entry(array("name" => gettext("Contacts"), "link" => PATH_URL . "user/" . $user->get_name() . "/contacts/", "menu" => array(YOUR_CONTACTS ? array("name" => gettext("Contact list"), "link" => PATH_URL . "user/" . $user->get_name() . "/contacts/") : "", PROFILE_VISITORS ? array("name" => gettext("Visitors of your profile"), "link" => PATH_URL . "profile_visitors.php") : "", USER_SEARCH ? koala_html_menu::get_separator() : "", USER_SEARCH ? array("name" => gettext("Find people"), "link" => PATH_URL . "search/people/") : "")));
         }
         // GROUPS
         if (YOUR_GROUPS) {
             $submenu = array(YOUR_GROUPS ? array("name" => gettext("Your groups"), "link" => PATH_URL . "user/" . $user->get_name() . "/groups/") : "", BROWSE_GROUPS ? array("name" => gettext("Browse groups"), "link" => PATH_URL . "groups/") : "", CREATE_GROUPS ? array("name" => gettext("Create group"), "link" => PATH_URL . "groups_create.php") : "");
             $cache = get_cache_function($user->get_name(), 86400);
             $groups = $cache->call("lms_steam::user_get_groups", $user->get_name(), FALSE);
             usort($groups, "sort_objects");
             if (count($groups) > 0) {
                 $submenu[] = koala_html_menu::get_separator();
             }
             foreach ($groups as $usergroup) {
                 $submenu[] = array("name" => $usergroup["OBJ_NAME"], "link" => $usergroup["GROUP_LINK"]);
             }
             if (GROUPS_MENU) {
                 $koala_html_menu->add_menu_entry(array("name" => gettext("Groups"), "link" => PATH_URL . "user/" . $user->get_name() . "/groups/", "menu" => $submenu));
             }
         }
         // additional platform menus
         $menus = json_decode(PLATFROM_MENUS, true);
         if (!is_array($menus)) {
             $menus = array();
         }
         foreach ($menus as $menu) {
             $koala_html_menu->add_menu_entry($menu);
         }
         $extensions = ExtensionMaster::getInstance()->getExtensionByType("IMenuExtension");
         foreach ($extensions as $extension) {
             $entries = $extension->getMenuEntries();
             if (isset($entries) && is_array($entries)) {
                 foreach ($entries as $entry) {
                     $koala_html_menu->add_menu_entry($entry);
                 }
             }
         }
         // EXTRAS removed for Version 1_5
         /*
         $koala_html_menu->add_menu_entry( array( "name" => gettext( "Extras" ), "link" => PATH_URL . "downloads/", "menu" => array(
         	// SUBMENUS EXTRAS
         	array( "name" => gettext( "Downloads" ), "link" => PATH_URL . "downloads/" ),
         	array( "name" => gettext( "More information"), "link" => PATH_URL ),
         	koala_html_menu::get_separator(),
         	array( "name" => gettext( "Help"), "link" => HELP_URL )
         ) ) );
         */
     } else {
         //removed for version 1_5
         //$koala_html_menu->add_menu_entry( array( "name" => gettext( "Home" ), "link" => PATH_URL ) );
         //$koala_html_menu->add_menu_entry( array( "name" => gettext( "Sign in" ), "link" => PATH_URL . "sign_in.php" ) );
         //$koala_html_menu->add_menu_entry( array( "name" => gettext( "Downloads" ), "link" => PATH_URL . "downloads/" ) );
         //$koala_html_menu->add_menu_entry(array("name" => " ", "link" => "#"));
         return "<div id='menu'></div>";
     }
     return $koala_html_menu->get_html();
 }
示例#6
0
文件: rights.php 项目: rolwi/koala
$login_user = $steam->get_login_user();
$login_user_id = $login_user->get_id();
$login_user_groups = $login_user->get_groups();
foreach ($login_user_groups as $login_user_group) {
    $login_user_group_ids[] = $login_user_group->get_id();
}
$is_author = $rights->check_access_edit($login_user, $login_user_group_ids);
if (!$is_author || count($answer_folder->get_inventory()) > 0 || $owner_id != $login_user_id) {
    //Disconnect & close
    $steam->disconnect();
    die("<html>\n<body onload='javascript:window.close();'>\n</body>\n</html>");
}
//get questionary name
$questionary_name = $questionary->get_name();
//get groups from user
$groups = array(steam_factory::groupname_to_object($steam, "everyone"));
$groups_tmp = $owner->get_groups();
if (is_array($groups_tmp)) {
    $groups = array_merge($groups, $groups_tmp);
}
//get favourites from user
$favourites = $owner->get_buddies();
if (!is_array($favourites)) {
    $favourites = array();
}
//save changes
$all = array_merge($groups, $favourites);
if ($mission == "save") {
    //get the right arrays
    $post = $_POST;
    $publish = isset($post["publish"]) ? $post["publish"] : array();
示例#7
0
 public function set_group_access($access = -1, $admins = 0, $access_attribute_key = KOALA_GROUP_ACCESS)
 {
     if ($access == PERMISSION_GROUP_UNDEFINED) {
         return "";
     }
     $all_users = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), STEAM_ALL_USER);
     $world_users = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), "Everyone");
     $group = $this->get_steam_group();
     $workroom = $group->get_workroom();
     // Generally reset access rights here to be able to repair access rights on older groups
     // Re-Set access rights for non members
     $group->set_sanction($all_users, 0);
     $group->set_sanction($world_users, 0);
     $workroom->set_sanction($all_users, 0);
     $workroom->set_sanction($world_users, 0);
     // if admin group set, give access to admins
     if (is_object($admins)) {
         $admins->set_sanction_all($admins);
         $admins->sanction_meta(SANCTION_ALL, $admins);
         $group->set_sanction_all($admins);
         $group->sanction_meta(SANCTION_ALL, $admins);
         $workroom->set_sanction_all($admins);
         $workroom->sanction_meta(SANCTION_ALL, $admins);
     }
     // Disable acquiring
     $group->set_acquire(FALSE);
     switch ($access) {
         case PERMISSION_GROUP_PRIVATE:
             // Nothing to do
             break;
         case PERMISSION_GROUP_PUBLIC_FREEENTRY:
             $group->set_insert_access($world_users, TRUE);
             $group->set_read_access($world_users, TRUE);
             $group->set_insert_access($all_users, TRUE);
             $workroom->set_read_access($all_users, TRUE);
             break;
         case PERMISSION_GROUP_PUBLIC_PASSWORD:
             $group->set_insert_access($world_users, FALSE);
             $group->set_read_access($world_users, FALSE);
             $group->set_insert_access($all_users, FALSE);
             $workroom->set_read_access($all_users, TRUE);
             break;
         case PERMISSION_GROUP_PUBLIC_CONFIRMATION:
             $group->set_insert_access($world_users, FALSE);
             $group->set_read_access($world_users, FALSE);
             $group->set_insert_access($all_users, FALSE);
             $workroom->set_read_access($all_users, TRUE);
             break;
         default:
             throw new Exception("try to set invalid access on group access=" . $access, E_PARAMETER);
             break;
     }
     $group->set_attribute($access_attribute_key, $access);
 }
示例#8
0
}
$user = lms_steam::get_current_user();
$cache = get_cache_function($user->get_name(), 600);
$cache->drop("lms_steam::user_count_unread_mails", $user->get_name());
$portal->set_page_title(gettext("Message"));
$content = new HTML_TEMPLATE_IT();
$content->loadTemplateFile(PATH_TEMPLATES . "messages_read.template.html");
$mail_headers = $message->get_attribute("MAIL_MIMEHEADERS");
if (!is_array($mail_headers)) {
    $mail_headers = array();
}
if (array_key_exists("X-Steam-Group", $mail_headers)) {
    $groupname = $mail_headers["X-Steam-Group"];
    $content->setCurrentBlock("BLOCK_GROUP");
    $content->setVariable("LABEL_TO", gettext("To"));
    if ($group = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $groupname)) {
        $content->setVariable("VALUE_GROUP", "<a href=\"" . PATH_URL . "groups/" . $group->get_id() . "/members/\">" . $group->get_name() . "</a>");
    } else {
        $content->setVariable("VALUE_GROUP", h($groupname));
    }
    $content->parse("BLOCK_GROUP");
}
$message_sender_html = "";
if ($is_sent) {
    $content->setVariable("LABEL_FROM", gettext("To"));
    // construct the HTML output for the field "receiver"
    $mailto = $message->get_attribute("mailto");
    if (!is_array($mailto)) {
        $mailto = array($mailto);
    }
    $message_sender_html_buffer = "";
示例#9
0
 /**
  * function get-user:
  *
  * Returns a steam_user instance by its login-name
  *
  * @param steam_connector $pSteamConnector connection to sTeam-server
  * @param string $pGroupName group name
  * @param Boolean $pBuffer Send now or buffer request?
  * @return steam_user the user object
  */
 public static function get_group($pSteamConnectorID, $pGroupName, $pBuffer = 0)
 {
     if (!is_string($pSteamConnectorID)) {
         throw new ParameterException("pSteamConnectorID", "string");
     }
     return steam_factory::groupname_to_object($pSteamConnectorID, $pGroupName, $pBuffer);
 }
示例#10
0
 if (is_object($tutorial)) {
     $tutorial_steam_group = $tutorial->get_steam_object();
     if (!$sizeproblems && isset($max_members) && $max_members > 0 && $max_members < $tutorial_steam_group->count_members()) {
         $problems .= gettext("Cannot set max number of participants.") . " ";
         $hints .= str_replace("%ACTUAL", $tutorial_steam_group->count_members(), str_replace("%CHOSEN", $max_members, gettext("You chose to limit your tutorial's max number of participants to %CHOSEN but your tutorial already has %ACTUAL participants. If you want to set the max number of participants below %ACTUAL you have to remove some participants first."))) . " ";
     }
 }
 if (empty($problems)) {
     if ((int) $values['membership'] == PERMISSION_TUTORIAL_PRIVATE) {
         $tutorial_private = 'TRUE';
     } else {
         $tutorial_private = 'FALSE';
     }
     if (!isset($tutorial)) {
         // create new tutorial:
         $tutorial_steam_group = steam_factory::groupname_to_object($GLOBALS['STEAM']->get_id(), $course->get_groupname() . '.learners')->create_subgroup('' . $tutorial_no, FALSE, $values['dsc']);
         $tutorial_steam_group->set_attributes(array('TUTORIAL_PRIVATE' => $tutorial_private, 'TUTORIAL_LONG_DESC' => $values['long_dsc'], 'TUTORIAL_TUTOR' => $values['tutor'], 'TUTORIAL_MAX_LEARNERS' => $values['max_learners'], 'GROUP_MAXSIZE' => (int) $values['max_learners'], 'OBJ_TYPE' => 'group_tutorial_koala'));
         $koala_tutorial = new koala_group_tutorial($tutorial_steam_group);
     } else {
         // update existing tutorial:
         $just_edit = TRUE;
         $tutorial_steam_group = $tutorial->get_steam_object();
         $koala_tutorial = $tutorial;
         $attrs = $tutorial_steam_group->get_attributes(array(OBJ_DESC, 'TUTORIAL_PRIVATE', 'TUTORIAL_LONG_DESC', 'TUTORIAL_TUTOR', 'TUTORIAL_MAX_LEARNERS', 'GROUP_MAXSIZE'));
         $changes = array();
         if ($attrs[OBJ_DESC] != $values['dsc']) {
             $changes[OBJ_DESC] = $values['dsc'];
         }
         if ($attrs['TUTORIAL_PRIVATE'] != $tutorial_private) {
             $changes['TUTORIAL_PRIVATE'] = $tutorial_private;
         }
示例#11
0
echo "Gastanmeldung......";
$steam = new steam_connector(STEAM_SERVER, STEAM_PORT, STEAM_ROOT_LOGIN, STEAM_ROOT_PW);
$GLOBALS["STEAM"] = $steam;
$steam_user = $steam->get_current_steam_user();
echo $steam_user->get_name();
echo "<span style=\"color:green;font-size:small\">erfolgreich</span><br />";
if (!$steam || !$steam->get_login_status()) {
    print "No server connection!";
    exit;
}
echo "connection data<br />";
echo "server: " . STEAM_SERVER . ":" . STEAM_PORT . "<br />";
echo "PublicGroups: " . steam_factory::groupname_to_object($steam->get_id(), "PublicGroups")->get_id() . "<br />";
echo "PrivGroups: " . steam_factory::groupname_to_object($steam->get_id(), "PrivGroups")->get_id() . "<br />";
echo "Faculties: " . steam_factory::groupname_to_object($steam->get_id(), "Faculties")->get_id() . "<br />";
echo "Courses: " . steam_factory::groupname_to_object($steam->get_id(), "Courses")->get_id() . "<br />";
echo "Prüfe STEAM_PUBLIC_GROUP.......";
if (defined("STEAM_PUBLIC_GROUP") && STEAM_PUBLIC_GROUP != "") {
    check_steam_group(STEAM_PUBLIC_GROUP);
    //	try {
    //		$steam_public_group = steam_factory::get_object($steam->get_id(), STEAM_PUBLIC_GROUP);
    //	} catch (Exception $e) {
    //		echo "<span style=\"color:red;font-size:small\">STEAM_PUBLIC_GROUP falsch</span><br />";
    //		$steam_public_group = steam_factory::groupname_to_object( $steam->get_id(), "PublicGroups" );
    //		if ($steam_public_group != 0 && $steam_public_group instanceof steam_group) {
    //			echo "STEAM_PUBLIC_GROUP should be: " . $steam_public_group->get_id();
    //		} else {
    //			echo "create a public group e.g. PublicGroups and set id to STEAM_PUBLIC_GROUP in config file";
    //		}
    //		exit;
    //	}
示例#12
0
 public function set_access($access = -1, $learners = 0, $staff = 0, $admins = 0, $access_attribute_key = KOALA_GROUP_ACCESS, $a = 0, $b = 0)
 {
     if ($access == PERMISSION_UNDEFINED) {
         return "";
     }
     if (!is_object($learners)) {
         throw new Exception("learners is no group object", E_PARAMETER);
     }
     if (!is_object($staff)) {
         throw new Exception("staff is no group object", E_PARAMETER);
     }
     if ($access < 0) {
         throw new Exception("access key must be greater than zero", E_PARAMETER);
     }
     $all_users = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), STEAM_ALL_USER);
     $world_users = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), "Everyone");
     // Generally reset access rights here to be able to repair access rights on older courses
     $staff->set_sanction_all($staff);
     $staff->sanction_meta(SANCTION_ALL, $staff);
     $learners->set_sanction_all($staff);
     $learners->sanction_meta(SANCTION_ALL, $staff);
     $this->steam_object->set_sanction_all($staff);
     $this->steam_object->sanction_meta(SANCTION_ALL, $staff);
     if (is_object($admins)) {
         $admins->set_sanction_all($admins);
         $admins->sanction_meta(SANCTION_ALL, $admins);
         $staff->set_sanction_all($admins);
         $staff->sanction_meta(SANCTION_ALL, $admins);
         $learners->set_sanction_all($admins);
         $learners->sanction_meta(SANCTION_ALL, $admins);
         $this->steam_object->set_sanction_all($admins);
         $this->steam_object->sanction_meta(SANCTION_ALL, $admins);
     }
     // Disable acquiring
     $learners->set_acquire(FALSE);
     switch ($access) {
         case PERMISSION_COURSE_PAUL_SYNC:
             $learners->set_insert_access($all_users, FALSE);
             $learners->set_insert_access($world_users, FALSE);
             $learners->set_read_access($world_users, FALSE);
             break;
         case PERMISSION_COURSE_HISLSF:
             // Set Access in Case of HIS Sync as before
             // TODO: Check if SANCTION_INSERT is required for group sTeam in case of LSF Sync because this may be used to get into the koala-course via the backend
             //$learners->set_insert_access( $all_users, TRUE );
             $learners->set_insert_access($all_users, FALSE);
             $learners->set_insert_access($world_users, FALSE);
             $learners->set_read_access($world_users, FALSE);
             $access = PERMISSION_COURSE_HISLSF;
             break;
         case PERMISSION_COURSE_PASSWORD:
             $learners->set_insert_access($all_users, FALSE);
             $learners->set_insert_access($world_users, FALSE);
             $learners->set_read_access($world_users, FALSE);
             break;
         case PERMISSION_COURSE_CONFIRMATION:
             $learners->set_insert_access($world_users, FALSE);
             $learners->set_read_access($world_users, FALSE);
             $learners->set_insert_access($all_users, FALSE);
             break;
         case PERMISSION_COURSE_PUBLIC:
             $learners->set_insert_access($world_users, TRUE);
             $learners->set_read_access($world_users, TRUE);
             $learners->set_insert_access($all_users, TRUE);
             break;
         default:
             throw new Exception("try to set invalid access on course access=" . $access, E_PARAMETER);
             break;
     }
     $this->set_attribute($access_attribute_key, $access);
 }
示例#13
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $path = $this->params;
     $portal = \lms_portal::get_instance();
     $user = \lms_steam::get_current_user();
     if (isset($path[0])) {
         if (\steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), "courses." . $path[0]) instanceof \steam_group) {
             $current_semester = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), "courses." . $path[0]);
         } else {
             header("Location: " . PATH_URL . "404/");
             die;
         }
     } else {
         $current_semester = \lms_steam::get_current_semester();
     }
     $current_semester_name = $current_semester->get_name();
     if (\lms_steam::is_steam_admin($user)) {
         if (!$portal->get_user()->is_logged_in()) {
             throw new Exception("Access denied. Please login.", E_USER_AUTHORIZATION);
         }
         $semester_admins = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $current_semester->get_groupname() . ".admins");
         $admin_group = new \koala_group_default($semester_admins);
         if ($_SERVER["REQUEST_METHOD"] == "POST") {
             $delete = $_POST["delete"];
             if (count($delete) == 1) {
                 $login = key($delete);
                 $admin = \steam_factory::username_to_object($GLOBALS["STEAM"]->get_id(), $login);
                 $admin_group->remove_member($admin);
             }
         }
         $content = \Semester::getInstance()->loadTemplate("semester_admins.template.html");
         $content->setVariable("INFORMATION_ADMINS", str_replace("%SEMESTER", h($current_semester->get_attribute("OBJ_DESC")), gettext("These people are allowed to create courses for %SEMESTER.")) . " " . gettext("They can appoint other users as staff members/moderators for their own courses."));
         $content->setVariable("LINK_ADD_ADMIN", PATH_URL . "semester/addAdmin/" . $current_semester_name . "/" . $admin_group->get_id());
         $content->setVariable("LABEL_ADD_ADMIN", gettext("Add another admin"));
         //TODO: Messages extension schreiben
         // TODO: Passt der Link?
         $content->setVariable("LINK_MESSAGE", PATH_URL . "mail/write/" . $admin_group->get_id());
         $content->setVariable("LABEL_MESSAGE_ADMINS", gettext("Mail to admins"));
         $admins = $admin_group->get_members();
         $no_admins = count($admins);
         if ($no_admins > 0) {
             $content->setVariable("LABEL_ADMINS", gettext("Course admins"));
             $content->setCurrentBlock("BLOCK_CONTACT_LIST");
             $content->setVariable("LABEL_NAME_POSITION", gettext("Name") . "/" . gettext("Position"));
             $content->setVariable("LABEL_SUBJECT_AREA", gettext("Subject area"));
             $content->setVariable("LABEL_COMMUNICATION", gettext("Communication"));
             $content->setVariable("LABEL_REMOVE_ADMIN", gettext("Action"));
             foreach ($admins as $admin) {
                 $adm_attributes = $admin->get_attributes(array("USER_FIRSTNAME", "USER_FULLNAME", "OBJ_DESC", "OBJ_ICON"));
                 $content->setCurrentBlock("BLOCK_CONTACT");
                 $content->setVariable("CONTACT_NAME", h($adm_attributes["USER_FIRSTNAME"]) . " " . h($adm_attributes["USER_FULLNAME"]));
                 // TODO: Profile Image einfügen
                 // TODO: Passt der Link?
                 $icon_link = \lms_user::get_user_image_url(30, 40);
                 $content->setVariable("CONTACT_IMAGE", $icon_link);
                 // TODO: Passt der Link?
                 $content->setVariable("CONTACT_LINK", PATH_URL . "user/" . $admin->get_name() . "/");
                 $content->setVariable("OBJ_DESC", h($adm_attributes["OBJ_DESC"]));
                 $content->setVariable("LABEL_MESSAGE", gettext("Message"));
                 // TODO: Passt der Link?
                 $content->setVariable("LINK_SEND_MESSAGE", PATH_URL . "mail/write/" . $admin->get_name());
                 $content->setVariable("LABEL_SEND", gettext("Send"));
                 $content->setVariable("LABEL_REMOVE", gettext("Remove"));
                 $content->setVariable("CONTACT_ID", $admin->get_name());
                 $content->parse("BLOCK_CONTACT");
             }
             $content->parse("BLOCK_CONTACT_LIST");
         } else {
             $content->setVariable("LABEL_ADMINS", gettext("No admins found."));
         }
         /* TODO: Portal anpassen
         			$portal->set_page_title( h($current_semester->get_name()) . " Admins" );
         			$portal->set_page_main( 
         				array(
         					array( "link" => PATH_URL . SEMESTER_URL . "/" . h($current_semester->get_name()) . "/", "name" => h($current_semester->get_attribute( "OBJ_DESC" ))), array( "link" => "", "name" => gettext( "Admins" ) )
         				),
         				$content->get(),
         				""
         			);
         			$portal->show_html( );
         			*/
     } else {
         header("Location: " . PATH_URL . "404/");
         die;
     }
     $frameResponseObject->setTitle("Semester " . $current_semester_name);
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
示例#14
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $path = $this->params;
     $user = \lms_steam::get_current_user();
     $content = \Semester::getInstance()->loadTemplate("courses_overview.template.html");
     $content->setVariable("HELP_TEXT", "<b>" . gettext('Notice') . ':</b> ' . gettext('You can easily find courses by using the filter. Just type in a part of the course\'s title, it\'s ID or the name of the tutor.'));
     $content->setVariable('LABEL_FILTER', gettext('Filter'));
     /**
      * Action Bar
      */
     $content->setCurrentBlock("BLOCK_ACTIONBAR");
     $isFiltered = false;
     $isEditMode = false;
     if (isset($path[0])) {
         if (\steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), "courses." . $path[0]) instanceof \steam_group) {
             $current_semester = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), "courses." . $path[0]);
         } else {
             ExtensionMaster::getInstance()->send404Error();
         }
     } else {
         $current_semester = \lms_steam::get_current_semester();
     }
     $current_semester_name = $current_semester->get_name();
     if (isset($path[1]) && $path[1] == "booked") {
         $isFiltered = true;
     }
     if (isset($path[2]) && $path[2] == "edit") {
         $isEditMode = true;
     }
     if ($isFiltered) {
         if (ALL_COURSES) {
             $content->setCurrentBlock("BLOCK_ALL_COURSES");
             $content->setVariable("LABEL_MY_COURSES", gettext("All courses"));
             $content->setVariable("LINK_MY_COURSES", PATH_URL . "semester/index/" . $current_semester_name . "/all" . ($isEditMode ? "/edit" : ""));
             $content->parse("BLOCK_ALL_COURSES");
         }
     } else {
         if (YOUR_COURSES) {
             $content->setCurrentBlock("BLOCK_YOUR_COURSES");
             $content->setVariable("LABEL_MY_COURSES", gettext("My courses"));
             $content->setVariable("LINK_MY_COURSES", PATH_URL . "semester/index/" . $current_semester_name . "/booked" . ($isEditMode ? "/edit" : ""));
             $content->parse("BLOCK_YOUR_COURSES");
         }
     }
     if ($isEditMode) {
         $content->setCurrentBlock("BLOCK_EDIT_MODE");
         $content->setVariable("LABEL_EDIT_MODE", gettext("Disable edit mode"));
         $content->setVariable("LINK_EDIT_MODE", PATH_URL . "semester/index/" . $current_semester_name . ($isFiltered ? "/booked" : "/all"));
         $content->parse("BLOCK_EDIT_MODE");
     } else {
         $content->setCurrentBlock("BLOCK_EDIT_MODE");
         $content->setVariable("LABEL_EDIT_MODE", gettext("Enable edit mode"));
         $content->setVariable("LINK_EDIT_MODE", PATH_URL . "semester/index/" . $current_semester_name . ($isFiltered ? "/booked" : "/all") . "/edit");
         $content->parse("BLOCK_EDIT_MODE");
     }
     $is_steam_admin = \lms_steam::is_steam_admin($user);
     if ($is_steam_admin || \lms_steam::is_semester_admin($current_semester, $user)) {
         $content->setCurrentBlock("BLOCK_SEMESTER_ADMIN");
         if (ADD_COURSE) {
             $content->setCurrentBlock("BLOCK_ADD_COURSE");
             $content->setVariable("LINK_CREATE_COURSE", PATH_URL . "semester/addCourse" . "/" . $current_semester_name);
             $content->setVariable("LABEL_CREATE_COURSE", gettext("Create new course"));
             $content->parse("BLOCK_ADD_COURSE");
         }
         if (IMPORT_COURSE_FROM_PAUL) {
             $content->setCurrentBlock("BLOCK_IMPORT_COURSE_FROM_PAUL");
             $content->setVariable("LINK_CREATE_PAUL_COURSE", PATH_URL . "semester/importCourse" . "/" . $current_semester_name);
             $content->setVariable("LABEL_CREATE_PAUL_COURSE", gettext("Create new course via PAUL"));
             $content->parse("BLOCK_IMPORT_COURSE_FROM_PAUL");
         }
         if ($is_steam_admin) {
             $content->setCurrentBlock("BLOCK_SERVER_ADMIN");
             if (MANAGE_SEMESTER) {
                 $content->setCurrentBlock("BLOCK_MANAGE_SEMESTER");
                 $content->setVariable("LINK_MANAGE_SEMESTER", PATH_URL . "semester/manageSemester" . "/" . $current_semester_name);
                 $content->setVariable("LABEL_MANAGE_SEMESTER", gettext("Manage this semester"));
                 $content->parse("BLOCK_MANAGE_SEMESTER");
             }
             if (ADD_SEMESTER) {
                 $content->setCurrentBlock("BLOCK_ADD_SEMESTER");
                 $content->setVariable("LINK_CREATE_SEMESTER", PATH_URL . "semester/addSemester");
                 $content->setVariable("LABEL_CREATE_SEMESTER", gettext("Create new semester"));
                 $content->parse("BLOCK_ADD_SEMESTER");
             }
             $content->parse("BLOCK_SERVER_ADMIN");
         }
         $content->parse("BLOCK_SEMESTER_ADMIN");
     }
     $content->parse("BLOCK_ACTIONBAR");
     // AUS DEM SYSTEM AUSLESEN
     $cache = get_cache_function("ORGANIZATION", 600);
     $semesters = $cache->call("lms_steam::get_semesters");
     foreach ($semesters as $s) {
         $content->setCurrentBlock("BLOCK_TABS");
         if ($s["OBJ_NAME"] == $current_semester_name) {
             $content->setVariable("TAB_STATE", "tabOut");
             $content->setVariable("LINK_SEMESTER", $s["OBJ_NAME"]);
         } else {
             $content->setVariable("TAB_STATE", "tabIn");
             $filter_part = "";
             $content->setVariable("LINK_SEMESTER", "<a href=\"" . PATH_URL . "semester/index" . "/" . $s["OBJ_NAME"] . "/" . ($isFiltered ? "booked" : "all") . "\">" . $s["OBJ_NAME"] . "</a>");
         }
         $content->parse("BLOCK_TABS");
     }
     $courses = $isFiltered ? $cache->call("lms_steam::semester_get_courses", $current_semester->get_id(), $user->get_name()) : $cache->call("lms_steam::semester_get_courses", $current_semester->get_id());
     $no_courses = count($courses);
     if ($no_courses > 0) {
         $content->setCurrentBlock("BLOCK_COURSES_AVAILABLE");
         $content->setVariable("LABEL_ID", gettext("Course ID"));
         $content->setVariable("LABEL_NAME", gettext("Course Name"));
         $content->setVariable("LABEL_DESC", gettext("Information"));
         $content->setVariable("LABEL_TUTORS", gettext("Staff members"));
         $content->setVariable("LABEL_STUDENTS", gettext("Students"));
         $content->setVariable("LABEL_ACTION", gettext("Action"));
         $memberships = \lms_steam::semester_get_user_coursememberships($current_semester->get_id(), \lms_steam::get_current_user());
         foreach ($courses as $course) {
             $course_found = TRUE;
             /* THIS WAS ALREADY COMMENTED OUT!
                //Cannot be determined after performance optimization, so deleted courses remain in course list for CACHE_LIFETIME_STATIC (1 Hour)
                if ( !isset( $memberships[ $course["OBJ_ID"] ] ) ) {
                  error_log("courses_overview.php: Found deleted course in cache-data of semester=" . $current_semester->get_name() . " courseid=" . $course["OBJ_NAME"] ." description=" . $course["OBJ_DESC"] . " objectid=" . $course[ "OBJ_ID" ]);
                  $course_found = FALSE;
                }
                */
             if ($course_found) {
                 $is_subscribed = isset($memberships[$course["OBJ_ID"]]);
                 $content->setCurrentBlock("BLOCK_COURSE");
                 if (\koala_group_course::is_paul_course($course["COURSE_NUMBER"])) {
                     $label_course_id = $course["COURSE_NUMBER"];
                 } else {
                     $label_course_id = \koala_group_course::convert_course_id($course["OBJ_NAME"]);
                 }
                 $actions = "";
                 if ($isEditMode) {
                     $actions .= "<br><a href=\"" . PATH_URL . "course_delete.php?course=" . $course["OBJ_ID"] . "\">" . gettext("Delete course") . "</a>";
                     $actions .= "<br><a href=\"" . PATH_URL . "copy_weblog_wiki.php?course=" . $course["OBJ_ID"] . "\">" . gettext("Copy Weblog/Wiki") . "</a>";
                 }
                 $content->setVariable("VALUE_ID", h($label_course_id));
                 // TODO: Passt der Link?
                 $content->setVariable("COURSE_LINK", PATH_URL . SEMESTER_URL . "/" . h($current_semester->get_name()) . "/" . h($course["OBJ_NAME"]) . "/");
                 $content->setVariable("COURSE_NAME", h($course["OBJ_DESC"]));
                 $content->setVariable("COURSE_TUTORS", h($course["COURSE_TUTORS"]));
                 $content->setVariable("VALUE_STUDENTS", $course["COURSE_NO_PARTICIPANTS"] . (isset($course["COURSE_MAX_PARTICIPANTS"]) && $course["COURSE_MAX_PARTICIPANTS"] > 0 ? " / " . $course["COURSE_MAX_PARTICIPANTS"] : ""));
                 $content->setVariable("VALUE_COURSE_DESC", h($course["COURSE_SHORT_DSC"]));
                 if ($is_subscribed) {
                     if ($course["COURSE_HISLSF_ID"] > 0) {
                         $content->setVariable("COURSE_ACTION", "Kursabmeldung erfolgt ausschlie&szlig;&uuml;ber <b><a href=\"https://lsf.uni-paderborn.de/qisserver/rds?state=wsearchv&search=2&veranstaltung.veranstid=" . trim($course["COURSE_HISLSF_ID"]) . "\" target=\"_blank\">HIS-LSF</a></b>. Die Synchronisation mit koaLA kann bis zu einer Stunde dauern.");
                     } elseif ($course[KOALA_GROUP_ACCESS] == PERMISSION_COURSE_PAUL_SYNC) {
                         $content->setVariable("COURSE_ACTION", gettext("You are member.") . "<br />" . gettext("The participants for this course will be imported from the PAUL system as of 30.04.2009"));
                         $noop = gettext("The participant management for this course is imported from PAUL. To unsubscribe this course unsubscribe this course in PAUL. Your unsubscription will be synchronized with koaLA within one hour.");
                     } else {
                         $content->setVariable("COURSE_ACTION", "<a href=\"" . PATH_URL . "group_cancel.php?group=" . $course["OBJ_ID"] . "\">" . gettext("Resign") . "</a>" . $actions);
                     }
                 } else {
                     if ($course["COURSE_HISLSF_ID"] > 0) {
                         $content->setVariable("COURSE_ACTION", "Kursbuchung erfolgt ausschlie&szlig;lich &uuml;ber <b><a href=\"https://lsf.uni-paderborn.de/qisserver/rds?state=wsearchv&search=2&veranstaltung.veranstid=" . trim($course["COURSE_HISLSF_ID"]) . "\" target=\"_blank\">HIS-LSF</a></b>. Die Synchronisation mit koaLA kann bis zu einer Stunde dauern.");
                     } elseif ($course[KOALA_GROUP_ACCESS] == PERMISSION_COURSE_PAUL_SYNC) {
                         $content->setVariable("COURSE_ACTION", gettext("You are not member.") . "<br />" . gettext("The participants for this course will be imported from the PAUL system as of 30.04.2009"));
                         $noop = gettext("The participant management for this course is imported from PAUL. To subscribe this course subscribe this course in PAUL. Your subscription will be synchronized with koaLA within one hour.");
                     } elseif (isset($course["COURSE_MAX_PARTICIPANTS"]) && (int) $course["COURSE_MAX_PARTICIPANTS"] > 0 && (int) $course["COURSE_MAX_PARTICIPANTS"] <= (int) $course["COURSE_NO_PARTICIPANTS"]) {
                         $content->setVariable("COURSE_ACTION", gettext("Group is full"));
                     } else {
                         $content->setVariable("COURSE_ACTION", "<a href=\"" . PATH_URL . "group_subscribe.php?group=" . $course["OBJ_ID"] . "\">" . gettext("Sign on") . "</a>");
                     }
                 }
                 $content->parse("BLOCK_COURSE");
             }
         }
         $content->parse("BLOCK_COURSES_AVAILABLE");
     } else {
         $content->setCurrentBlock("BLOCK_NO_COURSE");
         $content->setVariable("NO_COURSE_TEXT", gettext("No courses available yet."));
         $content->parse("BLOCK_NO_COURSE");
     }
     //$headline = ( isset($_GET[ "filter" ]) && $_GET[ "filter" ] == "booked" ) ? gettext( "My courses in %SEMESTER" ) : gettext( "All courses in %SEMESTER" );
     //$portal->set_page_title( $current_semester->get_attribute( "OBJ_DESC" ));
     //$portal->set_page_main( str_replace( "%SEMESTER", $current_semester->get_attribute( "OBJ_DESC" ), $headline), $content->get(), "" );
     //$portal->show_html();
     $frameResponseObject->setTitle("Semester - " . $current_semester_name);
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
示例#15
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //$portal = \lms_portal::get_instance();
     //$portal->initialize( GUEST_NOT_ALLOWED );
     //$portal->set_page_title( gettext( "Buddy Icon" ) );
     $user = \lms_steam::get_current_user();
     $confirmText = "";
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $problem = "";
         $hint = "";
         if (isset($_POST["action"]) && $_POST["action"] == "deleteicon") {
             // need to set OBJ_ICON to "0" and then to icons module to avoid weird
             // effects in icon handling (server side fix done but not testedyet)
             $old_icon = $user->get_attribute("OBJ_ICON");
             $user->set_acquire_attribute("OBJ_ICON", 0);
             $user->set_attribute("OBJ_ICON", 0);
             // set the default user icon by acquiring OBJ_ICON from icons module
             $user->set_acquire_attribute("OBJ_ICON", $GLOBALS["STEAM"]->get_module("icons"));
             // delete previous user icon object
             if ($old_icon instanceof steam_document) {
                 if ($old_icon->get_path() != "/images/doctypes/user_unknown.jpg" && $old_icon->check_access_write($user)) {
                     $this->clean_iconcache($old_icon);
                     $old_icon->delete();
                 }
             }
             $confirmText = gettext("Your profile icon has been deleted.");
             $this->clean_usericoncache($user);
         } else {
             // upload new icon
             if (count($_FILES) == 0) {
                 $problem = gettext("No image specified.") . " ";
                 $hint = gettext("Please choose an image on your local disk to upload.") . " ";
             }
             if (strpos($_FILES["icon"]["type"], "image") === FALSE) {
                 $problem .= gettext("File is not an image.") . " ";
                 $hint .= gettext("The icon has to be an image file (JPG, GIF or PNG).");
             }
             if ((int) $_FILES["icon"]["size"] > 256000) {
                 $problem .= gettext("File is larger than 250 KByte.");
                 $hint .= gettext("It is only allowed to upload profile icons with file size smaller than 250 KByte.");
             }
             if (empty($problem)) {
                 $user->set_acquire_attribute("OBJ_ICON", 0);
                 $user->delete_value("OBJ_ICON");
                 $old_icon = $user->get_attribute("OBJ_ICON");
                 ob_start();
                 readfile($_FILES["icon"]["tmp_name"]);
                 $content = ob_get_contents();
                 ob_end_clean();
                 $filename = str_replace(array("\\", "'"), array("", ""), $_FILES["icon"]["name"]);
                 if ($old_icon instanceof steam_document && $old_icon->check_access_write($user)) {
                     $new_icon = $old_icon;
                     $new_icon->set_attribute("OBJ_NAME", $filename);
                     $new_icon->set_content($content);
                     $new_icon->set_attribute("DOC_MIME_TYPE", $_FILES["icon"]["type"]);
                 } else {
                     $new_icon = \steam_factory::create_document($GLOBALS["STEAM"]->get_id(), $filename, $content, $_FILES["icon"]["type"], FALSE);
                     $new_icon->set_attribute("OBJ_TYPE", "document_icon_usericon");
                 }
                 $user->set_attribute("OBJ_ICON", $new_icon);
                 $all_user = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), "sTeam");
                 $new_icon->set_read_access($all_user);
                 $GLOBALS["STEAM"]->buffer_flush();
                 // clean cache-related data
                 $this->clean_usericoncache($user);
                 $confirmText = gettext("Your profile icon has been changed.");
             } else {
                 $frameResponseObject->setProblemDescription($problem);
             }
         }
     }
     $content = \Profile::getInstance()->loadTemplate("profile_icon.template.html");
     //$content = new \HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "profile_icon.template.html" );
     //$content->setVariable( "INFO_TEXT", gettext( "Your buddy icon is what we use to represent you when you're in koaLA." ) );
     if (PLATFORM_ID == "bid") {
         $content->setVariable("INFO_TEXT", "Hier können Sie ein Benutzerbild hinterlegen. Dieses wird beispielsweise an Ihren Dokumenten und Forenbeiträgen zusammen mit Ihrem Namen angezeigt.");
     } else {
         $content->setVariable("INFO_TEXT", "Das Benutzerbild wird Sie in " . PLATFORM_NAME . " repräsentieren");
     }
     $content->setVariable("WINDOW_CONFIRM_TEXT", gettext("Are you sure you want to delete your current buddy icon?"));
     $content->setVariable("LABEL_DELETE", gettext("DELETE"));
     $user->delete_value("OBJ_ICON");
     $icon = $user->get_attribute("OBJ_ICON");
     if ($icon instanceof \steam_object) {
         $icon_id = $icon->get_id();
         // if user icon is acquired (= default icon) hide the delete button
         if (is_object($user->get_acquire_attribute("OBJ_ICON"))) {
             $content->setVariable("HIDE_BUTTON", "style='display:none;'");
         }
     } else {
         $icon_id = 0;
         $content->setVariable("HIDE_BUTTON", "style='display:none;'");
     }
     // use it in 140x185 standard thumb size to optimize sharing of icon cache data
     $icon_link = $icon_id == 0 ? PATH_URL . "styles/standard/images/anonymous.jpg" : PATH_URL . "download/image/" . $icon_id . "/140/185";
     $content->setVariable("USER_IMAGE", $icon_link);
     $content->setVariable("LABEL_YOUR_BUDDY_ICON", gettext("This is your buddy icon at the moment."));
     $content->setVariable("LABEL_REPLACE", gettext("Replace with an image"));
     $content->setVariable("LABEL_UPLOAD_INFO", gettext("The uploaded file has to be an image file (JPG, GIF or PNG), should have the dimensions of 140 x 185 pixels and <b>may not be larger than 250 KByte</b>. "));
     $content->setVariable("LABEL_UPLOAD", gettext("Upload"));
     if (PLATFORM_ID == "bid") {
         $breadcrumb = array(array("name" => $user->get_attribute("USER_FIRSTNAME") . " " . $user->get_attribute("USER_FULLNAME"), "link" => PATH_URL . "home"), array("name" => gettext("Profile"), "link" => PATH_URL . "profile/"), array("name" => gettext("Your buddy icon")));
     } else {
         $breadcrumb = array(array("name" => $user->get_attribute("USER_FIRSTNAME") . " " . $user->get_attribute("USER_FULLNAME"), "link" => PATH_URL . "profile/" . "index/" . $user->get_name() . "/"), array("name" => gettext("Profile"), "link" => PATH_URL . "profile/index/" . $user->get_name() . "/"), array("name" => gettext("Your buddy icon")));
     }
     $frameResponseObject->setHeadline($breadcrumb);
     $frameResponseObject->setConfirmText($confirmText);
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
     //$portal->set_page_main($breadcrumb, $content->get(), "");
     //return $portal->get_html();
 }
示例#16
0
<?php

include "../../../etc/koala.conf.php";
include "../classes/exam_organization_conf.php";
function deleteExamDataOnCourse($courseObject, $ageOfDataInDays)
{
}
echo "Script for deleting marked exam data\n";
$newline = "\n";
echo "Loggin in...{$newline}";
$steam_user = new lms_user(STEAM_ROOT_LOGIN, STEAM_ROOT_PW);
//TODO: use phpsteam here. this fails if wrong login data for root
$steam_user->login();
$user_module = $GLOBALS["STEAM"]->get_module("users");
$current_semester = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), SYNC_KOALA_SEMESTER, 0);
echo "Current semester is {$current_semester} {$newline}";
//$courses_koala  = lms_steam::semester_get_courses( $current_semester->get_id() );
$courses_koala = lms_steam::semester_get_courses(1117);
//id der kurs-gruppe
echo "Searching for courses...{$newline}";
foreach ($courses_koala as $course) {
    echo "Course found {$newline}";
}
echo "finished searching for courses!{$newline}";
示例#17
0
 public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
 {
     $type = $this->params["type"];
     $value = $this->params["value"];
     $sanction = $this->object->get_sanction();
     $attrib = $this->object->get_attributes(array(OBJ_NAME, OBJ_DESC, "bid:doctype"));
     $bid_doctype = isset($attrib["bid:doctype"]) ? $attrib["bid:doctype"] : "";
     $docTypeQuestionary = strcmp($attrib["bid:doctype"], "questionary") == 0;
     $docTypeMessageBoard = $this->object instanceof \steam_messageboard;
     // in questionaries the write right is limited to insert rights only
     if ($docTypeQuestionary) {
         $SANCTION_WRITE_FOR_CURRENT_OBJECT = SANCTION_INSERT;
     } else {
         if ($docTypeMessageBoard) {
             $SANCTION_WRITE_FOR_CURRENT_OBJECT = SANCTION_ANNOTATE;
         } else {
             $SANCTION_WRITE_FOR_CURRENT_OBJECT = SANCTION_WRITE | SANCTION_EXECUTE | SANCTION_MOVE | SANCTION_INSERT | SANCTION_ANNOTATE;
         }
     }
     //SET ACQUIRE RIGHTS
     if ($type == "acquire") {
         if ($value == "acq") {
             $this->object->set_acquire_from_environment();
             foreach ($sanction as $id => $sanct) {
                 $this->object->sanction(ACCESS_DENIED, \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $id, CLASS_OBJECT));
                 $this->object->sanction_meta(ACCESS_DENIED, \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $id, CLASS_OBJECT));
             }
         } else {
             $this->object->set_acquire(0);
         }
     } elseif ($type == "crude") {
         $everyone = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), "everyone");
         $everyoneId = $everyone->get_id();
         $steamGroup = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), "sTeam");
         $steamGroupId = $steamGroup->get_id();
         if ($value == "privat") {
             foreach ($sanction as $id => $sanct) {
                 $this->object->sanction(ACCESS_DENIED, \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $id, CLASS_OBJECT));
                 $this->object->sanction_meta(ACCESS_DENIED, \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $id, CLASS_OBJECT));
             }
         } elseif ($value == "user_public") {
             //DENY GLOBAL ACCESS
             $this->object->sanction(ACCESS_DENIED, \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $everyoneId, CLASS_OBJECT));
             $this->object->sanction_meta(ACCESS_DENIED, \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $everyoneId, CLASS_OBJECT));
             //SET LOCAL SERVER ACCESS
             if (!isset($sanction[$steamGroupId])) {
                 $this->object->sanction(SANCTION_READ, \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $steamGroupId, CLASS_OBJECT));
                 $this->object->sanction_meta(SANCTION_READ, \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $steamGroupId, CLASS_OBJECT));
             }
         } elseif ($value == "server_public") {
             $this->object->sanction(SANCTION_READ, \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $everyoneId, CLASS_OBJECT));
             $this->object->sanction_meta(SANCTION_READ, \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $everyoneId, CLASS_OBJECT));
         }
     } elseif ($type == "sanction") {
         $currentSanction = ACCESS_DENIED;
         $additionalSanction = ACCESS_DENIED;
         if ($value >= 1) {
             $currentSanction |= SANCTION_READ;
         }
         if ($value >= 2) {
             $currentSanction |= $SANCTION_WRITE_FOR_CURRENT_OBJECT;
         }
         if ($value == 3) {
             $currentSanction |= SANCTION_SANCTION;
             $additionalSanction = SANCTION_ALL;
         }
         $this->object->sanction($currentSanction, \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->sanctionId, CLASS_OBJECT));
         // set the new meta rights
         $this->object->sanction_meta($additionalSanction, \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->sanctionId, CLASS_OBJECT));
     }
     $ajaxResponseObject->setStatus("ok");
     return $ajaxResponseObject;
 }
示例#18
0
         $changes['UNIT_DISPLAY_TYPE'] = gettext('Document Pool');
     }
     if ($attrs[OBJ_DESC] !== $values['short_dsc']) {
         $changes[OBJ_DESC] = $values["short_dsc"];
     }
     if ($attrs['OBJ_LONG_DESC'] !== $values['dsc']) {
         $changes['OBJ_LONG_DESC'] = $values['dsc'];
     }
     if (count($changes) > 0) {
         $new_unit->set_attributes($changes);
     }
 }
 // clean cache-related data
 //clean_usericoncache($user);
 // Podcast Handling
 $world_users = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), "Everyone");
 if (isset($values["podcast"])) {
     $new_unit->set_attribute("KOALA_CONTAINER_TYPE", "container_podcast_koala");
     $new_unit->set_sanction($world_users, SANCTION_READ);
 } else {
     $new_unit->set_attribute("KOALA_CONTAINER_TYPE", 0);
     $new_unit->set_sanction($world_users, 0);
 }
 $group_members = $owner->get_members_group();
 $group_staff = $owner->get_staff_group();
 $group_admins = $owner->get_admins_group();
 $workroom = $owner->get_workroom();
 $access = (int) $values['access'];
 $access_descriptions = units_docpool::get_access_descriptions($owner);
 $koala_unit->set_access($access, $access_descriptions[$access]['members'], $access_descriptions[$access]['steam'], $group_members, $group_staff, $group_admins);
 $GLOBALS['STEAM']->buffer_flush();
示例#19
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //CODE FOR ALL COMMANDS OF THIS PACKAGE START
     $user = \lms_steam::get_current_user();
     // Disable caching
     // TODO: Work on cache handling. An enabled cache leads to bugs
     // if used with the wiki.
     \CacheSettings::disable_caching();
     if (!($wiki_container = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id))) {
         include "bad_link.php";
         exit;
     }
     if (!$wiki_container instanceof \steam_container) {
         $wiki_doc = $wiki_container;
         $wiki_container = $wiki_doc->get_environment();
         if ($wiki_doc->get_attribute(DOC_MIME_TYPE) != "text/wiki") {
             include "bad_link.php";
             exit;
         }
     }
     //CODE FOR ALL COMMANDS OF THIS PACKAGE END
     $env = $wiki_container->get_environment();
     $grp = $env->get_creator();
     if ($grp->get_name() == "learners" && $grp->get_attribute(OBJ_TYPE) == "course_learners") {
         $grp = $grp->get_parent_group();
     }
     if (!isset($wiki_container) || !is_object($wiki_container)) {
         if (!($env = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $_GET["env"]))) {
             throw new Exception("Environment unknown.");
         }
         if (!($grp = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $_GET["group"]))) {
             throw new Exception("Group unknown");
         }
     }
     $accessmergel = FALSE;
     if (isset($wiki_container) && is_object($wiki_container)) {
         $creator = $wiki_container->get_creator();
         if ($wiki_container->get_attribute(KOALA_ACCESS) == PERMISSION_UNDEFINED && \lms_steam::get_current_user()->get_id() != $creator->get_id() && !\lms_steam::is_koala_admin(\lms_steam::get_current_user())) {
             $accessmergel = TRUE;
         }
     }
     $backlink = empty($_POST["values"]["backlink"]) ? $_SERVER["HTTP_REFERER"] : $_POST["values"]["backlink"];
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $values = $_POST["values"];
         if (get_magic_quotes_gpc()) {
             if (!empty($values['name'])) {
                 $values['name'] = stripslashes($values['name']);
             }
             if (!empty($values['dsc'])) {
                 $values['dsc'] = stripslashes($values['dsc']);
             }
         }
         if (empty($values["name"])) {
             $problems = gettext("The name of new wiki is missing.");
             $hints = gettext("Please type in a name.");
         }
         if (strpos($values["name"], "/")) {
             if (!isset($problems)) {
                 $problems = "";
             }
             $problems .= gettext("Please don't use the \"/\"-char in the name of the wiki.");
         }
         if (empty($problems)) {
             $group_members = $grp;
             $group_admins = 0;
             $group_staff = 0;
             // check if group is a course
             $grouptype = (string) $grp->get_attribute("OBJ_TYPE");
             if ($grouptype == "course") {
                 $group_staff = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".staff");
                 $group_admins = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".admins");
                 $group_members = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".learners");
                 $workroom = $group_members->get_workroom();
             } else {
                 $workroom = $grp->get_workroom();
             }
             if (!isset($wiki_container) || !is_object($wiki_container)) {
                 $new_wiki = \steam_factory::create_room($GLOBALS["STEAM"]->get_id(), $values["name"], $env, $values["dsc"]);
                 $new_wiki->set_attribute("OBJ_TYPE", "container_wiki_koala");
                 $_SESSION["confirmation"] = str_replace("%NAME", $values["name"], gettext("New wiki '%NAME' created."));
             } else {
                 $wiki_container->set_attribute(OBJ_NAME, $values["name"]);
                 if ($values["wiki_startpage"] == gettext("Glossary")) {
                     $values["wiki_startpage"] = "glossary";
                 }
                 $wiki_container->set_attribute("OBJ_WIKI_STARTPAGE", $values["wiki_startpage"]);
                 $wiki_container->set_attribute(OBJ_DESC, $values["dsc"]);
                 //$portal->set_confirmation(gettext( "The changes have been saved." ));
                 $new_wiki = $wiki_container;
             }
             $koala_wiki = new \lms_wiki($new_wiki);
             $access = (int) $values["access"];
             $access_descriptions = \lms_wiki::get_access_descriptions($grp);
             if (!$accessmergel) {
                 $koala_wiki->set_access($access, $access_descriptions[$access]["members"], $access_descriptions[$access]["steam"], $group_members, $group_staff, $group_admins);
             }
             $GLOBALS["STEAM"]->buffer_flush();
             $cache = get_cache_function(\lms_steam::get_current_user()->get_name());
             $cache->drop("lms_steam::get_inventory_recursive", $workroom->get_id(), CLASS_CONTAINER, array("OBJ_TYPE", "WIKI_LANGUAGE"));
             $cache->drop("lms_steam::get_group_communication_objects", $workroom->get_id(), CLASS_MESSAGEBOARD | CLASS_CALENDAR | CLASS_CONTAINER | CLASS_ROOM);
             if (!isset($wiki_container) || !is_object($wiki_container)) {
                 header("Location: " . $backlink);
                 exit;
             }
         } else {
             $frameResponseObject->setProblemDescription($problems);
             $frameResponseObject->setProblemSolution(isset($hints) ? $hints : "");
         }
     }
     $content = \Wiki::getInstance()->loadTemplate("object_new.template.html");
     //$content = new HTML_TEMPLATE_IT( PATH_TEMPLATES );
     //$content->loadTemplateFile( "object_new.template.html" );
     if (isset($wiki_container) && is_object($wiki_container)) {
         $content->setVariable("INFO_TEXT", str_replace("%NAME", h($wiki_container->get_name()), gettext("You are going to edit the wiki '<b>%NAME</b>'.")));
         $content->setVariable("LABEL_CREATE", gettext("Save changes"));
         $pagetitle = gettext("Preferences");
         if (empty($values)) {
             $values = array();
             $values["name"] = $wiki_container->get_name();
             $values["dsc"] = $wiki_container->get_attribute(OBJ_DESC);
             $values["wiki_startpage"] = $wiki_container->get_attribute("OBJ_WIKI_STARTPAGE");
             $values["access"] = $wiki_container->get_attribute(KOALA_ACCESS);
         }
         $breadcrumbheader = gettext("Preferences");
         $content->setVariable("OPTION_WIKI_GLOSSARY", gettext("Glossary"));
         $wiki_entries = $wiki_container->get_inventory(CLASS_DOCUMENT);
         $wiki_entries_sorted = array();
         foreach ($wiki_entries as $wiki_entry) {
             if ($wiki_entry->get_attribute(DOC_MIME_TYPE) === "text/wiki") {
                 $wiki_entries_sorted[] = str_replace(".wiki", "", $wiki_entry->get_name());
             }
         }
         sort($wiki_entries_sorted);
         $startpageFound = false;
         foreach ($wiki_entries_sorted as $wiki_entry) {
             $content->setCurrentBlock("BLOCK_WIKI_STARTPAGE_OPTION");
             $content->setVariable("OPTION_WIKI_STARTPAGE", $wiki_entry);
             if ($values["wiki_startpage"] == $wiki_entry) {
                 $content->setVariable("WIKI_STARTPAGE_SELECTED", "selected");
                 $startpageFound = true;
             }
             $content->parse("BLOCK_WIKI_STARTPAGE_OPTION");
         }
         if (!$startpageFound) {
             $content->setVariable("OPTION_WIKI_GLOSSARY_SELECTED", "selected");
         }
     } else {
         $grpname = $grp->get_attribute(OBJ_NAME);
         if ($grp->get_attribute(OBJ_TYPE) == "course") {
             $grpname = $grp->get_attribute(OBJ_DESC);
         }
         $content->setVariable("OPTION_WIKI_GLOSSARY", gettext("Glossary"));
         $content->setVariable("OPTION_WIKI_GLOSSARY_SELECTED", "selected");
         $content->setVariable("INFO_TEXT", str_replace("%ENV", h($grpname), gettext("You are going to create a new wiki in '<b>%ENV</b>'.")));
         $content->setVariable("LABEL_CREATE", gettext("Create wiki"));
         $pagetitle = gettext("Create wiki");
         $breadcrumbheader = gettext("Add new wiki");
     }
     if (!empty($values)) {
         if (!empty($values["name"])) {
             $content->setVariable("VALUE_NAME", h($values["name"]));
         }
         if (!empty($values["dsc"])) {
             $content->setVariable("VALUE_DSC", h($values["dsc"]));
         }
         if (!empty($values["wiki_startpage"])) {
             $content->setVariable("VALUE_WIKI_STARTPAGE", h($values["wiki_startpage"]));
         }
     }
     $content->setVariable("VALUE_BACKLINK", $backlink);
     $content->setVariable("LABEL_NAME", gettext("Name"));
     $content->setVariable("LABEL_DSC", gettext("Description"));
     $content->setVariable("LABEL_WIKI_STARTPAGE", gettext("Startpage"));
     $content->setVariable("LABEL_ACCESS", gettext("Access"));
     $content->setVariable("LABEL_BB_BOLD", gettext("B"));
     $content->setVariable("HINT_BB_BOLD", gettext("boldface"));
     $content->setVariable("LABEL_BB_ITALIC", gettext("I"));
     $content->setVariable("HINT_BB_ITALIC", gettext("italic"));
     $content->setVariable("LABEL_BB_UNDERLINE", gettext("U"));
     $content->setVariable("HINT_BB_UNDERLINE", gettext("underline"));
     $content->setVariable("LABEL_BB_STRIKETHROUGH", gettext("S"));
     $content->setVariable("HINT_BB_STRIKETHROUGH", gettext("strikethrough"));
     $content->setVariable("LABEL_BB_IMAGE", gettext("IMG"));
     $content->setVariable("HINT_BB_IMAGE", gettext("image"));
     $content->setVariable("LABEL_BB_URL", gettext("URL"));
     $content->setVariable("HINT_BB_URL", gettext("web link"));
     $content->setVariable("LABEL_BB_MAIL", gettext("MAIL"));
     $content->setVariable("HINT_BB_MAIL", gettext("email link"));
     if ($accessmergel) {
         $mailto = "mailto:'.SUPPORT_EMAIL.'?subject=KoaLA:%20Invalid%20Access%20Rights&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 {
         $access = \lms_wiki::get_access_descriptions($grp);
         if ((string) $grp->get_attribute("OBJ_TYPE") == "course") {
             $access_default = PERMISSION_PUBLIC;
         } else {
             $access_default = PERMISSION_PUBLIC_READONLY;
             if (isset($wiki_container) && is_object($wiki_container) && $creator->get_id() != \lms_steam::get_current_user()->get_id()) {
                 $access[PERMISSION_PRIVATE_READONLY] = str_replace("%NAME", $creator->get_name(), $access[PERMISSION_PRIVATE_READONLY]);
             } else {
                 $access[PERMISSION_PRIVATE_READONLY] = str_replace("%NAME", "you", $access[PERMISSION_PRIVATE_READONLY]);
             }
         }
         if (is_array($access)) {
             $content->setCurrentBlock("BLOCK_ACCESS");
             foreach ($access as $key => $array) {
                 if ($key != PERMISSION_UNDEFINED || isset($values) && (int) $values["access"] == PERMISSION_UNDEFINED) {
                     $content->setCurrentBlock("ACCESS");
                     $content->setVariable("LABEL", $array["summary_short"] . ": " . $array["label"]);
                     $content->setVariable("VALUE", $key);
                     if (isset($values) && $key == (int) $values["access"] || empty($values) && $key == $access_default) {
                         $content->setVariable("CHECK", "checked=\"checked\"");
                     }
                     $content->parse("ACCESS");
                 }
             }
             $content->parse("BLOCK_ACCESS");
         }
     }
     $content->setVariable("BACKLINK", "<a href=\"{$backlink}\">" . gettext("back") . "</a>");
     $rootlink = \lms_steam::get_link_to_root($grp);
     WIKI_FULL_HEADLINE ? $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication"))) : "";
     if (isset($wiki_container) && is_object($wiki_container)) {
         $headline[] = array("link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/", "name" => h($wiki_container->get_name()));
     }
     $headline[] = array("link" => "", "name" => $breadcrumbheader);
     $frameResponseObject->setTitle($pagetitle);
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($content->get());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
     /*$portal->set_page_main( $headline, $content->get() );
     	 $portal->set_page_title( $pagetitle );
     	 $portal->show_html();*/
 }
示例#20
0
 public static function semester_get_courses($semester_obj_id, $user_login_name = "")
 {
     $semester = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $semester_obj_id, CLASS_GROUP);
     if (!empty($user_login_name)) {
         $user = steam_factory::username_to_object($GLOBALS["STEAM"]->get_id(), $user_login_name);
     }
     $courses = $semester->get_subgroups();
     $no_courses = count($courses);
     if ($no_courses > 0) {
         // Load groupnames
         $names_tnr = array();
         for ($i = 0; $i < $no_courses; $i++) {
             $names_tnr[$i] = $courses[$i]->get_groupname(TRUE);
         }
         $groupnames = $GLOBALS["STEAM"]->buffer_flush();
         $tnr = array();
         for ($i = 0; $i < $no_courses; $i++) {
             $tnr[$i] = array();
             $tnr[$i]["GROUP_LEARNERS"] = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $groupnames[$names_tnr[$i]] . "." . "learners", TRUE);
             $tnr[$i]["GROUP_STAFF"] = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $groupnames[$names_tnr[$i]] . "." . "staff", TRUE);
             $tnr[$i]["ATTRIBUTES"] = $courses[$i]->get_attributes(array("COURSE_PARTICIPANT_MNGMNT", "COURSE_SEMESTER", "COURSE_TUTORS", "COURSE_SHORT_DSC", "COURSE_LONG_DSC", "OBJ_DESC", "OBJ_NAME", "COURSE_HISLSF_ID", "COURSE_NUMBER", KOALA_GROUP_ACCESS), TRUE);
             $tnr[$i]["OBJ_NAME"] = $courses[$i]->get_name(TRUE);
         }
         // COURSE_NUMBER is the new visible Key of Courses
         // COURSE_NUMBER is only set if Course was imported from PAUL
         $result = $GLOBALS["STEAM"]->buffer_flush();
         $member_tnr = array();
         for ($i = 0; $i < $no_courses; $i++) {
             $member_tnr[$i] = array();
             if (!is_object($result[$tnr[$i]["GROUP_LEARNERS"]])) {
                 continue;
             }
             if (!is_object($result[$tnr[$i]["GROUP_STAFF"]])) {
                 continue;
             }
             if (!empty($user_login_name)) {
                 $member_tnr[$i]["IS_MEMBER"] = $result[$tnr[$i]["GROUP_LEARNERS"]]->is_member($user, TRUE);
                 $member_tnr[$i]["IS_STAFF"] = $result[$tnr[$i]["GROUP_STAFF"]]->is_member($user, TRUE);
             }
             $member_tnr[$i]["MAX_PARTICIPANTS"] = $result[$tnr[$i]["GROUP_LEARNERS"]]->get_attribute("GROUP_MAXSIZE", TRUE);
             $member_tnr[$i]["COURSE_NO_PARTICIPANTS"] = $result[$tnr[$i]["GROUP_LEARNERS"]]->count_members(TRUE);
         }
         $member_result = $GLOBALS["STEAM"]->buffer_flush();
         $res = array();
         for ($i = 0; $i < $no_courses; $i++) {
             if ($groupnames[$names_tnr[$i]] == "admin") {
                 continue;
             }
             if (!is_object($result[$tnr[$i]["GROUP_LEARNERS"]])) {
                 continue;
             }
             if (!is_object($result[$tnr[$i]["GROUP_STAFF"]])) {
                 continue;
             }
             if (!empty($user_login_name)) {
                 if (!($member_result[$member_tnr[$i]["IS_MEMBER"]] || $member_result[$member_tnr[$i]["IS_STAFF"]])) {
                     continue;
                 }
             }
             $res[$i] = $result[$tnr[$i]["ATTRIBUTES"]];
             $res[$i]["OBJ_ID"] = $courses[$i]->get_id();
             $res[$i]["COURSE_MAX_PARTICIPANTS"] = $member_result[$member_tnr[$i]["MAX_PARTICIPANTS"]];
             $res[$i]["COURSE_NO_PARTICIPANTS"] = $member_result[$member_tnr[$i]["COURSE_NO_PARTICIPANTS"]];
             $res[$i]["SORTKEY"] = koala_group_course::convert_course_id($res[$i][OBJ_NAME], $res[$i]["COURSE_NUMBER"]);
         }
         usort($res, "sort_courses");
         return $res;
     } else {
         return array();
     }
 }
示例#21
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $portal = \lms_portal::get_instance();
     if (!isset($messageboard) || !is_object($messageboard)) {
         if (empty($this->params[0])) {
             throw new \Exception("Environment not set.");
         }
         if (empty($this->params[1])) {
             throw new \Exception("Group not set.");
         }
         if (!($env = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params[0]))) {
             throw new \Exception("Environment unknown.");
         }
         if (!($grp = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params[1]))) {
             throw new \Exception("Group unknown");
         }
     }
     $accessmergel = FALSE;
     if (isset($messageboard) && is_object($messageboard)) {
         $creator = $messageboard->get_creator();
         if ($messageboard->get_attribute(KOALA_ACCESS) == PERMISSION_UNDEFINED && \lms_steam::get_current_user()->get_id() != $creator->get_id() && !\lms_steam::is_koala_admin(\lms_steam::get_current_user())) {
             $accessmergel = TRUE;
         }
     }
     // TODO: Passt der link?
     $backlink = empty($_POST["values"]["backlink"]) ? $_SERVER["HTTP_REFERER"] : $_POST["values"]["backlink"];
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $values = $_POST["values"];
         if (get_magic_quotes_gpc()) {
             if (!empty($values['name'])) {
                 $values['name'] = stripslashes($values['name']);
             }
             if (!empty($values['dsc'])) {
                 $values['dsc'] = stripslashes($values['dsc']);
             }
         }
         if (empty($values["name"])) {
             $problems = gettext("The name of new message board is missing.");
             $hints = gettext("Please type in a name.");
         }
         if (strpos($values["name"], "/")) {
             if (!isset($problems)) {
                 $problems = "";
             }
             $problems .= gettext("Please don't use the \"/\"-char in the the forum name.");
         }
         if (empty($problems)) {
             $group_members = $grp;
             $group_admins = 0;
             $group_staff = 0;
             // check if group is a course
             $grouptype = (string) $grp->get_attribute("OBJ_TYPE");
             if ($grouptype == "course") {
                 $group_staff = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".staff");
                 $group_admins = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".admins");
                 $group_members = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".learners");
                 $workroom = $group_members->get_workroom();
             } else {
                 $workroom = $grp->get_workroom();
             }
             if (!isset($messageboard) || !is_object($messageboard)) {
                 $new_forum = \steam_factory::create_messageboard($GLOBALS["STEAM"]->get_id(), $values["name"], $env, $values["dsc"]);
                 $_SESSION["confirmation"] = str_replace("%NAME", h($values["name"]), gettext("New forum '%NAME' created."));
             } else {
                 $messageboard->set_attribute(OBJ_NAME, $values["name"]);
                 $messageboard->set_attribute(OBJ_DESC, $values["dsc"]);
                 $portal->set_confirmation(gettext("The changes have been saved."));
                 $new_forum = $messageboard;
             }
             $koala_forum = new \lms_forum($new_forum);
             $access = (int) $values["access"];
             $access_descriptions = \lms_forum::get_access_descriptions($grp);
             if (!$accessmergel) {
                 $koala_forum->set_access($access, $access_descriptions[$access]["members"], $access_descriptions[$access]["steam"], $group_members, $group_staff, $group_admins);
             }
             $GLOBALS["STEAM"]->buffer_flush();
             $cache = get_cache_function(\lms_steam::get_current_user()->get_name(), 600);
             $cache->drop("lms_steam::get_inventory_recursive", $workroom->get_id(), CLASS_MESSAGEBOARD, array("FORUM_LANGUAGE"));
             $cache->drop("lms_steam::get_group_communication_objects", $workroom->get_id(), CLASS_MESSAGEBOARD | CLASS_CALENDAR | CLASS_CONTAINER | CLASS_ROOM);
             if (!isset($messageboard) || !is_object($messageboard)) {
                 header("Location: " . $backlink);
                 exit;
             }
         } else {
             $portal->set_problem_description($problems, isset($hints) ? $hints : "");
         }
     }
     $content = \Messageboard::getInstance()->loadTemplate("object_new.template.html");
     if (isset($messageboard) && is_object($messageboard)) {
         $content->setVariable("INFO_TEXT", str_replace("%NAME", h($messageboard->get_name()), gettext("You are going to edit the forum '<b>%NAME</b>'.")));
         $content->setVariable("LABEL_CREATE", gettext("Save changes"));
         $pagetitle = gettext("Preferences");
         if (empty($values)) {
             $values = array();
             $values["name"] = $messageboard->get_name();
             $values["dsc"] = $messageboard->get_attribute(OBJ_DESC);
             $values["access"] = $messageboard->get_attribute(KOALA_ACCESS);
         }
         $breadcrumbheader = gettext("Preferences");
     } else {
         $grpname = $grp->get_attribute(OBJ_NAME);
         if ($grp->get_attribute(OBJ_TYPE) == "course") {
             $grpname = $grp->get_attribute(OBJ_DESC);
         }
         $content->setVariable("INFO_TEXT", str_replace("%ENV", h($grpname), gettext("You are going to create a new forum in '<b>%ENV</b>'.")));
         $content->setVariable("LABEL_CREATE", gettext("Create forum"));
         $pagetitle = gettext("Create forum");
         $breadcrumbheader = gettext("Add new forum");
     }
     if (!empty($values)) {
         if (!empty($values["name"])) {
             $content->setVariable("VALUE_NAME", h($values["name"]));
         }
         if (!empty($values["dsc"])) {
             $content->setVariable("VALUE_DSC", h($values["dsc"]));
         }
     }
     $content->setVariable("VALUE_BACKLINK", $backlink);
     $content->setVariable("BACKLINK", "<a href=\"{$backlink}\">" . gettext("back") . "</a>");
     $content->setVariable("LABEL_NAME", gettext("Name"));
     $content->setVariable("LABEL_DSC", gettext("Description"));
     $content->setVariable("LABEL_BB_BOLD", gettext("B"));
     $content->setVariable("HINT_BB_BOLD", gettext("boldface"));
     $content->setVariable("LABEL_BB_ITALIC", gettext("I"));
     $content->setVariable("HINT_BB_ITALIC", gettext("italic"));
     $content->setVariable("LABEL_BB_UNDERLINE", gettext("U"));
     $content->setVariable("HINT_BB_UNDERLINE", gettext("underline"));
     $content->setVariable("LABEL_BB_STRIKETHROUGH", gettext("S"));
     $content->setVariable("HINT_BB_STRIKETHROUGH", gettext("strikethrough"));
     $content->setVariable("LABEL_BB_IMAGE", gettext("IMG"));
     $content->setVariable("HINT_BB_IMAGE", gettext("image"));
     $content->setVariable("LABEL_BB_URL", gettext("URL"));
     $content->setVariable("HINT_BB_URL", gettext("web link"));
     $content->setVariable("LABEL_BB_MAIL", gettext("MAIL"));
     $content->setVariable("HINT_BB_MAIL", gettext("email link"));
     $content->setVariable("LABEL_ACCESS", gettext("Access"));
     if ((string) $grp->get_attribute("OBJ_TYPE") == "course") {
         $access_default = PERMISSION_PUBLIC;
     } else {
         $access_default = PERMISSION_PUBLIC;
     }
     if ($accessmergel) {
         $mailto = "mailto:'.SUPPORT_EMAIL.'?subject=KoaLA:%20Invalid%20Access%20Rights&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 {
         $access = \lms_forum::get_access_descriptions($grp);
         if (is_array($access)) {
             $content->setCurrentBlock("BLOCK_ACCESS");
             foreach ($access as $key => $array) {
                 if ($key != PERMISSION_UNDEFINED || isset($values) && (int) $values["access"] == PERMISSION_UNDEFINED) {
                     $content->setCurrentBlock("ACCESS");
                     $content->setVariable("LABEL", $array["summary_short"] . ": " . $array["label"]);
                     $content->setVariable("VALUE", $key);
                     if (isset($values) && $key == (int) $values["access"] || empty($values) && $key == $access_default) {
                         $content->setVariable("CHECK", "checked=\"checked\"");
                     }
                     $content->parse("ACCESS");
                 }
             }
             $content->parse("BLOCK_ACCESS");
         }
     }
     // TODO: Passt der link?
     $rootlink = \lms_steam::get_link_to_root($grp);
     $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")));
     if (isset($messageboard) && is_object($messageboard)) {
         $headline[] = array("link" => PATH_URL . "forums/" . $messageboard->get_id() . "/", "name" => $messageboard->get_name());
     }
     $headline[] = array("link" => "", "name" => $breadcrumbheader);
     $frameResponseObject->setTitle("Messageboard");
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
示例#22
0
 public function create_entry($subject, $body, $category = "", $keywords = array(), $timestamp = "")
 {
     if (empty($timestamp)) {
         $timestamp = time();
     }
     $data = array("DATE_TITLE" => $subject, "DATE_DESCRIPTION" => $body, "DATE_START_DATE" => $timestamp, "DATE_END_DATE" => $timestamp, "DATE_CATEGORY" => $category, "OBJ_KEYWORDS" => $keywords);
     // CREATE NEW ENTRY IN CALENDAR
     $date_object = $this->add_entry($data);
     $all_user = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), STEAM_ALL_USER);
     // CREATE NEW LINK IN CATEGORY
     if (!empty($category)) {
         $link = steam_factory::create_link($GLOBALS["STEAM"]->get_id(), $date_object);
         $link->move($category);
     }
     // RETURN NEW DATE OBJECT
     return $date_object;
 }
示例#23
0
} catch (Exception $e) {
    error_log($e->getTraceAsString());
    print "Cannot write Log-File! ";
    print "Please check if " . LOG_HISLSFSYNC . " is writable.";
    exit;
}
$counter_deleted_bookings = 0;
foreach ($bookings_for_deletion as $booking) {
    $result = $GLOBALS["STEAM"]->predefined_command($user_module, "lookup_login", array($booking->student_login, FALSE), 0);
    if (is_object($result[0])) {
        $student = $result[0];
    } else {
        // Benutzer hat sich noch nie in sTeam eingeloggt.
        continue;
    }
    $steam_group = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $booking->course_id_koala, 0);
    $course = new koala_group_course($steam_group);
    // KURSAUSTRITT AUCH IN KOALA MIT UEBERNEHMEN
    if ($course->remove_member($student)) {
        $message = str_replace("%NAME", $student->get_attribute("USER_FIRSTNAME") . " " . $student->get_attribute("USER_FULLNAME"), gettext("Hallo %NAME,")) . "\n\n";
        $message .= str_replace("%GROUP", $course->get_name(), gettext("You have been removed from the course '%GROUP' because of your membership data in the HIS LSF system.")) . "\n\n";
        $message .= gettext("This is an automatically generated email.");
        lms_steam::mail($student, lms_steam::get_current_user(), PLATFORM_NAME . ": " . str_replace("%GROUP", $course->get_name(), gettext("You have been removed from the course '%GROUP'.")), $message);
        $query = "DELETE FROM " . SYNC_TABLE_NAME . " WHERE id='" . $booking->id . "';";
        if (mysql_query($query)) {
            $counter_deleted_bookings++;
        }
    } else {
        print "konnte nicht geloescht werden.";
    }
}
示例#24
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //$portal = \lms_portal::get_instance();
     //$portal->initialize( GUEST_NOT_ALLOWED );
     //$portal->set_guest_allowed( GUEST_NOT_ALLOWED );
     $user = \lms_steam::get_current_user();
     //$portal_user = $portal->get_user();
     //$path = $request->getPath();
     $group_course = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), "Courses." . $this->params[0] . "." . $this->params[1]);
     $group = new \koala_group_course($group_course);
     if (!$group instanceof \koala_group) {
         throw new \Exception("Is not a koala_group: " . $group_id, E_PARAMETER);
     }
     switch (get_class($group)) {
         case "koala_group_course":
             $html_handler_group = new \koala_html_course($group);
             $html_handler_group->set_context("communication");
             break;
         default:
             $html_handler_group = new \koala_html_group($group);
             $html_handler_group->set_context("communication");
             break;
     }
     $content = \Course::getInstance()->loadTemplate("groups_communication.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "groups_communication.template.html" );
     $workroom = $group->get_workroom();
     $read_access = $workroom->check_access_read($user);
     if (!$read_access) {
         throw new Exception("No read access on container: id=" . $workroom->get_id(), E_USER_RIGHTS);
     }
     $cache = get_cache_function(\lms_steam::get_current_user()->get_name(), 600);
     $communication_objects = $cache->call("lms_steam::get_group_communication_objects", $workroom->get_id(), CLASS_MESSAGEBOARD | CLASS_CALENDAR | CLASS_CONTAINER | CLASS_ROOM);
     $forums = array();
     $weblogs = array();
     $wikis = array();
     foreach ($communication_objects as $object) {
         if ($object["OBJ_CLASS"] === "steam_messageboard") {
             $forums[] = $object;
         } else {
             if ($object["OBJ_CLASS"] === "steam_calendar") {
                 $weblogs[] = $object;
             } else {
                 if (($object["OBJ_CLASS"] === "steam_container" || $object["OBJ_CLASS"] === "steam_room") && ($object["OBJ_TYPE"] != null && ($object["OBJ_TYPE"] == "KOALA_WIKI" || $object["OBJ_TYPE"] == "container_wiki_koala"))) {
                     $wikis[] = $object;
                 }
             }
         }
     }
     $content->setVariable("LABEL_FORUMS", gettext("Discussion Boards"));
     if (count($forums) > 0) {
         $content->setCurrentBlock("BLOCK_FORUMS");
         $content->setVariable("LABEL_FORUM_DESCRIPTION", gettext("Forum / description"));
         $content->setVariable("LABEL_ARTICLES", gettext("Articles"));
         $content->setVariable("LABEL_ACCESS", gettext("Access"));
         $content->setVariable("LABEL_LAST_COMMENT", gettext("Last comment"));
         $access_descriptions = \lms_forum::get_access_descriptions($group);
         foreach ($forums as $forum) {
             $cache = get_cache_function($forum["OBJ_ID"], 600);
             $discussions = $cache->call("lms_forum::get_discussions", $forum["OBJ_ID"]);
             $latest_post = isset($discussions[0]) ? $discussions[0] : FALSE;
             $content->setCurrentBlock("BLOCK_FORUM");
             $content->setVariable("NAME_FORUM", h($forum["OBJ_NAME"]));
             $content->setVariable("LINK_FORUM", PATH_URL . "forums/" . $forum["OBJ_ID"] . "/");
             $content->setVariable("OBJ_DESC", get_formatted_output($forum["OBJ_DESC"]));
             $language = !empty($forum["FORUM_LANGUAGE"]) ? $forum["FORUM_LANGUAGE"] : "German";
             $content->setVariable("VALUE_LANGUAGE", $language);
             $access = "<span title=\"" . $access_descriptions[$forum["KOALA_ACCESS"]]["label"] . "\">" . $access_descriptions[$forum["KOALA_ACCESS"]]["summary_short"] . "</span>";
             $content->setVariable("VALUE_ACCESS", $access);
             $content->setVariable("VALUE_ARTICLES", count($discussions));
             if ($latest_post) {
                 $content->setVariable("SUBJECT_LAST_COMMENT", h($latest_post["LATEST_POST_TITLE"]));
                 $content->setVariable("LINK_LAST_COMMENT", PATH_URL . "forums/" . $latest_post["OBJ_ID"] . "/");
                 $content->setVariable("POSTED_BY_LABEL", "(" . h($latest_post["LATEST_POST_AUTHOR"]) . ", " . how_long_ago($latest_post["LATEST_POST_TS"]) . ")");
             } else {
                 $content->setVariable("POSTED_BY_LABEL", gettext("-"));
             }
             $content->parse("BLOCK_FORUM");
         }
         $content->parse("BLOCK_FORUMS");
     } else {
         $content->setVariable("LABEL_NO_FORUMS_FOUND", "<b>" . gettext("No forums available. Either no forums are created in this context, or you have no rights to read them.") . "</b>");
     }
     $content->setVariable("LABEL_WEBLOGS", gettext("Weblogs"));
     if (count($weblogs) > 0) {
         $content->setCurrentBlock("BLOCK_WEBLOGS");
         $content->setVariable("LABEL_WEBLOG_DESCRIPTION", gettext("Weblog / description"));
         $content->setVariable("LABEL_WEBLOG_ENTRIES", gettext("Entries"));
         $content->setVariable("LABEL_WEBLOG_ACCESS", gettext("Access"));
         $content->setVariable("LABEL_WEBLOG_LAST_ENTRY", gettext("Last entry"));
         $access_descriptions = \lms_weblog::get_access_descriptions($group);
         foreach ($weblogs as $weblog) {
             $cache = get_cache_function($weblog["OBJ_ID"], 600);
             $entries = $cache->call("lms_weblog::get_items", $weblog["OBJ_ID"]);
             $last_entry = isset($entries[0]) ? $entries[0] : FALSE;
             $content->setCurrentBlock("BLOCK_WEBLOG");
             $content->setVariable("NAME_WEBLOG", h($weblog["OBJ_NAME"]));
             $content->setVariable("LINK_WEBLOG", PATH_URL . "weblog/" . $weblog["OBJ_ID"] . "/");
             $content->setVariable("WEBLOG_OBJ_DESC", get_formatted_output($weblog["OBJ_DESC"]));
             $title = $access_descriptions[$weblog["KOALA_ACCESS"]]["label"];
             if ($weblog["KOALA_ACCESS"] == PERMISSION_PRIVATE_READONLY && !$group instanceof koala_html_course) {
                 $obj = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $weblog["OBJ_ID"], CLASS_CALENDAR);
                 $creator = $obj->get_creator();
                 if ($creator->get_id() != \lms_steam::get_current_user()->get_id()) {
                     $title = str_replace("%NAME", $creator->get_name(), $title);
                 } else {
                     $title = str_replace("%NAME", "you", $title);
                 }
             }
             $content->setVariable("VALUE_WEBLOG_LANGUAGE", "German");
             $access = "<span title=\"" . $title . "\">" . $access_descriptions[$weblog["KOALA_ACCESS"]]["summary_short"] . "</span>";
             $content->setVariable("VALUE_WEBLOG_ACCESS", $access);
             $content->setVariable("VALUE_WEBLOG_ARTICLES", count($entries));
             $content->setVariable("LINK_WEBLOG_LAST_ENTRY", PATH_URL . "weblog/" . $last_entry["OBJ_ID"] . "/");
             if ($last_entry) {
                 $content->setVariable("SUBJECT_WEBLOG_LAST_ENTRY", h($last_entry["DATE_TITLE"]));
                 $content->setVariable("WEBLOG_POSTED_BY_LABEL", "(" . h($last_entry["AUTHOR"]) . ", " . how_long_ago($last_entry["DATE_START_DATE"]) . ")");
             } else {
                 $content->setVariable("WEBLOG_POSTED_BY_LABEL", gettext("-"));
             }
             $content->parse("BLOCK_WEBLOG");
         }
         $content->parse("BLOCK_WEBLOGS");
     } else {
         $content->setVariable("LABEL_NO_WEBLOGS_FOUND", "<b>" . gettext("No weblogs available. Either no weblogs are created in this context, or you have no rights to read them.") . "</b>");
     }
     $content->setVariable("LABEL_WIKIS", gettext("Wikis"));
     if (count($wikis) > 0) {
         $content->setCurrentBlock("BLOCK_WIKIS");
         $content->setVariable("LABEL_WIKI_DESCRIPTION", gettext("Wiki / description"));
         $content->setVariable("LABEL_WIKI_ENTRIES", gettext("Entries"));
         $content->setVariable("LABEL_WIKI_ACCESS", gettext("Access"));
         $content->setVariable("LABEL_WIKI_LAST_ENTRY", gettext("Last entry"));
         $access_descriptions = lms_wiki::get_access_descriptions($group);
         foreach ($wikis as $wiki) {
             $cache = get_cache_function($wiki["OBJ_ID"], 600);
             $entries = $cache->call("lms_wiki::get_items", $wiki["OBJ_ID"]);
             $last_entry = isset($entries[0]) ? $entries[0] : FALSE;
             $content->setCurrentBlock("BLOCK_WIKI");
             $content->setVariable("NAME_WIKI", h($wiki["OBJ_NAME"]));
             $content->setVariable("LINK_WIKI", PATH_URL . "wiki/" . $wiki["OBJ_ID"] . "/");
             $content->setVariable("WIKI_OBJ_DESC", get_formatted_output($wiki["OBJ_DESC"]));
             $title = $access_descriptions[$wiki["KOALA_ACCESS"]]["label"];
             if ($wiki["KOALA_ACCESS"] == PERMISSION_PRIVATE_READONLY && !$group instanceof koala_html_course) {
                 $obj = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $wiki["OBJ_ID"], CLASS_CONTAINER);
                 $creator = $obj->get_creator();
                 if ($creator->get_id() != lms_steam::get_current_user()->get_id()) {
                     $title = str_replace("%NAME", $creator->get_name(), $title);
                 } else {
                     $title = str_replace("%NAME", "you", $title);
                 }
             }
             $access = "<span title=\"" . $title . "\">" . $access_descriptions[$wiki["KOALA_ACCESS"]]["summary_short"] . "</span>";
             $content->setVariable("VALUE_WIKI_ACCESS", $access);
             $content->setVariable("VALUE_WIKI_ARTICLES", count($entries));
             $content->setVariable("LINK_WIKI_LAST_ENTRY", PATH_URL . "wiki/" . $last_entry["OBJ_ID"] . "/");
             $content->setVariable("SUBJECT_WIKI_LAST_ENTRY", str_replace(".wiki", "", h($last_entry["OBJ_NAME"])));
             $content->setVariable("WIKI_POSTED_BY_LABEL", $last_entry["DOC_LAST_MODIFIED"] != null ? "(" . h($last_entry["DOC_USER_MODIFIED"]) . ", " . how_long_ago($last_entry["DOC_LAST_MODIFIED"]) . ")" : "-");
             $content->parse("BLOCK_WIKI");
         }
         $content->parse("BLOCK_WIKIS");
     } else {
         $content->setVariable("LABEL_NO_WIKIS_FOUND", "<b>" . gettext("No wikis available. Either no wikis are created in this context, or you have no rights to read them.") . "</b>");
     }
     $html_handler_group->set_html_left($content->get());
     //$portal->set_page_main( $html_handler_group->get_headline(), $html_handler_group->get_html(), "");
     $frameResponseObject->setHeadline($html_handler_group->get_headline());
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($html_handler_group->get_html());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
示例#25
0
<?php

require_once "../etc/koala.conf.php";
if (!isset($create_new)) {
    $create_new = FALSE;
}
$user = lms_steam::get_current_user();
$all_users = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), STEAM_ALL_USER);
$accessmergel = FALSE;
if (isset($group) && is_object($group)) {
    $creator = $group->get_steam_group()->get_creator();
    if ($group->get_steam_group()->get_attribute(KOALA_GROUP_ACCESS) != PERMISSION_GROUP_PRIVATE && lms_steam::get_current_user()->get_id() != $creator->get_id() && !lms_steam::is_koala_admin(lms_steam::get_current_user())) {
        $accessmergel = TRUE;
    }
}
if ($create_new) {
    // CREATE
    if (isset($_POST) && isset($_POST["grouptype"]) && $_POST["grouptype"] == "group_private") {
        $is_public = FALSE;
    } else {
        $is_public = TRUE;
    }
    $waspassword = FALSE;
    $backlink = PATH_URL . "groups_create.php";
    $extensions = lms_steam::get_extensionmanager()->get_extensions_by_class('koala_group');
    $submit_text = gettext("Create group");
} else {
    // EDIT
    $backlink = PATH_URL . "groups/" . $group->get_steam_group()->get_id() . "/";
    if (!$group->is_admin($user)) {
        include "bad_link.php";
示例#26
0
 public function createCourse($id, $courseID, $customerID)
 {
     $user = lms_steam::get_current_user();
     $all_users = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), STEAM_ALL_USER);
     $current_semester = steam_factory::get_group($GLOBALS["STEAM"]->get_id(), "Courses." . $this->getObjectName($customerID));
     $elearning_course = elearning_mediathek::get_instance()->get_elearning_course_by_id($courseID);
     $name = $elearning_course->get_name();
     $new_course = steam_factory::create_group($GLOBALS["STEAM"]->get_id(), $id, $current_semester, FALSE, $name);
     $icon_id = steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), "/packages/elearning_stahl_verkauf/icon_verkauf.jpg")->get_id();
     $new_course->set_attributes(array("OBJ_TYPE" => "course", "COURSE_PARTICIPANT_MNGMNT" => 0, "COURSE_SEMESTER" => $this->getObjectName($customerID), "COURSE_TUTORS" => "", "COURSE_SHORT_DSC" => $elearning_course->get_description(), "COURSE_LONG_DSC" => "[img]" . PATH_SERVER . "/cached/get_document.php?id={$icon_id}&height=100[/img]\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tIn dieser Schulung möchten wir Ihnen die notwendigen Kenntnisse vermitteln, wie Sie ein Verkaufsgespräch gut führen – beginnend mit dem Blickkontakt, wenn eine Kundin oder ein Kunde Ihr Geschäft betritt, bis hin zur Verabschiedung, mit der Sie den Kunden hoffentlich mit dem Gefühl verabschieden, dass er bald wiederkommen wird.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tOberhalb dieses Textes befindet sich eine Registerkarte »Lektionen«, über die Sie sich zunächst die Schulungsinhalte aneignen können. Auf diese Inhalte haben Sie jederzeit Zugriff; Sie können die Inhalte so oft durcharbeiten, wie Sie wünschen. Und Sie können dies von jedem an das Internet angeschlossenen Computer aus, also beispielsweise auch von zu Hause.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tUm zu zeigen, dass Sie die Inhalte beherrschen, müssen Sie an einem Test teilnehmen. Dieser Test wird zu einem bestimmten Termin für Sie freigeschaltet. Sie erhalten dann zu gegebener Zeit eine Mitteilung, dass Sie zu dem Test zugelassen sind. Neben der Registerkarte, mit der Sie zu den Schulungsinhalten gelangen, finden Sie dann eine zusätzliche Registerkarte, mit der Sie den Test ablegen können.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tSollten Sie auf Probleme stoßen – seien es technische, inhaltliche oder Fragen zur Benutzung dieses Systems – finden Sie Hilfe am oberen Rand dieser Seite. Außerdem können Sie jederzeit Kontakt zu Ihrem Ansprechpartner aufnehmen, der Ihnen gerne weiterhelfen wird.", "COURSE_HISLSF_ID" => "", "ACTIVATED_FOR_CUSTOMER" => $customerID));
     $learners = steam_factory::create_group($GLOBALS["STEAM"]->get_id(), "learners", $new_course, FALSE, "Participants of course '" . $name . "'");
     $learners->set_attribute("OBJ_TYPE", "course_learners");
     $staff = steam_factory::create_group($GLOBALS["STEAM"]->get_id(), "staff", $new_course, FALSE, "Tutors of course '" . $name . "'");
     $staff->set_attribute("OBJ_TYPE", "course_staff");
     $admins = steam_factory::create_group($GLOBALS["STEAM"]->get_id(), "admins", $new_course, FALSE, "Admins of course '" . $name . "'");
     $admins->set_attribute("OBJ_TYPE", "course_admins");
     //$staff->add_member( $user );
     // RIGHTS MANAGEMENT =======================================
     $course_calendar = $new_course->get_calendar();
     $learners_workroom = $learners->get_workroom();
     $course_workroom = $new_course->get_workroom();
     $staff->set_sanction_all($staff);
     $staff->sanction_meta(SANCTION_ALL, $staff);
     $learners->set_sanction_all($staff);
     $learners->sanction_meta(SANCTION_ALL, $staff);
     $new_course->set_sanction_all($staff);
     $new_course->sanction_meta(SANCTION_ALL, $staff);
     $admins->set_sanction_all($admins);
     $admins->sanction_meta(SANCTION_ALL, $admins);
     $staff->set_sanction_all($admins);
     $staff->sanction_meta(SANCTION_ALL, $admins);
     $learners->set_sanction_all($admins);
     $learners->sanction_meta(SANCTION_ALL, $admins);
     $new_course->set_sanction_all($admins);
     $new_course->sanction_meta(SANCTION_ALL, $admins);
     $course_calendar->set_acquire(FALSE);
     $course_calendar->set_sanction_all($staff);
     $course_calendar->sanction_meta(SANCTION_ALL, $staff);
     $course_calendar->set_sanction_all($admins);
     $course_calendar->sanction_meta(SANCTION_ALL, $admins);
     $course_calendar->set_read_access($learners, TRUE);
     $course_calendar->set_write_access($new_course, FALSE);
     $course_calendar->set_insert_access($new_course, FALSE);
     $course_calendar->set_insert_access($all_users, FALSE);
     // Course workroom
     $course_workroom->set_sanction($new_course, SANCTION_READ | SANCTION_EXECUTE | SANCTION_ANNOTATE);
     $course_workroom->set_sanction_all($staff);
     $course_workroom->set_sanction_all($admins);
     $course_workroom->sanction_meta(SANCTION_ALL, $staff);
     $course_workroom->sanction_meta(SANCTION_ALL, $admins);
     // Learners workroom
     $learners_workroom->set_read_access($all_users, TRUE);
     $learners_workroom->set_sanction($learners, SANCTION_READ | SANCTION_EXECUTE | SANCTION_ANNOTATE);
     $learners_workroom->set_sanction_all($staff);
     $learners_workroom->set_sanction_all($admins);
     $learners_workroom->sanction_meta(SANCTION_ALL, $staff);
     $learners_workroom->sanction_meta(SANCTION_ALL, $admins);
     $koala_course = new koala_group_course($new_course);
     $koala_course->set_access(1, $learners, $staff, $admins, KOALA_GROUP_ACCESS);
     $new_course->set_attributes(array("COURSE_UNITS_ENABLED" => "TRUE", "UNITS_DOCPOOL_ENABLED" => "TRUE", "UNITS_ELEARNING_ENABLED" => "TRUE", "UNITS_MEDIATHING_ENABLED" => "FALSE", "UNITS_ORGANIZATION_ENABLED" => "FALSE", "UNITS_VIDEOSTREAMING_ENABLED" => "FALSE"));
     // create unit elearning
     $env = $koala_course->get_workroom();
     $new_unit_elearning_course = steam_factory::create_container($GLOBALS["STEAM"]->get_id(), $elearning_course->get_name(), $env, $elearning_course->get_description());
     $new_unit_elearning_course->set_attributes(array("UNIT_TYPE" => "units_elearning", "OBJ_TYPE" => "elearning_unit_koala", "UNIT_DISPLAY_TYPE" => gettext("units_elearning"), "ELEARNING_UNIT_ID" => $courseID));
     return true;
 }
示例#27
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //$portal = \lms_portal::get_instance();
     //$portal->initialize( GUEST_NOT_ALLOWED );
     //$portal->set_guest_allowed( GUEST_NOT_ALLOWED );
     $user = \lms_steam::get_current_user();
     //$portal_user = $portal->get_user();
     //$path = $request->getPath();
     $current_semester = $this->params[1];
     $group_course = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), "Courses." . $this->params[0] . "." . $this->params[1]);
     $group = new \koala_group_course($group_course);
     //$html_handler_course = new \koala_html_course($course);
     if (!$group instanceof \koala_group) {
         throw new \Exception("Variable group not set.");
     }
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         if (isset($_POST["remove"]) && is_array($_POST["remove"])) {
             $id = key($_POST["remove"]);
             $member_to_kick = \steam_factory::username_to_object($GLOBALS["STEAM"]->get_id(), $id);
             $group->remove_member($member_to_kick);
             $frameResponseObject->setConfirmText(str_replace("%NAME", h($member_to_kick->get_attribute("USER_FIRSTNAME")) . " " . h($member_to_kick->get_attribute("USER_FULLNAME")), gettext("User %NAME successfully removed from group members.")));
             //$portal->set_confirmation( str_replace( "%NAME", h($member_to_kick->get_attribute( "USER_FIRSTNAME" ))." " . h($member_to_kick->get_attribute( "USER_FULLNAME" )), gettext( "User %NAME successfully removed from group members." ) ) );
             // clear caches:
             $cache = get_cache_function($member_to_kick->get_name());
             $cache->drop("lms_steam::user_get_groups", $member_to_kick->get_name(), TRUE);
             $cache->drop("lms_steam::user_get_groups", $member_to_kick->get_name(), FALSE);
             $cache->drop("lms_steam::user_get_profile", $member_to_kick->get_name());
             $cache->drop("lms_portal::get_menu_html", $member_to_kick->get_name(), TRUE);
             $cache = get_cache_function($group->get_id());
             $cache->drop("lms_steam::group_get_members", $group->get_id());
         } else {
             if (isset($_POST["hide"]) && is_array($_POST["hide"])) {
                 $hidden_members = $group->get_steam_group()->get_attribute("COURSE_HIDDEN_STAFF");
                 if (!is_array($hidden_members)) {
                     $hidden_members = array();
                 }
                 $users_to_hide = array_keys($_POST["hide"]);
                 $displayed_staff_members = array();
                 $displayed_staff_members = array_keys($_POST["displayed_staff_member"]);
                 $tmp1_users_to_hide = array_unique(array_merge($hidden_members, $users_to_hide));
                 $tmp2_users_to_hide = array_diff($tmp1_users_to_hide, $displayed_staff_members);
                 $final_users_to_hide = array_unique(array_merge($tmp2_users_to_hide, $users_to_hide));
                 $group->get_steam_group()->set_attribute("COURSE_HIDDEN_STAFF", $final_users_to_hide);
             } else {
                 $hidden_members = $group->get_steam_group()->get_attribute("COURSE_HIDDEN_STAFF");
                 if (!is_array($hidden_members)) {
                     $hidden_members = array();
                 }
                 $displayed_staff_members = array();
                 $displayed_staff_members = array_keys($_POST["displayed_staff_member"]);
                 $users_to_hide = array();
                 $users_to_hide = array_diff($hidden_members, $displayed_staff_members);
                 $group->get_steam_group()->set_attribute("COURSE_HIDDEN_STAFF", $users_to_hide);
             }
             $frameResponseObject->setConfirmText("Sucessfully updated the visibility of course staff");
             //$portal->set_confirmation( "Sucessfully updated the visibility of course staff" );
         }
     }
     $cache = get_cache_function($group->get_id(), CACHE_LIFETIME_STATIC);
     switch (get_class($group)) {
         case "koala_group_course":
             $html_handler_group = new \koala_html_course($group);
             $html_handler_group->set_context("staff");
             //$members = $cache->call( "lms_steam::group_get_members", $group->steam_group_staff->get_id() );
             $members = \lms_steam::group_get_members($group->steam_group_staff->get_id());
             break;
         default:
             $html_handler_group = new \koala_html_group($group);
             $html_handler_group->set_context("staff");
             //$members = $cache->call( "lms_steam::group_get_members", $group->get_id() );
             $members = \lms_steam::group_get_members($group->get_id());
             break;
     }
     $is_admin = $group->is_admin($user);
     $content = \Course::getInstance()->loadTemplate("list_staff.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "list_staff.template.html" );
     $no_members = count($members);
     //DONE
     if ($no_members > 0) {
         $pageIterator = \lms_portal::get_paginator(10, $no_members, "(" . str_replace("%NAME", h($group->get_name()), gettext("%TOTAL members in %NAME")) . ")");
         $content->setVariable("PAGEITERATOR", $pageIterator["html"]);
         $start = $pageIterator["startIndex"];
         //$start = $portal->set_paginator( $content, 10, $no_members, "(" . str_replace( "%NAME", h($group->get_name()), gettext( "%TOTAL members in %NAME" ) ) . ")" );
         $end = $start + 10 > $no_members ? $no_members : $start + 10;
         $content->setVariable("LABEL_CONTACTS", gettext("staff member") . " (" . str_replace(array("%a", "%z", "%s"), array($start + 1, $end, $no_members), gettext("%a-%z out of %s")) . ")");
         $content->setCurrentBlock("BLOCK_CONTACT_LIST");
         $content->setVariable("LABEL_NAME_POSITION", gettext("Name, position"));
         !COURSE_STAFF_FACULTY_AND_FOCUS or $content->setVariable("LABEL_SUBJECT_AREA", gettext("Origin/Focus"));
         $content->setVariable("LABEL_COMMUNICATION", gettext("Communication"));
         if (\lms_steam::is_koala_admin($user) || !COURSE_KOALAADMIN_ONLY && $is_admin) {
             !COURSE_STAFFLIST_MANAGE or $content->setVariable("TH_MANAGE_CONTACT", gettext("Action"));
             !COURSE_STAFFLIST_HIDE or $content->setVariable("TH_STAFF_MEMBER_VISIBILITY", gettext("hidden"));
             !COURSE_STAFFLIST_HIDE or $content->setVariable("STAFF_MEMBER_VISIBILITY_TITLE", gettext("Selected staff members will not be visible on the course start page."));
         }
         !COURSE_STAFF_EXTENSIONS or $content->setVariable("TH_MANAGE_EXTENSIONS", "Status");
         $content->setVariable("BEGIN_HTML_FORM", "<form method=\"POST\" action=\"\">");
         $content->setVariable("END_HTML_FORM", "</form>");
         $hidden_members = $group->get_steam_group()->get_attribute("COURSE_HIDDEN_STAFF");
         if (!is_array($hidden_members)) {
             $hidden_members = array();
         }
         for ($i = $start; $i < $end; $i++) {
             $member = $members[$i];
             if ($member["USER_TRASHED"] === 1) {
                 continue;
             }
             $content->setCurrentBlock("BLOCK_CONTACT");
             $content->setVariable("CONTACT_LINK", PATH_URL . "user/" . h($member["OBJ_NAME"]) . "/");
             $icon_link = $member["OBJ_ICON"] == 0 ? PATH_STYLE . "images/anonymous.jpg" : PATH_URL . "download/image/" . h($member["OBJ_ICON"]) . "/26/35";
             $content->setVariable("CONTACT_IMAGE", $icon_link);
             $title = !empty($member["USER_ACADEMIC_TITLE"]) ? h($member["USER_ACADEMIC_TITLE"]) . " " : "";
             $content->setVariable("CONTACT_NAME", $title . h($member["USER_FIRSTNAME"]) . " " . h($member["USER_FULLNAME"]));
             if (!COURSE_SHOW_ONLY_EXTERN_MAIL || COURSE_SHOW_ONLY_EXTERN_MAIL && is_string(\steam_factory::get_user($GLOBALS['STEAM']->get_id(), $member["OBJ_NAME"])->get_attribute("USER_EMAIL")) && steam_factory::get_user($GLOBALS['STEAM']->get_id(), $member["OBJ_NAME"])->get_attribute("USER_EMAIL") != "" && steam_factory::get_user($GLOBALS['STEAM']->get_id(), $member["OBJ_NAME"])->get_attribute("USER_FORWARD_MSG") === 1) {
                 $content->setVariable("LINK_SEND_MESSAGE", PATH_URL . "messages_write.php?to=" . h($member["OBJ_NAME"]));
                 $content->setVariable("LABEL_MESSAGE", gettext("Message"));
                 $content->setVariable("LABEL_SEND", gettext("Send"));
             }
             !COURSE_STAFF_FACULTY_AND_FOCUS or $content->setVariable("FACULTY_AND_FOCUS", h($member["USER_PROFILE_FACULTY"]));
             if (\lms_steam::is_koala_admin($user) || !COURSE_KOALAADMIN_ONLY && $is_admin) {
                 !COURSE_STAFFLIST_MANAGE or $content->setVariable("TD_MANAGE_CONTACT", "<td align=\"center\"><input type=\"submit\"  name=\"remove[" . h($member["OBJ_NAME"]) . "]\" value=\"" . gettext("Remove") . "\"/></td>");
                 if (in_array($member["OBJ_ID"], $hidden_members)) {
                     !COURSE_STAFFLIST_HIDE or $content->setVariable("TD_STAFF_MEMBER_VISIBILITY", "<td align=\"center\"><input type=\"checkbox\" name=\"hide[" . $member["OBJ_ID"] . "]\" checked=\"checked\"/>" . "\n\t\t\t<input type=\"hidden\" name=\"displayed_staff_member[" . $member["OBJ_ID"] . "]\" />" . "</td>");
                 } else {
                     !COURSE_STAFFLIST_HIDE or $content->setVariable("TD_STAFF_MEMBER_VISIBILITY", "<td align=\"center\"><input type=\"checkbox\" name=\"hide[" . $member["OBJ_ID"] . "]\" />" . "\n\t\t\t<input type=\"hidden\" name=\"displayed_staff_member[" . $member["OBJ_ID"] . "]\" />" . "</td>");
                 }
             }
             $member_desc = empty($member["OBJ_DESC"]) ? "student" : $member["OBJ_DESC"];
             $status = secure_gettext($member_desc);
             $content->setVariable("OBJ_DESC", h($status));
             if (COURSE_STAFF_EXTENSIONS) {
                 $extensions = $group->get_extensions();
                 $result = "";
                 foreach ($extensions as $extension) {
                     $result .= $extension->get_member_info(\steam_factory::get_user($GLOBALS["STEAM"]->get_id(), $member["OBJ_NAME"]), $group);
                 }
                 $content->setVariable("EXTENSIONS_DATA", $result);
             }
             $content->parse("BLOCK_CONTACT");
         }
         if (\lms_steam::is_koala_admin($user) || !COURSE_KOALAADMIN_ONLY && $is_admin) {
             !COURSE_STAFFLIST_HIDE or $content->setVariable("LABEL_SUBMIT_BUTTON", gettext("Save"));
         }
         $content->parse("BLOCK_CONTACT_LIST");
     } else {
         $content->setVariable("LABEL_NO_MEMBERS", gettext("No staff found."));
     }
     $html_handler_group->set_html_left($content->get());
     //$portal->set_page_main( $html_handler_group->get_headline(), $html_handler_group->get_html() , "" );
     $frameResponseObject->setHeadline($html_handler_group->get_headline());
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($html_handler_group->get_html());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
示例#28
0
文件: wiki_new.php 项目: rolwi/koala
 if (strpos($values["name"], "/")) {
     if (!isset($problems)) {
         $problems = "";
     }
     $problems .= gettext("Please don't use the \"/\"-char in the name of the wiki.");
 }
 if (empty($problems)) {
     $group_members = $grp;
     $group_admins = 0;
     $group_staff = 0;
     // check if group is a course
     $grouptype = (string) $grp->get_attribute("OBJ_TYPE");
     if ($grouptype == "course") {
         $group_staff = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".staff");
         $group_admins = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".admins");
         $group_members = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".learners");
         $workroom = $group_members->get_workroom();
     } else {
         $workroom = $grp->get_workroom();
     }
     if (!isset($wiki_container) || !is_object($wiki_container)) {
         $new_wiki = steam_factory::create_room($GLOBALS["STEAM"]->get_id(), $values["name"], $env, $values["dsc"]);
         $new_wiki->set_attribute("OBJ_TYPE", "container_wiki_koala");
         $_SESSION["confirmation"] = str_replace("%NAME", $values["name"], gettext("New wiki '%NAME' created."));
     } else {
         $wiki_container->set_attribute(OBJ_NAME, $values["name"]);
         $wiki_container->set_attribute(OBJ_DESC, $values["dsc"]);
         $portal->set_confirmation(gettext("The changes have been saved."));
         $new_wiki = $wiki_container;
     }
     $koala_wiki = new lms_wiki($new_wiki);
示例#29
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //echo SEMESTER_URL;die;
     //$portal = \lms_portal::get_instance();
     //$portal->initialize( GUEST_NOT_ALLOWED );
     $user = \lms_steam::get_current_user();
     $all_users = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), STEAM_ALL_USER);
     $scg = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), STEAM_COURSES_GROUP, CLASS_GROUP);
     $current_semester = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $scg->get_groupname() . "." . STEAM_CURRENT_SEMESTER);
     if (!\lms_steam::is_steam_admin($user) && !lms_steam::is_semester_admin($current_semester, $user)) {
         include "bad_link.php";
         exit;
     }
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $values = $_POST["values"];
         $problems = "";
         $hints = "";
         if (empty($values["semester"])) {
             throw new Exception("Semester is not given.");
         }
         if (empty($values["id"])) {
             $problems .= gettext("The course ID is missing.") . " ";
             $hints .= gettext("The ID is necessary for unique identification, ordering and finding the course. Please fill this out.") . " ";
         }
         if (!empty($values["access"]) && $values["access"] == PERMISSION_COURSE_PASSWORD && empty($values["password"])) {
             $problems .= gettext("The course password is missing.") . " ";
             $hints .= gettext("You chose to password protect your course. Please provide a password.") . " ";
         }
         if (empty($problems) && !empty($values["get_lsf_infos"])) {
             // INFOS UEBER LSF HOLEN
             $lsf_client = new \hislsf_soap();
             unset($_SESSION["LSF_COURSE_INFO"]);
             // TODO: SEMESTER DYNAMISCH SETZEN
             $result = $lsf_client->get_available_courses(SYNC_HISLSF_SEMESTER, $values["id"]);
             if (isset($result->veranstaltung)) {
                 if (count($result->veranstaltung) == 1) {
                     header("Location: " . PATH_URL . "course/create" . "/" . $current_semester->get_name() . "/?lsf_course_id=" . $result->veranstaltung->Veranstaltungsschluessel);
                     exit;
                 } else {
                     header("Location: " . PATH_URL . "course" . "/" . $current_semester->get_name() . "/hislsf/" . $values["id"] . "/");
                     exit;
                 }
             } else {
                 $problems = "Keine Veranstaltungen im LSF unter dieser Nummer gefunden.";
             }
         }
         if (empty($problems)) {
             if (empty($values["name"])) {
                 $problems .= gettext("The course name is missing.") . " ";
                 $hints .= gettext("A name is necessary for identification.") . " ";
             }
             if (strpos($values['id'], '.')) {
                 $problems .= gettext("Please don't use the \".\"-char in the course ID.") . ' ';
             }
             if (empty($values["tutors"])) {
                 $values["tutors"] = "NN";
             }
             if (empty($problems)) {
                 if (!isset($values["hislsf"]) || !$values["hislsf"]) {
                     $values["lsf_id"] = "";
                 }
                 $max_members = -1;
                 if ($values["lsf_id"] === "") {
                     if (!empty($values["maxsize"]) && trim($values["maxsize"]) != "" && preg_match('/[^-.0-9]/', trim($values["maxsize"]))) {
                         $problems .= gettext("Invalid max number of participants.") . " ";
                         $hints .= gettext("Please enter a valid number for the max number of participants.") . " " . gettext("Please note that the input of a '0' or to leave the field blank means no limitation.") . " ";
                     } else {
                         if (!empty($values["maxsize"]) && trim($values["maxsize"]) != "" && trim($values["maxsize"]) < 0) {
                             $problems .= gettext("Invalid max number of participants.") . " ";
                             $hints .= gettext("Please enter a number equal or greater than '0' for the max number of participants.") . " " . gettext("Please note that the input of a '0' or to leave the field blank means no limitation.") . " ";
                         } else {
                             if (isset($values["maxsize"])) {
                                 if (trim($values["maxsize"]) === "") {
                                     $max_members = 0;
                                 } else {
                                     $max_members = (int) trim($values["maxsize"]);
                                 }
                             }
                         }
                     }
                 }
                 if (empty($problems)) {
                     try {
                         $new_course = \steam_factory::create_group($GLOBALS["STEAM"]->get_id(), $values["id"], $current_semester, FALSE, $values["name"]);
                     } catch (Exception $e) {
                         $problems .= gettext("The course ID already exists.") . " ";
                         $hints .= gettext("The ID is necessary for unique identification, ordering and finding the course. This ID already exists.") . " ";
                     }
                     if (empty($problems)) {
                         $new_course->set_attributes(array("OBJ_TYPE" => "course", "COURSE_PARTICIPANT_MNGMNT" => $obj_type, "COURSE_SEMESTER" => $values["semester"], "COURSE_TUTORS" => $values["tutors"], "COURSE_SHORT_DSC" => $values["short_dsc"], "COURSE_LONG_DSC" => $values["long_dsc"], "COURSE_HISLSF_ID" => $values["lsf_id"]));
                         $learners = \steam_factory::create_group($GLOBALS["STEAM"]->get_id(), "learners", $new_course, FALSE, "Participants of course '" . $values["name"] . "'");
                         $learners->set_attribute("OBJ_TYPE", "course_learners");
                         $staff = \steam_factory::create_group($GLOBALS["STEAM"]->get_id(), "staff", $new_course, FALSE, "Tutors of course '" . $values["name"] . "'");
                         $staff->set_attribute("OBJ_TYPE", "course_staff");
                         $staff->add_member($user);
                         $admins = \steam_factory::create_group($GLOBALS["STEAM"]->get_id(), "admins", $new_course, FALSE, "Admins of course '" . $values["name"] . "'");
                         $admins->set_attribute("OBJ_TYPE", "course_admins");
                         // uncomment below if koala can handle admins vs tutors
                         //$admins->add_member( $user );
                         // RIGHTS MANAGEMENT =======================================
                         $course_calendar = $new_course->get_calendar();
                         $learners_workroom = $learners->get_workroom();
                         $course_workroom = $new_course->get_workroom();
                         $staff->set_sanction_all($staff);
                         $staff->sanction_meta(SANCTION_ALL, $staff);
                         $learners->set_sanction_all($staff);
                         $learners->sanction_meta(SANCTION_ALL, $staff);
                         $new_course->set_sanction_all($staff);
                         $new_course->sanction_meta(SANCTION_ALL, $staff);
                         $admins->set_sanction_all($admins);
                         $admins->sanction_meta(SANCTION_ALL, $admins);
                         $staff->set_sanction_all($admins);
                         $staff->sanction_meta(SANCTION_ALL, $admins);
                         $learners->set_sanction_all($admins);
                         $learners->sanction_meta(SANCTION_ALL, $admins);
                         $new_course->set_sanction_all($admins);
                         $new_course->sanction_meta(SANCTION_ALL, $admins);
                         $course_calendar->set_acquire(FALSE);
                         $course_calendar->set_sanction_all($staff);
                         $course_calendar->sanction_meta(SANCTION_ALL, $staff);
                         $course_calendar->set_sanction_all($admins);
                         $course_calendar->sanction_meta(SANCTION_ALL, $admins);
                         $course_calendar->set_read_access($learners, TRUE);
                         $course_calendar->set_write_access($new_course, FALSE);
                         $course_calendar->set_insert_access($new_course, FALSE);
                         $course_calendar->set_insert_access($all_users, FALSE);
                         // Course workroom
                         $course_workroom->set_sanction($new_course, SANCTION_READ | SANCTION_EXECUTE | SANCTION_ANNOTATE);
                         $course_workroom->set_sanction_all($staff);
                         $course_workroom->set_sanction_all($admins);
                         $course_workroom->sanction_meta(SANCTION_ALL, $staff);
                         $course_workroom->sanction_meta(SANCTION_ALL, $admins);
                         // Learners workroom
                         $learners_workroom->set_read_access($all_users, TRUE);
                         $learners_workroom->set_sanction($learners, SANCTION_READ | SANCTION_EXECUTE | SANCTION_ANNOTATE);
                         $learners_workroom->set_sanction_all($staff);
                         $learners_workroom->set_sanction_all($admins);
                         $learners_workroom->sanction_meta(SANCTION_ALL, $staff);
                         $learners_workroom->sanction_meta(SANCTION_ALL, $admins);
                         $koala_course = new \koala_group_course($new_course);
                         if (!isset($values["hislsf"]) || !$values["hislsf"]) {
                             $access = $values["access"];
                             $koala_course->set_access($access, $learners, $staff, $admins, KOALA_GROUP_ACCESS);
                             if (isset($values["password"]) && $access == PERMISSION_COURSE_PASSWORD) {
                                 $koala_course->get_group_learners()->set_password($values["password"]);
                             } else {
                                 $koala_course->get_group_learners()->set_password("");
                             }
                         } else {
                             $koala_course->set_access(PERMISSION_COURSE_HISLSF, $learners, $staff, $admins, KOALA_GROUP_ACCESS);
                         }
                         if ($max_members > -1) {
                             $learners->set_attribute(GROUP_MAXSIZE, $max_members);
                         }
                         // RIGHTS MANAGEMENT =======================================
                         // extensions:
                         if (isset($_POST["extensions_available"]) && !empty($_POST["extensions_available"])) {
                             $extensions_available = explode("/", $_POST["extensions_available"]);
                             if (isset($_POST["extensions_enabled"])) {
                                 $extensions_enabled = $_POST["extensions_enabled"];
                             } else {
                                 $extensions_enabled = array();
                             }
                             if (isset($_POST["extensions_enabled_add"])) {
                                 $extensions_enabled = array_merge($extensions_enabled, explode("/", $_POST["extensions_enabled_add"]));
                             }
                             if (is_array($extensions_available)) {
                                 foreach ($extensions_available as $extension_name) {
                                     $extension = \lms_steam::get_extensionmanager()->get_extension($extension_name);
                                     if (!is_object($extension)) {
                                         continue;
                                     }
                                     if (array_search($extension_name, $extensions_enabled) === FALSE) {
                                         $extension->disable_for($koala_course);
                                     } else {
                                         $extension->enable_for($koala_course);
                                     }
                                 }
                             }
                         }
                         $cache = get_cache_function("ORGANIZATION");
                         $cache->drop("lms_steam::semester_get_courses", $current_semester->get_id());
                         header("Location: " . PATH_URL . "semester/index" . "/" . $current_semester->get_name() . "/" . $new_course->get_name() . "/");
                         exit;
                     }
                 }
             }
         }
         if (!empty($problems)) {
             $frameResponseObject->setConfirmText($problems, $hints);
             //$portal->set_problem_description( $problems, $hints );
         }
     }
     if (!empty($_GET["lsf_course_id"])) {
         $lsf_client = new hislsf_soap();
         $course_infos = $lsf_client->get_course_information(SYNC_HISLSF_SEMESTER, $_GET["lsf_course_id"]);
         if (empty($course_infos) && empty($problems)) {
             $frameResponseObject->setConfirmText(gettext("Error getting course data from HIS/LSF."));
             //$portal->set_problem_description(gettext("Error getting course data from HIS/LSF.") );
         } else {
             if (empty($course_infos["course_dsc"])) {
                 $course_infos["course_dsc"] = "keine Beschreibung vorhanden.";
             } else {
                 $course_infos["course_dsc"] = unhtmlentities($course_infos["course_dsc"]);
             }
             $values = array("lsf_id" => $course_infos["course_lsf_id"], "id" => $course_infos["course_id"], "name" => $course_infos["course_name"], "tutors" => $course_infos["course_tutors"], "short_dsc" => $course_infos["course_type"], "long_dsc" => $course_infos["course_dsc"]);
         }
         $_SESSION["LSF_COURSE_INFO"] = "";
     }
     $content = \Course::getInstance()->loadTemplate("courses_create.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "courses_create.template.html" );
     $content->setVariable("FORM_ACTION", PATH_URL . "course/create" . "/" . $current_semester->get_name() . "/");
     $content->setVariable("VALUE_SEMESTER", h($current_semester->get_name()));
     //$content->setVariable( "INFO_TEXT", gettext( "Creating a course means..." ) );
     $content->setVariable("CONFIRMATION_TEXT", str_replace("%SEMESTER", h($current_semester->get_attribute("OBJ_DESC")), gettext("You are going to create a new course in <b>%SEMESTER</b>.")) . " " . gettext("Please fill out the requested meta data at first.") . " " . gettext("At the bottom, you can determine the manner of participant management.") . " " . gettext("Also you can add further course admins later on."));
     $content->setVariable("LABEL_GENERAL_INFORMATION", gettext("General Information"));
     $content->setVariable("LABEL_COURSE_ID", gettext("Course ID"));
     $content->setVariable("VALUE_COURSE_ID", isset($values) ? h($values["id"]) : '');
     $content->setVariable("LABEL_COURSE_NAME", gettext("Name"));
     $content->setVariable("VALUE_COURSE_NAME", isset($values) ? h($values["name"]) : '');
     $content->setVariable("LABEL_COURSE_SHORT_INFORMATION", gettext("Short Info"));
     $content->setVariable("VALUE_SHORT_DSC", isset($values) ? h($values["short_dsc"]) : '');
     $content->setVariable("SHORT_DSC_SHOW_UP", gettext("This value will show up in the semester's courses list beside id, name and staff members."));
     $content->setVariable("LABEL_COURSE_TUTORS", gettext("Staff members"));
     $content->setVariable("VALUE_TUTORS", isset($values) ? h($values["tutors"]) : '');
     $content->setVariable("LABEL_LONG_DSC", gettext("Long description"));
     $content->setVariable("LONG_DSC_SHOW_UP", gettext("This is for your course page. Please add information about schedule and locations at least."));
     $content->setVariable("VALUE_LONG_DSC", isset($values) ? h($values["long_dsc"]) : '');
     $content->setVariable("LABEL_BB_BOLD", gettext("B"));
     $content->setVariable("HINT_BB_BOLD", gettext("boldface"));
     $content->setVariable("LABEL_BB_ITALIC", gettext("I"));
     $content->setVariable("HINT_BB_ITALIC", gettext("italic"));
     $content->setVariable("LABEL_BB_UNDERLINE", gettext("U"));
     $content->setVariable("HINT_BB_UNDERLINE", gettext("underline"));
     $content->setVariable("LABEL_BB_STRIKETHROUGH", gettext("S"));
     $content->setVariable("HINT_BB_STRIKETHROUGH", gettext("strikethrough"));
     $content->setVariable("LABEL_BB_IMAGE", gettext("IMG"));
     $content->setVariable("HINT_BB_IMAGE", gettext("image"));
     $content->setVariable("LABEL_BB_URL", gettext("URL"));
     $content->setVariable("HINT_BB_URL", gettext("web link"));
     $content->setVariable("LABEL_BB_MAIL", gettext("MAIL"));
     $content->setVariable("HINT_BB_MAIL", gettext("email link"));
     $content->setVariable("PARTICIPANT_MANAGEMENT", gettext("Participant Management"));
     if (isset($values) && $values["lsf_id"] > 1) {
         $content->setCurrentBlock("HIS_LSF_PM");
         $content->setVariable("LSF_COURSE_ID", isset($values) ? h($values["lsf_id"]) : '');
         $content->setVariable("LSF_COURSE", isset($values) ? h($values["id"]) : '' . " " . isset($values) ? h($values["name"]) : '' . " (" . isset($values) ? h($values["short_dsc"]) : '' . ")");
         if ($values["hislsf"]) {
             $content->setVariable("HISLSF_CHECKED", "CHECKED");
         }
         $content->setVariable("LABEL_HISLSF", "Ja, es soll die Teilnehmerverwaltung des HIS LSF verwendet werden.");
         $content->setVariable("HISLSF_INFO", "Wenn gesetzt, k&ouml;nnen sich Studenten f&uuml;r diesen Kurs nur &uuml;ber das HIS LSF anmelden.");
         $content->parse("HIS_LSF_PM");
     }
     if (!isset($values) || !isset($values["hislsf"])) {
         $content->setCurrentBlock("BLOCK_MAXSIZE");
         $content->setVariable("LABEL_MAXSIZE", gettext("Max number of participants"));
         $content->setVariable("LABEL_MAXSIZE_DSC", gettext("To limit the max number of participants for your course enter a number greater than 0. Leave this field blank or enter a '0' for no limitation."));
         if (isset($values["maxsize"])) {
             $content->setVariable("VALUE_MAXSIZE", h($values["maxsize"]));
         }
         $content->parse("BLOCK_MAXSIZE");
         $content->setCurrentBlock("BLOCK_ACCESS");
         $content->setVariable("PARTICIPANT_MANAGEMENT", gettext("Participant Management"));
     }
     $access = \koala_group_course::get_access_descriptions();
     $access_default = PERMISSION_COURSE_PUBLIC;
     if (is_array($access) && (!isset($values) || !isset($values["hislsf"]))) {
         $content->setCurrentBlock("BLOCK_ACCESS");
         foreach ($access as $key => $array) {
             if ($key != PERMISSION_COURSE_PAUL_SYNC && $key != PERMISSION_UNDEFINED || isset($values) && (int) $values["access"] == PERMISSION_UNDEFINED) {
                 $content->setCurrentBlock("ACCESS");
                 $content->setVariable("LABEL", $array["summary_short"] . ": " . $array["label"]);
                 $content->setVariable("VALUE", $key);
                 if (isset($values) && $key == (int) $values["access"] || empty($values) && $key == $access_default) {
                     $content->setVariable("CHECK", "checked=\"checked\"");
                 }
                 if ($key == PERMISSION_COURSE_PASSWORD) {
                     $content->setVariable("ONCHANGE", "onchange=\"document.getElementById('passworddiv').style.display='block'\"");
                     $content->setCurrentBlock("ACCESS_PASSWORD");
                     $content->setVariable("LABEL_PASSWORD", gettext("Password"));
                     if (!empty($values["password"])) {
                         $content->setVariable("VALUE_PASSWORD", $values["password"]);
                     }
                     if (isset($values["access"]) && $values["access"] == PERMISSION_COURSE_PASSWORD) {
                         $content->setVariable("PASSWORDDIV_DISPLAY", "block");
                     } elseif (!isset($values["access"]) && $access_default == PERMISSION_COURSE_PASSWORD) {
                         $content->setVariable("PASSWORDDIV_DISPLAY", "block");
                     } else {
                         $content->setVariable("PASSWORDDIV_DISPLAY", "none");
                     }
                     $content->parse("ACCESS_PASSWORD");
                 } else {
                     $content->setVariable("ONCHANGE", "onchange=\"document.getElementById('passworddiv').style.display='none'\"");
                 }
                 $content->parse("ACCESS");
             }
         }
         $content->parse("BLOCK_ACCESS");
     }
     // extensions:
     //$extensions = \lms_steam::get_extensionmanager()->get_extensions_by_class( 'koala_group_course' );
     $extensions = 0;
     /*if ( count( $extensions ) > 0 ) {
     			$content->setCurrentBlock( "BLOCK_EXTENSIONS" );
     			$content->setVariable( "LABEL_EXTENSIONS", gettext( "Extensions" ) );
     			$extension_list = array();
     			foreach ( $extensions as $extension ) {
     				if( $extension->get_requirements() === array() )
     				{
     					$extension_name = $extension->get_name();
     					$content->setCurrentBlock( "BLOCK_EXTENSION" );
     					$content->setVariable( "EXTENSION_ID", $extension_name );
     					$content->setVariable( "EXTENSION_NAME", $extension->get_display_name() );
     					$content->setVariable( "EXTENSION_DESC", $extension->get_display_description() );
     					$subextensions = \lms_steam::get_extensionmanager()->get_dependent_extensions($extension);
     					if( count( $subextensions ) > 0 )
     					{
     						$content->setCurrentBlock( "BLOCK_SUBEXTENSIONS" );
     						$content->setVariable( "LABEL_SUBEXTENSIONS", str_replace( "%EXTENSION", h($extension->get_display_name()), gettext( "The following sub-extensions are available for %EXTENSION" ) ));
     						foreach($subextensions as $subextension)
     						{
     							$subextension_name = $subextension->get_name();
     							$content->setCurrentBlock( "BLOCK_SUBEXTENSION" );
     							$content->setVariable( "PARENT_EXTENSION_ID", $extension_name );
     							$content->setVariable( "SUBEXTENSION_ID", $subextension_name );
     							$content->setVariable( "SUBEXTENSION_NAME", $subextension->get_display_name() );
     							$content->setVariable( "SUBEXTENSION_DESC", $subextension->get_display_description() );
     							$content->setVariable( "SUBEXTENSION_DISABLED", "disabled=\"disabled\"" );
     							$content->parse( "BLOCK_SUBEXTENSION" );
     							$extension_list[] = $subextension_name;
     						}
     						$content->parse( "BLOCK_SUBEXTENSIONS" );
     					}
     					$content->parse( "BLOCK_EXTENSION" );
     					$extension_list[] = $extension_name;
     				}
     			}
     			$content->setVariable( "VALUE_EXTENSIONS", implode( "/", $extension_list ) );
     			$content->parse( "BLOCK_EXTENSIONS" );
     		}*/
     $content->setVariable("LABEL_CREATE_COURSE", gettext("Create and finish"));
     $content->setVariable("LABEL_CREATE_ADD_ADMIN", gettext("Create and add further admins"));
     //$portal->set_page_main(
     //array( array( "link" => PATH_URL . SEMESTER_URL . "/" . $current_semester->get_name(). "/", "name" => h($current_semester->get_attribute( "OBJ_DESC" )) ), array( "link" => "", "name" => gettext( "Create new course" ) ) ),
     //$content->get()
     //);
     $frameResponseObject->setHeadline(array(array("link" => PATH_URL . "semester/index" . "/" . $current_semester->get_name() . "/", "name" => h($current_semester->get_attribute("OBJ_DESC"))), array("link" => "", "name" => gettext("Create new course"))));
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($content->get());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
示例#30
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //$portal = \lms_portal::get_instance();
     //$portal->initialize( GUEST_NOT_ALLOWED );
     //$portal->set_guest_allowed( GUEST_NOT_ALLOWED );
     $user = \lms_steam::get_current_user();
     //$portal_user = $portal->get_user();
     //$path = $request->getPath();
     //$current_semester = $path[3];
     $scg = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), STEAM_COURSES_GROUP, CLASS_GROUP);
     $current_semester = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $scg->get_groupname() . "." . STEAM_CURRENT_SEMESTER);
     $group_course = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), "Courses." . $this->params[0] . "." . $this->params[1]);
     $group = new \koala_group_course($group_course);
     $all_users = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), STEAM_ALL_USER);
     if (!$group->is_admin($user)) {
         include "bad_link.php";
         exit;
     }
     $lsfid = $group->get_steam_group()->get_attribute("COURSE_HISLSF_ID");
     $is_lsfcourse = is_string($lsfid) && strlen($lsfid) > 0 && $lsfid > 0;
     $paul_id = $group->get_attribute("COURSE_NUMBER");
     $is_paul_course = \koala_group_course::is_paul_course($paul_id);
     $accessmergel = FALSE;
     if (is_object($group)) {
         $creator = $group->get_steam_group()->get_creator();
         if ($group->get_steam_group()->get_attribute(KOALA_GROUP_ACCESS) == PERMISSION_UNDEFINED && lms_steam::get_current_user()->get_id() != $creator->get_id() && !lms_steam::is_koala_admin(lms_steam::get_current_user())) {
             $accessmergel = TRUE;
         }
     }
     if (isset($_POST["course_save"])) {
         $values = $_POST["values"];
         $problems = "";
         $hints = "";
         if (empty($values["OBJ_DESC"])) {
             $problems .= gettext("The course name is missing.") . " ";
             $hints .= gettext("A name is necessary for identification.") . " ";
         }
         if (empty($values["COURSE_TUTORS"])) {
             $values["COURSE_TUTORS"] = "NN";
         }
         $max_members = -1;
         $sizeproblems = FALSE;
         if (!empty($values["maxsize"]) && trim($values["maxsize"]) != "" && preg_match('/[^-.0-9]/', trim($values["maxsize"]))) {
             $problems .= gettext("Invalid max number of participants.") . " ";
             $hints .= gettext("Please enter a valid number for the max number of participants.") . " " . gettext("Please note that the input of a '0' or to leave the field blank means no limitation.") . " ";
             $sizeproblems = TRUE;
         } else {
             if (!empty($values["maxsize"]) && trim($values["maxsize"]) != "" && trim($values["maxsize"]) < 0) {
                 $problems .= gettext("Invalid max number of participants.") . " ";
                 $hints .= gettext("Please enter a number equal or greater than '0' for the max number of participants.") . " " . gettext("Please note that the input of a '0' or to leave the field blank means no limitation.") . " ";
                 $sizeproblems = TRUE;
             } else {
                 if (isset($values["maxsize"])) {
                     if (trim($values["maxsize"]) === "") {
                         $max_members = 0;
                     } else {
                         $max_members = (int) trim($values["maxsize"]);
                     }
                 }
             }
         }
         if (!$sizeproblems && isset($max_members) && $max_members > 0 && $max_members < $group->count_members()) {
             $problems .= gettext("Cannot set max number of participants.") . " ";
             $hints .= str_replace("%ACTUAL", $group->count_members(), str_replace("%CHOSEN", $max_members, gettext("You choosed to limit your course's max number of participants of %CHOSEN but your course already has %ACTUAL participants. If you want to set the max number of participants below %ACTUAL you have to remove some participants first."))) . " ";
         }
         if (!empty($values["access"]) && $values["access"] == PERMISSION_COURSE_PASSWORD && empty($values["password"])) {
             $problems .= gettext("The course password is missing.") . " ";
             $hints .= gettext("You chose to password protect your course. Please provide a password.") . " ";
         }
         if (empty($problems)) {
             $group->set_attributes(array_diff_key($values, array("password" => "", "maxsize" => "")));
             $learners = $group->get_group_learners();
             if (!$is_lsfcourse) {
                 $access = $values["access"];
                 $waspassword = 0;
                 $akt_access = $group->get_attribute(KOALA_GROUP_ACCESS);
                 if ($akt_access == PERMISSION_COURSE_PASSWORD) {
                     $waspassword = 1;
                 }
                 if (!$accessmergel) {
                     $group->set_access($access, $learners, $group->get_group_staff());
                 }
                 if (isset($values) && $waspassword == 1 && isset($values["password"]) && $values["password"] == "******" && $values["access"] == PERMISSION_COURSE_PASSWORD) {
                     // Do nothing in case of valid password dummy
                 } elseif ($values["access"] != PERMISSION_COURSE_PASSWORD) {
                     $learners->set_password("");
                 } else {
                     $learners->set_password(isset($values["password"]) ? trim($values["password"]) : "");
                 }
                 if ($max_members > -1) {
                     $learners->set_attribute(GROUP_MAXSIZE, $max_members);
                 }
             }
             // extensions:
             if (isset($_POST["extensions_available"]) && !empty($_POST["extensions_available"])) {
                 $extensions_available = explode("/", $_POST["extensions_available"]);
                 if (isset($_POST["extensions_enabled"])) {
                     $extensions_enabled = $_POST["extensions_enabled"];
                 } else {
                     $extensions_enabled = array();
                 }
                 if (isset($_POST["extensions_enabled_add"])) {
                     $extensions_enabled = array_merge($extensions_enabled, explode("/", $_POST["extensions_enabled_add"]));
                 }
                 if (is_array($extensions_available)) {
                     foreach ($extensions_available as $extension_name) {
                         $extension = \lms_steam::get_extensionmanager()->get_extension($extension_name);
                         if (!is_object($extension)) {
                             continue;
                         }
                         if (array_search($extension_name, $extensions_enabled) === FALSE) {
                             $extension->disable_for($group);
                         } else {
                             $extension->enable_for($group);
                         }
                     }
                 }
             }
             $cache = get_cache_function("ORGANIZATION");
             $cache->drop("lms_steam::semester_get_courses", $current_semester->get_id());
             $_SESSION["confirmation"] = gettext("The changes have been saved.");
             header("Location: " . $_SERVER["REQUEST_URI"]);
             exit;
         } else {
             //$portal->set_problem_description( $problems, $hints );
         }
     } elseif (isset($_POST["get_paul_course_data"])) {
         //at this time only the course name and short description are updated/changed
         $paul_client = new \paul_soap();
         $paul_course_id = h($group->get_attribute(OBJ_NAME));
         try {
             $paul_course_info = $paul_client->get_course_information($paul_course_id);
         } catch (Exception $exception) {
             $problem = $exception->getMessage();
             error_log($problem);
             throw new Exception("PAUL_SOAP exception: " . $problem);
         }
         //the same as in the following else-block
         $values = $group->get_attributes(array("OBJ_NAME", "OBJ_DESC", "COURSE_TUTORS", "COURSE_SHORT_DSC", "COURSE_LONG_DSC"));
         $ms = $group->get_group_learners()->get_attribute(GROUP_MAXSIZE);
         if ($ms === 0) {
             $values["maxsize"] = "";
         } else {
             $values["maxsize"] = $ms;
         }
         $values["OBJ_DESC"] = $paul_course_info["course_name_german"];
         $values["COURSE_SHORT_DSC"] = $paul_course_info["short_description"];
         //$portal->set_confirmation("test");
         //print_r($paul_course_values);
     } else {
         $values = $group->get_attributes(array("OBJ_NAME", "OBJ_DESC", "COURSE_TUTORS", "COURSE_SHORT_DSC", "COURSE_LONG_DSC"));
         $ms = $group->get_group_learners()->get_attribute(GROUP_MAXSIZE);
         if ($ms === 0) {
             $values["maxsize"] = "";
         } else {
             $values["maxsize"] = $ms;
         }
     }
     $content = \Course::getInstance()->loadTemplate("courses_edit.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "courses_edit.template.html" );
     $content->setVariable("LABEL_EDIT_COURSE_DESCRIPTION", gettext("Course Preferences"));
     $course_name = $group->get_attribute(OBJ_NAME);
     $course_number = $group->get_attribute("COURSE_NUMBER");
     $course_name = \koala_group_course::convert_course_id($course_name, $course_number);
     if (\koala_group_course::is_paul_course($course_number) && \lms_steam::is_koala_admin($user)) {
         $content->setVariable("VALUE_PAUL_ID", "  (" . gettext("PAUL-ID: " . h($group->get_attribute(OBJ_NAME))) . ")");
         $content->setVariable("ACTION_PAUL_COURSE_DATA", "<input type=\"submit\"  name=\"get_paul_course_data\" id=\"get_paul_course_data\" title=\"" . gettext("Get the course name and short description from PAUL") . "\" value=\"" . gettext("Get PAUL course data") . "\">");
     }
     $content->setVariable("LABEL_COURSE_ID", gettext("Course ID"));
     $content->setVariable("VALUE_COURSE_ID", h($course_name));
     $content->setVariable("LABEL_COURSE_NAME", gettext("Name"));
     $content->setVariable("VALUE_COURSE_NAME", h($values["OBJ_DESC"]));
     $content->setVariable("LABEL_COURSE_SHORT_INFORMATION", gettext("Short Info"));
     $content->setVariable("VALUE_SHORT_DSC", h($values["COURSE_SHORT_DSC"]));
     $content->setVariable("SHORT_DSC_SHOW_UP", gettext("This value will show up in the semester's courses list beside id, name and staff members."));
     $content->setVariable("LABEL_COURSE_TUTORS", gettext("Staff members"));
     $content->setVariable("VALUE_TUTORS", h($values["COURSE_TUTORS"]));
     $content->setVariable("LABEL_LONG_DSC", gettext("Long description"));
     $content->setVariable("LONG_DSC_SHOW_UP", gettext("This is for your course page. Please add information about schedule and locations at least."));
     $content->setVariable("VALUE_LONG_DSC", h($values["COURSE_LONG_DSC"]));
     $content->setVariable("COURSE_SAVE", gettext("Save changes"));
     $content->setVariable("AENDERN", gettext("Are you sure about your changes?"));
     $content->setVariable("LABEL_BB_BOLD", gettext("B"));
     $content->setVariable("HINT_BB_BOLD", gettext("boldface"));
     $content->setVariable("LABEL_BB_ITALIC", gettext("I"));
     $content->setVariable("HINT_BB_ITALIC", gettext("italic"));
     $content->setVariable("LABEL_BB_UNDERLINE", gettext("U"));
     $content->setVariable("HINT_BB_UNDERLINE", gettext("underline"));
     $content->setVariable("LABEL_BB_STRIKETHROUGH", gettext("S"));
     $content->setVariable("HINT_BB_STRIKETHROUGH", gettext("strikethrough"));
     $content->setVariable("LABEL_BB_IMAGE", gettext("IMG"));
     $content->setVariable("HINT_BB_IMAGE", gettext("image"));
     $content->setVariable("LABEL_BB_URL", gettext("URL"));
     $content->setVariable("HINT_BB_URL", gettext("web link"));
     $content->setVariable("LABEL_BB_MAIL", gettext("MAIL"));
     $content->setVariable("HINT_BB_MAIL", gettext("email link"));
     if (!$is_lsfcourse) {
         $content->setCurrentBlock("BLOCK_MAXSIZE");
         $content->setVariable("LABEL_MAXSIZE", gettext("Max number of participants"));
         $content->setVariable("LABEL_MAXSIZE_DSC", gettext("To limit the max number of participants for your course enter a number greater than 0. Leave this field blank or enter a '0' for no limitation."));
         $content->setVariable("VALUE_MAXSIZE", h($values["maxsize"]));
         $content->parse("BLOCK_MAXSIZE");
         $content->setCurrentBlock("BLOCK_ACCESS");
         $content->setVariable("PARTICIPANT_MANAGEMENT", gettext("Participant Management"));
         if ($accessmergel) {
             $mailto = "mailto:'.SUPPORT_EMAIL.'?subject=KoaLA:%20Invalid%20Access%20Rights&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 {
             $waspassword = 0;
             $access = \koala_group_course::get_access_descriptions();
             if (isset($values) && isset($values["access"])) {
                 $akt_access = $values["access"];
             } else {
                 $akt_access = $group->get_attribute(KOALA_GROUP_ACCESS);
                 if ($akt_access == PERMISSION_COURSE_PASSWORD) {
                     $waspassword = 1;
                 }
             }
             if (is_array($access)) {
                 $content->setVariable("WASPASSWORD", $waspassword);
                 foreach ($access as $key => $array) {
                     if ($key != PERMISSION_UNDEFINED || $akt_access == PERMISSION_UNDEFINED) {
                         if ($key != PERMISSION_COURSE_PAUL_SYNC || $is_paul_course || $akt_access == PERMISSION_COURSE_PAUL_SYNC) {
                             $content->setCurrentBlock("ACCESS");
                             $content->setVariable("LABEL", $array["summary_short"] . ": " . $array["label"]);
                             $content->setVariable("VALUE", $key);
                             if ($key == $akt_access) {
                                 $content->setVariable("CHECK", "checked=\"checked\"");
                             }
                             if ($key == PERMISSION_COURSE_PASSWORD) {
                                 $content->setVariable("ONCHANGE", "onchange=\"document.getElementById('passworddiv').style.display='block'\"");
                                 $content->setCurrentBlock("ACCESS_PASSWORD");
                                 $content->setVariable("LABEL_PASSWORD", gettext("Password"));
                                 if (!empty($values["password"])) {
                                     $content->setVariable("VALUE_PASSWORD", $values["password"]);
                                 } else {
                                     if ($waspassword == 1) {
                                         $content->setVariable("VALUE_PASSWORD", "******");
                                     }
                                 }
                                 if ($akt_access == PERMISSION_COURSE_PASSWORD) {
                                     $content->setVariable("PASSWORDDIV_DISPLAY", "block");
                                 } else {
                                     $content->setVariable("PASSWORDDIV_DISPLAY", "none");
                                 }
                                 $content->parse("ACCESS_PASSWORD");
                             } else {
                                 $content->setVariable("ONCHANGE", "onchange=\"document.getElementById('passworddiv').style.display='none'\"");
                             }
                             $content->parse("ACCESS");
                         }
                     }
                 }
             }
         }
         $content->parse("BLOCK_ACCESS");
     } else {
         $content->setCurrentBlock("BLOCK_ACCESS");
         $content->setCurrentBlock("BLOCK_HISLSF");
         $content->setVariable("PARTICIPANT_MANAGEMENT", gettext("Participant Management"));
         $hislink = "<a href=\"https://lsf.uni-paderborn.de/qisserver/rds?state=wsearchv&search=2&veranstaltung.veranstid=" . trim($lsfid) . "\" target=\"_blank\">HIS-LSF</a>";
         $content->setVariable("PARTICIPANT_MANAGEMENT_VALUE", str_replace("%LINK", $hislink, gettext("The participant management for this course is handled by <b>%LINK</b>.")));
         $content->parse("BLOCK_HISLSF");
         $content->parse("BLOCK_ACCESS");
     }
     // extensions:
     //$extensions = \lms_steam::get_extensionmanager()->get_extensions_by_class( 'koala_group_course' );
     $extensions = 0;
     /*	if ( count( $extensions ) > 0 ) {
     			$content->setCurrentBlock( "BLOCK_EXTENSIONS" );
     			$content->setVariable( "LABEL_EXTENSIONS", gettext( "Extensions" ) );
     			$extension_list = array();
     			foreach ( $extensions as $extension ) {
     				if( $extension->get_requirements() === array() )
     				{
     					$extension_name = $extension->get_name();
     					$content->setCurrentBlock( "BLOCK_EXTENSION" );
     					$content->setVariable( "EXTENSION_ID", $extension_name );
     					$content->setVariable( "EXTENSION_NAME", $extension->get_display_name() );
     					$content->setVariable( "EXTENSION_DESC", $extension->get_display_description() );
     					$extension_enabled = $extension->is_enabled( $group );
     					if ( $extension_enabled )
     					$content->setVariable( "EXTENSION_ENABLED", "checked='checked'" );
     					$subextensions = lms_steam::get_extensionmanager()->get_dependent_extensions($extension);
     					if( count( $subextensions ) > 0 )
     					{
     						$content->setCurrentBlock( "BLOCK_SUBEXTENSIONS" );
     						$content->setVariable( "LABEL_SUBEXTENSIONS", str_replace( "%EXTENSION", h($extension->get_display_name()), gettext( "The following sub-extensions are available for %EXTENSION" ) ));
     						foreach($subextensions as $subextension)
     						{
     							$subextension_name = $subextension->get_name();
     							$content->setCurrentBlock( "BLOCK_SUBEXTENSION" );
     							$content->setVariable( "PARENT_EXTENSION_ID", $extension_name );
     							$content->setVariable( "SUBEXTENSION_ID", $subextension->get_name() );
     							$content->setVariable( "SUBEXTENSION_NAME", $subextension->get_display_name() );
     							$content->setVariable( "SUBEXTENSION_DESC", $subextension->get_display_description() );
     							$checkbox_attributes = '';
     							if ( $subextension->is_enabled_for( $group ) )
     							$checkbox_attributes .= "checked='checked'";
     							if ( ! $extension_enabled || $subextension_name === "units_docpool")
     							$checkbox_attributes .= " disabled='disabled'";
     							$content->setVariable( "SUBEXTENSION_ENABLED", $checkbox_attributes );
     							$content->parse( "BLOCK_SUBEXTENSION" );
     							$extension_list[] = $subextension_name;
     						}
     						$content->parse( "BLOCK_SUBEXTENSIONS" );
     					}
     					$content->parse( "BLOCK_EXTENSION" );
     					$extension_list[] = $extension_name;
     				}
     			}
     			$content->setVariable( "VALUE_EXTENSIONS", implode( "/", $extension_list ) );
     			$content->parse( "BLOCK_EXTENSIONS" );
     		}*/
     $backlink = PATH_URL . "course/index/" . $this->params[0] . "/" . $this->params[1] . "/";
     $content->setVariable("BACKLINK", "<a href=\"{$backlink}\">" . gettext("back") . "</a>");
     //$portal->set_page_main(
     //array( array( "link" => $backlink, "name" => h($values["OBJ_DESC"]) ), array( "linK" => "", "name" => gettext( "Course Preferences" ) ) ),
     //$content->get()
     //);
     $frameResponseObject->setHeadline(array(array("link" => $backlink, "name" => h($values["OBJ_DESC"])), array("linK" => "", "name" => gettext("Course Preferences"))));
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($content->get());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }