本文整理汇总了PHP中Display::badge方法的典型用法代码示例。如果您正苦于以下问题:PHP Display::badge方法的具体用法?PHP Display::badge怎么用?PHP Display::badge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Display
的用法示例。
在下文中一共展示了Display::badge方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set_header_parameters
//.........这里部分代码省略.........
<img src="'.api_get_path(WEB_IMG_PATH).'bug.large.png" style="vertical-align: middle;" alt="'.get_lang('ReportABug').'" title="'.get_lang(
'ReportABug'
).'"/></a>
</li>';
}
$this->assign('bug_notification_link', $bug_notification_link);
$notification = return_notification_menu();
$this->assign('notification_menu', $notification);
//Preparing values for the menu
//Logout link
if (isset($_configuration['hide_logout_button']) && $_configuration['hide_logout_button'] == 'true') {
$this->assign('logout_link', null);
} else {
$this->assign('logout_link', api_get_path(WEB_PATH).'index.php?logout=logout&uid='.api_get_user_id());
}
//Profile link
if (api_get_setting('allow_social_tool') == 'true') {
$profile_url = api_get_path(WEB_CODE_PATH).'social/home.php';
$profile_link = Display::url(get_lang('Profile'), $profile_url);
} else {
$profile_url = api_get_path(WEB_CODE_PATH).'auth/profile.php';
$profile_link = Display::url(get_lang('Profile'), $profile_url);
}
$this->assign('profile_link', $profile_link);
$this->assign('profile_url', $profile_url);
//Message link
$message_link = null;
$message_url = null;
if (api_get_setting('allow_message_tool') == 'true') {
$message_url = api_get_path(WEB_CODE_PATH).'messages/inbox.php';
$message_link = '<a href="'.api_get_path(WEB_CODE_PATH).'messages/inbox.php">'.get_lang('Inbox').'</a>';
}
$this->assign('message_link', $message_link);
$this->assign('message_url', $message_url);
$institution = api_get_setting('Institution');
$portal_name = empty($institution) ? api_get_setting('siteName') : $institution;
$this->assign('portal_name', $portal_name);
//Menu
$menu = return_menu();
$this->assign('menu', $menu);
//Setting notifications
$count_unread_message = 0;
if (api_get_setting('allow_message_tool') == 'true') {
// get count unread message and total invitations
$count_unread_message = MessageManager::get_number_of_messages(true);
}
$total_invitations = 0;
if (api_get_setting('allow_social_tool') == 'true') {
$number_of_new_messages_of_friend = SocialManager::get_message_number_invitation_by_user_id(
api_get_user_id()
);
$group_pending_invitations = GroupPortalManager::get_groups_by_user(
api_get_user_id(),
GROUP_USER_PERMISSION_PENDING_INVITATION,
false
);
$group_pending_invitations = 0;
if (!empty($group_pending_invitations)) {
$group_pending_invitations = count($group_pending_invitations);
}
$total_invitations = intval($number_of_new_messages_of_friend) + $group_pending_invitations + intval(
$count_unread_message
);
}
$total_invitations = (!empty($total_invitations) ? Display::badge($total_invitations) : null);
$this->assign('user_notifications', $total_invitations);
//Breadcrumb
$breadcrumb = return_breadcrumb($interbreadcrumb, $language_file, $nameTools);
$this->assign('breadcrumb', $breadcrumb);
//Extra content
$extra_header = null;
if (!api_is_platform_admin()) {
$extra_header = trim(api_get_setting('header_extra_content'));
}
$this->assign('header_extra_content', $extra_header);
//if ($this->show_header == 1) {
header('Content-Type: text/html; charset='.api_get_system_encoding());
header(
'X-Powered-By: '.$_configuration['software_name'].' '.substr($_configuration['system_version'], 0, 1)
);
//}
}
示例2: set_header_parameters
//.........这里部分代码省略.........
$resize .= '<a title="' . get_lang('ResetFontSize') . '" href="#" class="reset_font btn btn-default"><em class="fa fa-font"></em></a>';
$resize .= '<a title="' . get_lang('IncreaseFontSize') . '" href="#" class="increase_font btn btn-default"><em class="fa fa-font"></em></a>';
$resize .= '</div>';
$resize .= '</div>';
}
$this->assign('accessibility', $resize);
// Preparing values for the menu
// Logout link
$hideLogout = api_get_setting('hide_logout_button');
if ($hideLogout === 'true') {
$this->assign('logout_link', null);
} else {
$this->assign('logout_link', api_get_path(WEB_PATH) . 'index.php?logout=logout&uid=' . api_get_user_id());
}
//Profile link
if (api_get_setting('social.allow_social_tool') == 'true') {
$profile_url = api_get_path(WEB_CODE_PATH) . 'social/home.php';
$profile_link = Display::url(get_lang('Profile'), $profile_url);
} else {
$profile_url = api_get_path(WEB_CODE_PATH) . 'auth/profile.php';
$profile_link = Display::url(get_lang('Profile'), $profile_url);
}
$this->assign('profile_link', $profile_link);
$this->assign('profile_url', $profile_url);
//Message link
$message_link = null;
$message_url = null;
if (api_get_setting('message.allow_message_tool') == 'true') {
$message_url = api_get_path(WEB_CODE_PATH) . 'messages/inbox.php';
$message_link = '<a href="' . api_get_path(WEB_CODE_PATH) . 'messages/inbox.php">' . get_lang('Inbox') . '</a>';
}
$this->assign('message_link', $message_link);
$this->assign('message_url', $message_url);
$institution = api_get_setting('platform.institution');
$portal_name = empty($institution) ? api_get_setting('platform.site_name') : $institution;
$this->assign('portal_name', $portal_name);
//Menu
$menu = return_menu();
$this->assign('menu', $menu);
// Setting notifications
$count_unread_message = 0;
if (api_get_setting('message.allow_message_tool') == 'true') {
// get count unread message and total invitations
$count_unread_message = MessageManager::get_number_of_messages(true);
}
$total_invitations = 0;
if (api_get_setting('social.allow_social_tool') == 'true') {
$number_of_new_messages_of_friend = SocialManager::get_message_number_invitation_by_user_id(api_get_user_id());
$usergroup = new UserGroup();
$group_pending_invitations = $usergroup->get_groups_by_user(api_get_user_id(), GROUP_USER_PERMISSION_PENDING_INVITATION, false);
if (!empty($group_pending_invitations)) {
$group_pending_invitations = count($group_pending_invitations);
} else {
$group_pending_invitations = 0;
}
$total_invitations = intval($number_of_new_messages_of_friend) + $group_pending_invitations + intval($count_unread_message);
}
$total_invitations = !empty($total_invitations) ? Display::badge($total_invitations) : null;
$this->assign('user_notifications', $total_invitations);
// Block Breadcrumb
$breadcrumb = return_breadcrumb($interbreadcrumb, $language_file, $nameTools);
$this->assign('breadcrumb', $breadcrumb);
//Extra content
$extra_header = null;
if (!api_is_platform_admin()) {
$extra_header = trim(api_get_setting('header_extra_content'));
}
$this->assign('header_extra_content', $extra_header);
if ($sendHeaders) {
header('Content-Type: text/html; charset=' . api_get_system_encoding());
header('X-Powered-By: ' . $_configuration['software_name'] . ' ' . substr($_configuration['system_version'], 0, 1));
}
$socialMeta = '';
$metaTitle = api_get_setting('meta_title');
if (!empty($metaTitle)) {
$socialMeta .= '<meta name="twitter:card" content="summary" />' . "\n";
$socialMeta .= '<meta property="og:title" content="' . $metaTitle . '" />' . "\n";
$socialMeta .= '<meta property="og:url" content="' . api_get_path(WEB_PATH) . '" />' . "\n";
$metaDescription = api_get_setting('meta_description');
if (!empty($metaDescription)) {
$socialMeta .= '<meta property="og:description" content="' . $metaDescription . '" />' . "\n";
}
$metaSite = api_get_setting('meta_twitter_site');
if (!empty($metaSite)) {
$socialMeta .= '<meta name="twitter:site" content="' . $metaSite . '" />' . "\n";
$metaCreator = api_get_setting('meta_twitter_creator');
if (!empty($metaCreator)) {
$socialMeta .= '<meta name="twitter:creator" content="' . $metaCreator . '" />' . "\n";
}
}
$metaImage = api_get_setting('meta_image_path');
if (!empty($metaImage)) {
if (is_file(api_get_path(SYS_PATH) . $metaImage)) {
$path = api_get_path(WEB_PATH) . $metaImage;
$socialMeta .= '<meta property="og:image" content="' . $path . '" />' . "\n";
}
}
}
$this->assign('social_meta', $socialMeta);
}
示例3: get_table_data
//.........这里部分代码省略.........
//$row[] = $invisibility_span_open.$data[4].$invisibility_span_close;
//Admins get an edit column
if (api_is_allowed_to_edit(null, true)) {
$cat = new Category();
$show_message = $cat->show_message_resource_delete($item->get_course_code());
if ($show_message === false) {
$row[] = $this->build_edit_column($item);
}
} else {
//students get the results and certificates columns
$eval_n_links = array_merge($alleval, $alllink);
if (count($eval_n_links) > 0 && $status_user != 1) {
$value_data = isset($data[4]) ? $data[4] : null;
if (!is_null($value_data)) {
$score = $item->calc_score(api_get_user_id());
$new_score = $data[3] * $score[0] / $score[1];
$new_score = floatval(number_format($new_score, api_get_setting('gradebook_number_decimals')));
$row[] = Display::tip($new_score, $data[4]);
}
}
if (!empty($cats)) {
$row[] = null;
}
}
$row['child_of'] = $parent_id;
$sortable_data[] = $row;
}
//"Warning row"
if (!empty($data_array)) {
if (api_is_allowed_to_edit()) {
// Compare the category weight to the sum of all weights inside the category
if (intval($total_weight) == $category_weight) {
$label = null;
$total = score_badges(array($total_weight . ' / ' . $category_weight, '100'));
} else {
$label = Display::return_icon('warning.png', sprintf(get_lang('TotalWeightMustBeX'), $category_weight));
$total = Display::badge($total_weight . ' / ' . $category_weight, 'warning');
}
$row = array(null, null, " <h5>" . get_lang('SubTotal') . '</h5>', null, $total . ' ' . $label, 'child_of' => $parent_id);
$sortable_data[] = $row;
}
}
}
}
//end looping categories
}
//end looping categories
if (api_is_allowed_to_edit()) {
if (count($main_cat) > 1) {
$main_weight = intval($main_cat[0]->get_weight());
if (intval($total_categories_weight) == $main_weight) {
$total = score_badges(array($total_categories_weight . ' / ' . $main_weight, '100'));
} else {
$total = Display::badge($total_categories_weight . ' / ' . $main_weight, 'warning');
}
$row = array(null, null, '<h3>' . get_lang('Total') . '</h3>', null, $total);
$sortable_data[] = $row;
}
}
// warning messages
$view = isset($_GET['view']) ? $_GET['view'] : null;
if (api_is_allowed_to_edit()) {
if (isset($_GET['selectcat']) && $_GET['selectcat'] > 0 && $view != 'presence') {
$id_cat = intval($_GET['selectcat']);
$category = Category::load($id_cat);
//$weight_category = intval($this->build_weight($category[0]));
示例4: return_profile_block
function return_profile_block()
{
global $_configuration;
$user_id = api_get_user_id();
if (empty($user_id)) {
return;
}
$profile_content = '<ul class="nav nav-list">';
// @todo Add a platform setting to add the user image.
if (api_get_setting('allow_message_tool') == 'true') {
require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php';
// New messages.
$number_of_new_messages = MessageManager::get_new_messages();
// New contact invitations.
$number_of_new_messages_of_friend = SocialManager::get_message_number_invitation_by_user_id(api_get_user_id());
// New group invitations sent by a moderator.
$group_pending_invitations = GroupPortalManager::get_groups_by_user(api_get_user_id(), GROUP_USER_PERMISSION_PENDING_INVITATION, false);
$group_pending_invitations = count($group_pending_invitations);
$total_invitations = $number_of_new_messages_of_friend + $group_pending_invitations;
$cant_msg = Display::badge($number_of_new_messages);
$link = '';
if (api_get_setting('allow_social_tool') == 'true') {
$link = '?f=social';
}
$profile_content .= '<li class="inbox-social"><a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php'.$link.'">'.get_lang('Inbox').$cant_msg.' </a></li>';
$profile_content .= '<li class="new-message-social"><a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php'.$link.'">'.get_lang('Compose').' </a></li>';
if (api_get_setting('allow_social_tool') == 'true') {
$total_invitations = Display::badge($total_invitations);
$profile_content .= '<li class="invitations-social"><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.get_lang('PendingInvitations').$total_invitations.'</a></li>';
}
if (isset($_configuration['allow_my_files_link_in_homepage']) && $_configuration['allow_my_files_link_in_homepage']) {
$profile_content .= '<li class="myfiles-social"><a href="'.api_get_path(WEB_PATH).'main/social/myfiles.php">'.get_lang('MyFiles').'</a></li>';
}
}
$editProfileUrl = api_get_path(WEB_CODE_PATH) . 'auth/profile.php';
if (api_get_setting('sso_authentication') === 'true') {
$subSSOClass = api_get_setting('sso_authentication_subclass');
$objSSO = null;
if (!empty($subSSOClass)) {
require_once api_get_path(SYS_CODE_PATH) . 'auth/sso/sso.' . $subSSOClass . '.class.php';
$subSSOClass = 'sso' . $subSSOClass;
$objSSO = new $subSSOClass();
} else {
$objSSO = new sso();
}
$editProfileUrl = $objSSO->generateProfileEditingURL();
}
$profile_content .= '<li class="profile-social"><a href="' . $editProfileUrl . '">'.get_lang('EditProfile').'</a></li>';
$profile_content .= '</ul>';
$html = self::show_right_block(get_lang('Profile'), $profile_content, 'profile_block');
return $html;
}
示例5: score_badges
/**
* @param array $list_values
* @return string
*/
public static function score_badges($list_values)
{
$counter = 1;
$badges = array();
foreach ($list_values as $value) {
$class = 'warning';
if ($counter == 1) {
$class = 'success';
}
$counter++;
$badges[] = Display::badge($value, $class);
}
return Display::badge_group($badges);
}
示例6: get_table_data
//.........这里部分代码省略.........
//$score = $item->calc_score(api_get_user_id());
//$new_score = $data[3] * $score[0] / $score[1];
//$new_score = floatval(number_format($new_score, api_get_setting('gradebook_number_decimals')));
// Result
$row[] = $value_data;
$best = isset($data['best']) ? $data['best'] : null;
$average = isset($data['average']) ? $data['average'] : null;
$ranking = isset($data['ranking']) ? $data['ranking'] : null;
// Ranking
$row[] = $ranking;
// Best
$row[] = $best;
// Average
$row[] = $average;
}
}
if (!empty($cats)) {
if ($this->exportToPdf == false) {
$row[] = null;
}
}
}
if ($this->exportToPdf == false) {
$row['child_of'] = $parent_id;
}
$sortable_data[] = $row;
}
// "Warning row"
if (!empty($data_array)) {
if ($this->teacherView) {
// Compare the category weight to the sum of all weights inside the category
if (intval($total_weight) == $category_weight) {
$label = null;
$total = GradebookUtils::score_badges(array($total_weight . ' / ' . $category_weight, '100'));
} else {
$label = Display::return_icon('warning.png', sprintf(get_lang('TotalWeightMustBeX'), $category_weight));
$total = Display::badge($total_weight . ' / ' . $category_weight, 'warning');
}
$row = array(null, null, " <h5>" . get_lang('SubTotal') . '</h5>', null, $total . ' ' . $label, 'child_of' => $parent_id);
$sortable_data[] = $row;
}
}
}
}
}
}
//end looping categories
$main_weight = 0;
if (count($main_cat) > 1) {
/** @var Category $myCat */
foreach ($main_cat as $myCat) {
$myParentId = $myCat->get_parent_id();
if ($myParentId == 0) {
$main_weight = intval($myCat->get_weight());
}
}
}
if ($this->teacherView) {
// Total for teacher.
if (count($main_cat) > 1) {
if (intval($total_categories_weight) == $main_weight) {
$total = GradebookUtils::score_badges(array($total_categories_weight . ' / ' . $main_weight, '100'));
} else {
$total = Display::badge($total_categories_weight . ' / ' . $main_weight, 'warning');
}
$row = array(null, null, '<strong>' . get_lang('Total') . '</strong>', null, $total);
示例7: return_profile_block
/**
* @return null|string|void
*/
public function return_profile_block()
{
global $_configuration;
$user_id = api_get_user_id();
if (empty($user_id)) {
return;
}
$userGroup = new UserGroup();
$profile_content = '<ul class="nav nav-pills nav-stacked">';
// @todo Add a platform setting to add the user image.
if (api_get_setting('message.allow_message_tool') == 'true') {
// New messages.
$number_of_new_messages = MessageManager::get_new_messages();
// New contact invitations.
$number_of_new_messages_of_friend = SocialManager::get_message_number_invitation_by_user_id(api_get_user_id());
// New group invitations sent by a moderator.
$group_pending_invitations = $userGroup->get_groups_by_user(api_get_user_id(), GROUP_USER_PERMISSION_PENDING_INVITATION, false);
$group_pending_invitations = count($group_pending_invitations);
$total_invitations = $number_of_new_messages_of_friend + $group_pending_invitations;
$cant_msg = Display::badge($number_of_new_messages);
$link = '';
if (api_get_setting('social.allow_social_tool') == 'true') {
$link = '?f=social';
}
$profile_content .= '<li class="inbox-message-social"><a href="' . api_get_path(WEB_PATH) . 'main/messages/inbox.php' . $link . '">' . Display::return_icon('inbox.png', get_lang('Inbox'), null, ICON_SIZE_SMALL) . get_lang('Inbox') . $cant_msg . ' </a></li>';
$profile_content .= '<li class="new-message-social"><a href="' . api_get_path(WEB_PATH) . 'main/messages/new_message.php' . $link . '">' . Display::return_icon('new-message.png', get_lang('Compose'), null, ICON_SIZE_SMALL) . get_lang('Compose') . ' </a></li>';
if (api_get_setting('social.allow_social_tool') == 'true') {
$total_invitations = Display::badge($total_invitations);
$profile_content .= '<li class="invitations-social"><a href="' . api_get_path(WEB_PATH) . 'main/social/invitations.php">' . Display::return_icon('invitations.png', get_lang('PendingInvitations'), null, ICON_SIZE_SMALL) . get_lang('PendingInvitations') . $total_invitations . '</a></li>';
}
if (isset($_configuration['allow_my_files_link_in_homepage']) && $_configuration['allow_my_files_link_in_homepage']) {
$profile_content .= '<li class="myfiles-social"><a href="' . api_get_path(WEB_PATH) . 'main/social/myfiles.php">' . get_lang('MyFiles') . '</a></li>';
}
}
$editProfileUrl = Display::getProfileEditionLink($user_id);
$profile_content .= '<li class="profile-social"><a href="' . $editProfileUrl . '">' . Display::return_icon('edit-profile.png', get_lang('EditProfile'), null, ICON_SIZE_SMALL) . get_lang('EditProfile') . '</a></li>';
$profile_content .= '</ul>';
$html = self::show_right_block(get_lang('Profile'), $profile_content, 'profile_block', null, 'profile', 'profileCollapse');
return $html;
}
示例8: show_social_menu
/**
* Shows the right menu of the Social Network tool
*
* @param string $show highlight link possible values:
* group_add,
* home,
* messages,
* messages_inbox,
* messages_compose ,
* messages_outbox,
* invitations,
* shared_profile,
* friends,
* groups search
* @param int $group_id group id
* @param int $user_id user id
* @param bool $show_full_profile show profile or not (show or hide the user image/information)
* @param bool $show_delete_account_button
*
*/
public static function show_social_menu($show = '', $group_id = 0, $user_id = 0, $show_full_profile = false, $show_delete_account_button = false)
{
if (empty($user_id)) {
$user_id = api_get_user_id();
}
$usergroup = new UserGroup();
$user_info = api_get_user_info($user_id, true);
$current_user_id = api_get_user_id();
$current_user_info = api_get_user_info($current_user_id, true);
if ($current_user_id == $user_id) {
$user_friend_relation = null;
} else {
$user_friend_relation = SocialManager::get_relation_between_contacts($current_user_id, $user_id);
}
$show_groups = array('groups', 'group_messages', 'messages_list', 'group_add', 'mygroups', 'group_edit', 'member_list', 'invite_friends', 'waiting_list', 'browse_groups');
// get count unread message and total invitations
$count_unread_message = MessageManager::get_number_of_messages(true);
$count_unread_message = !empty($count_unread_message) ? Display::badge($count_unread_message) : null;
$number_of_new_messages_of_friend = SocialManager::get_message_number_invitation_by_user_id(api_get_user_id());
$group_pending_invitations = $usergroup->get_groups_by_user(api_get_user_id(), GROUP_USER_PERMISSION_PENDING_INVITATION, false);
$group_pending_invitations = count($group_pending_invitations);
$total_invitations = $number_of_new_messages_of_friend + $group_pending_invitations;
$total_invitations = !empty($total_invitations) ? Display::badge($total_invitations) : '';
$filesIcon = Display::return_icon('sn-files.png', get_lang('MyFiles'), '', ICON_SIZE_SMALL);
$friendsIcon = Display::return_icon('sn-friends.png', get_lang('Friends'), '', ICON_SIZE_SMALL);
$groupsIcon = Display::return_icon('sn-groups.png', get_lang('SocialGroups'), '', ICON_SIZE_SMALL);
$homeIcon = Display::return_icon('sn-home.png', get_lang('Home'), '', ICON_SIZE_SMALL);
$invitationsIcon = Display::return_icon('sn-invitations.png', get_lang('Invitations'), '', ICON_SIZE_SMALL);
$messagesIcon = Display::return_icon('sn-message.png', get_lang('Messages'), '', ICON_SIZE_SMALL);
$sharedProfileIcon = Display::return_icon('sn-profile.png', get_lang('ViewMySharedProfile'));
$searchIcon = Display::return_icon('sn-search.png', get_lang('Search'), '', ICON_SIZE_SMALL);
$html = '';
$active = null;
if (!in_array($show, array('shared_profile', 'groups', 'group_edit', 'member_list', 'waiting_list', 'invite_friends'))) {
$links = '<ul class="nav nav-pills nav-stacked">';
$active = $show == 'home' ? 'active' : null;
$links .= '
<li class="home-icon ' . $active . '">
<a href="' . api_get_path(WEB_CODE_PATH) . 'social/home.php">
' . $homeIcon . ' ' . get_lang('Home') . '
</a>
</li>';
$active = $show == 'messages' ? 'active' : null;
$links .= '
<li class="messages-icon ' . $active . '">
<a href="' . api_get_path(WEB_CODE_PATH) . 'messages/inbox.php?f=social">
' . $messagesIcon . ' ' . get_lang('Messages') . $count_unread_message . '
</a>
</li>';
//Invitations
$active = $show == 'invitations' ? 'active' : null;
$links .= '
<li class="invitations-icon ' . $active . '">
<a href="' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php">
' . $invitationsIcon . ' ' . get_lang('Invitations') . $total_invitations . '
</a>
</li>';
//Shared profile and groups
$active = $show == 'shared_profile' ? 'active' : null;
$links .= '
<li class="shared-profile-icon' . $active . '">
<a href="' . api_get_path(WEB_CODE_PATH) . 'social/profile.php">
' . $sharedProfileIcon . ' ' . get_lang('ViewMySharedProfile') . '
</a>
</li>';
$active = $show == 'friends' ? 'active' : null;
$links .= '
<li class="friends-icon ' . $active . '">
<a href="' . api_get_path(WEB_CODE_PATH) . 'social/friends.php">
' . $friendsIcon . ' ' . get_lang('Friends') . '
</a>
</li>';
$active = $show == 'browse_groups' ? 'active' : null;
$links .= '
<li class="browse-groups-icon ' . $active . '">
<a href="' . api_get_path(WEB_CODE_PATH) . 'social/groups.php">
' . $groupsIcon . ' ' . get_lang('SocialGroups') . '
</a>
</li>';
//Search users
//.........这里部分代码省略.........
示例9: show_social_menu
/**
* Shows the right menu of the Social Network tool
*
* @param string highlight link possible values: group_add, home, messages, messages_inbox, messages_compose ,messages_outbox ,invitations, shared_profile, friends, groups search
* @param int group id
* @param int user id
* @param bool show profile or not (show or hide the user image/information)
*
*/
public static function show_social_menu($show = '', $group_id = 0, $user_id = 0, $show_full_profile = false, $show_delete_account_button = false)
{
if (empty($user_id)) {
$user_id = api_get_user_id();
}
$usergroup = new UserGroup();
$user_info = api_get_user_info($user_id, true);
$current_user_id = api_get_user_id();
$current_user_info = api_get_user_info($current_user_id, true);
if ($current_user_id == $user_id) {
$user_friend_relation = null;
} else {
$user_friend_relation = SocialManager::get_relation_between_contacts($current_user_id, $user_id);
}
$show_groups = array('groups', 'group_messages', 'messages_list', 'group_add', 'mygroups', 'group_edit', 'member_list', 'invite_friends', 'waiting_list', 'browse_groups');
// get count unread message and total invitations
$count_unread_message = MessageManager::get_number_of_messages(true);
$count_unread_message = !empty($count_unread_message) ? Display::badge($count_unread_message) : '';
$number_of_new_messages_of_friend = SocialManager::get_message_number_invitation_by_user_id(api_get_user_id());
$group_pending_invitations = $usergroup->get_groups_by_user(api_get_user_id(), GROUP_USER_PERMISSION_PENDING_INVITATION, false);
$group_pending_invitations = count($group_pending_invitations);
$total_invitations = $number_of_new_messages_of_friend + $group_pending_invitations;
$total_invitations = !empty($total_invitations) ? Display::badge($total_invitations) : '';
$html = '<div class="social-menu">';
if (in_array($show, $show_groups) && !empty($group_id)) {
//--- Group image
$group_info = $usergroup->get($group_id);
$big = $usergroup->get_picture_group($group_id, $group_info['picture'], 160, GROUP_IMAGE_SIZE_BIG);
$html .= '<div class="social-content-image">';
$html .= '<div class="well social-background-content">';
$html .= Display::url('<img src=' . $big['file'] . ' class="social-groups-image" /> </a><br /><br />', api_get_path(WEB_PATH) . 'main/social/groups.php?id=' . $group_id);
if ($usergroup->is_group_admin($group_id, api_get_user_id())) {
$html .= '<div id="edit_image" class="hidden_message" style="display:none"><a href="' . api_get_path(WEB_PATH) . 'main/social/group_edit.php?id=' . $group_id . '">' . get_lang('EditGroup') . '</a></div>';
}
$html .= '</div>';
$html .= '</div>';
} else {
$img_array = UserManager::get_user_picture_path_by_id($user_id, 'web', true, true);
$big_image = UserManager::get_picture_user($user_id, $img_array['file'], '', USER_IMAGE_SIZE_BIG);
$big_image = $big_image['file'];
$normal_image = $img_array['dir'] . $img_array['file'];
//--- User image
$html .= '<div class="well social-background-content">';
if ($img_array['file'] != 'unknown.jpg') {
$html .= '<a class="thumbnail ajax" href="' . $big_image . '"><img src=' . $normal_image . ' /> </a>';
} else {
$html .= '<img src=' . $normal_image . ' width="110px" />';
}
if (api_get_user_id() == $user_id) {
$html .= '<div id="edit_image" class="hidden_message" style="display:none">';
$html .= '<a href="' . api_get_path(WEB_PATH) . 'main/auth/profile.php">' . get_lang('EditProfile') . '</a></div>';
}
$html .= '</div>';
}
if (!in_array($show, array('shared_profile', 'groups', 'group_edit', 'member_list', 'waiting_list', 'invite_friends'))) {
$html .= '<div class="well sidebar-nav"><ul class="nav nav-list">';
$active = $show == 'home' ? 'active' : null;
$html .= '<li class="' . $active . '"><a href="' . api_get_path(WEB_PATH) . 'main/social/home.php">' . Display::return_icon('home.png', get_lang('Home'), array()) . get_lang('Home') . '</a></li>';
if (api_get_setting('allow_message_tool') == 'true') {
$active = $show == 'messages' ? 'active' : null;
$html .= '<li class="' . $active . '"><a href="' . api_get_path(WEB_PATH) . 'main/messages/inbox.php?f=social">' . Display::return_icon('instant_message.png', get_lang('Messages'), array()) . get_lang('Messages') . $count_unread_message . '</a></li>';
}
// Invitations
if (api_get_setting('allow_message_tool') == 'true') {
$active = $show == 'invitations' ? 'active' : null;
$html .= '<li class="' . $active . '"><a href="' . api_get_path(WEB_PATH) . 'main/social/invitations.php">' . Display::return_icon('invitation.png', get_lang('Invitations'), array()) . get_lang('Invitations') . $total_invitations . '</a></li>';
}
//Shared profile and groups
$active = $show == 'shared_profile' ? 'active' : null;
$html .= '<li class="' . $active . '"><a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php">' . Display::return_icon('my_shared_profile.png', get_lang('ViewMySharedProfile'), array()) . get_lang('ViewMySharedProfile') . '</a></li>';
$active = $show == 'friends' ? 'active' : null;
$html .= '<li class="' . $active . '"><a href="' . api_get_path(WEB_PATH) . 'main/social/friends.php">' . Display::return_icon('friend.png', get_lang('Friends'), array()) . get_lang('Friends') . '</a></li>';
$active = $show == 'browse_groups' ? 'active' : null;
$html .= '<li class="' . $active . '"><a href="' . api_get_path(WEB_PATH) . 'main/social/groups.php">' . Display::return_icon('group_s.png', get_lang('SocialGroups'), array()) . get_lang('SocialGroups') . '</a></li>';
//Search users
$active = $show == 'search' ? 'active' : null;
$html .= '<li class="' . $active . '"><a href="' . api_get_path(WEB_PATH) . 'main/social/search.php">' . Display::return_icon('zoom.png', get_lang('Search'), array()) . get_lang('Search') . '</a></li>';
$html .= '</ul>
</div>';
}
if (in_array($show, $show_groups) && !empty($group_id)) {
$html .= $usergroup->show_group_column_information($group_id, api_get_user_id(), $show);
}
if ($show == 'shared_profile') {
//echo '<div align="center" class="social-menu-title" ><span class="social-menu-text1">'.get_lang('Menu').'</span></div>';
$html .= '<div class="well sidebar-nav">
<ul class="nav nav-list">';
// My own profile
if ($show_full_profile && $user_id == intval(api_get_user_id())) {
$html .= '<li><a href="' . api_get_path(WEB_PATH) . 'main/social/home.php">' . Display::return_icon('home.png', get_lang('Home'), array()) . get_lang('Home') . '</a></li>';
if (api_get_setting('allow_message_tool') == 'true') {
//.........这里部分代码省略.........
示例10: show_social_menu
/**
* Shows the right menu of the Social Network tool
*
* @param string $show highlight link possible values:
* group_add,
* home,
* messages,
* messages_inbox,
* messages_compose ,
* messages_outbox,
* invitations,
* shared_profile,
* friends,
* groups search
* @param int $group_id group id
* @param int $user_id user id
* @param bool $show_full_profile show profile or not (show or hide the user image/information)
* @param bool $show_delete_account_button
*
*/
public static function show_social_menu($show = '', $group_id = 0, $user_id = 0, $show_full_profile = false, $show_delete_account_button = false)
{
if (empty($user_id)) {
$user_id = api_get_user_id();
}
$usergroup = new UserGroup();
$user_info = api_get_user_info($user_id, true);
$current_user_id = api_get_user_id();
$current_user_info = api_get_user_info($current_user_id, true);
if ($current_user_id == $user_id) {
$user_friend_relation = null;
} else {
$user_friend_relation = SocialManager::get_relation_between_contacts($current_user_id, $user_id);
}
$show_groups = array('groups', 'group_messages', 'messages_list', 'group_add', 'mygroups', 'group_edit', 'member_list', 'invite_friends', 'waiting_list', 'browse_groups');
// get count unread message and total invitations
$count_unread_message = MessageManager::get_number_of_messages(true);
$count_unread_message = !empty($count_unread_message) ? Display::badge($count_unread_message) : null;
$number_of_new_messages_of_friend = SocialManager::get_message_number_invitation_by_user_id(api_get_user_id());
$group_pending_invitations = $usergroup->get_groups_by_user(api_get_user_id(), GROUP_USER_PERMISSION_PENDING_INVITATION, false);
$group_pending_invitations = count($group_pending_invitations);
$total_invitations = $number_of_new_messages_of_friend + $group_pending_invitations;
$total_invitations = !empty($total_invitations) ? Display::badge($total_invitations) : '';
$html = '';
$active = null;
if (!in_array($show, array('shared_profile', 'groups', 'group_edit', 'member_list', 'waiting_list', 'invite_friends'))) {
$html .= '<div class="panel panel-default sidebar-nav">';
$html .= '<div class="panel-body">';
$html .= '<ul class="nav nav-pills nav-stacked">';
$active = $show == 'home' ? 'active' : null;
$html .= '<li class="home-icon ' . $active . '"><a href="' . api_get_path(WEB_CODE_PATH) . 'social/home.php">' . Display::return_icon('social-home.png', get_lang('Home'), '', ICON_SIZE_SMALL) . ' ' . get_lang('Home') . '</a></li>';
$active = $show == 'messages' ? 'active' : null;
$html .= '<li class="messages-icon ' . $active . '"><a href="' . api_get_path(WEB_CODE_PATH) . 'messages/inbox.php?f=social">' . Display::return_icon('social-message.png', get_lang('Messages'), '', ICON_SIZE_SMALL) . ' ' . get_lang('Messages') . $count_unread_message . '</a></li>';
//Invitations
$active = $show == 'invitations' ? 'active' : null;
$html .= '<li class="invitations-icon ' . $active . '"><a href="' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php">' . Display::return_icon('social-invitations.png', get_lang('Invitations'), '', ICON_SIZE_SMALL) . ' ' . get_lang('Invitations') . $total_invitations . '</a></li>';
//Shared profile and groups
$active = $show == 'shared_profile' ? 'active' : null;
$html .= '<li class="shared-profile-icon' . $active . '"><a href="' . api_get_path(WEB_CODE_PATH) . 'social/profile.php">' . Display::return_icon('social-profile.png', get_lang('ViewMySharedProfile'), '', ICON_SIZE_SMALL) . ' ' . get_lang('ViewMySharedProfile') . '</a></li>';
$active = $show == 'friends' ? 'active' : null;
$html .= '<li class="friends-icon ' . $active . '"><a href="' . api_get_path(WEB_CODE_PATH) . 'social/friends.php">' . Display::return_icon('social-friends.png', get_lang('Friends'), '', ICON_SIZE_SMALL) . ' ' . get_lang('Friends') . '</a></li>';
$active = $show == 'browse_groups' ? 'active' : null;
$html .= '<li class="browse-groups-icon ' . $active . '"><a href="' . api_get_path(WEB_CODE_PATH) . 'social/groups.php">' . Display::return_icon('social-groups.png', get_lang('SocialGroups'), '', ICON_SIZE_SMALL) . ' ' . get_lang('SocialGroups') . '</a></li>';
//Search users
$active = $show == 'search' ? 'active' : null;
$html .= '<li class="search-icon ' . $active . '"><a href="' . api_get_path(WEB_CODE_PATH) . 'social/search.php">' . Display::return_icon('social-search.png', get_lang('Search'), '', ICON_SIZE_SMALL) . ' ' . get_lang('Search') . '</a></li>';
//My files
$active = $show == 'myfiles' ? 'active' : null;
$html .= '<li class="myfiles-icon ' . $active . '"><a href="' . api_get_path(WEB_CODE_PATH) . 'social/myfiles.php">' . Display::return_icon('social-files.png', get_lang('MyFiles'), '', ICON_SIZE_SMALL) . ' ' . get_lang('MyFiles') . '</span></a></li>';
$html .= '</ul></div></div>';
}
if (in_array($show, $show_groups) && !empty($group_id)) {
$html .= $usergroup->show_group_column_information($group_id, api_get_user_id(), $show);
}
if ($show == 'shared_profile') {
$html .= '<div class="panel panel-default sidebar-nav">';
$html .= '<div class="panel-body">';
$html .= '<ul class="nav nav-pills nav-stacked">';
// My own profile
if ($show_full_profile && $user_id == intval(api_get_user_id())) {
$html .= '<li class="home-icon ' . $active . '"><a href="' . api_get_path(WEB_CODE_PATH) . 'social/home.php">' . Display::return_icon('social-home.png', get_lang('Home'), '', ICON_SIZE_SMALL) . ' ' . get_lang('Home') . '</a></li>
<li class="messages-icon ' . $active . '"><a href="' . api_get_path(WEB_CODE_PATH) . 'messages/inbox.php?f=social">' . Display::return_icon('social-message.png', get_lang('Messages'), '', ICON_SIZE_SMALL) . ' ' . get_lang('Messages') . $count_unread_message . '</a></li>';
$active = $show == 'invitations' ? 'active' : null;
$html .= '<li class="invitations-icon' . $active . '"><a href="' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php">' . Display::return_icon('social-invitations.png', get_lang('Invitations'), '', ICON_SIZE_SMALL) . ' ' . get_lang('Invitations') . $total_invitations . '</a></li>';
$html .= '<li class="shared-profile-icon active"><a href="' . api_get_path(WEB_CODE_PATH) . 'social/profile.php">' . Display::return_icon('social-profile.png', get_lang('ViewMySharedProfile'), '', ICON_SIZE_SMALL) . ' ' . get_lang('ViewMySharedProfile') . '</a></li>
<li class="friends-icon"><a href="' . api_get_path(WEB_CODE_PATH) . 'social/friends.php">' . Display::return_icon('social-friends.png', get_lang('Friends'), '', ICON_SIZE_SMALL) . ' ' . get_lang('Friends') . '</a></li>
<li class="browse-groups-icon"><a href="' . api_get_path(WEB_CODE_PATH) . 'social/groups.php">' . Display::return_icon('social-groups.png', get_lang('SocialGroups'), '', ICON_SIZE_SMALL) . ' ' . get_lang('SocialGroups') . '</a></li>';
$active = $show == 'search' ? 'active' : null;
$html .= '<li class="search-icon ' . $active . '"><a href="' . api_get_path(WEB_CODE_PATH) . 'social/search.php">' . Display::return_icon('social-search.png', get_lang('Search'), '', ICON_SIZE_SMALL) . ' ' . get_lang('Search') . '</a></li>';
$active = $show == 'myfiles' ? 'active' : null;
$html .= '<li class="myfiles-icon ' . $active . '"><a href="' . api_get_path(WEB_CODE_PATH) . 'social/myfiles.php">' . Display::return_icon('social-files.png', get_lang('MyFiles'), '', ICON_SIZE_SMALL) . ' ' . get_lang('MyFiles') . '</a></li>';
}
// My friend profile.
if ($user_id != api_get_user_id()) {
$html .= '<li><a href="#" class="btn-to-send-message" data-send-to="' . $user_id . '" title="' . get_lang('SendMessage') . '">';
$html .= Display::return_icon('compose_message.png', get_lang('SendMessage')) . ' ' . get_lang('SendMessage') . '</a></li>';
}
// Check if I already sent an invitation message
$invitation_sent_list = SocialManager::get_list_invitation_sent_by_user_id(api_get_user_id());
if (isset($invitation_sent_list[$user_id]) && is_array($invitation_sent_list[$user_id]) && count($invitation_sent_list[$user_id]) > 0) {
//.........这里部分代码省略.........