Minor - format code, replace icon

pull/2473/head
jmontoyaa 8 years ago
parent ed3e1f4bf5
commit 7fbe67b6ec
  1. 46
      main/inc/lib/social.lib.php
  2. 17
      main/mySpace/index.php

@ -1469,7 +1469,7 @@ class SocialManager extends UserManager
* @param int $messageId id parent * @param int $messageId id parent
* @param string $messageStatus status type of message * @param string $messageStatus status type of message
* *
* @return bool * @return int
* *
* @author Yannick Warnier * @author Yannick Warnier
*/ */
@ -1481,9 +1481,13 @@ class SocialManager extends UserManager
$messageStatus = '' $messageStatus = ''
) { ) {
$tblMessage = Database::get_main_table(TABLE_MESSAGE); $tblMessage = Database::get_main_table(TABLE_MESSAGE);
$userId = intval($userId); $userId = (int) $userId;
$friendId = intval($friendId); $friendId = (int) $friendId;
$messageId = intval($messageId); $messageId = (int) $messageId;
if (empty($userId) || empty($friendId)) {
return 0;
}
// Just in case we replace the and \n and \n\r while saving in the DB // Just in case we replace the and \n and \n\r while saving in the DB
$messageContent = str_replace(["\n", "\n\r"], '<br />', $messageContent); $messageContent = str_replace(["\n", "\n\r"], '<br />', $messageContent);
@ -1662,7 +1666,7 @@ class SocialManager extends UserManager
$start = '0000-00-00'; $start = '0000-00-00';
} }
$isOwnWall = (api_get_user_id() == $userId && $userId == $friendId); $isOwnWall = api_get_user_id() == $userId && $userId == $friendId;
$messages = self::getWallMessages( $messages = self::getWallMessages(
$userId, $userId,
MESSAGE_STATUS_WALL, MESSAGE_STATUS_WALL,
@ -1708,8 +1712,12 @@ class SocialManager extends UserManager
if ($isOwnWall) { if ($isOwnWall) {
$media .= '<div class="col-md-1 col-xs-1 social-post-answers">'; $media .= '<div class="col-md-1 col-xs-1 social-post-answers">';
$media .= '<div class="pull-right deleted-mgs">'; $media .= '<div class="pull-right deleted-mgs">';
$media .= '<a title="'.get_lang("SocialMessageDelete").'" href="'.api_get_path(WEB_CODE_PATH).'social/profile.php?messageId='. $url = api_get_path(WEB_CODE_PATH).'social/profile.php?messageId='.$message['id'];
$message['id'].'">x</a>'; $media .= Display::url(
Display::returnFontAwesomeIcon('trash'),
$url,
['title' => get_lang("SocialMessageDelete")]
);
$media .= '</div>'; $media .= '</div>';
$media .= '</div>'; $media .= '</div>';
} }
@ -1816,7 +1824,8 @@ class SocialManager extends UserManager
$description = $graph->description; $description = $graph->description;
$title = $graph->title; $title = $graph->title;
$html = '<div class="thumbnail social-thumbnail">'; $html = '<div class="thumbnail social-thumbnail">';
$html .= empty($image) ? '' : '<a target="_blank" href="'.$url.'"><img class="img-responsive social-image" src="'.$image.'" /></a>'; $html .= empty($image) ? '' : '<a target="_blank" href="'.$url.'">
<img class="img-responsive social-image" src="'.$image.'" /></a>';
$html .= '<div class="social-description">'; $html .= '<div class="social-description">';
$html .= '<a target="_blank" href="'.$url.'"><h5 class="social-title"><b>'.$title.'</b></h5></a>'; $html .= '<a target="_blank" href="'.$url.'"><h5 class="social-title"><b>'.$title.'</b></h5></a>';
$html .= empty($description) ? '' : '<span>'.$description.'</span>'; $html .= empty($description) ? '' : '<span>'.$description.'</span>';
@ -2011,8 +2020,9 @@ class SocialManager extends UserManager
} }
$friendHtml .= '</ul>'; $friendHtml .= '</ul>';
} else { } else {
$friendHtml .= '<div class="">'.get_lang('NoFriendsInYourContactList').'<br />' $friendHtml .= '<div class="">'.get_lang('NoFriendsInYourContactList').'<br />
.'<a class="btn btn-primary" href="'.api_get_path(WEB_PATH).'whoisonline.php"><em class="fa fa-search"></em> '.get_lang('TryAndFindSomeFriends').'</a></div>'; <a class="btn btn-primary" href="'.api_get_path(WEB_PATH).'whoisonline.php">
<em class="fa fa-search"></em> '.get_lang('TryAndFindSomeFriends').'</a></div>';
} }
$friendHtml = Display::panel($friendHtml, get_lang('SocialFriend').' ('.$number_friends.')'); $friendHtml = Display::panel($friendHtml, get_lang('SocialFriend').' ('.$number_friends.')');
@ -2087,8 +2097,9 @@ class SocialManager extends UserManager
} }
$friendHtml .= '</div>'; $friendHtml .= '</div>';
} else { } else {
$friendHtml .= '<div class="help">'.get_lang('NoFriendsInYourContactList').' ' $friendHtml .= '<div class="help">'.get_lang('NoFriendsInYourContactList').'
.'<a href="'.api_get_path(WEB_PATH).'whoisonline.php"><em class="fa fa-search"></em> '.get_lang('TryAndFindSomeFriends').'</a></div>'; <a href="'.api_get_path(WEB_PATH).'whoisonline.php">
<em class="fa fa-search"></em> '.get_lang('TryAndFindSomeFriends').'</a></div>';
} }
return $friendHtml; return $friendHtml;
@ -2226,8 +2237,12 @@ class SocialManager extends UserManager
$htmlDelete = ''; $htmlDelete = '';
if ($isOwnWall) { if ($isOwnWall) {
$htmlDelete .= '<a title="'.get_lang("SocialMessageDelete").'" href="'.api_get_path(WEB_CODE_PATH).'social/profile.php?messageId='. $url = api_get_path(WEB_CODE_PATH).'social/profile.php?messageId='.$message['id'];
$message['id'].'">x</a>'; $htmlDelete .= Display::url(
Display::returnFontAwesomeIcon('trash'),
$url,
['title' => get_lang('SocialMessageDelete')]
);
} }
$html = ''; $html = '';
@ -2238,7 +2253,8 @@ class SocialManager extends UserManager
$html .= '</div>'; $html .= '</div>';
} }
$html .= '<div class="user-image" >'; $html .= '<div class="user-image" >';
$html .= '<a href="'.$urlAuthor.'">'.'<img class="avatar-thumb" src="'.$avatarAuthor.'" alt="'.$nameCompleteAuthor.'"></a>'; $html .= '<a href="'.$urlAuthor.'">
<img class="avatar-thumb" src="'.$avatarAuthor.'" alt="'.$nameCompleteAuthor.'"></a>';
$html .= '</div>'; $html .= '</div>';
$html .= '<div class="user-data">'; $html .= '<div class="user-data">';
$html .= '<div class="username"><a href="'.$urlAuthor.'">'.$nameCompleteAuthor.'</a>'.$htmlReceiver.'</div>'; $html .= '<div class="username"><a href="'.$urlAuthor.'">'.$nameCompleteAuthor.'</a>'.$htmlReceiver.'</div>';

@ -154,7 +154,10 @@ $actionsRight .= Display::url(
); );
if (!empty($session_id) && if (!empty($session_id) &&
!in_array($display, ['accessoverview', 'lpprogressoverview', 'progressoverview', 'exerciseprogress', 'surveyoverview']) !in_array(
$display,
['accessoverview', 'lpprogressoverview', 'progressoverview', 'exerciseprogress', 'surveyoverview']
)
) { ) {
$actionsLeft .= Display::url( $actionsLeft .= Display::url(
Display::return_icon( Display::return_icon(
@ -214,7 +217,10 @@ if (!empty($session_id) &&
// Actions menu // Actions menu
$nb_menu_items = count($menu_items); $nb_menu_items = count($menu_items);
if (empty($session_id) || if (empty($session_id) ||
in_array($display, ['accessoverview', 'lpprogressoverview', 'progressoverview', 'exerciseprogress', 'surveyoverview']) in_array(
$display,
['accessoverview', 'lpprogressoverview', 'progressoverview', 'exerciseprogress', 'surveyoverview']
)
) { ) {
if ($nb_menu_items > 1) { if ($nb_menu_items > 1) {
foreach ($menu_items as $key => $item) { foreach ($menu_items as $key => $item) {
@ -261,14 +267,12 @@ $view->assign('numberTeachers', $numberTeachers);
$view->assign('humanresources', $countHumanResourcesUsers); $view->assign('humanresources', $countHumanResourcesUsers);
$view->assign( $view->assign(
'total_user', 'total_user',
$numberStudents + $numberStudentBosses + $numberTeachers + $countHumanResourcesUsers); $numberStudents + $numberStudentBosses + $numberTeachers + $countHumanResourcesUsers
);
$view->assign('studentboss', STUDENT_BOSS); $view->assign('studentboss', STUDENT_BOSS);
$view->assign('drh', DRH); $view->assign('drh', DRH);
$view->assign('stats', $stats); $view->assign('stats', $stats);
//echo Display::page_subheader(get_lang('Students').' ('.$numberStudents.')');
$form = new FormValidator( $form = new FormValidator(
'search_user', 'search_user',
'get', 'get',
@ -360,7 +364,6 @@ if ($skipData == false) {
} }
} }
$view->assign('header', $nameTools); $view->assign('header', $nameTools);
$view->assign('form', $form->returnForm()); $view->assign('form', $form->returnForm());
$view->assign('actions', Display::toolbarAction('toolbar', [$actionsLeft, $actionsRight])); $view->assign('actions', Display::toolbarAction('toolbar', [$actionsLeft, $actionsRight]));

Loading…
Cancel
Save