本文整理汇总了PHP中steam_factory::groupname_to_object方法的典型用法代码示例。如果您正苦于以下问题:PHP steam_factory::groupname_to_object方法的具体用法?PHP steam_factory::groupname_to_object怎么用?PHP steam_factory::groupname_to_object使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类steam_factory
的用法示例。
在下文中一共展示了steam_factory::groupname_to_object方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_groupname_to_object
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");
}
示例2: initialize
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: frameResponse
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: get_comment_html
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: get_menu_html
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: foreach
$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: set_group_access
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: get_cache_function
}
$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: get_group
/**
* 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: gettext
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: steam_connector
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: set_access
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: frameResponse
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: frameResponse
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 = "";
//.........这里部分代码省略.........
示例15: execute
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>. "));
//.........这里部分代码省略.........