本文整理汇总了PHP中lms_steam::is_koala_admin方法的典型用法代码示例。如果您正苦于以下问题:PHP lms_steam::is_koala_admin方法的具体用法?PHP lms_steam::is_koala_admin怎么用?PHP lms_steam::is_koala_admin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lms_steam
的用法示例。
在下文中一共展示了lms_steam::is_koala_admin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($steam_user)
{
if (!$steam_user instanceof steam_user) {
throw new Exception("not a user", E_PARAMETER);
}
parent::__construct(PATH_EXTENSIONS . "content/profile/ui/html/user_profile.template.html");
$this->steam_user = $steam_user;
$this->networking_profile = new lms_networking_profile($steam_user);
$this->networking_profile->count_profile_visit(lms_steam::get_current_user());
$cache = get_cache_function($steam_user->get_name(), 86400);
$user_profile = $cache->call("lms_steam::user_get_profile", $steam_user->get_name());
$itemId = $user_profile["OBJ_ICON"];
$icon_link = $user_profile["OBJ_ICON"] == 0 ? PATH_STYLE . "images/anonymous.jpg" : PATH_URL . "download/image/" . $itemId . "/140/185";
//$icon_link = ( $user_profile[ "OBJ_ICON" ] == 0 ) ? PATH_STYLE . "images/anonymous.jpg" : PATH_URL . "cached/get_document.php?id=" . $user_profile[ "OBJ_ICON" ] . "&type=usericon&width=140&height=185";
$this->template->setVariable("USER_IMAGE", $icon_link);
$this->template->setVariable("GIVEN_NAME", $user_profile["USER_FIRSTNAME"]);
$this->template->setVariable("FAMILY_NAME", $user_profile["USER_FULLNAME"]);
if (!empty($user_profile["USER_ACADEMIC_TITLE"])) {
$this->template->setVariable("ACADEMIC_TITLE", $user_profile["USER_ACADEMIC_TITLE"]);
}
if (!empty($user_profile["USER_ACADEMIC_DEGREE"])) {
$this->template->setVariable("ACADEMIC_DEGREE", "(" . $user_profile["USER_ACADEMIC_DEGREE"] . ")");
}
$user = lms_steam::get_current_user();
if (lms_steam::is_koala_admin($user)) {
$this->template->setVariable("LABEL_LAST_LOGIN", gettext("last login") . ":");
$this->template->setVariable("LABEL_PAGE_HITS", gettext("page hits") . ":");
$this->template->setVariable("LAST_LOGIN", how_long_ago($user_profile["USER_LAST_LOGIN"]));
$this->template->setVariable("PAGE_HITS", $this->networking_profile->get_profile_visits());
}
}
示例2: is_admin
public function is_admin($user)
{
$ret = $this->steam_object->is_admin($user);
if (!$ret) {
$ret = lms_steam::is_koala_admin($user);
}
return $ret;
}
示例3: frameResponse
public function frameResponse(\FrameResponseObject $frameResponseObject)
{
$path = $this->params;
$user = \lms_steam::get_current_user();
$public = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), STEAM_PUBLIC_GROUP, CLASS_GROUP);
$id = $path[0];
try {
$steam_group = !empty($id) ? \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $id) : FALSE;
} catch (\Exception $ex) {
include "bad_link.php";
exit;
}
$group_is_private = FALSE;
if ($steam_group && is_object($steam_group)) {
switch ((string) $steam_group->get_attribute("OBJ_TYPE")) {
case "course":
$group = new \koala_group_course($steam_group);
// TODO: Passt der backlink?
$backlink = PATH_URL . SEMESTER_URL . "/" . $group->get_semester()->get_name() . "/" . h($group->get_name()) . "/";
break;
default:
$group = new \koala_group_default($steam_group);
// TODO: Passt der backlink?
$backlink = PATH_URL . "groups/" . $group->get_id() . "/";
// Determine if group is public or private
$parent = $group->get_parent_group();
if ($parent->get_id() == STEAM_PRIVATE_GROUP) {
$group_is_private = TRUE;
}
break;
}
}
if ($group_is_private) {
if (!$steam_group->is_member($user) && !\lms_steam::is_koala_admin($user)) {
throw new \Exception(gettext("You have no rights to access this group"), E_USER_RIGHTS);
}
}
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 = \Group::getInstance()->loadTemplate("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 . "messageboard/index/" . $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 {
//.........这里部分代码省略.........
示例4: execute
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);
//.........这里部分代码省略.........
示例5: get_context_menu
public function get_context_menu($context, $params = array())
{
if (!isset($_SESSION["LMS_USER"]) || !$_SESSION["LMS_USER"] instanceof lms_user || !$_SESSION["LMS_USER"]->is_logged_in()) {
return array();
}
$current_user = lms_steam::get_current_user();
$steam_group = $this->course->get_steam_group();
$learners_group = $this->course->get_group_learners();
if (!$this->course->is_member($current_user) && !$this->course->is_admin($current_user)) {
if ($context == "start" && (!$this->course->is_paul_course() && ($steam_group->get_attribute("COURSE_HISLSF_ID") == 0 || $steam_group->get_attribute("COURSE_HISLSF_ID") == "") && ($this->course->get_maxsize() == 0 || $this->course->get_maxsize() > 0 && $this->course->get_maxsize() > $this->course->count_members())) || $this->course->is_paul_course() && $this->course->get_attribute(KOALA_GROUP_ACCESS) != PERMISSION_COURSE_PAUL_SYNC) {
return array(array("link" => PATH_URL . "group_subscribe.php?group=" . $steam_group->get_id(), "name" => gettext("Join this course")));
}
return array();
}
$context_menu = array();
switch ($context) {
case "reserve_list":
$rl = $steam_group->get_attribute("SEM_APP_ID");
if (!empty($rl["SEM_APP_ID"])) {
$context_menu[] = array("link" => PATH_URL . "courses_edit_reserve_list.php?course=" . $steam_group->get_id() . "&rlid=" . $rl, "name" => gettext("Edit reserve list"));
$context_menu[] = array("link" => PATH_URL . "courses_remove_reserve_list.php?course=" . $steam_group->get_id(), "name" => gettext("Remove reserve list"));
}
break;
case "start":
if (COURSE_PREFERENCES) {
if (COURSE_KOALAADMIN_ONLY) {
if (lms_steam::is_koala_admin($current_user)) {
$context_menu[] = array("link" => PATH_URL . "course" . "/edit/" . $this->course->get_semester()->get_name() . "/" . $steam_group->get_name() . "/", "name" => gettext("Preferences"));
}
} else {
if ($this->course->is_admin($current_user)) {
$context_menu[] = array("link" => PATH_URL . "course" . "/edit/" . $this->course->get_semester()->get_name() . "/" . $steam_group->get_name() . "/", "name" => gettext("Preferences"));
//$context_menu[] = array( "link" => PATH_URL . "group_add_admin.php?group=" . $steam_group->get_id() , "name" => gettext( "Add staff member" ) );
$rl = $steam_group->get_attribute("SEM_APP_ID");
if (empty($rl["SEM_APP_ID"])) {
if (defined("COURSE_SEM_APP_ENABLED") && COURSE_SEM_APP_ENABLED && defined("SEM_APP_BASE_URL") && SEM_APP_BASE_URL != "") {
$context_menu[] = array("link" => PATH_URL . "courses_add_reserve_list.php?course=" . $steam_group->get_id(), "name" => gettext("Add reserve list"));
}
}
}
}
}
if (COURSE_LEAVE && (!$this->course->is_paul_course() && ($steam_group->get_attribute("COURSE_HISLSF_ID") == 0 || $steam_group->get_attribute("COURSE_HISLSF_ID") == "") || $this->course->is_paul_course() && $this->course->get_attribute(KOALA_GROUP_ACCESS) != PERMISSION_COURSE_PAUL_SYNC)) {
$context_menu[] = array("link" => PATH_URL . "group_cancel.php?group=" . $steam_group->get_id(), "name" => gettext("Cancel membership"));
}
break;
case "members":
if (lms_steam::is_koala_admin($current_user) || !COURSE_KOALAADMIN_ONLY && $this->course->is_admin($current_user)) {
!COURSE_PARTICIPANTS_CIRCULAR or $context_menu[] = array("link" => PATH_URL . "messages_write.php?group=" . $steam_group->get_id(), "name" => gettext("Write circular"));
!COURSE_PARTICIPANTS_EXCEL_LIST or $context_menu[] = array("link" => PATH_URL . SEMESTER_URL . "/" . $this->course->get_semester()->get_name() . "/" . $steam_group->get_name() . "/learners/excel/", "name" => gettext("Participant list (Excel)"));
!COURSE_PARTICIPANTS_ATTENDANCE_LIST or $context_menu[] = array("link" => PATH_URL . SEMESTER_URL . "/" . $this->course->get_semester()->get_name() . "/" . $steam_group->get_name() . "/learners/excel/attendance", "name" => gettext("Attendance list (Excel)"));
!COURSE_PARTICIPANTS_MANAGE_MEMBERSHIP_REQUESTS or $context_menu[] = array("link" => PATH_URL . SEMESTER_URL . "/" . $this->course->get_semester()->get_name() . "/" . $steam_group->get_name() . "/requests/", "name" => gettext("Manage membership requests"));
!COURSE_PARTICIPANTS_ADD_MEMBER or $context_menu[] = array("link" => PATH_URL . "group_add_member.php?group=" . $steam_group->get_id(), "name" => gettext("Add member"));
}
break;
case "staff":
if (lms_steam::is_koala_admin($current_user) || !COURSE_KOALAADMIN_ONLY && $this->course->is_admin($current_user)) {
!COURSE_STAFF_CIRCULAR or $context_menu[] = array("link" => PATH_URL . "messages_write.php?group=" . $steam_group->get_id(), "name" => gettext("Write circular"));
!COURSE_STAFF_EXCEL_LIST or $context_menu[] = array("link" => PATH_URL . SEMESTER_URL . "/" . $this->course->get_semester()->get_name() . "/" . $steam_group->get_name() . "/staff/excel/", "name" => gettext("staff member list (Excel)"));
//$context_menu[] = array( "link" => PATH_URL . SEMESTER_URL . "/" . $this->course->get_semester()->get_name() . "/" . $steam_group->get_name() . "/learners/excel/attendance", "name" => gettext( "Attendance list (Excel)" ) );
//$context_menu[] = array( "link" => PATH_URL . SEMESTER_URL . "/" . $this->course->get_semester()->get_name() . "/" . $steam_group->get_name() . "/requests/", "name" => gettext( "Manage membership requests" ) );
!COURSE_STAFF_ADD_MEMBER or $context_menu[] = array("link" => PATH_URL . "group_add_admin.php?group=" . $steam_group->get_id(), "name" => gettext("Add staff member"));
}
break;
case "communication":
if ($learners_group->get_workroom()->check_access_insert($current_user)) {
$context_menu[] = array("link" => PATH_URL . "weblog_new.php?env=" . $learners_group->get_workroom()->get_id() . "&group=" . $steam_group->get_id(), "name" => gettext("Create new weblog"));
$context_menu[] = array("link" => PATH_URL . "forum_new.php?env=" . $learners_group->get_workroom()->get_id() . "&group=" . $steam_group->get_id(), "name" => gettext("Create new forum"));
$context_menu[] = array("link" => PATH_URL . "wiki_new.php?env=" . $learners_group->get_workroom()->get_id() . "&group=" . $steam_group->get_id(), "name" => gettext("Create new wiki"));
}
break;
}
//TODO: extensionmanager
/* // extensions context menu entries:
foreach ($this->course->get_extensions() as $extension)
{
$extension_context_menu = $extension->get_context_menu( $context, $params );
if ( is_array( $extension_context_menu ) && !empty( $extension_context_menu ) ) {
$context_menu = array_merge( $context_menu, $extension_context_menu );
}
}*/
return $context_menu;
}
示例6: frameResponse
public function frameResponse(\FrameResponseObject $frameResponseObject)
{
$path = $this->params;
$user = \lms_steam::get_current_user();
$public = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), STEAM_PUBLIC_GROUP, CLASS_GROUP);
$id = $path[0];
$portal = \lms_portal::get_instance();
$portal_user = $portal->get_user();
try {
$steam_group = !empty($id) ? \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $id) : FALSE;
} catch (\Exception $ex) {
include "bad_link.php";
exit;
}
$group_is_private = FALSE;
if ($steam_group && is_object($steam_group)) {
switch ((string) $steam_group->get_attribute("OBJ_TYPE")) {
case "course":
$group = new \koala_group_course($steam_group);
// TODO: Passt der backlink?
$backlink = PATH_URL . SEMESTER_URL . "/" . $group->get_semester()->get_name() . "/" . h($group->get_name()) . "/";
break;
default:
$group = new \koala_group_default($steam_group);
// TODO: Passt der backlink?
$backlink = PATH_URL . "groups/" . $group->get_id() . "/";
// Determine if group is public or private
$parent = $group->get_parent_group();
if ($parent->get_id() == STEAM_PRIVATE_GROUP) {
$group_is_private = TRUE;
}
break;
}
}
if ($group_is_private) {
if (!$steam_group->is_member($user) && !\lms_steam::is_koala_admin($user)) {
throw new \Exception(gettext("You have no rights to access this group"), E_USER_RIGHTS);
}
}
if (!$group instanceof \koala_group) {
throw new \Exception("Variable group not set.");
}
if (COURSE_PARTICIPANTS_STAFF_ONLY && !$group->is_admin($user)) {
header("location:../");
exit;
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (is_array($_POST["remove"])) {
$id = key($_POST["remove"]);
$member_to_kick = \steam_factory::username_to_object($GLOBALS["STEAM"]->get_id(), $id);
$group->remove_member($member_to_kick);
$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());
}
}
$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("members");
$members = $cache->call("lms_steam::group_get_members", $group->steam_group_learners->get_id());
break;
default:
$html_handler_group = new \koala_html_group($group);
$html_handler_group->set_context("members");
$members = $cache->call("lms_steam::group_get_members", $group->get_id());
break;
}
$is_admin = $group->is_admin($user);
$content = \Group::getInstance()->loadTemplate("list_users.template.html");
$is_member = $group->is_member($user);
//echo "is_member? " . $is_member;
$privacy_deny_participants = $group->get_attribute("GROUP_PRIVACY");
//echo "attribute: ''" . $privacy_deny_participants . "''";
if ($privacy_deny_participants == PERMISSION_GROUP_PRIVACY_DENY_PARTICIPANTS && !$is_member) {
//echo "*** deny ***";
//TODO
$content->setVariable("LABEL_PRIVACY_DENY_PARTICIPANTS", gettext("Participants are hidden."));
} else {
//echo "*** permit ***";
$no_members = count($members);
if ($no_members > 0) {
switch (get_class($group)) {
case "koala_group_course":
$groupname = $group->get_course_id();
break;
default:
$groupname = $group->get_name();
break;
}
if (!USER_LIST_NO_PAGEING) {
$paginator = \lms_portal::get_paginator(10, $no_members, "(" . str_replace("%NAME", h($groupname), gettext("%TOTAL members in %NAME")) . ")");
$start = $paginator["startIndex"];
//.........这里部分代码省略.........
示例7: frameResponse
public function frameResponse(\FrameResponseObject $frameResponseObject)
{
$group_id = $this->params[0];
$user = \lms_steam::get_current_user();
try {
$steam_group = !empty($group_id) ? \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $group_id) : FALSE;
} catch (Exception $ex) {
include "bad_link.php";
exit;
}
$group_is_private = FALSE;
if ($steam_group && is_object($steam_group)) {
switch ((string) $steam_group->get_attribute("OBJ_TYPE")) {
case "course":
$group = new koala_group_course($steam_group);
// TODO: Passt der backlink?
$backlink = PATH_URL . SEMESTER_URL . "/" . $group->get_semester()->get_name() . "/" . h($group->get_name()) . "/";
break;
default:
$group = new \koala_group_default($steam_group);
// TODO: Passt der backlink?
$backlink = PATH_URL . "groups/" . $group->get_id() . "/";
// Determine if group is public or private
$parent = $group->get_parent_group();
if ($parent->get_id() == STEAM_PRIVATE_GROUP) {
$group_is_private = TRUE;
}
break;
}
}
if ($group_is_private) {
if (!$steam_group->is_member($user) && !\lms_steam::is_koala_admin($user)) {
throw new Exception(gettext("You have no rights to access this group"), E_USER_RIGHTS);
}
}
if (!$steam_group->check_access_write($user)) {
throw new Exception(str_replace("%USER", $user->get_login(), sr_replace("%GROUP", $group->get_id(), gettext("Access denied: User %USER has no right to delete the group %GROUP"))), E_USER_RIGHTS);
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$values = $_POST["values"];
$env = $steam_group->get_environment();
// TODO: Passt der link?
$upper_link = PATH_URL . "groups/" . (is_object($env) ? "?cat=" . $env->get_id() : "");
$group_name = $group->get_display_name();
$members = $group->get_members();
$inventory = $group->get_workroom()->get_inventory_raw();
$deleted = TRUE;
foreach ($inventory as $object) {
if (!$object instanceof \steam_user) {
try {
\lms_steam::delete($object);
} catch (Exception $ex3) {
\logging::write_log(LOG_DEBUGLOG, "groups_delete:error deleting object from group workroom\t" . $login . " \t" . $group->get_display_name() . " \t" . $steam_group->get_id() . " \t" . $object->get_id());
}
}
}
if ($steam_group->delete()) {
$user->get_attributes(array(OBJ_NAME, USER_FIRSTNAME, USER_FULLNAME));
foreach ($members as $member) {
$cache = get_cache_function($member->get_name());
$cache->drop("lms_steam::user_get_groups", $member->get_name(), TRUE);
$cache->drop("lms_steam::user_get_groups", $member->get_name(), FALSE);
$cache->drop("lms_steam::user_get_profile", $member->get_name());
$cache->drop("lms_portal::get_menu_html", $member->get_name(), TRUE);
}
$cache = get_cache_function($steam_group->get_id());
$cache->drop("lms_steam::group_get_members", $steam_group->get_id());
foreach ($members as $member) {
\lms_steam::mail($member, $user, PLATFORM_NAME . ": " . str_replace("%NAME", h($group_name), gettext("Group %NAME has been deleted.")), str_replace("%USER", $user->get_name() . " (" . $user->get_attribute(USER_FIRSTNAME) . " " . $user->get_attribute(USER_FULLNAME) . ")", str_replace("%NAME", h($group_name), gettext("The group '%NAME' has been deleted from he koaLA System by %USER."))) . "\n\n-- \n" . str_replace("%NAME", h($group_name), gettext("This system generated notification message was sent to you as a former member of the deleted group \"%NAME\"")));
}
$_SESSION["confirmation"] = str_replace("%NAME", h($group_name), gettext("The group '%NAME' has been deleted. A notification has been sent to former members."));
header("Location: " . $upper_link);
exit;
} else {
throw new Exception("Deletion of group failed");
}
}
$content = \Group::getInstance()->loadTemplate("group_delete.template.html");
$content->setVariable("FORM_ACTION", "");
$content->setVariable("LABEL_ARE_YOU_SURE", gettext("Are you sure?"));
$content->setVariable("INFO_DELETE_GROUP", str_replace("%GROUP_NAME", h($group->get_name()), gettext("You are going to delete '%GROUP_NAME'.")) . "<br />" . gettext("All data of this group will be removed from the system including weblogs, wikis, forums and documents. All members of this group will be notified about the deletion automatically.") . "<br /><br /><strong>" . gettext("The deletion process may take several minutes.")) . "</strong>";
$content->setVariable("LABEL_DELETE_IT", gettext("Yes, delete this group"));
$content->setVariable("DELETE_BACK_LINK", $_SERVER["HTTP_REFERER"]);
$content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]);
$content->setVariable("LABEL_RETURN", gettext("back"));
$frameResponseObject->setTitle("Group");
$rawHtml = new \Widgets\RawHtml();
$rawHtml->setHtml($content->get());
$frameResponseObject->addWidget($rawHtml);
return $frameResponseObject;
}
示例8: Exception
<?php
if (!$course->is_staff(lms_steam::get_current_user()) && !lms_steam::is_koala_admin(lms_steam::get_current_user())) {
throw new Exception("No rights to view this.", E_USER_RIGHTS);
}
require_once "Spreadsheet/Excel/Writer.php";
$cache = get_cache_function($unit->get_id(), CACHE_LIFETIME_STATIC);
$participant_group = $unit->get_attribute("UNIT_POINTLIST_PARTICIPANTS");
$proxy = $unit->get_attribute("UNIT_POINTLIST_PROXY");
if (defined("LOG_DEBUGLOG")) {
$time1 = microtime(TRUE);
$login = lms_steam::get_current_user()->get_name();
logging::write_log(LOG_DEBUGLOG, "units_pointlist_excel:\t " . $login . "\t" . $unit->get_display_name() . "\t" . $participant_group->get_identifier() . "\t" . $participant_group->count_members() . "\t" . date("d.m.y G:i:s", time()) . "... ");
}
$members = $cache->call("lms_steam::group_get_members", $participant_group->get_id(), TRUE);
// INITIALIZATION
$course_id = $course->get_course_id();
$course_name = $course->get_course_name();
$semester = $course->get_semester();
$proxy_data = $proxy->get_all_attributes();
$points = units_pointlist::extract_pointlist($proxy_data);
$maxpoints = $proxy_data["UNIT_POINTLIST_MAXPOINTS"];
$count = $unit->get_attribute("UNIT_POINTLIST_COUNT");
$bonus_1 = $unit->get_attribute("UNIT_POINTLIST_BONUS_1");
$bonus_2 = $unit->get_attribute("UNIT_POINTLIST_BONUS_2");
$unit_name = $unit->get_display_name();
$excel = new Spreadsheet_Excel_Writer();
$excel->setTempDir(PATH_TEMP);
$format_table_header =& $excel->addFormat(array('Size' => 12, 'Align' => 'left', 'Bold' => 1));
$format_table_header_number =& $excel->addFormat(array('Size' => 12, 'Align' => 'right', 'Bold' => 1));
$sheet_table_header =& $excel->addFormat(array('Size' => 14, 'Align' => 'left'));
示例9: execute
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)) {
//.........这里部分代码省略.........
示例10: is_admin
public function is_admin($steam_user)
{
$ret = $this->is_staff($steam_user);
if (!$ret) {
$ret = lms_steam::is_koala_admin($steam_user);
}
return $ret;
}
示例11: ini_set
<?php
include_once "../../etc/koala.conf.php";
ini_set('memory_limit', '2024M');
ini_set('max_execution_time', '300');
$portal = lms_portal::get_instance();
$portal->initialize(GUEST_NOT_ALLOWED);
$user = lms_steam::get_current_user();
if (!lms_steam::is_koala_admin($user)) {
header("location:/");
exit;
}
$STEAM = $GLOBALS["STEAM"];
echo "<h1>Installing SPM</h1>";
$package_container = steam_factory::get_object_by_name($STEAM->get_id(), "/packages");
if (!is_object($package_container)) {
echo "Could not find /packages on your open-sTeam server.<br>";
die;
}
echo "Reading file <br>";
$myFile = PATH_TEMP . "elearning_stahl_verkauf-1_40.spm";
$fh = fopen($myFile, 'r');
$theData = fread($fh, filesize($myFile));
fclose($fh);
echo "Uploading File <br>";
$package = steam_factory::create_document($STEAM->get_id(), "elearning_stahl_verkauf-1_40.spm", $theData, "application/download", $package_container);
echo "Installiere Package<br>";
echo $STEAM->install_package($package);
示例12: frameResponse
public function frameResponse(\FrameResponseObject $frameResponseObject)
{
$path = $this->params;
$user = \lms_steam::get_current_user();
$public = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), STEAM_PUBLIC_GROUP, CLASS_GROUP);
$id = $path[0];
$portal = \lms_portal::get_instance();
$portal->initialize(GUEST_NOT_ALLOWED);
$portal_user = $portal->get_user();
try {
$steam_group = !empty($id) ? \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $id) : FALSE;
} catch (\Exception $ex) {
include "bad_link.php";
exit;
}
$group_is_private = FALSE;
if ($steam_group && is_object($steam_group)) {
switch ((string) $steam_group->get_attribute("OBJ_TYPE")) {
case "course":
$group = new \koala_group_course($steam_group);
// TODO: Passt der backlink?
$backlink = PATH_URL . SEMESTER_URL . "/" . $group->get_semester()->get_name() . "/" . h($group->get_name()) . "/";
break;
default:
$group = new \koala_group_default($steam_group);
// TODO: Passt der backlink?
$backlink = PATH_URL . "groups/" . $group->get_id() . "/";
// Determine if group is public or private
$parent = $group->get_parent_group();
if ($parent->get_id() == STEAM_PRIVATE_GROUP) {
$group_is_private = TRUE;
}
break;
}
}
if ($group_is_private) {
if (!$steam_group->is_member($user) && !\lms_steam::is_koala_admin($user)) {
throw new \Exception(gettext("You have no rights to access this group"), E_USER_RIGHTS);
}
}
$content = \Group::getInstance()->loadTemplate("membership_requests.template.html");
$content->setVariable("INFO_TEXT", gettext("The people listed are interested in becoming a member of your group.") . " " . gettext("Here, you can choose wether to affirm their membership or cancel the request.") . " " . gettext("In both cases, the user concerned will automatically get informed by mail about your decision."));
// always try to use the correct specialized group:
if ($group instanceof \koala_object) {
$group = \koala_object::get_koala_object($group->get_steam_object());
} else {
if ($group instanceof \steam_object) {
$group = \koala_object::get_koala_object($group);
} else {
throw new \Exception("No 'group' param provided");
}
}
$type = $group->get_attribute("OBJ_TYPE");
switch ($type) {
case "group_tutorial_koala":
// TODO: Passt der backlink?
$backlink = $backlink . "tutorials/" . $group->get_id() . "/";
break;
case "course_tutorial":
// TODO: Passt der backlink?
$backlink = $backlink . "tutorials/" . $group->get_id() . "/";
break;
default:
// TODO: Passt der backlink?
$backlink = $backlink . "members/";
}
if (!$group->is_admin($user)) {
// throw new Exception( $user->get_name() . " is no admin of " . $group->get_name() );
header("Location: " . PATH_URL . "error.php?error=" . E_USER_RIGHTS);
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (isset($_POST['affirm']) && is_array($_POST['affirm'])) {
$candidate = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), key($_POST["affirm"]));
if ($group instanceof \koala_group_tutorial) {
if ($group->get_course_group()->get_attribute("EXCLUSIVE_TUTORIAL_MEMBERSHIP") === "TRUE") {
$course_learners_group = $group->steam_group_course_learners;
$subgroups = $course_learners_group->get_subgroups();
foreach ($subgroups as $sg) {
if (($sg->get_attribute("OBJ_TYPE") === "course_tutorial" || $sg->get_attribute("OBJ_TYPE") === "group_tutorial_koala") && $sg->is_member($candidate) && $sg != $steam_group) {
$already_member_and_exclusive = true;
$in_group = $sg;
}
}
}
}
if ($already_member_and_exclusive) {
if (!isset($_POST['confirmed']) || $_POST['confirmed'] != "true") {
$content->setCurrentBlock("BLOCK_WARNING");
$content->setVariable("WARNING_TEXT", gettext("Attention! The user whose membership you wish to affirm already became member in another tutorial in the meantime."));
$content->parse("BLOCK_WARNING");
}
if (isset($_POST['confirmed']) && $_POST['confirmed'] === "true") {
$group->add_member($candidate);
$group->remove_membership_request($candidate);
$subject = str_replace("%GROUP", $group->get_name(), gettext("Welcome to '%GROUP'"));
$message = gettext("Your membership was affirmed.");
$portal->set_confirmation(str_replace("%NAME", $candidate->get_attribute("USER_FIRSTNAME") . " " . $candidate->get_attribute("USER_FULLNAME"), gettext("Membership of %NAME affirmed.")));
// uncache group members page:
$cache = get_cache_function($group->get_id(), CACHE_LIFETIME_STATIC);
$cache->drop("lms_steam::group_get_members", $group->get_id());
//.........这里部分代码省略.........
示例13: frameResponse
public function frameResponse(\FrameResponseObject $frameResponseObject)
{
$path = $this->params;
$user = \lms_steam::get_current_user();
$public = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), STEAM_PUBLIC_GROUP, CLASS_GROUP);
$id = $path[0];
try {
$steam_group = !empty($id) ? \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $id) : FALSE;
} catch (Exception $ex) {
include "bad_link.php";
exit;
}
$html_handler_group = new \koala_html_group($steam_group);
$html_handler_group->set_context("start");
$group_is_private = FALSE;
if ($steam_group && is_object($steam_group)) {
switch ((string) $steam_group->get_attribute("OBJ_TYPE")) {
case "course":
$group = new \koala_group_course($steam_group);
// TODO: Passt der backlink?
$backlink = PATH_URL . SEMESTER_URL . "/" . $group->get_semester()->get_name() . "/" . h($group->get_name()) . "/";
break;
default:
$group = new \koala_group_default($steam_group);
// TODO: Passt der backlink?
$backlink = PATH_URL . "groups/" . $group->get_id() . "/";
// Determine if group is public or private
$parent = $group->get_parent_group();
if ($parent->get_id() == STEAM_PRIVATE_GROUP) {
$group_is_private = TRUE;
}
break;
}
}
if ($group_is_private) {
if (!$steam_group->is_member($user) && !\lms_steam::is_koala_admin($user)) {
throw new Exception(gettext("You have no rights to access this group"), E_USER_RIGHTS);
}
}
if ($id != STEAM_PUBLIC_GROUP) {
//TODO: Somethings wrong here... again a 404 error while loading koala_html_group
/*
$html_handler_group = new \koala_html_group( $group );
$html_handler_group->set_context( "start" );
*/
$content = \Group::getInstance()->loadTemplate("group_start.template.html");
$content->setVariable("LABEL_DESCRIPTION", gettext("Description"));
$desc = $group->get_attribute("OBJ_DESC");
if (empty($desc)) {
$content->setVariable("OBJ_DESC", gettext("No description available."));
} else {
$content->setVariable("OBJ_DESC", get_formatted_output($desc));
}
$about = $group->get_attribute("OBJ_LONG_DSC");
if (!empty($about)) {
$content->setCurrentBlock("BLOCK_ABOUT");
$content->setVariable("VALUE_ABOUT", get_formatted_output($about));
$content->parse("BLOCK_ABOUT");
}
$content->setVariable("LABEL_ADMINS", gettext("Moderated by"));
if ($group->get_maxsize() > 0) {
$content->setCurrentBlock("BLOCK_GROUPSIZE");
$content->setVariable("LABEL_MAXSIZE_HEADER", gettext("The number of participants of this group is limited."));
$content->setVariable("LABEL_MAXSIZE_DESCRIPTION", str_replace("%MAX", $group->get_maxsize(), str_replace("%ACTUAL", $group->count_members(), gettext("The actual participant count is %ACTUAL of %MAX."))));
$content->parse("BLOCK_GROUPSIZE");
}
$admins = $group->get_admins();
if (count($admins) > 0) {
foreach ($admins as $admin) {
$content->setCurrentBlock("BLOCK_ADMIN");
$admin_attributes = $admin->get_attributes(array("USER_FIRSTNAME", "USER_FULLNAME", "OBJ_ICON", "OBJ_DESC", "OBJ_NAME"));
if ($admin instanceof \steam_user) {
$content->setVariable("ADMIN_NAME", h($admin_attributes["USER_FIRSTNAME"]) . " " . h($admin_attributes["USER_FULLNAME"]));
$content->setVariable("ADMIN_LINK", PATH_URL . "user/" . h($admin->get_name()) . "/");
} else {
$content->setVariable("ADMIN_NAME", h($admin_attributes["OBJ_NAME"]));
$content->setVariable("ADMIN_LINK", PATH_URL . "groups/" . $admin->get_id() . "/");
}
$content->setVariable("ADMIN_ICON", PATH_URL . "cached/get_document.php?id=" . $admin_attributes["OBJ_ICON"]->get_id() . "&type=usericon&width=40&height=47");
$admin_desc = empty($admin_attributes["OBJ_DESC"]) ? "student" : $admin_attributes["OBJ_DESC"];
$content->setVariable("ADMIN_DESC", secure_gettext($admin_desc));
$content->parse("BLOCK_ADMIN");
}
} else {
$content->setVariable("LABEL_UNMODERATED", gettext("Group is unmoderated."));
}
//TODO: Somethings wrong here... again a 404 error while loading koala_html_group
//$html_handler_group->set_html_left( $content->get() );
// TODO: Portal...!
//$portal->set_page_main( $html_handler_group->get_headline(), $html_handler_group->get_html() , "" );
//$portal->show_html();
} else {
//TODO: Wann wird das hier aufgerufen??
$public = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), STEAM_PUBLIC_GROUP, CLASS_GROUP);
$user = \lms_steam::get_current_user();
$content = \Group::getInstance()->loadTemplate("groups_public.template.html");
if (MANAGE_GROUPS_MEMBERSHIP || CREATE_GROUPS) {
$content->setCurrentBlock("BLOCK_ACTION_BAR_GROUPS");
if (MANAGE_GROUPS_MEMBERSHIP) {
$content->setCurrentBlock("BLOCK_MANAGE_GROUPS_MEMBERSHIP");
//.........这里部分代码省略.........
示例14: execute
public function execute(\FrameResponseObject $frameResponseObject)
{
//if (!defined("OBJ_ID")) define( "OBJ_ID", $weblog->get_id() );
$weblogId = $this->id;
$weblog = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $weblogId);
if (!defined("OBJ_ID")) {
define("OBJ_ID", $weblog->get_id());
}
$env = $weblog->get_environment();
$grp = $env->get_creator();
if ($grp->get_name() == "learners" && $grp->get_attribute(OBJ_TYPE) == "course_learners") {
$grp = $grp->get_parent_group();
}
$accessmergel = FALSE;
if (isset($weblog) && is_object($weblog)) {
$creator = $weblog->get_creator();
if ($weblog->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 the weblog 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 weblog.");
}
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($weblog) || !is_object($weblog)) {
$weblog_new = \steam_weblog::create_steam_structure($GLOBALS["STEAM"], $values["name"], $values["dsc"], $env);
$_SESSION["confirmation"] = str_replace("%NAME", h($values["name"]), gettext("New weblog '%NAME' created."));
} else {
$weblog->set_attribute(OBJ_NAME, $values["name"]);
$weblog->set_attribute(OBJ_DESC, $values["dsc"]);
$frameResponseObject->setConfirmText(gettext("The changes have been saved."));
//$portal->set_confirmation( gettext( "The changes have been saved." ));
$weblog_new = $weblog;
}
//var_dump($weblog_new);die;
$koala_weblog = new \lms_weblog($weblog_new);
$access = (int) $values["access"];
//var_dump($access);
$access_descriptions = \lms_weblog::get_access_descriptions($grp);
//var_dump(!$accessmergel);die;
//if (!$accessmergel) $koala_weblog->set_access( $access, $access_descriptions[$access]["members"] , $access_descriptions[$access]["steam"], $group_members, $group_staff, $group_admins );
// HIER DER NEUE CODE::ENDE
$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_CALENDAR, array("WEBLOG_LANGUAGE"));
$cache->drop("lms_steam::get_group_communication_objects", $workroom->get_id(), CLASS_MESSAGEBOARD | CLASS_CALENDAR | CLASS_CONTAINER | CLASS_ROOM);
if (!isset($weblog) || !is_object($weblog)) {
header("Location: " . $backlink);
exit;
}
} else {
//TODO:PROBLEMDESCRIPTION
//$portal->set_problem_description( $problems, isset($hints)?$hints:"" );
}
}
$content = \Weblog::getInstance()->loadTemplate("object_new.template.html");
//$content = new HTML_TEMPLATE_IT( PATH_TEMPLATES );
//$content->loadTemplateFile( "object_new.template.html" );
if (isset($weblog) && is_object($weblog)) {
$content->setVariable("INFO_TEXT", str_replace("%NAME", h($weblog->get_name()), gettext("You are going to edit the weblog '<b>%NAME</b>'.")));
$content->setVariable("LABEL_CREATE", gettext("Save changes"));
$pagetitle = gettext("Preferences");
if (empty($values)) {
$values = array();
$values["name"] = $weblog->get_name();
$values["dsc"] = $weblog->get_attribute(OBJ_DESC);
$values["access"] = $weblog->get_attribute(KOALA_ACCESS);
}
$breadcrumbheader = gettext("Preferences");
//.........这里部分代码省略.........
示例15: reset_elearning_unit_user_data
function reset_elearning_unit_user_data()
{
$user = lms_steam::get_current_user();
if (lms_steam::is_koala_admin($user)) {
//delete old preferences
$this->unit_elearning_preferences->delete();
//create new
$this->check_elearning_data();
}
}