getSocialUserBlock converted to setSocialUserBlock()

- Now the function needs a template object in order to setup content.
- Add Display::panel function
- Use template obj in auth/profile.php requires some testing.
1.10.x
Julio Montoya 10 years ago
parent 52a5051f6c
commit 51bb82ec0a
  1. 104
      main/auth/profile.php
  2. 49
      main/inc/lib/display.lib.php
  3. 10
      main/inc/lib/message.lib.php
  4. 25
      main/inc/lib/social.lib.php
  5. 10
      main/inc/lib/template.lib.php
  6. 5
      main/messages/inbox.php
  7. 6
      main/messages/new_message.php
  8. 30
      main/messages/outbox.php
  9. 5
      main/messages/view_message.php
  10. 5
      main/social/friends.php
  11. 12
      main/social/groups.php
  12. 64
      main/social/home.php
  13. 3
      main/social/invitations.php
  14. 11
      main/social/myfiles.php
  15. 9
      main/social/profile.php
  16. 6
      main/social/search.php
  17. 4
      main/template/default/social/myfiles.tpl
  18. 2
      main/template/default/social/user_block.tpl

@ -84,18 +84,16 @@ if (!empty($_GET['fe'])) {
$jquery_ready_content = '';
if (api_get_setting('allow_message_tool') == 'true') {
$jquery_ready_content = <<<EOF
$(".message-content .message-delete").click(function(){
$(this).parents(".message-content").animate({ opacity: "hide" }, "slow");
$(".message-view").animate({ opacity: "show" }, "slow");
});
$(".message-content .message-delete").click(function(){
$(this).parents(".message-content").animate({ opacity: "hide" }, "slow");
$(".message-view").animate({ opacity: "show" }, "slow");
});
EOF;
}
$tool_name = is_profile_editable() ? get_lang('ModifProfile') : get_lang('ViewProfile');
$table_user = Database :: get_main_table(TABLE_MAIN_USER);
/* Form */
/*
* Get initial values for all fields.
*/
@ -117,7 +115,13 @@ if ($user_data !== false) {
/*
* Initialize the form.
*/
$form = new FormValidator('profile', 'post', api_get_self()."?".str_replace('&fe=1', '', $_SERVER['QUERY_STRING']), null, array('style' => 'width: 70%; float: '.($text_dir == 'rtl' ? 'right;' : 'left;')));
$form = new FormValidator(
'profile',
'post',
api_get_self()."?".str_replace('&fe=1', '', Security::remove_XSS($_SERVER['QUERY_STRING'])),
null,
array('style' => 'width: 70%; float: '.($text_dir == 'rtl' ? 'right;' : 'left;'))
);
if (api_is_western_name_order()) {
// FIRST NAME and LAST NAME
@ -226,7 +230,6 @@ if (is_profile_editable() && api_get_setting('user_selected_theme') == 'true') {
$form->applyFilter('theme', 'trim');
}
// EXTENDED PROFILE this make the page very slow!
if (api_get_setting('extended_profile') == 'true') {
$width_extended_profile = 500;
@ -248,7 +251,6 @@ if (api_get_setting('extended_profile') == 'true') {
$form->addHtmlEditor('openarea', get_lang('MyPersonalOpenArea'), false, false, array('ToolbarSet' => 'Profile', 'Width' => $width_extended_profile, 'Height' => '350'));
$form->applyFilter(array('competences', 'diplomas', 'teach', 'openarea'), 'stripslashes');
$form->applyFilter(array('competences', 'diplomas', 'teach'), 'trim'); // openarea is untrimmed for maximum openness
}
// PASSWORD, if auth_source is platform
@ -294,9 +296,6 @@ if (is_profile_editable()) {
$user_data = array_merge($user_data, $extra_data);
$form->setDefaults($user_data);
/* FUNCTIONS */
/**
* Is user auth_source is platform ?
*
@ -351,7 +350,6 @@ function upload_user_production($user_id) {
* @uses Gets user ID from global variable
*/
function check_user_password($password) {
global $_user;
$user_id = api_get_user_id();
if ($user_id != strval(intval($user_id)) || empty($password)) { return false; }
$table_user = Database :: get_main_table(TABLE_MAIN_USER);
@ -405,9 +403,7 @@ if (is_platform_authentication()) {
}
if ($form->validate()) {
$wrong_current_password = false;
// $user_data = $form->exportValues();
$user_data = $form->getSubmitValues(1);
// set password if a new one was provided
@ -431,17 +427,13 @@ if ($form->validate()) {
$allow_users_to_change_email_with_no_password = false;
}
//If user sending the email to be changed (input available and not frozen )
// If user sending the email to be changed (input available and not frozen )
if (api_get_setting('profile', 'email') == 'true') {
if ($allow_users_to_change_email_with_no_password) {
if (!check_user_email($user_data['email'])) {
$changeemail = $user_data['email'];
//$_SESSION['change_email'] = 'success';
}
} else {
//Normal behaviour
if (!check_user_email($user_data['email']) && !empty($user_data['password0']) && !$wrong_current_password) {
@ -454,10 +446,15 @@ if ($form->validate()) {
}
}
// Upload picture if a new one is provided
if ($_FILES['picture']['size']) {
if ($new_picture = UserManager::update_user_picture(api_get_user_id(), $_FILES['picture']['name'], $_FILES['picture']['tmp_name'])) {
$new_picture = UserManager::update_user_picture(
api_get_user_id(),
$_FILES['picture']['name'],
$_FILES['picture']['tmp_name']
);
if ($new_picture) {
$user_data['picture_uri'] = $new_picture;
$_SESSION['image_uploaded'] = 'success';
}
@ -485,7 +482,8 @@ if ($form->validate()) {
if ($_FILES['production']['size']) {
$res = upload_user_production(api_get_user_id());
if (!$res) {
//it's a bit excessive to assume the extension is the reason why upload_user_production() returned false, but it's true in most cases
//it's a bit excessive to assume the extension is the reason why
// upload_user_production() returned false, but it's true in most cases
$filtered_extension = true;
} else {
$_SESSION['production_uploaded'] = 'success';
@ -494,7 +492,7 @@ if ($form->validate()) {
// remove values that shouldn't go in the database
unset($user_data['password0'],$user_data['password1'], $user_data['password2'], $user_data['MAX_FILE_SIZE'],
$user_data['remove_picture'], $user_data['apply_change'],$user_data['email'] );
$user_data['remove_picture'], $user_data['apply_change'], $user_data['email'] );
// Following RFC2396 (http://www.faqs.org/rfcs/rfc2396.html), a URI uses ':' as a reserved character
// we can thus ensure the URL doesn't contain any scheme name by searching for ':' in the string
@ -605,7 +603,6 @@ if ($form->validate()) {
$sql .= " WHERE user_id = '".api_get_user_id()."'";
Database::query($sql);
// User tag process
//1. Deleting all user tags
$list_extra_field_type_tag = UserManager::get_all_extra_field_by_type(UserManager::USER_FIELD_TYPE_TAG);
@ -617,7 +614,6 @@ if ($form->validate()) {
}
//2. Update the extra fields and user tags if available
if (is_array($extras) && count($extras)> 0) {
foreach ($extras as $key => $value) {
//3. Tags are process in the UserManager::update_extra_field_value by the UserManager::process_tags function
@ -651,32 +647,31 @@ if ($form->validate()) {
}
// the header
Display::display_header(get_lang('ModifyProfile'));
$actions = null;
if (api_get_setting('allow_social_tool') != 'true') {
if (api_get_setting('extended_profile') == 'true') {
echo '<div class="actions">';
$actions .= '<div class="actions">';
if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') {
echo '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'.Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')).'</a>';
$actions .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'.Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')).'</a>';
}
if (api_get_setting('allow_message_tool') == 'true') {
echo '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.Display::return_icon('inbox.png', get_lang('Messages')).'</a>';
$actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.Display::return_icon('inbox.png', get_lang('Messages')).'</a>';
}
$show = isset($_GET['show']) ? '&amp;show='.Security::remove_XSS($_GET['show']) : '';
if (isset($_GET['type']) && $_GET['type'] == 'extended') {
echo '<a href="profile.php?type=reduced'.$show.'">'.Display::return_icon('edit.png', get_lang('EditNormalProfile'),'',16).'</a>';
$actions .= '<a href="profile.php?type=reduced'.$show.'">'.Display::return_icon('edit.png', get_lang('EditNormalProfile'),'',16).'</a>';
} else {
echo '<a href="profile.php?type=extended'.$show.'">'.Display::return_icon('edit.png', get_lang('EditExtendProfile'),'',16).'</a>';
$actions .= '<a href="profile.php?type=extended'.$show.'">'.Display::return_icon('edit.png', get_lang('EditExtendProfile'),'',16).'</a>';
}
echo '</div>';
$actions .= '</div>';
}
}
if (!empty($file_deleted)) {
Display :: display_confirmation_message(get_lang('FileDeleted'), false);
Display::addFlash(Display :: return_message(get_lang('FileDeleted'), 'normal', false));
} elseif (!empty($update_success)) {
$message = get_lang('ProfileReg');
@ -687,17 +682,17 @@ if (!empty($file_deleted)) {
if ($upload_production_success) {
$message.='<br />'.get_lang('ProductionUploaded');
}
Display :: display_confirmation_message($message, false);
Display::addFlash(Display :: return_message($message, 'normal', false));
}
if (!empty($msg_fail_changue_email)){
$errormail=get_lang('ToChangeYourEmailMustTypeYourPassword');
Display :: display_error_message($errormail, false);
Display::addFlash(Display :: return_message($errormail, 'error', false));
}
if (!empty($msg_is_not_password)){
$warning_msg = get_lang('CurrentPasswordEmptyOrIncorrect');
Display :: display_warning_message($warning_msg, false);
Display::addFlash(Display :: return_message($warning_msg, 'warning', false));
}
// User picture size is calculated from SYSTEM path
@ -723,25 +718,30 @@ $url_big_image = $big_image.'?rnd='.time();
$show_delete_account_button = api_get_setting('platform_unsubscribe_allowed') == 'true' ? true : false;
$tpl = new Template(get_lang('ModifyProfile'));
$tpl->assign('actions', $actions);
//$tpl->assign('message', Display::getFlashToString());
SocialManager::setSocialUserBlock($tpl, $user_id, 'messages');
if (api_get_setting('allow_social_tool') == 'true') {
echo '<div class="row">';
echo '<div class="col-md-3">';
echo SocialManager::getSocialUserBlock(api_get_user_id(), 'home');
echo SocialManager::show_social_menu('home', null, api_get_user_id(), false, $show_delete_account_button);
echo '</div>';
echo '<div class="col-md-9">';
$form->display();
echo '</div>';
SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'home');
$tpl->assign('social_menu_block', SocialManager::show_social_menu('home', null, api_get_user_id(), false, $show_delete_account_button));
$tpl->assign('social_right_content', $form->returnForm());
$social_layout = $tpl->get_template('social/inbox.tpl');
$tpl->display($social_layout);
} else {
// Style position:absolute has been removed for Opera-compatibility.
echo '<div id="image-message-container" style="float:right;display:inline;padding:3px;width:230px;" >';
$imageToShow = '<div id="image-message-container" style="float:right;display:inline;padding:3px;width:230px;" >';
if ($image == 'unknown.jpg') {
echo '<img '.$img_attributes.' />';
$imageToShow .= '<img '.$img_attributes.' />';
} else {
echo '<input type="image" '.$img_attributes.' onclick="javascript: return show_image(\''.$url_big_image.'\',\''.$big_image_width.'\',\''.$big_image_height.'\');"/>';
$imageToShow .= '<input type="image" '.$img_attributes.' onclick="javascript: return show_image(\''.$url_big_image.'\',\''.$big_image_width.'\',\''.$big_image_height.'\');"/>';
}
echo '</div>';
$form->display();
$imageToShow .= '</div>';
$content = $imageToShow.$form->returnForm();
$tpl->assign('content', $form->returnForm());
$tpl->display_one_col_template();
}
Display :: display_footer();

@ -2016,10 +2016,12 @@ class Display
*/
public static function getProfileEditionLink($userId, $asAdmin = false)
{
$editProfileUrl = api_get_path(WEB_CODE_PATH) . 'auth/profile.php';
$editProfileUrl = api_get_path(WEB_CODE_PATH).'auth/profile.php';
if ($asAdmin) {
$editProfileUrl = api_get_path(WEB_CODE_PATH) . "admin/user_edit.php?user_id=" . intval($userId);
$editProfileUrl = api_get_path(
WEB_CODE_PATH
)."admin/user_edit.php?user_id=".intval($userId);
}
if (api_get_setting('sso_authentication') === 'true') {
@ -2028,18 +2030,55 @@ class Display
$objSSO = null;
if (!empty($subSSOClass)) {
require_once api_get_path(SYS_CODE_PATH) . "auth/sso/sso.$subSSOClass.class.php";
require_once api_get_path(
SYS_CODE_PATH
)."auth/sso/sso.$subSSOClass.class.php";
$subSSOClass = 'sso' . $subSSOClass;
$subSSOClass = 'sso'.$subSSOClass;
$objSSO = new $subSSOClass();
} else {
$objSSO = new sso();
}
$editProfileUrl = $objSSO->generateProfileEditingURL($userId, $asAdmin);
$editProfileUrl = $objSSO->generateProfileEditingURL(
$userId,
$asAdmin
);
}
return $editProfileUrl;
}
/**
* @param string $content
* @param string $title
* @param string $footer
* @param string $style
* @return string
*/
public static function panel($content, $title = '', $footer = '', $style = '')
{
$title = !empty($title) ? '<div class="panel-heading"><h3 class="panel-title">'.$title.'</h3></div>' : '';
$footer = !empty($footer) ? '<div class="panel-footer">'.$footer.'</div>' : '';
return '
<div class="panel panel-default">
'.$title.'
'.self::contentPanel($content).'
'.$footer.'
</div>'
;
}
/**
* @param string $content
* @return string
*/
public static function contentPanel($content)
{
return '<div class="panel-body">
'.$content.'
</div>';
}
}

@ -1494,7 +1494,14 @@ class MessageManager
}
// display sortable table with messages of the current user
$table = new SortableTable('message_outbox', array('MessageManager', 'get_number_of_messages_sent'), array('MessageManager', 'get_message_data_sent'), 3, 20, 'DESC');
$table = new SortableTable(
'message_outbox',
array('MessageManager', 'get_number_of_messages_sent'),
array('MessageManager', 'get_message_data_sent'),
3,
20,
'DESC'
);
$parameters['f'] = isset($_GET['f']) && $_GET['f'] == 'social' ? 'social' : null;
$table->set_additional_parameters($parameters);
@ -1506,6 +1513,7 @@ class MessageManager
$table->set_form_actions(array('delete' => get_lang('DeleteSelectedMessages')));
$html .= $table->return_table();
return $html;
}

@ -609,10 +609,10 @@ class SocialManager extends UserManager
<a href="'.api_get_path(WEB_CODE_PATH).'social/group_edit.php?id='.$group_id.'">'.
get_lang('EditGroup').'</a></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'].'?'.uniqid();
$normal_image = $img_array['dir'].$img_array['file'].'?'.uniqid();
@ -625,6 +625,7 @@ class SocialManager extends UserManager
}
$html .= '</div>';
return $html;
}
@ -1523,28 +1524,28 @@ class SocialManager extends UserManager
/**
* Generate the social block for a user
* @param int $userId The user id
* @param string $groupBlock Optional. Highlight link possible values: group_add, home, messages, messages_inbox,
* messages_compose ,messages_outbox ,invitations, shared_profile, friends, groups search
* @param string $groupBlock Optional. Highlight link possible values:
* group_add, home, messages, messages_inbox, messages_compose,
* messages_outbox, invitations, shared_profile, friends, groups, search
* @param int $groupId Optional. Group ID
* @return string The HTML code with the social block
*/
public static function getSocialUserBlock($userId, $groupBlock = '', $groupId = 0)
public static function setSocialUserBlock($template, $userId, $groupBlock = '', $groupId = 0)
{
$userInfo = api_get_user_info($userId, true);
$socialAvarBlock = SocialManager::show_social_avatar_block($groupBlock, $groupId, $userId);
if (api_get_setting('allow_social_tool') != 'true') {
return '';
}
$socialAvatarBlock = SocialManager::show_social_avatar_block($groupBlock, $groupId, $userId);
$profileEditionLink = null;
if (api_get_user_id() == $userId) {
$profileEditionLink = Display::getProfileEditionLink($userId);
}
$template = new Template();
$userInfo = api_get_user_info($userId, true);
$template->assign('user', $userInfo);
$template->assign('socialAvatarBlock', $socialAvarBlock);
$template->assign('socialAvatarBlock', $socialAvatarBlock);
$template->assign('profileEditionLink', $profileEditionLink);
return $template->fetch('default/social/user_block.tpl');
$template->assign('social_avatar_block', $template->fetch('default/social/user_block.tpl'));
}
}

@ -404,11 +404,11 @@ class Template
*/
private function set_user_parameters()
{
$user_info = array();
$user_info['logged'] = 0;
$user_info = array();
$user_info['logged'] = 0;
$this->user_is_logged_in = false;
if (api_user_is_login()) {
$user_info = api_get_user_info(api_get_user_id());
$user_info = api_get_user_info(api_get_user_id(), true);
$user_info['logged'] = 1;
$user_info['is_admin'] = 0;
@ -417,9 +417,9 @@ class Template
}
$user_info['messages_count'] = MessageManager::get_new_messages();
$this->user_is_logged_in = true;
$this->user_is_logged_in = true;
}
//Setting the $_u array that could be use in any template
// Setting the $_u array that could be use in any template
$this->assign('_u', $user_info);
}

@ -130,8 +130,6 @@ if (isset($_GET['f']) && $_GET['f'] == 'social' || api_get_setting('allow_social
$userInfo = UserManager::get_user_info_by_id($user_id);
//LEFT CONTENT
if (api_get_setting('allow_social_tool') == 'true') {
//Block Social Avatar
$social_avatar_block = SocialManager::getSocialUserBlock($user_id, 'messages');
//Block Social Menu
$social_menu_block = SocialManager::show_social_menu('messages');
}
@ -168,8 +166,9 @@ if (api_get_setting('allow_social_tool') == 'true') {
}
$tpl = new Template(null);
// Block Social Avatar
SocialManager::setSocialUserBlock($tpl, $user_id, 'messages');
if (api_get_setting('allow_social_tool') == 'true') {
$tpl->assign('social_avatar_block', $social_avatar_block);
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('social/inbox.tpl');

@ -313,8 +313,6 @@ if ($group_id != 0) {
$social_left_content = null;
$userInfo = UserManager::get_user_info_by_id($user_id);
if (api_get_setting('allow_social_tool') == 'true') {
//Block Social Avatar
$social_avatar_block = SocialManager::getSocialUserBlock($user_id, 'messages');
//Block Social Menu
$social_menu_block = SocialManager::show_social_menu('messages');
$social_right_content .= '<div class="row">';
@ -374,8 +372,10 @@ if (api_get_setting('allow_social_tool') == 'true') {
}
$tpl = new Template(get_lang('ComposeMessage'));
// Block Social Avatar
SocialManager::setSocialUserBlock($tpl, $user_id, 'messages');
if (api_get_setting('allow_social_tool') == 'true') {
$tpl->assign('social_avatar_block', $social_avatar_block);
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('social/inbox.tpl');

@ -85,12 +85,12 @@ if ($_GET['f']=='social') {
}
}
$info_delete_outbox=array();
$info_delete_outbox=explode(',',$_GET['form_delete_outbox']);
$count_delete_outbox=(count($info_delete_outbox)-1);
$info_delete_outbox =array();
$info_delete_outbox = isset($_GET['form_delete_outbox']) ? explode(',',$_GET['form_delete_outbox']) : '';
$count_delete_outbox = count($info_delete_outbox) - 1;
if( trim($info_delete_outbox[0])=='delete' ) {
for ($i=1;$i<=$count_delete_outbox;$i++) {
if (isset($info_delete_outbox[0]) && trim($info_delete_outbox[0])=='delete') {
for ($i = 1; $i <= $count_delete_outbox; $i++) {
MessageManager::delete_message_by_user_sender(api_get_user_id(),$info_delete_outbox[$i]);
}
$message_box=get_lang('SelectedMessagesDeleted').
@ -110,16 +110,12 @@ if (isset($_REQUEST['action'])) {
$social_right_content = '';
$userInfo = UserManager::get_user_info_by_id($user_id);
if (api_get_setting('allow_social_tool') == 'true') {
//Block Social Avatar
$social_avatar_block = SocialManager::getSocialUserBlock($user_id, 'messages');
//Block Social Menu
$social_menu_block = SocialManager::show_social_menu('messages');
$social_right_content .= '<div class="span9">';
$social_right_content .= '<div class="actions">';
$social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php?f=social">'.Display::return_icon('back.png', get_lang('Back'), array(), 32).'</a>';
$social_right_content .= '</div>';
$social_right_content .= '<div class="actions">';
$social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php?f=social">'.Display::return_icon('back.png', get_lang('Back'), array(), 32).'</a>';
$social_right_content .= '</div>';
$social_right_content .= '<div class="span9">';
}
//MAIN CONTENT
if ($action == 'delete') {
@ -146,16 +142,14 @@ if ($action == 'delete') {
$social_right_content .= MessageManager::outbox_display();
}
if (api_get_setting('allow_social_tool') == 'true') {
$social_right_content .= '</div>';
}
$tpl = new Template(get_lang('ComposeMessage'));
// Block Social Avatar
SocialManager::setSocialUserBlock($tpl, $user_id, 'messages');
if (api_get_setting('allow_social_tool') == 'true') {
$tpl->assign('social_avatar_block', $social_avatar_block);
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('social/home.tpl');
$social_layout = $tpl->get_template('social/inbox.tpl');
$tpl->display($social_layout);
} else {
$content = $social_right_content;

@ -55,8 +55,6 @@ $message = '';
//LEFT COLUMN
$userInfo = UserManager::get_user_info_by_id($user_id);
if (api_get_setting('allow_social_tool') == 'true') {
//Block Social Avatar
$social_avatar_block = SocialManager::getSocialUserBlock($user_id, $show_menu);
//Block Social Menu
$social_menu_block = SocialManager::show_social_menu($show_menu);
$message .='<div class="span9">';
@ -74,6 +72,9 @@ if (!empty($message)) {
api_not_allowed();
}
$tpl = new Template(get_lang('View'));
// Block Social Avatar
SocialManager::setSocialUserBlock($tpl, $user_id, $show_menu);
if (api_get_setting('allow_social_tool') == 'true') {
$tpl->assign('social_avatar_block', $social_avatar_block);
$tpl->assign('social_menu_block', $social_menu_block);

@ -82,7 +82,6 @@ $interbreadcrumb[] = array('url' => 'profile.php', 'name' => get_lang('SocialNet
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Friends'));
//Block Social Avatar
$user_info = UserManager::get_user_info_by_id($user_id);
$social_avatar_block = SocialManager::getSocialUserBlock($user_id, 'friends');
//Block Social Menu
$social_menu_block = SocialManager::show_social_menu('friends');
@ -138,9 +137,9 @@ if (count($friends) == 0) {
}
$social_right_content .= '</div>';
$tpl = new Template(get_lang('Social'));
$tpl->assign('social_avatar_block', $social_avatar_block);
SocialManager::setSocialUserBlock($tpl, $user_id, 'friends');
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_right_content', $social_right_content);

@ -217,11 +217,13 @@ if ($group_id != 0) {
}
}
}
$tpl = new Template();
$create_thread_link = '';
$userInfo = api_get_user_info(api_get_user_id(), true);
if ($group_id != 0) {
//Block Social Avatar
$social_avatar_block = SocialManager::getSocialUserBlock($user_id, 'groups', $group_id);
SocialManager::setSocialUserBlock($tpl, $user_id, 'groups', $group_id);
//Block Social Menu
$social_menu_block = SocialManager::show_social_menu('groups', $group_id);
} else {
@ -229,8 +231,8 @@ if ($group_id != 0) {
if (isset($_GET['view']) && $_GET['view'] == 'mygroups') {
$show_menu = $_GET['view'];
}
//Block Social Avatar
$social_avatar_block = SocialManager::getSocialUserBlock($user_id, $show_menu, $group_id);
// Block Social Avatar
SocialManager::setSocialUserBlock($tpl, $user_id, $show_menu, $group_id);
$social_menu_block = SocialManager::show_social_menu($show_menu, $group_id);
}
@ -877,9 +879,7 @@ if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'show_message' && $_REQ
$show_message = Display::return_message(get_lang('Deleted'), 'success');
}
$tpl = new Template();
$tpl->set_help('Groups');
$tpl->assign('social_avatar_block', $social_avatar_block);
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_right_content', $social_right_content);

@ -83,17 +83,18 @@ if (api_get_setting('profile', 'picture') == 'true') {
}
}
$social_avatar_block = SocialManager::getSocialUserBlock(api_get_user_id(), 'home');
//Block Menu
$social_menu_block = SocialManager::show_social_menu('home');
//Search box
$social_search_block = '<div class="panel panel-default social-search">';
// Search box
/*$social_search_block = '<div class="panel panel-default social-search">';
$social_search_block .= '<div class="panel-heading">'.get_lang("SearchUsers").'</div>';
$social_search_block .= '<div class="panel-body">';
$social_search_block.= UserManager::get_search_form('');
$social_search_block.= '</div>';
$social_search_block.= '</div>';
$social_search_block.= '</div>';*/
$social_search_block = Display::panel(UserManager::get_search_form(''), get_lang("SearchUsers"));
//BLock Social Skill
$social_skill_block = '';
@ -104,29 +105,32 @@ if (api_get_setting('allow_skills_tool') == 'true') {
$ranking = $skill->get_user_skill_ranking(api_get_user_id());
$skills = $skill->get_user_skills(api_get_user_id(), true);
$social_skill_block = '<div class="panel panel-default social-skill">';
$social_skill_block .= '<div class="panel-heading">' . get_lang('Skills');
$social_skill_block .= '<div class="btn-group pull-right"> <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
<span class="caret"></span></a>
<ul class="dropdown-menu">';
//$social_skill_block = '<div class="panel panel-default social-skill">';
//$social_skill_block .= '<div class="panel-heading">' . get_lang('Skills');
$content = '<div class="btn-group pull-right">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
<span class="caret"></span></a>
<ul class="dropdown-menu">';
if (api_is_student() || api_is_student_boss() || api_is_drh()) {
$social_skill_block .= '<li>' . Display::url(
$content .= '<li>' . Display::url(
get_lang('SkillsReport'),
api_get_path(WEB_CODE_PATH) . 'social/my_skills_report.php'
) . '</li>';
}
$social_skill_block .= '<li>' . Display::url(
$content .= '<li>' . Display::url(
get_lang('SkillsWheel'),
api_get_path(WEB_CODE_PATH) . 'social/skills_wheel.php'
) . '</li>';
$social_skill_block .= '<li>' . Display::url(
$content .= '<li>' . Display::url(
sprintf(get_lang('YourSkillRankingX'), $ranking),
api_get_path(WEB_CODE_PATH) . 'social/skills_ranking.php'
) . '</li>';
$social_skill_block .= '</ul></div></div>';
$content .= '</ul></div>';
$social_skill_block = Display::panel($content, get_lang('Skills'));
$lis = '';
if (!empty($skills)) {
@ -142,7 +146,7 @@ if (api_get_setting('allow_skills_tool') == 'true') {
$badgeImage = Display::return_icon(
'badges-default.png',
$skill['name'],
array('title' => $skill['name']),ICON_SIZE_BIG
array('title' => $skill['name']), ICON_SIZE_BIG
);
}
@ -152,25 +156,28 @@ if (api_get_setting('allow_skills_tool') == 'true') {
'<div class="badges-name">' . $skill['name'] . '</div>'
);
}
$social_skill_block .= '<div class="panel-body">';
/*$social_skill_block .= '<div class="panel-body">';
$social_skill_block .= Display::tag('ul', $lis, array('class' => 'list-badges'));
$social_skill_block .= '</div>';
}else{
$social_skill_block .= '</div>';*/
$social_skill_block .= Display::panel(Display::tag('ul', $lis, array('class' => 'list-badges')));
} else {
$social_skill_block .= Display::panel(
Display::url(get_lang('SkillsWheel'),api_get_path(WEB_CODE_PATH) . 'social/skills_wheel.php'),
get_lang('WithoutAchievedSkills')
);
$social_skill_block .= '<div class="panel-body">';
/*$social_skill_block .= '<div class="panel-body">';
$social_skill_block .= '<p>'. get_lang("WithoutAchievedSkills") . '</p>';
$social_skill_block .= '<p>' . Display::url(get_lang('SkillsWheel'),api_get_path(WEB_CODE_PATH) . 'social/skills_wheel.php').'</p>';
$social_skill_block .= '</div>';
$social_skill_block .= '</div>';*/
}
$social_skill_block.='</div>';
}
//Group box by age
$social_group_block = '<div class="panel panel-default social-group">';
/*$social_group_block = '<div class="panel panel-default social-group">';
$social_group_block .= '<div class="panel-heading">'.get_lang('Group').'</div>';
$social_group_block .= '<div class="panel-body">';
$social_group_block .= '<div class="panel-body">';*/
$results = GroupPortalManager::get_groups_by_age(1, false);
@ -249,7 +256,7 @@ foreach ($results as $result) {
}
$list=count($groups_newest);
$social_group_block = null;
if ($list > 0) {
$social_group_block .= '<div class="list-group-newest">';
$social_group_block .= '<div class="group-title">' . get_lang('Newest') . '</div>';
@ -274,6 +281,7 @@ if ($list > 0) {
$social_group_block.= $groups_pop[$i][2] . '</div>';
$social_group_block.="</div>";
}
$social_group_block.= "</div>";
/*$social_group_block .= Display::return_sortable_grid(
'home_group',
@ -285,10 +293,12 @@ if ($list > 0) {
array(true, true, true, true, true)
);*/
}
$social_group_block .= '</div>';
$social_group_block = Display::panel($social_group_block, get_lang('Group'));
$tpl = new Template(get_lang('SocialNetwork'));
$tpl->assign('social_avatar_block', $social_avatar_block);
SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'home');
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_search_block', $social_search_block);
$tpl->assign('social_skill_block', $social_skill_block);

@ -91,7 +91,6 @@ if (is_array($_GET) && count($_GET)>0) {
}
//Block Avatar Social
$userInfo = UserManager::get_user_info_by_id($user_id);
$social_avatar_block = SocialManager::getSocialUserBlock($user_id, 'invitations');
//Block Menu Social
$social_menu_block = SocialManager::show_social_menu('invitations');
//Block Invitations
@ -207,7 +206,7 @@ if (count($pending_invitations) > 0) {
}
$tpl = new Template(null);
$tpl->assign('social_avatar_block', $social_avatar_block);
SocialManager::setSocialUserBlock($tpl, $user_id, 'invitations');
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_invitations_block',$socialInvitationsBlock);
$tpl->assign('message', $show_message);

@ -131,7 +131,7 @@ if (is_array($_GET) && count($_GET) > 0) {
}
//Social Avatar BLock
$user_info = UserManager::get_user_info_by_id($user_id);
$social_avatar_block = SocialManager::getSocialUserBlock($user_id, 'myfiles');
//Social Menu Block
$social_menu_block = SocialManager::show_social_menu('myfiles');
$actions = null;
@ -155,17 +155,12 @@ if (isset($_GET['cidReq'])) {
) . '</a>';
}
$tpl = new Template();
SocialManager::setSocialUserBlock($tpl, $user_id, 'myfiles');
$editor = new \Chamilo\CoreBundle\Component\Editor\Editor();
$editor = $tpl->fetch('default/'.$editor->getEditorStandAloneTemplate());
$social_right_content = '<div class="span9">';
$social_right_content .= $editor;
$social_right_content .= '</div>';
$tpl->assign('social_avatar_block', $social_avatar_block);
$tpl->assign('social_right_content', $editor);
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_right_content', $social_right_content);
$tpl->assign('actions', $actions);
$tpl->assign('message', $show_message);

@ -222,8 +222,7 @@ if (is_array($personal_course_list)) {
//to avoid repeted courses
$course_list_code = array_unique_dimensional($course_list_code);
}
//Block Avatar Social
$social_avatar_block = SocialManager::getSocialUserBlock($user_id, 'shared_profile');
//Social Block Menu
$social_menu_block = SocialManager::show_social_menu('shared_profile', null, $user_id, $show_full_profile);
@ -727,10 +726,10 @@ if ($show_full_profile) {
}
}
$tpl = new Template(get_lang('Social'));
$tpl->assign('social_avatar_block', $social_avatar_block);
// Block Avatar Social
SocialManager::setSocialUserBlock($tpl, $user_id, 'shared_profile');
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_wall_block', $social_wall_block);
$tpl->assign('social_post_wall_block', $social_post_wall_block);

@ -35,8 +35,7 @@ if (!empty($extra_fields)) {
}
}
$user_info = UserManager::get_user_info_by_id($user_id);
//Block Social Avatar
$social_avatar_block = SocialManager::getSocialUserBlock($user_id, 'search');
//Block Social Menu
$social_menu_block = SocialManager::show_social_menu('search');
$social_right_content = '';
@ -214,7 +213,8 @@ if ($query != '' || ($query_vars['search_type']=='1' && count($query_vars)>2) )
}
$tpl = new Template($tool_name);
$tpl->assign('social_avatar_block', $social_avatar_block);
// Block Social Avatar
SocialManager::setSocialUserBlock($tpl, $user_id, 'search');
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_right_content', $social_right_content);
$tpl->assign('search_form', $searchForm);

@ -12,7 +12,7 @@
<div class="row">
<div class="col-md-12">
<div id="message_ajax_reponse" class=""></div>
</div>-
</div>
</div>
<div class="row">
{{ social_right_content}}
@ -21,4 +21,4 @@
{{ socialAutoExtendLink }}
</div>
</div>
{% endblock %}
{% endblock %}

@ -3,7 +3,7 @@
<p class="lead">{{ user.complete_name }}</p>
<p>
<img src="{{ "instant_message.png" | icon }}" atl="{{ "Email" | get_lang }}">
{{ user.email}}
{{ user.email}}
</p>
{% if user.user_is_online_in_chat != 0 %}
<p>

Loading…
Cancel
Save