本文整理汇总了PHP中lms_portal::get_paginator方法的典型用法代码示例。如果您正苦于以下问题:PHP lms_portal::get_paginator方法的具体用法?PHP lms_portal::get_paginator怎么用?PHP lms_portal::get_paginator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lms_portal
的用法示例。
在下文中一共展示了lms_portal::get_paginator方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: frameResponse
//.........这里部分代码省略.........
unset($feeds[$id]);
$user->set_attribute("USER_RSS_FEEDS", $feeds);
$_SESSION["confirmation"] = str_replace("%NAME", h($messageboard->get_name()), gettext("subscription of '%NAME' canceled."));
header("Location: " . PATH_URL . "forums/" . $messageboard->get_id() . "/");
exit;
}
if (empty($_GET["pattern"]) && !isset($author_id)) {
$cache = get_cache_function(OBJ_ID, 300);
$discussions = $cache->call("lms_forum::get_discussions", OBJ_ID);
} elseif (isset($author_id)) {
$cache = get_cache_function(\lms_steam::get_current_user()->get_name(), 300);
$discussions = $cache->call("lms_forum::search_user_posts", $messageboard->get_id(), $author_id);
} else {
$cache = get_cache_function(\lms_steam::get_current_user()->get_name(), 300);
$discussions = $cache->call("lms_forum::search_pattern", $messageboard->get_id(), $_GET["pattern"]);
}
$content->setVariable("LABEL_ALL_TOPICS", gettext("All Threads"));
if ($messageboard->check_access_annotate(\lms_steam::get_current_user())) {
$content->setCurrentBlock("BLOCK_WRITE_ACCESS");
if (isset($author_id)) {
$content->setVariable("LABEL_THREADS_POSTED_IN", gettext("All Threads"));
// TODO: Passt der link?
$content->setVariable("LINK_AUTHOR", PATH_URL . "forums/" . $messageboard->get_id() . "/");
} else {
$content->setVariable("LABEL_THREADS_POSTED_IN", gettext("Threads you've posted in"));
// TODO: Passt der link?
$content->setVariable("LINK_AUTHOR", PATH_URL . "forums/" . $messageboard->get_id() . "/?author=" . \lms_steam::get_current_user()->get_name());
}
// TODO: Passt der link?
$content->setVariable("LINK_POST_NEW", PATH_URL . "messageboard/newDiscussion/" . $messageboard->get_id());
$content->setVariable("LABEL_POST_NEW_THREAD", gettext("Post a new thread"));
$content->parse("BLOCK_WRITE_ACCESS");
}
if ($messageboard->check_access_write(\lms_steam::get_current_user())) {
$content->setCurrentBlock("BLOCK_ADMIN");
$content->setVariable("LINK_EDIT", PATH_URL . "messageboard/editMessageboard/" . $messageboard->get_id());
$content->setVariable("LABEL_EDIT", gettext("Preferences"));
$content->setVariable("LINK_DELETE", PATH_URL . "messageboard/deleteMessageboard/" . $messageboard->get_id());
$content->setVariable("LABEL_DELETE", gettext("Delete forum"));
$content->parse("BLOCK_ADMIN");
}
$content->setCurrentBlock("BLOCK_WATCH");
if ($is_watching) {
$content->setVariable("LABEL_BOOKMARK", gettext("End watching"));
// TODO: Passt der link?
$content->setVariable("LINK_BOOKMARK", PATH_URL . "forums/" . $messageboard->get_id() . "/?action=delete_bookmark&unsubscribe=" . $messageboard->get_id());
} else {
$content->setVariable("LABEL_BOOKMARK", gettext("Watch this forum"));
// TODO: Passt der link?
$content->setVariable("LINK_BOOKMARK", PATH_URL . "forums/" . $messageboard->get_id() . "/?action=bookmark_rss");
}
$content->parse("BLOCK_WATCH");
// ACCESS
$access_descriptions = \lms_forum::get_access_descriptions($grp);
$access_descriptions = $access_descriptions[$messageboard->get_attribute(KOALA_ACCESS)];
$access = $access_descriptions["summary_short"] . ": " . $access_descriptions["label"];
$content->setCurrentBlock("BLOCK_ACCESS");
$content->setVariable("TITLE_ACCESS", gettext("Access"));
$content->setVariable("LABEL_ACCESS", $access);
$content->parse("BLOCK_ACCESS");
$content->setVariable("LABEL_TITLE", gettext("Title"));
$content->setVariable("LABEL_AUTHOR", gettext("Author"));
$content->setVariable("LABEL_REPLIES", gettext("Replies"));
$content->setVariable("LABEL_LATEST_POST", gettext("Latest Post"));
// PAGE SETZEN
$no_discussions = count($discussions);
$paginator = \lms_portal::get_paginator(20, $no_discussions, gettext("(%TOTAL discussions in forum)"));
$start = $paginator["startIndex"];
//$start = $portal->set_paginator( $content, 20, $no_discussions, gettext( "(%TOTAL discussions in forum)" ) );
$end = $start + 20 > $no_discussions ? $no_discussions : $start + 20;
for ($i = $start; $i < $end; $i++) {
$discussion = $discussions[$i];
$content->setVariable("PAGINATOR", $paginator["html"]);
$content->setCurrentBlock("BLOCK_THREAD");
if (time() - $discussion["LATEST_POST_TS"] > $_SESSION["last_login"]) {
$content->setCurrentBlock("BLOCK_THREAD_NEW");
$content->setVariable("NEW_LABEL", gettext("New"));
$content->parse("BLOCK_THREAD_NEW");
}
$content->setVariable("THREAD_LINK", PATH_URL . "messageboard/viewDiscussion/" . $discussion["OBJ_ID"] . "/");
$content->setVariable("THREAD_SUBJECT", h($discussion["OBJ_NAME"]));
$content->setVariable("THREAD_LAST_ENTRY", how_long_ago($discussion["LATEST_POST_TS"]));
// TODO: Passt der link?
$content->setVariable("AUTHOR_LINK", PATH_URL . "user/" . $discussion["AUTHOR_LOGIN"] . "/");
$content->setVariable("AUTHOR_IMAGE", PATH_URL . "cached/get_document.php?id=" . $discussion["OBJ_ICON"] . "&type=usericon&width=30&height=40");
$title = !empty($discussion["USER_ACADEMIC_TITLE"]) ? $discussion["USER_ACADEMIC_TITLE"] . " " : "";
$content->setVariable("AUTHOR_NAME", h($title . $discussion["USER_FIRSTNAME"] . " " . $discussion["USER_FULLNAME"]));
$content->setVariable("THREAD_REPLIES", h($discussion["REPLIES"]));
$content->parse("BLOCK_THREAD");
}
$portal->set_rss_feed(PATH_URL . "services/feeds/forum_public.php?id=" . OBJ_ID, gettext("Feed"), str_replace("%l", isset($login) ? $login : "", gettext("Subscribe to this forum's Newsfeed")));
// TODO: Passt der link?
$rootlink = \lms_steam::get_link_to_root($messageboard);
$headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("link" => "", "name" => h($messageboard->get_name())));
$frameResponseObject->setTitle("Messageboard");
$rawHtml = new \Widgets\RawHtml();
$rawHtml->setHtml($content->get());
$frameResponseObject->addWidget($rawHtml);
return $frameResponseObject;
}
示例2: 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)) {
//.........这里部分代码省略.........
示例3: execute
public function execute(\FrameResponseObject $frameResponseObject)
{
$timestamp = $this->params[1];
//$portal = \lms_portal::get_instance();
//$portal->initialize( GUEST_NOT_ALLOWED );
$user = \lms_steam::get_current_user();
//$path = $request->getPath();
$STEAM = $GLOBALS["STEAM"];
$weblogId = $this->params[0];
$weblog = \steam_factory::get_object($STEAM->get_id(), $weblogId);
//if ( ! $weblog = steam_factory::get_object( $STEAM->get_id(), $_GET[ "id" ] ) )
//{
// include( "bad_link.php" );
// exit;
//}
if (!$weblog instanceof \steam_calendar) {
if ($weblog instanceof \steam_container) {
$category = $weblog;
$categories = $category->get_environment();
$weblog = new \steam_weblog($GLOBALS["STEAM"], $categories->get_environment()->get_id());
} elseif ($weblog instanceof \steam_date) {
$date = $weblog;
$weblog = new \steam_weblog($GLOBALS["STEAM"], $date->get_environment()->get_id());
} else {
include "bad_link.php";
exit;
}
} else {
$weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $weblogId);
define("OBJ_ID", $weblogId);
if (!$weblog->check_access_read($user)) {
throw new \Exception("No rights to view this.", E_USER_RIGHTS);
}
}
$weblog_html_handler = new \lms_weblog($weblog);
$weblog_html_handler->set_widget_categories();
$weblog_html_handler->set_widget_archive();
$first_of_month = $timestamp;
$last_of_month = strtotime("-1 day", strtotime("+1 month", $first_of_month));
$date_objects = $weblog->get_date_objects((int) $first_of_month, (int) $last_of_month);
// $date_objects = $weblog->get_date_objects( );
$no_entries = count($date_objects);
//TODO: PAGINATOR REINKNALLEN
$pageIterator = \lms_portal::get_paginator(5, $no_entries, gettext("%TOTAL entries in this archive."));
//$content->setVariable("PAGEITERATOR", $pageIterator["html"]);
$start = $pageIterator["startIndex"];
//$start = $portal->set_paginator( 5, $no_entries, gettext( "%TOTAL entries in this archive." ) );
$end = $start + 5 > $no_entries ? $no_entries : $start + 5;
$weblog_html_handler->print_entries($date_objects, TRUE);
//$portal->set_rss_feed( PATH_URL . "services/feeds/weblog_public.php?id=" . OBJ_ID , gettext( "Feed" ), str_replace( "%l", (isset($login))?$login:'', gettext( "Subscribe to this forum's Newsfeed" ) ) );
$rootlink = \lms_steam::get_link_to_root($weblog);
$headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($weblog->get_name()), "link" => PATH_URL . "weblog/" . $weblog->get_id() . "/"), array("link" => "", "name" => strftime("%B %G", $timestamp)));
//$portal->set_page_main(
// $headline,
// $weblog_html_handler->get_html()
//);
$frameResponseObject->setHeadline($headline);
$widget = new \Widgets\RawHtml();
$widget->setHtml($weblog_html_handler->get_html());
$frameResponseObject->addWidget($widget);
return $frameResponseObject;
}
示例4: execute
public function execute(\FrameResponseObject $frameResponseObject)
{
$current_user = \lms_steam::get_current_user();
$login = $current_user->get_name();
//$path = $request->getPath();
if (isset($this->id)) {
$userName = $this->id;
$user = \steam_factory::get_user($GLOBALS["STEAM"]->get_id(), $userName);
} else {
$user = $current_user;
}
//$portal=\lms_portal::get_instance();
$cache = get_cache_function($login, 86400);
// $portal->set_page_title( $login );
$html_handler_profile = new \koala_html_profile($user);
$html_handler_profile->set_context("groups");
$content = \Profile::getInstance()->loadTemplate("list_groups.template.html");
//$content = new HTML_TEMPLATE_IT();
//$content->loadTemplateFile( PATH_TEMPLATES . "list_groups.template.html" );
if ($this->viewer_authorized($current_user, $user)) {
$public = $user->get_id() != $current_user->get_id() ? TRUE : FALSE;
$groups = $cache->call("lms_steam::user_get_groups", $login, $public);
usort($groups, "sort_objects");
$no_groups = count($groups);
if ($no_groups > 0) {
$content->setCurrentBlock("BLOCK_GROUP_LIST");
$pageIterator = \lms_portal::get_paginator(10, $no_groups, "(" . gettext("%TOTAL groups in list") . ")");
$content->setVariable("PAGEITERATOR", $pageIterator["html"]);
$start = $pageIterator["startIndex"];
$end = $start + 10 > $no_groups ? $no_groups : $start + 10;
if ($current_user->get_id() == $user->get_id()) {
$content->setVariable("LABEL_GROUPS", gettext("Your groups") . " (" . str_replace(array("%a", "%z", "%s"), array($start + 1, $end, $no_groups), gettext("%a-%z out of %s")) . ")");
} else {
$content->setVariable("LABEL_GROUPS", str_replace("%NAME", $user->get_attribute("USER_FIRSTNAME") . " " . $user->get_attribute("USER_FULLNAME"), gettext("%NAME's groups")) . " (" . str_replace(array("%a", "%z", "%s"), array($start + 1, $end, $no_groups), gettext("%a-%z out of %s")) . ")");
}
// GROUPS
$content->setVariable("LABEL_NAME_DESCRIPTION", gettext("Name, description"));
$content->setVariable("LABEL_MEMBERS", gettext("Members list"));
$content->setVariable("LABEL_COMMUNICATION", gettext("Communication"));
if ($user->get_id() == $current_user->get_id()) {
$content->setVariable("TH_MANAGE_GROUP", gettext("Manage membership"));
}
for ($i = $start; $i < $end; $i++) {
$group = $groups[$i];
$content->setCurrentBlock("BLOCK_GROUP");
$content->setVariable("GROUP_LINK", PATH_URL . "groups/" . $group["OBJ_ID"] . "/");
$content->setVariable("GROUP_NAME", h($group["OBJ_NAME"]));
$content->setVariable("MEMBER_LINK", PATH_URL . "groups/" . $group["OBJ_ID"] . "/members/");
$content->setVariable("GROUP_MEMBERS", h($group["GROUP_NO_MEMBERS"]));
$content->setVariable("LINK_SEND_MESSAGE", PATH_URL . "messages_write.php?group=" . $group["OBJ_ID"]);
$content->setVariable("LABEL_MESSAGE", gettext("Message"));
$content->setVariable("LABEL_SEND", gettext("Send"));
if ($user->get_id() == $current_user->get_id()) {
$content->setVariable("TD_MANAGE_GROUP", "<a href=\"" . PATH_URL . "group_cancel.php?group=" . $group["OBJ_ID"] . "\">" . gettext("Resign") . "</a>");
}
$content->setVariable("OBJ_DESC", h($group["OBJ_DESC"]));
$content->parse("BLOCK_GROUP");
}
$content->parse("BLOCK_GROUP_LIST");
} else {
$content->setVariable("LABEL_GROUPS", gettext("No memberships found."));
}
} else {
$messagebox = "<div class=\"infoBar\"><h2>" . gettext("The user has restricted the display of this information.") . "</h2></div>";
$content->setVariable("LABEL_PRIVACY_DENY_PARTICIPANTS", $messagebox);
}
$frameResponseObject->setHeadline($html_handler_profile->get_headline());
$html_handler_profile->set_html_left($content->get());
$rawHtml = new \Widgets\RawHtml();
$rawHtml->setHtml($html_handler_profile->get_html());
$frameResponseObject->addWidget($rawHtml);
return $frameResponseObject;
//$portal->set_page_main( $html_handler_profile->get_headline(), $html_handler_profile->get_html());
//return $portal->get_html();
}
示例5: frameResponse
//.........这里部分代码省略.........
$html_content = "<div class=\"infoBar\">" . gettext("The group is full! You can not add any further members, because the maximum size of the group has been reached. Please increase this value to add more members.") . "</div>";
} else {
$content->setVariable("HEAD_SEARCH", gettext("Search"));
$content->setVariable("INFO_TEXT", gettext("Here you can lookup some people.") . " " . str_replace("%GROUP", $group->get_display_name(), gettext("You can add a search result as member to '<b>%GROUP</b>'.")));
if (!empty($_REQUEST["pattern"])) {
$content->setVariable("VALUE_PATTERN", $_REQUEST["pattern"]);
}
$content->setVariable("LABEL_CHECK_NAME", gettext("Name"));
$content->setVariable("LABEL_CHECK_LOGIN", gettext("Email address or login"));
$content->setVariable("LABEL_SEARCH", gettext("Search"));
$content->setVariable("GROUP_ID", $group->get_id());
$content->setVariable("BACKLINK", "<a href=\"{$backlink}\">" . gettext("back") . "</a>");
// SEARCH RESULTS
if (!empty($_REQUEST["pattern"])) {
$cache = get_cache_function($user->get_name(), 60);
$result = $cache->call("lms_steam::search_user", $_REQUEST["pattern"], $_REQUEST["lookin"]);
if ($_REQUEST["lookin"] == "name") {
$content->setVariable("CHECKED_NAME", 'checked="checked"');
} else {
$content->setVariable("CHECKED_LOGIN", 'checked="checked"');
}
// PROCEED RESULT SET
$html_people = \Semester::getInstance()->loadTemplate("list_users.template.html");
$no_people = count($result);
if ($no_people > 0) {
if (isset($_REQUEST["backlink"])) {
$tmp_backlink = $_REQUEST["backlink"];
} else {
if (isset($backlink)) {
$tmp_backlink = $backlink;
}
}
//$start = $portal->set_paginator( 10, $no_people, "(" . gettext( "%TOTAL people in result set" ) . ")", "?pattern=" . $_REQUEST[ "pattern" ] . "&lookin=" . $_REQUEST[ "lookin" ] . "&group=" . $_REQUEST["group"] . "&backlink=" . $tmp_backlink );
$paginator = \lms_portal::get_paginator(10, $no_people, "(" . gettext("%TOTAL people in result set") . ")", "?pattern=" . $_REQUEST["pattern"] . "&lookin=" . $_REQUEST["lookin"] . "&group=" . $_REQUEST["group"] . "&backlink=" . $tmp_backlink);
$start = $paginator["startIndex"];
$end = $start + 10 > $no_people ? $no_people : $start + 10;
$html_people->setVariable("PAGINATOR", $paginator["html"]);
$html_people->setVariable("LABEL_CONTACTS", gettext("Results") . " (" . str_replace(array("%a", "%z", "%s"), array($start + 1, $end, $no_people), gettext("%a-%z out of %s")) . ")");
$html_people->setCurrentBlock("BLOCK_CONTACT_LIST");
$html_people->setVariable("LABEL_NAME_POSITION", gettext("Name, position"));
$html_people->setVariable("LABEL_SUBJECT_AREA", gettext("Subject area"));
$html_people->setVariable("LABEL_COMMUNICATION", gettext("Communication"));
$html_people->setVariable("TH_MANAGE_CONTACT", gettext("Action"));
for ($i = $start; $i < $end; $i++) {
$person = $result[$i];
$html_people->setCurrentBlock("BLOCK_CONTACT");
// TODO: Passt der Link?
$html_people->setVariable("CONTACT_LINK", PATH_URL . "user/" . $person["OBJ_NAME"] . "/");
// TODO: Passt der Link?
$icon_link = PATH_URL . "download/" . $person["OBJ_ICON"] . "/usericon/30/40";
$html_people->setVariable("CONTACT_IMAGE", $icon_link);
$html_people->setVariable("CONTACT_NAME", h($person["USER_FIRSTNAME"]) . " " . h($person["USER_FULLNAME"]));
$html_people->setVariable("LINK_SEND_MESSAGE", PATH_URL . "messages_write.php?to=" . $person["OBJ_NAME"]);
$html_people->setVariable("LABEL_MESSAGE", gettext("Message"));
$html_people->setVariable("LABEL_SEND", gettext("Send"));
$html_people->setVariable("OBJ_DESC", h($person["OBJ_DESC"]));
$p = new \steam_object($GLOBALS["STEAM"]->get_id(), $person["OBJ_ID"]);
//if the group is a tutorial and the course has exclusive subgroups for tutorials set, we have to
//see if our person is already member in one of the other tutorials.
$already_member_and_exclusive = false;
if ($group instanceof \koala_group_tutorial) {
if ($group->get_course_group()->get_attribute("EXCLUSIVE_TUTORIAL_MEMBERSHIP") === "TRUE") {
$course_learners_group = $steam_group->get_parent_group();
$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($p) && $sg != $steam_group) {
示例6: frameResponse
//.........这里部分代码省略.........
$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());
// uncache menu so that course/group appears:
$cache = get_cache_function($candidate->get_name());
$cache->drop("lms_steam::user_get_profile", $candidate->get_name());
$cache->drop("lms_portal::get_menu_html", $candidate->get_name(), TRUE);
}
} else {
$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());
// uncache menu so that course/group appears:
$cache = get_cache_function($candidate->get_name());
$cache->drop("lms_steam::user_get_profile", $candidate->get_name());
$cache->drop("lms_portal::get_menu_html", $candidate->get_name(), TRUE);
}
} elseif (isset($_POST['cancel']) && is_array($_POST['cancel'])) {
$candidate = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), key($_POST["cancel"]));
$group->remove_membership_request($candidate);
$subject = str_replace("%GROUP", $group->get_name(), gettext("Your membership for '%GROUP' was rejected"));
$message = gettext("Your membership was rejected.");
$portal->set_confirmation(str_replace("%NAME", $candidate->get_attribute("USER_FIRSTNAME") . " " . $candidate->get_attribute("USER_FULLNAME"), gettext("Membership of %NAME rejected.")));
}
//$candidate->mail( $subject, $message, $user->get_attribute( "USER_EMAIL" ));
\lms_steam::mail($candidate, $user, $subject, $message);
}
$result = $group->get_membership_requests();
$html_people = \Group::getInstance()->loadTemplate("list_users.template.html");
$no_people = count($result);
if ($no_people > 0) {
$paginator = \lms_portal::get_paginator(10, $no_people, "(" . gettext("%TOTAL membership requests") . ")");
$start = $paginator["startIndex"];
//$start = $portal->set_paginator( 10, $no_people, "(" . gettext( "%TOTAL membership requests" ). ")" );
$end = $start + 10 > $no_people ? $no_people : $start + 10;
$content->setVariable("PAGINATOR", $paginator["html"]);
$html_people->setVariable("LABEL_CONTACTS", gettext("Membership requests") . " (" . str_replace(array("%a", "%z", "%s"), array($start + 1, $end, $no_people), gettext("%a-%z out of %s")) . ")");
$html_people->setCurrentBlock("BLOCK_CONTACT_LIST");
$html_people->setVariable("LABEL_NAME_POSITION", gettext("Name, position"));
$html_people->setVariable("LABEL_SUBJECT_AREA", gettext("Subject area"));
$html_people->setVariable("LABEL_COMMUNICATION", gettext("Communication"));
$html_people->setVariable("TH_MANAGE_CONTACT", gettext("Action"));
foreach ($result as $candidate) {
$person = $candidate->get_attributes(array("USER_FIRSTNAME", "USER_FULLNAME", "OBJ_ICON", "OBJ_NAME", "OBJ_DESC"));
$html_people->setCurrentBlock("BLOCK_CONTACT");
$html_people->setVariable("CONTACT_LINK", PATH_URL . "user/" . h($person["OBJ_NAME"]) . "/");
if (is_object($person["OBJ_ICON"])) {
// TODO: Passt der link?
$icon_link = PATH_URL . "cached/get_document.php?id=" . $person["OBJ_ICON"]->get_id() . "&type=usericon";
} else {
// TODO: Passt der link?
$icon_link = PATH_STYLE . "images/anonymous.jpg";
}
$html_people->setVariable("CONTACT_IMAGE", $icon_link);
$html_people->setVariable("CONTACT_NAME", h($person["USER_FIRSTNAME"]) . " " . h($person["USER_FULLNAME"]));
$html_people->setVariable("LINK_SEND_MESSAGE", PATH_URL . "messages_write.php?to=" . h($person["OBJ_NAME"]));
$html_people->setVariable("LABEL_MESSAGE", gettext("Message"));
$html_people->setVariable("LABEL_SEND", gettext("Send"));
//if the group is a tutorial and the course has exclusive subgroups for tutorials set, we have to
//see if our candidate is already member in one of the other tutorials.
$already_member_and_exclusive = false;
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) {
$html_people->setVariable("TD_MANAGE_CONTACT", "<td align=\"center\"><small><b>" . gettext("Attention: User already in tutorial") . " " . $in_group->get_name() . "<p /></b></small><input type=\"hidden\" name=\"confirmed\" value=\"true\"/><input type=\"submit\" name=\"affirm[" . $candidate->get_id() . "]\" value=\"" . gettext("Affirm anyhow") . "\"> " . gettext("or") . " <input type=\"submit\" name=\"cancel[" . $candidate->get_id() . "]\" value=\"" . gettext("Decline") . "\"/></td>");
} else {
$html_people->setVariable("TD_MANAGE_CONTACT", "<td align=\"center\"><input type=\"submit\" name=\"affirm[" . $candidate->get_id() . "]\" value=\"" . gettext("Affirm") . "\"> " . gettext("or") . " <input type=\"submit\" name=\"cancel[" . $candidate->get_id() . "]\" value=\"" . gettext("Decline") . "\"/></td>");
}
$html_people->setVariable("OBJ_DESC", h($person["OBJ_DESC"]));
$html_people->parse("BLOCK_CONTACT");
}
$html_people->parse("BLOCK_CONTACT_LIST");
$content->setVariable("HTML_USER_LIST", $html_people->get());
} else {
$content->setVariable("LABEL_NO_REQUESTS", "<h3>" . gettext("No membership request found.") . "</h3>");
}
$frameResponseObject->setTitle("Group");
$rawHtml = new \Widgets\RawHtml();
$rawHtml->setHtml($content->get());
$frameResponseObject->addWidget($rawHtml);
return $frameResponseObject;
}
示例7: execute
public function execute(\FrameResponseObject $frameResponseObject)
{
//CODE FOR ALL COMMANDS OF THIS PAKAGE END
$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 PAKAGE END
$wiki_html_handler = new \lms_wiki($wiki_container);
$wiki_html_handler->set_admin_menu("versions", $wiki_doc);
$content = \Wiki::getInstance()->loadTemplate("wiki_versions.template.html");
//$content = new HTML_TEMPLATE_IT();
//$content->loadTemplateFile( PATH_TEMPLATES . "wiki_versions.template.html" );
$prev_versions = $wiki_doc->get_previous_versions();
if (!is_array($prev_versions)) {
$prev_versions = array();
}
array_unshift($prev_versions, $wiki_doc);
$no_versions = count($prev_versions);
$content->setCurrentBlock("BLOCK_VERSION_LIST");
if (isset($_GET["markedfordiff"]) && !empty($_GET["markedfordiff"])) {
$uri_params = "?markedfordiff=" . $_GET["markedfordiff"];
//$start = $portal->set_paginator( $content, 10, $no_versions, "(" . gettext("%TOTAL versions in list") . ")", $uri_params );
$pageIterator = \lms_portal::get_paginator(10, $no_versions, "(" . gettext("%TOTAL groups in list") . ")");
$content->setVariable("PAGEITERATOR", $pageIterator["html"]);
$start = $pageIterator["startIndex"];
} else {
$pageIterator = \lms_portal::get_paginator(10, $no_versions, "(" . gettext("%TOTAL groups in list") . ")");
$content->setVariable("PAGEITERATOR", $pageIterator["html"]);
$start = $pageIterator["startIndex"];
}
//$start = $portal->set_paginator( $content, 10, $no_versions, "(" . gettext("%TOTAL versions in list") . ")" );
$end = $start + 10 > $no_versions ? $no_versions : $start + 10;
$entry_name = str_replace(".wiki", "", $wiki_doc->get_identifier());
$content->setVariable("LABEL_VERSIONS", gettext("Available Versions for the entry") . " \"" . h($entry_name) . "\" (" . str_replace(array("%a", "%z", "%s"), array($start + 1, $end, $no_versions), gettext("%a-%z out of %s")) . ")");
$content->setVariable("LABEL_VERSION_NUMBER", gettext("Version number"));
$content->setVariable("LABEL_SIZE", gettext("Size"));
$content->setVariable("LABEL_DATE", gettext("Modification date"));
$content->setVariable("LABEL_CREATOR", gettext("Modified by"));
$content->setVariable("LABEL_ACTION", gettext("Action"));
// Use buffer for document attributes
$attributes_tnr = array();
for ($i = $start; $i < $end; $i++) {
$attributes_tnr[$prev_versions[$i]->get_id()] = $prev_versions[$i]->get_attributes(array(DOC_USER_MODIFIED, DOC_LAST_MODIFIED, DOC_VERSION, DOC_SIZE), TRUE);
}
$attributes_result = $GLOBALS["STEAM"]->buffer_flush();
// use buffer for author attributes
$author_tnr = array();
for ($i = $start; $i < $end; $i++) {
$author_tnr[$prev_versions[$i]->get_id()] = $attributes_result[$attributes_tnr[$prev_versions[$i]->get_id()]][DOC_USER_MODIFIED]->get_attributes(array(USER_FIRSTNAME, USER_FULLNAME, OBJ_NAME), TRUE);
}
$author_result = $GLOBALS["STEAM"]->buffer_flush();
for ($i = $start; $i < $end; $i++) {
$doc = $prev_versions[$i];
$attributes = $attributes_result[$attributes_tnr[$doc->get_id()]];
$last_author = $author_result[$author_tnr[$doc->get_id()]];
$content->setCurrentBlock("BLOCK_VERSION");
if ($doc instanceof \steam_document) {
$content->setVariable("VALUE_SIZE", get_formatted_filesize($doc->get_content_size()));
$content->setVariable("VALUE_CREATOR_LINK", PATH_URL . "user/index/" . $author_result[$author_tnr[$doc->get_id()]][OBJ_NAME] . "/");
$content->setVariable("VALUE_CREATOR", h($last_author[USER_FIRSTNAME]) . " " . h($last_author[USER_FULLNAME]));
$content->setVariable("VALUE_DATE", strftime("%x %X", $attributes["DOC_LAST_MODIFIED"]));
if ($doc->get_id() !== $wiki_doc->get_id()) {
$content->setVariable("VALUE_VERSION_LINK", PATH_URL . "wiki/viewversion/" . $wiki_doc->get_id() . "/" . $doc->get_id() . "/");
$content->setVariable("VALUE_VERSION_NUMBER", "Version " . h($attributes_result[$attributes_tnr[$doc->get_id()]][DOC_VERSION]));
$content->setCurrentBlock("BLOCK_RECOVER");
$content->setVariable("VALUE_ACTION_RECOVER", "» " . gettext("Recover this version"));
$content->setVariable("VALUE_RECOVER_LINK", PATH_URL . "wiki/recoverversion/" . $wiki_doc->get_id() . "/" . $doc->get_id() . "/");
$content->parse("BLOCK_RECOVER");
} else {
$content->setVariable("VALUE_VERSION_LINK", PATH_URL . "wiki/viewentry/" . $wiki_doc->get_id() . "/");
$content->setVariable("VALUE_VERSION_NUMBER", "Version " . h($attributes_result[$attributes_tnr[$doc->get_id()]][DOC_VERSION]) . " (" . gettext("current") . ")");
}
if (isset($_GET["markedfordiff"]) && $_GET["markedfordiff"] == $doc->get_id()) {
$content->setVariable("VALUE_ACTION_MARK", "» " . gettext("Currently marked for version compare"));
} else {
$content->setVariable("VALUE_ACTION_MARK", "<a href=\"" . PATH_URL . "wiki/versionoverview/" . $wiki_doc->get_id() . "/?markedfordiff=" . $doc->get_id() . "\">" . "» " . gettext("Mark for version compare") . "</a>");
}
if ($attributes[DOC_VERSION] != 1) {
$content->setVariable("VALUE_ACTION_DIFF", "» " . gettext("Compare to previous version") . " " . ($attributes[DOC_VERSION] - 1));
$content->setVariable("VALUE_DIFF_LINK", PATH_URL . "wiki/compareversions/" . $wiki_doc->get_id() . "/" . $doc->get_id() . "/" . $prev_versions[$i + 1]->get_id());
}
if (isset($_GET["markedfordiff"]) && $_GET["markedfordiff"] != $doc->get_id()) {
$marked = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $_GET["markedfordiff"]);
$content->setVariable("VALUE_ACTION_MARKED_DIFF", "<a href=\"" . PATH_URL . "wiki/compareversions/" . $wiki_doc->get_id() . "/" . $doc->get_id() . "/" . $_GET["markedfordiff"] . "\">" . "» " . gettext("Compare to marked version") . " " . $marked->get_version() . "</a>");
}
}
//.........这里部分代码省略.........
示例8: 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"];
//.........这里部分代码省略.........
示例9: execute
public function execute(\FrameResponseObject $frameResponseObject)
{
$current_user = \lms_steam::get_current_user();
//$path = $request->getPath();
if ($this->id != "") {
$userName = $this->id;
$user = \steam_factory::get_user($GLOBALS["STEAM"]->get_id(), $userName);
} else {
$user = $current_user;
}
$login = $current_user->get_name();
$cache = get_cache_function($login, 86400);
//$portal = \lms_portal::get_instance();
//$portal->set_page_title( $login );
$html_handler_profile = new \koala_html_profile($user);
$html_handler_profile->set_context("contacts");
if ($this->viewer_authorized($current_user, $user)) {
// Display Contacts
$unconfirmed_html = "";
// Contacts to confirm (visible only for the user himself)
if ($current_user->get_id() == $user->get_id()) {
$content = \Profile::getInstance()->loadTemplate("list_users.template.html");
//$content = new HTML_TEMPLATE_IT();
//$content->loadTemplateFile( PATH_TEMPLATES . "list_users.template.html" );
$contacts = $cache->call("lms_steam::user_get_contacts_to_confirm", $login);
$no_contacts = count($contacts);
if ($no_contacts > 0) {
$content->setCurrentBlock("BLOCK_CONTACT_LIST");
$result = \lms_portal::get_paginator($content, 10, $no_contacts, "(" . gettext("%TOTAL contact requests in list") . ")");
$content->setVariable("PAGEITERATOR", $result["html"]);
$start = $result["start"];
$end = $start + 10 > $no_contacts ? $no_contacts : $start + 10;
if ($current_user->get_id() == $user->get_id()) {
$content->setVariable("LABEL_CONTACTS", gettext("Contact requests") . " (" . str_replace(array("%a", "%z", "%s"), array($start + 1, $end, $no_contacts), gettext("%a-%z out of %s")) . ")");
} else {
$content->setVariable("LABEL_CONTACTS", str_replace("%NAME", h($user->get_attribute("USER_FIRSTNAME")) . " " . h($user->get_attribute("USER_FULLNAME")), gettext("%NAME's contacts")) . " (" . str_replace(array("%a", "%z", "%s"), array($start + 1, $end, $no_contacts), gettext("%a-%z out of %s")) . ")");
}
// CONTACTS
$content->setVariable("LABEL_NAME_POSITION", gettext("Name, position"));
$content->setVariable("LABEL_SUBJECT_AREA", gettext("Origin/Focus"));
$content->setVariable("LABEL_COMMUNICATION", gettext("Communication"));
if ($user->get_id() == $current_user->get_id()) {
$content->setVariable("TH_MANAGE_CONTACT", gettext("Manage request"));
}
for ($i = $start; $i < $end; $i++) {
$contact = $contacts[$i];
$content->setCurrentBlock("BLOCK_CONTACT");
$content->setVariable("CONTACT_LINK", PATH_URL . "profile/" . h($contact["OBJ_NAME"]) . "/");
$icon_link = $contact["OBJ_ICON"] == 0 ? PATH_STYLE . "images/anonymous.jpg" : PATH_URL . "cached/get_document.php?id=" . h($contact["OBJ_ICON"]) . "&type=usericon&width=30&height=40";
$content->setVariable("CONTACT_IMAGE", $icon_link);
$title = !empty($contact["USER_ACADEMIC_TITLE"]) ? h($contact["USER_ACADEMIC_TITLE"]) . " " : "";
$content->setVariable("CONTACT_NAME", $title . h($contact["USER_FIRSTNAME"]) . " " . h($contact["USER_FULLNAME"]));
$faf = \lms_steam::get_faculty_name($contact["USER_PROFILE_FACULTY"]);
$faf .= empty($contact["USER_PROFILE_FOCUS"]) ? "" : ": " . h($contact["USER_PROFILE_FOCUS"]);
$content->setVariable("FACULTY_AND_FOCUS", $faf);
$content->setVariable("LINK_SEND_MESSAGE", PATH_URL . "messages_write.php?to=" . h($contact["OBJ_NAME"]));
$content->setVariable("LABEL_MESSAGE", gettext("Message"));
$content->setVariable("LABEL_SEND", gettext("Send"));
if ($user->get_id() == $current_user->get_id()) {
$content->setVariable("TD_MANAGE_CONTACT", "<td align=\"center\"><a href=\"" . PATH_URL . "contact_confirm.php?id=" . h($contact["OBJ_ID"]) . "\">" . gettext("Confirm") . " / " . gettext("Deny") . "</a></td>");
}
$contact_desc = empty($contact["OBJ_DESC"]) ? "student" : $contact["OBJ_DESC"];
$status = secure_gettext($contact_desc);
$content->setVariable("OBJ_DESC", h($status));
$content->parse("BLOCK_CONTACT");
}
$content->parse("BLOCK_CONTACT_LIST");
}
$unconfirmed_html = $content->get();
}
$content = \Profile::getInstance()->loadTemplate("list_users.template.html");
//$content = new HTML_TEMPLATE_IT();
//$content->loadTemplateFile( PATH_TEMPLATES . "list_users.template.html" );
// Contact list
$confirmed = $user->get_id() != $current_user->get_id() ? TRUE : FALSE;
$contacts = $cache->call("lms_steam::user_get_buddies", $login, $confirmed);
// If user views his own contact list, get information about the confirmed contacts too
//HACK START DOMINIK FRAGEN!
$confirmed_contacts = "";
//HACK END
if (!$confirmed) {
$confirmed_contacts = $user->get_attribute("USER_CONTACTS_CONFIRMED");
}
if (!is_array($confirmed_contacts)) {
$confirmed_contacts = array();
}
$no_contacts = count($contacts);
if ($no_contacts > 0) {
$content->setCurrentBlock("BLOCK_CONTACT_LIST");
$start = $portal->set_paginator($content, 10, $no_contacts, "(" . gettext("%TOTAL contacts in list") . ")");
$end = $start + 10 > $no_contacts ? $no_contacts : $start + 10;
if ($current_user->get_id() == $user->get_id()) {
$content->setVariable("LABEL_CONTACTS", gettext("Your contacts") . " (" . str_replace(array("%a", "%z", "%s"), array($start + 1, $end, $no_contacts), gettext("%a-%z out of %s")) . ")");
} else {
$content->setVariable("LABEL_CONTACTS", str_replace("%NAME", h($user->get_attribute("USER_FIRSTNAME")) . " " . h($user->get_attribute("USER_FULLNAME")), gettext("%NAME's contacts")) . " (" . str_replace(array("%a", "%z", "%s"), array($start + 1, $end, $no_contacts), gettext("%a-%z out of %s")) . ")");
}
// CONTACTS
$content->setVariable("LABEL_NAME_POSITION", gettext("Name, position"));
$content->setVariable("LABEL_SUBJECT_AREA", gettext("Origin/Focus"));
$content->setVariable("LABEL_COMMUNICATION", gettext("Communication"));
//.........这里部分代码省略.........