Fixing group layout and fixing help and notice blocks

skala
Julio Montoya 12 years ago
parent 3e433a4d32
commit 4facd18cc0
  1. 3
      index.php
  2. 4
      main/admin/configure_homepage.php
  3. 95
      main/auth/profile.php
  4. 6
      main/inc/lib/main_api.lib.php
  5. 31
      main/inc/lib/message.lib.php
  6. 3
      main/inc/lib/page.lib.php
  7. 4
      main/messages/new_message.php
  8. 24
      main/social/group_add.php
  9. 12
      main/social/group_edit.php
  10. 8
      main/social/group_waiting_list.php
  11. 4
      main/social/groups.php
  12. 2
      main/social/myfiles.php
  13. 214
      main/social/profile.php
  14. 9
      main/template/default/index/help_block.tpl
  15. 5
      main/template/default/index/profile_block.tpl
  16. 1
      main/template/default/index/profile_social_block.tpl
  17. 2
      main/template/default/layout/social_layout.tpl

@ -44,8 +44,7 @@ use Symfony\Component\HttpFoundation\Response;
class IndexController
{
public function indexAction(Application $app)
{
public function indexAction(Application $app) {
$request = $app['request'];
//Actions

@ -144,7 +144,7 @@ if (!empty($_GET['link'])) {
// Start analysing requested actions
if (!empty($action)) {
if ($_POST['formSent']) {
if (isset($_POST['formSent']) && $_POST['formSent']) {
// Variables used are $homep for home path, $menuf for menu file, $newsf
// for news file, $topf for top file, $noticef for noticefile,
// $ext for '.html'
@ -815,7 +815,7 @@ switch ($action) {
</tr>
<tr>
<?php
$access_url_id = 1;
// we only show the category options for the main chamilo installation
if (api_is_multiple_url_enabled()) {

@ -58,16 +58,16 @@ function generate_open_id_form() {
$("#div_api_key").html(datos);
}
});
}
}
function hide_icon_edit(element_html) {
ident="#edit_image";
$(ident).hide();
}
function show_icon_edit(element_html) {
}
function show_icon_edit(element_html) {
ident="#edit_image";
$(ident).show();
}
}
</script>';
//$interbreadcrumb[] = array('url' => '../auth/profile.php', 'name' => get_lang('ModifyProfile'));
@ -171,11 +171,11 @@ if (api_get_setting('profile', 'email') !== 'true') {
$form->freeze('email');
}
if (api_get_setting('registration', 'email') == 'true' && api_get_setting('profile', 'email') == 'true') {
if (api_get_setting('registration', 'email') == 'true' && api_get_setting('profile', 'email') == 'true') {
$form->applyFilter('email', 'stripslashes');
$form->applyFilter('email', 'trim');
$form->addRule('email', get_lang('ThisFieldIsRequired'), 'required');
$form->addRule('email', get_lang('EmailWrong'), 'email');
$form->addRule('email', get_lang('EmailWrong'), 'email');
}
// OPENID URL
@ -254,7 +254,7 @@ if (api_get_setting('extended_profile') == 'true') {
// PASSWORD, if auth_source is platform
if (is_platform_authentication() && is_profile_editable() && api_get_setting('profile', 'password') == 'true') {
$form->addElement('password', 'password0', array(get_lang('Pass'), get_lang('Enter2passToChange')), array('size' => 40));
$form->addElement('password', 'password0', array(get_lang('Pass'), get_lang('Enter2passToChange')), array('size' => 40));
$form->addElement('password', 'password1', get_lang('NewPass'), array('size' => 40));
$form->addElement('password', 'password2', get_lang('Confirmation'), array('size' => 40));
// user must enter identical password twice so we can prevent some user errors
@ -297,7 +297,7 @@ $form->setDefaults($user_data);
/**
* Is user auth_source is platform ?
*
*
* @return boolean if auth_source is platform
*/
function is_platform_authentication() {
@ -407,7 +407,7 @@ if ($form->validate()) {
$wrong_current_password = false;
// $user_data = $form->exportValues();
$user_data = $form->getSubmitValues();
// set password if a new one was provided
if (!empty($user_data['password0'])) {
if (check_user_password($user_data['password0'])) {
@ -428,15 +428,15 @@ if ($form->validate()) {
if (is_platform_authentication() && api_get_setting('allow_users_to_change_email_with_no_password') == 'false') {
$allow_users_to_change_email_with_no_password = false;
}
//If user sending the email to be changed (input available and not frozen )
if (api_get_setting('profile', 'email') == 'true') {
if (api_get_setting('profile', 'email') == 'true') {
if ($allow_users_to_change_email_with_no_password) {
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) {
@ -445,34 +445,34 @@ if ($form->validate()) {
if (!check_user_email($user_data['email']) && empty($user_data['password0'])){
$_SESSION['change_email'] = 'success';
}
}
}
}
// Upload picture if a new one is provided
if ($_FILES['picture']['size']) {
if ($_FILES['picture']['size']) {
if ($new_picture = UserManager::update_user_picture(api_get_user_id(), $_FILES['picture']['name'], $_FILES['picture']['tmp_name'])) {
$user_data['picture_uri'] = $new_picture;
$_SESSION['image_uploaded'] = 'success';
$_SESSION['image_uploaded'] = 'success';
}
} elseif (!empty($user_data['remove_picture'])) {
// remove existing picture if asked
UserManager::delete_user_picture(api_get_user_id());
$user_data['picture_uri'] = '';
}
//Remove production
//Remove production
if (is_array($user_data['remove_production'])) {
foreach (array_keys($user_data['remove_production']) as $production) {
UserManager::remove_user_production(api_get_user_id(), urldecode($production));
}
if ($production_list = UserManager::build_production_list(api_get_user_id(), true, true)) {
if ($production_list = UserManager::build_production_list(api_get_user_id(), true, true)) {
$form->insertElementBefore($form->createElement('static', null, null, $production_list), 'productions_list');
}
$form->removeElement('productions_list');
$file_deleted = true;
}
}
// upload production if a new one is provided
if ($_FILES['production']['size']) {
@ -497,19 +497,19 @@ if ($form->validate()) {
$user_data['openid'] = 'http://'.$my_user_openid;
}
$extras = array();
//Checking the user language
$languages = api_get_languages();
$languages = api_get_languages();
if (!in_array($user_data['language'], $languages['folder'])) {
$user_data['language'] = api_get_setting('platformLanguage');
}
//Only update values that are request by the "profile" setting
$profile_list = api_get_setting('profile');
//Adding missing variables
//Adding missing variables
$available_values_to_modify = array();
foreach($profile_list as $key => $status) {
foreach($profile_list as $key => $status) {
if ($status == 'true') {
switch($key) {
case 'login':
@ -517,7 +517,7 @@ if ($form->validate()) {
break;
case 'name':
$available_values_to_modify[] = 'firstname';
$available_values_to_modify[] = 'lastname';
$available_values_to_modify[] = 'lastname';
break;
case 'picture':
$available_values_to_modify[] = 'picture_uri';
@ -525,13 +525,13 @@ if ($form->validate()) {
default:
$available_values_to_modify[] = $key;
break;
}
}
}
}
//Fixing missing variables
//Fixing missing variables
$available_values_to_modify = array_merge($available_values_to_modify, array('competences', 'diplomas', 'openarea', 'teach', 'openid'));
// build SQL query
$sql = "UPDATE $table_user SET";
unset($user_data['api_key_generate']);
@ -553,24 +553,24 @@ if ($form->validate()) {
$extras[$new_key] = $value;
}
} else {
if (in_array($key, $available_values_to_modify)) {
if (in_array($key, $available_values_to_modify)) {
$sql .= " $key = '".Database::escape_string($value)."',";
}
}
}
}
//change email
if ($allow_users_to_change_email_with_no_password) {
if ($allow_users_to_change_email_with_no_password) {
if (isset($changeemail) && in_array('email', $available_values_to_modify)) {
$sql .= " email = '".Database::escape_string($changeemail)."',";
}
if (isset($password) && in_array('password', $available_values_to_modify)) {
$password = api_get_encrypted_password($password);
$sql .= " password = '".Database::escape_string($password)."'";
} else {
} else {
// remove trailing , from the query we have so far
$sql = rtrim($sql, ',');
}
}
} else {
//normal behaviour
if(empty($changeemail) && isset($password)) {
@ -578,7 +578,7 @@ if ($form->validate()) {
}
if (isset($changeemail) && !isset($password) && in_array('email', $available_values_to_modify)) {
$sql .= " email = '".Database::escape_string($changeemail)."'";
} elseif (isset($password) && isset($changeemail) && in_array('email', $available_values_to_modify) && in_array('password', $available_values_to_modify)) {
} elseif (isset($password) && isset($changeemail) && in_array('email', $available_values_to_modify) && in_array('password', $available_values_to_modify)) {
$sql .= " email = '".Database::escape_string($changeemail)."',";
$password = api_get_encrypted_password($password);
$sql .= " password = '".Database::escape_string($password)."'";
@ -588,19 +588,19 @@ if ($form->validate()) {
} else {
// remove trailing , from the query we have so far
$sql = rtrim($sql, ',');
}
}
}
if (api_get_setting('profile', 'officialcode') == 'true' && isset($user_data['official_code'])) {
$sql .= ", official_code = '".Database::escape_string($user_data['official_code'])."'";
}
$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(ExtraField::FIELD_TYPE_TAG);
if (is_array($list_extra_field_type_tag) && count($list_extra_field_type_tag)>0) {
foreach ($list_extra_field_type_tag as $id) {
UserManager::delete_user_tags(api_get_user_id(), $id);
@ -608,19 +608,19 @@ 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
UserManager::update_extra_field_value(api_get_user_id(), $key, $value);
}
}
// re-init the system to take new settings into account
$_SESSION['_user']['uidReset'] = true;
$_SESSION['noredirection'] = true;
$_SESSION['profile_update'] = 'success';
$url = api_get_self()."?{$_SERVER['QUERY_STRING']}".($filtered_extension && strpos($_SERVER['QUERY_STRING'], '&fe=1') === false ? '&fe=1' : '');
$url = api_get_self()."?{$_SERVER['QUERY_STRING']}".($filtered_extension && strpos($_SERVER['QUERY_STRING'], '&fe=1') === false ? '&fe=1' : '');
header("Location: ".$url);
exit;
}
@ -692,10 +692,11 @@ $image_file = $image_dir.$image;
$img_attributes = 'src="'.$image_file.'?rand='.time().'" '
.'alt="'.api_get_person_name($user_data['firstname'], $user_data['lastname']).'" '
.'style="float:'.($text_dir == 'rtl' ? 'left' : 'right').'; margin-top:0px;padding:5px;" ';
/*
if ($image_size['width'] > 300) {
//limit display width to 300px
$img_attributes .= 'width="300" ';
}
}*/
// get the path,width and height from original picture
$big_image = $image_dir.'big_'.$image;
@ -707,13 +708,13 @@ $url_big_image = $big_image.'?rnd='.time();
$show_delete_account_button = api_get_setting('platform_unsubscribe_allowed') == 'true' ? true : false;
if (api_get_setting('allow_social_tool') == 'true') {
if (api_get_setting('allow_social_tool') == 'true') {
echo '<div class="row-fluid">';
echo '<div class="span3">';
echo SocialManager::show_social_menu('home', null, api_get_user_id(), false, $show_delete_account_button);
echo '</div>';
echo '<div class="span9">';
$form->display();
$form->display();
echo '</div>';
} else {
// Style position:absolute has been removed for Opera-compatibility.

@ -6075,8 +6075,10 @@ function api_get_home_path() {
$clean_url = str_replace('/', '-', $clean_url);
$clean_url .= '/';
// if $clean_url == "localhost/" means that the multiple URL was not well configured we don't rename the $home variable
if ($clean_url != 'localhost/')
$home = 'home/'.$clean_url;
if ($clean_url != 'localhost/') {
//$home = 'home/'.$clean_url;
}
$home = 'home/'.$clean_url;
}
return $home;
}

@ -713,7 +713,6 @@ class MessageManager
$message_content .= $user_image.' ';
}
$message_content .='<tr>';
if (api_get_setting('allow_social_tool') == 'true') {
if ($source == 'outbox') {
$message_content .= get_lang('From').': <a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$user_sender_id.'">'.$name.'</a> '.api_strtolower(get_lang('To')).'&nbsp;<b>'.GetFullUserName($row[2]).'</b>';
@ -727,20 +726,23 @@ class MessageManager
$message_content .= get_lang('From').':&nbsp;'.$name.'</b> '.api_strtolower(get_lang('To')).' <b>'.get_lang('Me').'</b>';
}
}
$message_content .=' '.get_lang('Date').': '.api_get_local_time($row['send_date']).'
<br />
<hr style="color:#ddd" />
<table height="209px" width="100%">
<tr>
<td valign=top class="view-message-content">'.str_replace("\\","",$content).'</td>
</tr>
</table>
<div id="message-attach">'.(!empty($files_attachments)?implode('<br />',$files_attachments):'').'</div>
<div style="padding: 15px 0px 5px 0px">';
$message_content .=' '.get_lang('Date').': '.api_get_local_time($row['send_date']);
$message_content .= '<br />';
$message_content .= '<br />';
$message_content .= str_replace("\\","",$content);
$message_content .= '<br />';
$message_content .= '<div id="message-attach">'.(!empty($files_attachments)?implode('<br />',$files_attachments):'').'</div>
';
$social_link = '';
if ($_GET['f'] == 'social') {
$social_link = 'f=social';
}
if ($source == 'outbox') {
$message_content .= '<a href="outbox.php?'.$social_link.'">'.Display::return_icon('back.png',get_lang('ReturnToOutbox')).'</a> &nbsp';
} else {
@ -749,10 +751,7 @@ class MessageManager
}
$message_content .= '<a href="inbox.php?action=deleteone&id='.$message_id.'&'.$social_link.'" >'.Display::return_icon('delete.png',get_lang('DeleteMessage')).'</a>&nbsp';
$message_content .='</div></td>
<td width=10></td>
</tr>
</table>';
return $message_content;
}
@ -761,7 +760,7 @@ class MessageManager
* display message box sent showing it into outbox
* @return void
*/
public static function show_message_box_sent () {
public static function show_message_box_sent() {
global $charset;
$table_message = Database::get_main_table(TABLE_MESSAGE);

@ -187,10 +187,11 @@ class PageController
if (empty($home_notice)) {
$home_notice = @(string) file_get_contents($sys_path.$home.'home_notice.html');
}
//var_dump($sys_path.$home.'home_notice_'.$user_selected_language.'.html');exit;
if (!empty($home_notice)) {
$home_notice = api_to_system_encoding($home_notice, api_detect_encoding(strip_tags($home_notice)));
$home_notice = Display::div($home_notice, array('class' => 'homepage_notice'));
self::show_right_block(get_lang('Notice'), null, 'notice_block', array('content' => $home_notice));
}
}

@ -27,14 +27,13 @@ if (api_get_setting('allow_message_tool') !='true') {
$htmlHeadXtra[]='
<script>
function validate(form,list) {
if(list.selectedIndex<0) {
if (list.selectedIndex<0) {
alert("Please select someone to send the message to.")
return false
} else {
return true
}
}
</script>';
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/tag/jquery.fcbkcomplete.js" type="text/javascript" language="javascript"></script>';
@ -134,6 +133,7 @@ function show_compose_reply_to_message($message_id, $receiver_id) {
$query = "SELECT user_sender_id FROM $table_message WHERE user_receiver_id=".intval($receiver_id)." AND id='".intval($message_id)."';";
$result = Database::query($query);
$row = Database::fetch_array($result,'ASSOC');
$html = null;
if (!isset($row['user_sender_id'])) {
$html = get_lang('InvalidMessageId');
return $html;

@ -22,19 +22,16 @@ if (api_get_setting('allow_students_to_create_groups_in_social') == 'false' && !
api_not_allowed();
}
global $charset;
//jquery already called from main/inc/header.inc.php
$htmlHeadXtra[] = '<script type="text/javascript">
$htmlHeadXtra[] = '<script>
textarea = "";
num_characters_permited = 255;
function text_longitud(){
num_characters = document.forms[0].description.value.length;
if (num_characters > num_characters_permited){
document.forms[0].description.value = textarea;
}else{
textarea = document.forms[0].description.value;
}
num_characters = document.forms[0].description.value.length;
if (num_characters > num_characters_permited){
document.forms[0].description.value = textarea;
} else {
textarea = document.forms[0].description.value;
}
}
</script>';
@ -105,13 +102,14 @@ $interbreadcrumb[]= array ('url' =>'#','name' => $nameTools);
$social_left_content = SocialManager::show_social_menu('group_add');
$social_right_content = $form->return_form();
$social_right_content = '<div class="span9">';
$social_right_content .= $form->return_form();
$social_right_content .= '</div>';
$tpl = new Template();
$tpl->set_help('Groups');
$tpl->assign('social_left_content', $social_left_content);
$tpl->assign('social_right_content', $social_right_content);
//$tpl->assign('actions', $actions);
//$tpl->assign('message', $show_message);
$social_layout = $tpl->get_template('layout/social_layout.tpl');
$tpl->display($social_layout);

@ -25,7 +25,7 @@ require_once $libpath.'fileUpload.lib.php';
require_once $libpath.'group_portal_manager.lib.php';
require_once $libpath.'mail.lib.inc.php';
$htmlHeadXtra[] = '<script type="text/javascript">
$htmlHeadXtra[] = '<script>
var textarea = "";
var num_characters_permited = 255;
function textarea_maxlength(){
@ -142,17 +142,15 @@ $big_image_height = $big_image_size['height'];
$url_big_image = $big_image.'?rnd='.time();
$social_left_content = SocialManager::show_social_menu('group_edit',$group_id);
$social_right_content = $form->return_form();
$social_right_content = '<div class="span9">';
$social_right_content .= $form->return_form();
$social_right_content .= '</div>';
$tpl = new Template($tool_name);
$tpl->set_help('Groups');
$tpl->assign('social_left_content', $social_left_content);
$tpl->assign('social_left_menu', $social_left_menu);
$tpl->assign('social_right_content', $social_right_content);
$tpl->assign('actions', $actions);
$tpl->assign('message', $show_message);
$tpl->assign('content', $content);
$social_layout = $tpl->get_template('layout/social_layout.tpl');
$tpl->display($social_layout);

@ -23,7 +23,6 @@ $interbreadcrumb[]= array ('url' =>'home.php','name' => get_lang('Social'));
$interbreadcrumb[]= array ('url' =>'groups.php','name' => get_lang('Groups'));
$interbreadcrumb[]= array ('url' =>'#','name' => get_lang('WaitingList'));
$group_id = intval($_GET['id']);
//todo @this validation could be in a function in group_portal_manager
@ -96,20 +95,19 @@ foreach($users as $user) {
$new_member_list[] = $user;
}
$social_right_content = '<div class="span9">';
if (count($new_member_list) > 0) {
$social_right_content .= Display::return_sortable_grid('search_users', array(), $new_member_list, array('hide_navigation'=>true, 'per_page' => 100), $query_vars, false, array(true, false, true,true,false,true,true));
} else {
$social_right_content .= Display :: return_message(get_lang('ThereAreNotUsersInTheWaitingList'));
}
$social_right_content .= '</div>';
$tpl = new Template($tool_name);
$tpl = new Template();
$tpl->set_help('Groups');
$tpl->assign('social_left_content', $social_left_content);
$tpl->assign('social_left_menu', $social_left_menu);
$tpl->assign('social_right_content', $social_right_content);
$tpl->assign('actions', $actions);
$tpl->assign('message', $show_message);
$tpl->assign('content', $content);
$social_layout = $tpl->get_template('layout/social_layout.tpl');
$tpl->display($social_layout);

@ -31,7 +31,9 @@ if (isset($_GET['anchor_topic'])) {
break;
}
}
$anchor = 'topic_'.$match[1];
if (isset($match[1])) {
$anchor = 'topic_'.$match[1];
}
}
$htmlHeadXtra[] = '<script>

@ -113,4 +113,4 @@ $tpl->assign('actions', $actions);
$tpl->assign('message', $show_message);
$social_layout = $tpl->get_template('layout/social_layout.tpl');
$tpl->display($social_layout);
$tpl->display($social_layout);

@ -14,7 +14,7 @@ require_once '../inc/global.inc.php';
if (api_get_setting('allow_social_tool') !='true') {
$url = api_get_path(WEB_PATH).'whoisonline.php?id='.intval($_GET['u']);
header('Location: '.$url);
exit;
exit;
}
$user_id = api_get_user_id();
@ -66,7 +66,7 @@ $ajax_url = api_get_path(WEB_AJAX_PATH).'message.ajax.php';
api_block_anonymous_users();
$htmlHeadXtra[] = '<script>
function checkLength( o, n, min, max ) {
if ( o.val().length > max || o.val().length < min ) {
o.addClass( "ui-state-error" );
@ -77,79 +77,79 @@ function checkLength( o, n, min, max ) {
}
}
function send_message_to_user(user_id) {
function send_message_to_user(user_id) {
var subject = $( "#subject_id" );
var content = $( "#content_id" );
$("#send_message_form").show();
$("#send_message_form").show();
$("#send_message_div").dialog({
modal:true,
height:350,
buttons: {
"'. addslashes(get_lang('Sent')).'": function() {
"'. addslashes(get_lang('Sent')).'": function() {
var bValid = true;
bValid = bValid && checkLength( subject, "subject", 1, 255 );
bValid = bValid && checkLength( content, "content", 1, 255 );
if ( bValid ) {
var url = "'.$ajax_url.'?a=send_message&user_id="+user_id;
var params = $("#send_message_form").serialize();
var params = $("#send_message_form").serialize();
$.ajax({
url: url+"&"+params,
success:function(data) {
success:function(data) {
$("#message_ajax_reponse").html(data);
$("#message_ajax_reponse").show();
$("#send_message_div").dialog({ buttons:{}});
$("#send_message_form").hide();
$("#send_message_div").dialog("close");
$("#send_message_div").dialog({ buttons:{}});
$("#send_message_form").hide();
$("#send_message_div").dialog("close");
$("#subject_id").val("");
$("#content_id").val("");
}
}
});
}
},
},
close: function() {
}
},
close: function() {
}
});
$("#send_message_div").dialog("open");
//prevent the browser to follow the link
//prevent the browser to follow the link
}
function send_invitation_to_user(user_id) {
function send_invitation_to_user(user_id) {
var content = $( "#content_invitation_id" );
$("#send_invitation_form").show();
$("#send_invitation_form").show();
$("#send_invitation_div").dialog({
modal:true,
buttons: {
"'. addslashes(get_lang('SendInvitation')).'": function() {
var bValid = true;
var bValid = true;
bValid = bValid && checkLength( content, "content", 1, 255 );
if (bValid) {
var url = "'.$ajax_url.'?a=send_invitation&user_id="+user_id;
var params = $("#send_invitation_form").serialize();
var params = $("#send_invitation_form").serialize();
$.ajax({
url: url+"&"+params,
success:function(data) {
success:function(data) {
$("#message_ajax_reponse").html(data);
$("#message_ajax_reponse").show();
$("#send_invitation_div").dialog({ buttons:{}});
$("#send_invitation_form").hide();
$("#send_invitation_div").dialog("close");
$("#send_invitation_form").hide();
$("#send_invitation_div").dialog("close");
$("#content_invitation_id").val("");
}
}
});
}
},
},
close: function() {
}
});
$("#send_invitation_div").dialog("open");
//prevent the browser to follow the link
},
close: function() {
}
});
$("#send_invitation_div").dialog("open");
//prevent the browser to follow the link
}
function toogle_course (element_html, course_code){
@ -190,21 +190,21 @@ $(document).ready(function (){
$("#form_register_friend").submit();
}
});
$("#send_message_div").dialog({
autoOpen: false,
modal : false,
width : 550,
height : 300
modal : false,
width : 550,
height : 300
});
$("#send_invitation_div").dialog({
autoOpen: false,
modal : false,
width : 550,
height : 300
modal : false,
width : 550,
height : 300
});
});
function display_hide () {
@ -225,11 +225,11 @@ function register_friend(element_input) {
name_button=$(element_input).attr("id");
name_div_id="id_"+name_button.substring(13);
user_id=name_div_id.split("_");
user_friend_id=user_id[1];
user_friend_id=user_id[1];
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {
$("div#dpending_"+user_friend_id).html("<img src=\'../inc/lib/javascript/indicator.gif\' />");
$("div#dpending_"+user_friend_id).html("<img src=\'../inc/lib/javascript/indicator.gif\' />");
},
type: "POST",
url: "'.api_get_path(WEB_AJAX_PATH).'social.ajax.php?a=add_friend",
@ -278,7 +278,7 @@ $i=1;
if (is_array($personal_course_list)) {
foreach ($personal_course_list as $my_course) {
if ($i<=10) {
$list[$my_course['code']] = SocialManager::get_logged_user_course_html($my_course, $i);
$list[$my_course['code']] = SocialManager::get_logged_user_course_html($my_course, $i);
$course_list_code[] = array('code'=> $my_course['code']);
} else {
break;
@ -299,7 +299,7 @@ if (!empty($user_info['firstname']) || !empty($user_info['lastname'])) {
$personal_info .= '<div><h3>'.get_lang('Profile').'</h3></div>';
}
if ($show_full_profile) {
if ($show_full_profile) {
$personal_info .= '<dl class="dl-horizontal">';
$personal_info .= '<dt>'.get_lang('UserName').'</dt><dd>'. $user_info['username'].' </dd>';
if (!empty($user_info['firstname']) || !empty($user_info['lastname']))
@ -311,12 +311,12 @@ if ($show_full_profile) {
$personal_info .= '<dt>'.get_lang('Email').'</dt><dd>'.$user_info['email'].'</dd>';
if (!empty($user_info['phone']))
$personal_info .= '<dt>'.get_lang('Phone').'</dt><dd>'. $user_info['phone'].'</dd>';
$personal_info .= '</dl>';
} else {
$personal_info .= '</dl>';
} else {
$personal_info .= '<dl class="dl-horizontal">';
if (!empty($user_info['username']))
$personal_info .= '<dt>'.get_lang('UserName').'</dt><dd>'. $user_info['username'].'</dd>';
$personal_info .= '</dl>';
$personal_info .= '</dl>';
}
$social_right_content = SocialManager::social_wrapper_div($personal_info, 4);
@ -328,7 +328,7 @@ if ($show_full_profile) {
$friend_html = '';
$number_of_images = 6;
$number_friends = 0;
$number_friends = 0;
$number_friends = count($friends);
if ($number_friends != 0) {
@ -350,34 +350,34 @@ if ($show_full_profile) {
}
}
$friend_html.= '</div>'; // close div friend-header
$friend_html.='<ul class="thumbnails">';
$j=1;
for ($k=0;$k<$number_friends;$k++) {
if ($j > $number_of_images) break;
if (isset($friends[$k])) {
$friend = $friends[$k];
$name_user = api_get_person_name($friend['firstName'], $friend['lastName']);
$user_info_friend = api_get_user_info($friend['friend_user_id'], true);
$user_info_friend = api_get_user_info($friend['friend_user_id'], true);
if ($user_info_friend['user_is_online']) {
$status_icon = Display::span('', array('class' => 'online_user_in_text'));
} else {
$status_icon = Display::span('', array('class' => 'offline_user_in_text'));
}
$friend_html.= '<li class="span2">';
$friend_html.= '<div class="thumbnail">';
// the height = 92 must be the sqme in the image_friend_network span style in default.css
$friends_profile = SocialManager::get_picture_user($friend['friend_user_id'], $friend['image'], 92, USER_IMAGE_SIZE_ORIGINAL);
$friend_html.= '<img src="'.$friends_profile['file'].'" id="imgfriend_'.$friend['friend_user_id'].'" title="'.$name_user.'" />';
$friend_html.= '<img src="'.$friends_profile['file'].'" id="imgfriend_'.$friend['friend_user_id'].'" title="'.$name_user.'" />';
$friend_html.= '<div class="caption">';
$friend_html.= $status_icon.'<a href="profile.php?u='.$friend['friend_user_id'].'&amp;'.$link_shared.'">';
$friend_html.= $status_icon.'<a href="profile.php?u='.$friend['friend_user_id'].'&amp;'.$link_shared.'">';
$friend_html.= $name_user;
$friend_html.= '</a></div>';
$friend_html.= '</div>';
@ -394,8 +394,8 @@ if ($show_full_profile) {
$friend_html.= '<div>'.get_lang('NoFriendsInYourContactList').'<br /><a class="btn" href="'.api_get_path(WEB_PATH).'whoisonline.php">'.get_lang('TryAndFindSomeFriends').'</a></div>';
$friend_html.= '</div>'; // close div friend-header
}
$friend_html.= '</div>';
$social_right_content .= SocialManager::social_wrapper_div($friend_html, 5);
$friend_html.= '</div>';
$social_right_content .= SocialManager::social_wrapper_div($friend_html, 5);
// Extra information
$t_uf = Database :: get_main_table(TABLE_MAIN_USER_FIELD);
@ -403,7 +403,7 @@ if ($show_full_profile) {
$extra_user_data = UserManager::get_extra_user_data($user_id);
$extra_information = '';
if (is_array($extra_user_data) && count($extra_user_data)>0 ) {
$extra_information .= '<div><h3>'.get_lang('ExtraInformation').'</h3></div>';
$extra_information .='<div class="social-profile-info">';
$extra_information_value = '';
@ -423,7 +423,7 @@ if ($show_full_profile) {
if (is_array($data)) {
$extra_information_value .= '<dt>'.ucfirst($field_display_text).'</dt><dd> '.implode(',',$data).'</dd>';
} else {
if ($field_type == USER_FIELD_TYPE_DOUBLE_SELECT) {
if ($field_type == Extrafield::FIELD_TYPE_DOUBLE_SELECT) {
$id_options = explode(';',$data);
$value_options = array();
// get option display text from user_field_options table
@ -434,22 +434,22 @@ if ($show_full_profile) {
$value_options[] = $row_options[0];
}
$extra_information_value .= '<dt>'.ucfirst($field_display_text).':</dt><dd>'.implode(' ',$value_options).'</dd>';
} elseif($field_type == USER_FIELD_TYPE_TAG ) {
} elseif($field_type == Extrafield::FIELD_TYPE_TAG ) {
$user_tags = UserManager::get_user_tags($user_id, $field_id);
$tag_tmp = array();
foreach ($user_tags as $tags) {
foreach ($user_tags as $tags) {
$tag_tmp[] = '<a class="label label_tag" href="'.api_get_path(WEB_PATH).'main/social/search.php?q='.$tags['tag'].'">'.$tags['tag'].'</a>';
}
if (is_array($user_tags) && count($user_tags)>0) {
$extra_information_value .= '<dt>'.ucfirst($field_display_text).':</dt><dd>'.implode('', $tag_tmp).'</dd>';
}
} elseif ($field_type == USER_FIELD_TYPE_SOCIAL_PROFILE) {
} elseif ($field_type == Extrafield::FIELD_TYPE_SOCIAL_PROFILE) {
$icon_path = UserManager::get_favicon_from_url($data);
$bottom = '0.3';
//quick hack for hi5
$domain = parse_url($icon_path, PHP_URL_HOST); if ($domain == 'www.hi5.com' or $domain == 'hi5.com') { $bottom = '0.8'; }
$data = '<a href="'.$data.'"><img src="'.$icon_path.'" alt="ico" style="margin-right:0.5em;margin-bottom:-'.$bottom.'em;" />'.ucfirst($field_display_text).'</a>';
$extra_information_value .= '<dd>'.$data.'</dd>';
$extra_information_value .= '<dd>'.$data.'</dd>';
} else {
if (!empty($data)) {
$extra_information_value .= '<dt>'.ucfirst($field_display_text).':</dt><dd>'.$data.'</dd>';
@ -532,7 +532,7 @@ if ($show_full_profile) {
$total = count($grid_my_groups);
$i = 1;
foreach($grid_my_groups as $group) {
$my_groups .= $group[0];
$my_groups .= $group[0];
if ($i < $total) {
$my_groups .= ', ';
}
@ -542,28 +542,29 @@ if ($show_full_profile) {
}
// COURSES LIST
if ( is_array($list) ) {
$my_courses = null;
if ( is_array($list) ) {
$my_courses .= '<div><h3>'.api_ucfirst(get_lang('MyCourses')).'</h3></div>';
$my_courses .= '<div class="social-content-training">';
//Courses without sessions
//Courses without sessions
$i=1;
foreach ($list as $value) {
foreach ($list as $value) {
if (!empty($value)) { //if out of any session
$my_courses .= $value;
$my_courses .= '<div id="social_content'.$i.'" class="course_social_content" style="display:none" >s</div>';
$my_courses .= '<div id="social_content'.$i.'" class="course_social_content" style="display:none" >s</div>';
$i++;
}
}
$my_courses .= '</div>'; //social-content-training
$my_courses .= '</div>'; //social-content-training
$social_right_content .= SocialManager::social_wrapper_div($my_courses, 9);
}
// user feeds
$user_feeds = SocialManager::get_user_feeds($user_id);
if (!empty($user_feeds)) {
if (!empty($user_feeds)) {
$rss = '<div><h3>'.get_lang('RSSFeeds').'</h3></div>';
$rss .= '<div class="social-content-training">'.$user_feeds.'</div>';
$rss .= '<div class="social-content-training">'.$user_feeds.'</div>';
$social_right_content .= SocialManager::social_wrapper_div($rss, 9);
}
@ -576,7 +577,7 @@ if ($show_full_profile) {
foreach ($course_list_code as $course) {
$file_list.= UserManager::get_user_upload_files_by_course($user_id, $course['code'], $resourcetype='images');
}
}
}
$count_pending_invitations = 0;
if (!isset($_GET['u']) || (isset($_GET['u']) && $_GET['u']==api_get_user_id())) {
@ -587,10 +588,10 @@ if ($show_full_profile) {
if (!empty($production_list) || !empty($file_list) || $count_pending_invitations > 0) {
//Pending invitations
if (!isset($_GET['u']) || (isset($_GET['u']) && $_GET['u']==api_get_user_id())) {
if ($count_pending_invitations > 0) {
if ($count_pending_invitations > 0) {
$invitations .= '<div><h3>'.get_lang('PendingInvitations').'</h3></div>';
for ($i=0;$i<$count_pending_invitations;$i++) {
$user_invitation_id = $pending_invitations[$i]['user_sender_id'];
@ -598,7 +599,7 @@ if ($show_full_profile) {
$invitations .= '<div style="float:left;width:60px;" >';
$invitations .= '<img style="margin-bottom:5px;" src="'.$list_get_path_web[$i]['dir'].'/'.$list_get_path_web[$i]['file'].'" width="60px">';
$invitations .= '</div>';
$invitations .= '<div style="padding-left:70px;">';
$user_invitation_info = api_get_user_info($user_invitation_id);
$invitations .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$user_invitation_id.'">'.api_get_person_name($user_invitation_info['firstname'], $user_invitation_info['lastname']).'</a>';
@ -608,60 +609,60 @@ if ($show_full_profile) {
$invitations .= '<a id="btn_accepted_'.$user_invitation_id.'" class="btn" onclick="register_friend(this)" href="javascript:void(0)">'.get_lang('SocialAddToFriends').'</a>';
$invitations .= '<div id="id_response"></div>';
$invitations .= '</div>';
$invitations .= '</div>';
$invitations .= '</div>';
}
$social_right_content .= SocialManager::social_wrapper_div($invitations, 4);
}
}
}
//--Productions
$production_list = UserManager::build_production_list($user_id);
$product_content = '';
if (!empty($production_list)) {
if (!empty($production_list)) {
$product_content .= '<div><h3>'.get_lang('MyProductions').'</h3></div>';
$product_content .= $production_list;
$social_right_content .= SocialManager::social_wrapper_div($product_content, 5);
}
$images_uploaded = null;
// Images uploaded by course
if (!empty($file_list)) {
if (!empty($file_list)) {
$images_uploaded .= '<div><h3>'.get_lang('ImagesUploaded').'</h3></div>';
$images_uploaded .= '<div class="social-content-information">';
$images_uploaded .= $file_list;
$images_uploaded .= '</div>';
$images_uploaded .= '</div>';
$social_right_content .= SocialManager::social_wrapper_div($images_uploaded, 9);
}
}
}
if (!empty($user_info['competences']) || !empty($user_info['diplomas']) || !empty($user_info['openarea']) || !empty($user_info['teach']) ) {
$more_info .= '<div><h3>'.get_lang('MoreInformation').'</h3></div>';
$more_info .= '<div><h3>'.get_lang('MoreInformation').'</h3></div>';
$cut_size = 220;
if (!empty($user_info['competences'])) {
$more_info .= '<br />';
$more_info .= '<br />';
$more_info .= '<div class="social-actions-message"><strong>'.get_lang('MyCompetences').'</strong></div>';
$more_info .= '<div class="social-profile-extended">'.$user_info['competences'].'</div>';
$more_info .= '<div class="social-profile-extended">'.$user_info['competences'].'</div>';
$more_info .= '<br />';
}
if (!empty($user_info['diplomas'])) {
if (!empty($user_info['diplomas'])) {
$more_info .= '<div class="social-actions-message"><strong>'.get_lang('MyDiplomas').'</strong></div>';
$more_info .= '<div class="social-profile-extended">'.$user_info['diplomas'].'</div>';
$more_info .= '<div class="social-profile-extended">'.$user_info['diplomas'].'</div>';
$more_info .= '<br />';
}
if (!empty($user_info['openarea'])) {
if (!empty($user_info['openarea'])) {
$more_info .= '<div class="social-actions-message"><strong>'.get_lang('MyPersonalOpenArea').'</strong></div>';
$more_info .= '<div class="social-profile-extended">'.$user_info['openarea'].'</div>';
$more_info .= '<br />';
}
if (!empty($user_info['teach'])) {
if (!empty($user_info['teach'])) {
$more_info .= '<div class="social-actions-message"><strong>'.get_lang('MyTeach').'</strong></div>';
$more_info .= '<div class="social-profile-extended">'.$user_info['teach'].'</div>';
$more_info .= '<div class="social-profile-extended">'.$user_info['teach'].'</div>';
$more_info .= '<br />';
}
}
$social_right_content .= SocialManager::social_wrapper_div($more_info, 9);
}
}
}
$social_right_content .= MessageManager::generate_message_form('send_message');
$social_right_content .= MessageManager::generate_invitation_form('send_invitation');
@ -669,11 +670,6 @@ $social_right_content .= MessageManager::generate_invitation_form('send_invitati
$tpl = new Template(get_lang('Social'));
$tpl->assign('social_left_content', $social_left_content);
$tpl->assign('social_left_menu', $social_left_menu);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('layout/social_layout.tpl');
$content = $tpl->fetch($social_layout);
$tpl->assign('actions', $actions);
$tpl->assign('message', $message);
$tpl->assign('content', $content);
$tpl->display_one_col_template();
$tpl->display($social_layout);

@ -1 +1,8 @@
{% include 'default/layout/block_menu.tpl' with {'block_menu': help_block} %}
{% set block_menu = help_block %}
{% extends "default/layout/block_menu.tpl" %}
{% block block_menu_item %}
<h4>{{ block_menu.title }}</h4>
<ul class="nav nav-list">
{{ block_menu.content }}</ul>
</ul>
{% endblock %}

@ -3,7 +3,8 @@
{% block block_menu_item %}
<h4>{{ block_menu.title }}</h4>
<ul class="nav nav-list">
<li><a href="{{ _p.web}}main/messages/inbox.php">{{ 'Inbox' | get_lang}} {{ _u.messages_count}}</a></li>
<li><a href="{{ _p.web}}main/messages/new_message.php">{{ 'Compose' | get_lang}}</a></li>
<li><a href="{{ _p.web }}main/messages/inbox.php">{{ 'Inbox' | get_lang}} {{ _u.messages_count }}</a></li>
<li><a href="{{ _p.web }}main/messages/new_message.php">{{ 'Compose' | get_lang }}</a></li>
<li><a href="{{ _p.web }}main/auth/profile.php">{{ 'EditProfile' | get_lang }}</a></li>
</ul>
{% endblock %}

@ -6,5 +6,6 @@
<li><a href="{{ _p.web}}main/messages/inbox.php?f=social">{{ 'Inbox' | get_lang}} {{ _u.messages_count}}</a></li>
<li><a href="{{ _p.web}}main/messages/new_message.php?f=social"> {{ 'Compose' | get_lang}}</a></li>
<li><a href="{{ _p.web}}main/social/invitations.php"> {{ 'PendingInvitations' | get_lang }} {{ _u.messages_invitations_count}}</a></li>
<li><a href="{{ _p.web }}main/auth/profile.php">{{ 'EditProfile' | get_lang }}</a></li>
</ul>
{% endblock %}

@ -9,7 +9,7 @@
<div class="span9">
<div class="row">
<span id="message_ajax_reponse" class="span9"></span>
{{ social_right_content}}
{{ social_right_content }}
<div id="display_response_id" class="span9"></div>
</div>
</div>

Loading…
Cancel
Save