Social network improvements see #5508
parent
e8790bfb9a
commit
dcf6c5f4a3
@ -0,0 +1,673 @@ |
||||
<?php //$id: $
|
||||
/* For licensing terms, see /dokeos_license.txt */ |
||||
/** |
||||
============================================================================== |
||||
* @package dokeos.admin |
||||
============================================================================== |
||||
*/ |
||||
|
||||
// name of the language file that needs to be included |
||||
$language_file=array('admin','registration'); |
||||
|
||||
// resetting the course id |
||||
$cidReset=true; |
||||
|
||||
// including some necessary dokeos files |
||||
require('../inc/global.inc.php'); |
||||
|
||||
require_once ('../inc/lib/xajax/xajax.inc.php'); |
||||
$xajax = new xajax(); |
||||
//$xajax->debugOn(); |
||||
$xajax -> registerFunction ('search_users'); |
||||
|
||||
// setting the section (for the tabs) |
||||
$this_section = SECTION_PLATFORM_ADMIN; |
||||
|
||||
// Access restrictions |
||||
api_protect_admin_script(true); |
||||
|
||||
// setting breadcrumbs |
||||
$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin')); |
||||
$interbreadcrumb[]=array('url' => 'group_list.php','name' => get_lang('GroupList')); |
||||
|
||||
// Database Table Definitions |
||||
$tbl_group = Database::get_main_table(TABLE_MAIN_GROUP); |
||||
$tbl_user = Database::get_main_table(TABLE_MAIN_USER); |
||||
$tbl_group_rel_user = Database::get_main_table(TABLE_MAIN_USER_REL_GROUP); |
||||
|
||||
// setting the name of the tool |
||||
$tool_name = get_lang('SubscribeUsersToGroup'); |
||||
$group_id = intval($_GET['id']); |
||||
|
||||
$add_type = 'single'; |
||||
if(isset($_REQUEST['add_type']) && $_REQUEST['add_type']!=''){ |
||||
$add_type = Security::remove_XSS($_REQUEST['add_type']); |
||||
} |
||||
|
||||
/* |
||||
if (!api_is_platform_admin()) { |
||||
$sql = 'SELECT session_admin_id FROM '.Database :: get_main_table(TABLE_MAIN_SESSION).' WHERE id='.$id_session; |
||||
$rs = Database::query($sql,__FILE__,__LINE__); |
||||
if(Database::result($rs,0,0)!=$_user['user_id']) { |
||||
api_not_allowed(true); |
||||
} |
||||
}*/ |
||||
|
||||
//checking for extra field with filter on |
||||
include_once (api_get_path(LIBRARY_PATH).'usermanager.lib.php'); |
||||
include_once (api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php'); |
||||
|
||||
function search_users($needle,$type) |
||||
{ |
||||
global $tbl_user,$tbl_group_rel_user,$group_id; |
||||
$xajax_response = new XajaxResponse(); |
||||
$return = ''; |
||||
|
||||
if (!empty($needle) && !empty($type)) { |
||||
|
||||
// xajax send utf8 datas... datas in db can be non-utf8 datas |
||||
$charset = api_get_setting('platform_charset'); |
||||
$needle = Database::escape_string($needle); |
||||
$needle = api_convert_encoding($needle, $charset, 'utf-8'); |
||||
$user_anonymous=api_get_anonymous_id(); |
||||
|
||||
$order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username'; |
||||
$cond_user_id = ''; |
||||
if (!empty($id_session)) { |
||||
$group_id = Database::escape_string($group_id); |
||||
// check id_user from session_rel_user table |
||||
$sql = 'SELECT id_user FROM '.$tbl_group_rel_user.' WHERE group_id ="'.(int)$group_id.'"'; |
||||
$res = Database::query($sql,__FILE__,__LINE__); |
||||
$user_ids = array(); |
||||
if (Database::num_rows($res) > 0) { |
||||
while ($row = Database::fetch_row($res)) { |
||||
$user_ids[] = (int)$row[0]; |
||||
} |
||||
} |
||||
if (count($user_ids) > 0){ |
||||
$cond_user_id = ' AND user_id NOT IN('.implode(",",$user_ids).')'; |
||||
} |
||||
} |
||||
|
||||
if ($type == 'single') { |
||||
// search users where username or firstname or lastname begins likes $needle |
||||
$sql = 'SELECT user_id, username, lastname, firstname FROM '.$tbl_user.' user |
||||
WHERE (username LIKE "'.$needle.'%" |
||||
OR firstname LIKE "'.$needle.'%" |
||||
OR lastname LIKE "'.$needle.'%") AND user_id<>"'.$user_anonymous.'"'. |
||||
$order_clause. |
||||
' LIMIT 11'; |
||||
} else { |
||||
$sql = 'SELECT user_id, username, lastname, firstname FROM '.$tbl_user.' user |
||||
WHERE '.(api_sort_by_first_name() ? 'firstname' : 'lastname').' LIKE "'.$needle.'%" AND user_id<>"'.$user_anonymous.'"'.$cond_user_id. |
||||
$order_clause; |
||||
} |
||||
|
||||
global $_configuration; |
||||
if ($_configuration['multiple_access_urls']==true) { |
||||
$tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
||||
$access_url_id = api_get_current_access_url_id(); |
||||
if ($access_url_id != -1){ |
||||
if ($type == 'single') { |
||||
$sql = 'SELECT user.user_id, username, lastname, firstname FROM '.$tbl_user.' user |
||||
INNER JOIN '.$tbl_user_rel_access_url.' url_user ON (url_user.user_id=user.user_id) |
||||
WHERE access_url_id = '.$access_url_id.' AND (username LIKE "'.$needle.'%" |
||||
OR firstname LIKE "'.$needle.'%" |
||||
OR lastname LIKE "'.$needle.'%") AND user.user_id<>"'.$user_anonymous.'"'. |
||||
$order_clause. |
||||
' LIMIT 11'; |
||||
} else { |
||||
$sql = 'SELECT user.user_id, username, lastname, firstname FROM '.$tbl_user.' user |
||||
INNER JOIN '.$tbl_user_rel_access_url.' url_user ON (url_user.user_id=user.user_id) |
||||
WHERE access_url_id = '.$access_url_id.' |
||||
AND '.(api_sort_by_first_name() ? 'firstname' : 'lastname').' LIKE "'.$needle.'%" AND user.user_id<>"'.$user_anonymous.'"'.$cond_user_id. |
||||
$order_clause; |
||||
} |
||||
|
||||
} |
||||
} |
||||
|
||||
$rs = Database::query($sql, __FILE__, __LINE__); |
||||
$i=0; |
||||
if ($type=='single') { |
||||
while ($user = Database :: fetch_array($rs)) { |
||||
$i++; |
||||
if ($i<=10) { |
||||
$person_name = api_get_person_name($user['firstname'], $user['lastname']); |
||||
$return .= '<a href="javascript: void(0);" onclick="javascript: add_user(\''.$user['user_id'].'\',\''.$person_name.' ('.$user['username'].')'.'\')">'.$person_name.' ('.$user['username'].')</a><br />'; |
||||
} else { |
||||
$return .= '...<br />'; |
||||
} |
||||
} |
||||
|
||||
$xajax_response -> addAssign('ajax_list_users_single','innerHTML',api_utf8_encode($return)); |
||||
|
||||
} else { |
||||
global $nosessionUsersList; |
||||
$return .= '<select id="origin_users" name="nosessionUsersList[]" multiple="multiple" size="15" style="width:360px;">'; |
||||
while ($user = Database :: fetch_array($rs)) { |
||||
$person_name = api_get_person_name($user['firstname'], $user['lastname']); |
||||
$return .= '<option value="'.$user['user_id'].'">'.$person_name.' ('.$user['username'].')</option>'; |
||||
} |
||||
$return .= '</select>'; |
||||
$xajax_response -> addAssign('ajax_list_users_multiple','innerHTML',api_utf8_encode($return)); |
||||
} |
||||
} |
||||
|
||||
return $xajax_response; |
||||
} |
||||
|
||||
$xajax -> processRequests(); |
||||
|
||||
$htmlHeadXtra[] = $xajax->getJavascript('../inc/lib/xajax/'); |
||||
$htmlHeadXtra[] = ' |
||||
<script type="text/javascript"> |
||||
function add_user (code, content) { |
||||
|
||||
// document.getElementById("user_to_add").value = ""; |
||||
//document.getElementById("ajax_list_users_single").innerHTML = ""; |
||||
|
||||
destination = document.getElementById("destination_users"); |
||||
|
||||
for (i=0;i<destination.length;i++) { |
||||
if(destination.options[i].text == content) { |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
destination.options[destination.length] = new Option(content,code); |
||||
destination.selectedIndex = -1; |
||||
sortOptions(destination.options); |
||||
|
||||
} |
||||
function remove_item(origin) |
||||
{ |
||||
for(var i = 0 ; i<origin.options.length ; i++) { |
||||
if(origin.options[i].selected) { |
||||
origin.options[i]=null; |
||||
i = i-1; |
||||
} |
||||
} |
||||
} |
||||
|
||||
function validate_filter() { |
||||
document.formulaire.add_type.value = \''.$add_type.'\'; |
||||
document.formulaire.form_sent.value=0; |
||||
document.formulaire.submit(); |
||||
} |
||||
</script>'; |
||||
|
||||
$form_sent=0; |
||||
$errorMsg=$firstLetterUser=$firstLetterSession=''; |
||||
$UserList=$SessionList=array(); |
||||
$users=$sessions=array(); |
||||
$noPHP_SELF=true; |
||||
|
||||
if($_POST['form_sent']) { |
||||
$form_sent = $_POST['form_sent']; |
||||
$firstLetterUser = $_POST['firstLetterUser']; |
||||
$firstLetterSession = $_POST['firstLetterSession']; |
||||
$UserList = $_POST['sessionUsersList']; |
||||
$ClassList = $_POST['sessionClassesList']; |
||||
|
||||
if(!is_array($UserList)) { |
||||
$UserList=array(); |
||||
} |
||||
|
||||
if ($form_sent == 1) { |
||||
//added a parameter to send emails when registering a user |
||||
// SessionManager::suscribe_users_to_session($id_session,$UserList,true,true); |
||||
|
||||
//adding the session to the access_url_rel_session table |
||||
/*global $_configuration; |
||||
require_once (api_get_path(LIBRARY_PATH).'urlmanager.lib.php'); |
||||
if ($_configuration['multiple_access_urls']==true) { |
||||
$tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
||||
$access_url_id = api_get_current_access_url_id(); |
||||
UrlManager::add_session_to_url($id_session,$access_url_id); |
||||
} else { |
||||
// we are filling by default the access_url_rel_session table |
||||
UrlManager::add_session_to_url($id_session,1); |
||||
}*/ |
||||
//if(empty($_GET['add'])) |
||||
//header('Location: '.Security::remove_XSS($_GET['page']).'?id_session='.$id_session); |
||||
//else |
||||
header('Location: group_list.php'); |
||||
} |
||||
} |
||||
|
||||
$group_info = GroupPortalManager::get_group_data($group_id); |
||||
Display::display_header($tool_name); |
||||
//api_display_tool_title($tool_name.' ('.$session_info['name'].')'); |
||||
|
||||
$nosessionUsersList = $sessionUsersList = array(); |
||||
/*$sql = 'SELECT COUNT(1) FROM '.$tbl_user; |
||||
$rs = Database::query($sql, __FILE__, __LINE__); |
||||
$count_courses = Database::result($rs, 0, 0);*/ |
||||
$ajax_search = $add_type == 'unique' ? true : false; |
||||
global $_configuration; |
||||
|
||||
$order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username'; |
||||
|
||||
if ($ajax_search) { |
||||
$sql="SELECT u.user_id, lastname, firstname, username, group_id |
||||
FROM $tbl_user u |
||||
LEFT JOIN $tbl_group_rel_user gu |
||||
ON (gu.user_id = u.user_id) WHERE gu.group_id = $group_id ". |
||||
$order_clause; |
||||
|
||||
if ($_configuration['multiple_access_urls']==true) { |
||||
$tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
||||
$access_url_id = api_get_current_access_url_id(); |
||||
if ($access_url_id != -1){ |
||||
$sql="SELECT u.user_id, lastname, firstname, username, id_session |
||||
FROM $tbl_user u |
||||
INNER JOIN $tbl_session_rel_user |
||||
ON $tbl_session_rel_user.id_user = u.user_id |
||||
AND $tbl_session_rel_user.id_session = ".intval($id_session)." |
||||
INNER JOIN $tbl_user_rel_access_url url_user ON (url_user.user_id=u.user_id) |
||||
WHERE access_url_id = $access_url_id |
||||
$order_clause"; |
||||
} |
||||
} |
||||
$result=Database::query($sql,__FILE__,__LINE__); |
||||
$Users=Database::store_result($result); |
||||
foreach ($Users as $user) { |
||||
$sessionUsersList[$user['user_id']] = $user ; |
||||
} |
||||
} else { |
||||
/* |
||||
//Filter by Extra Fields |
||||
$use_extra_fields = false; |
||||
if (is_array($extra_field_list)) { |
||||
if (is_array($new_field_list) && count($new_field_list)>0 ) { |
||||
$result_list=array(); |
||||
foreach ($new_field_list as $new_field) { |
||||
$varname = 'field_'.$new_field['variable']; |
||||
if (Usermanager::is_extra_field_available($new_field['variable'])) { |
||||
if (isset($_POST[$varname]) && $_POST[$varname]!='0') { |
||||
$use_extra_fields = true; |
||||
$extra_field_result[]= Usermanager::get_extra_user_data_by_value($new_field['variable'], $_POST[$varname]); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
*/ |
||||
$use_extra_fields =false; |
||||
|
||||
if ($use_extra_fields) { |
||||
$final_result = array(); |
||||
if (count($extra_field_result)>1) { |
||||
for($i=0;$i<count($extra_field_result)-1;$i++) { |
||||
if (is_array($extra_field_result[$i+1])) { |
||||
$final_result = array_intersect($extra_field_result[$i],$extra_field_result[$i+1]); |
||||
} |
||||
} |
||||
} else { |
||||
$final_result = $extra_field_result[0]; |
||||
} |
||||
|
||||
$where_filter =''; |
||||
if ($_configuration['multiple_access_urls']==true) { |
||||
if (is_array($final_result) && count($final_result)>0) { |
||||
$where_filter = " AND u.user_id IN ('".implode("','",$final_result)."') "; |
||||
} else { |
||||
//no results |
||||
$where_filter = " AND u.user_id = -1"; |
||||
} |
||||
} else { |
||||
if (is_array($final_result) && count($final_result)>0) { |
||||
$where_filter = " WHERE u.user_id IN ('".implode("','",$final_result)."') "; |
||||
} else { |
||||
//no results |
||||
$where_filter = " WHERE u.user_id = -1"; |
||||
} |
||||
} |
||||
} |
||||
|
||||
if ($use_extra_fields) { |
||||
$sql="SELECT user_id, lastname, firstname, username, group_id |
||||
FROM $tbl_user u |
||||
LEFT JOIN $tbl_session_rel_user |
||||
ON $tbl_session_rel_user.id_user = u.user_id AND id_session = '$id_session' |
||||
$where_filter |
||||
$order_clause"; |
||||
|
||||
} else { |
||||
|
||||
$sql="SELECT u.user_id, lastname, firstname, username, group_id |
||||
FROM $tbl_user u |
||||
LEFT JOIN $tbl_group_rel_user gu |
||||
ON (gu.user_id = u.user_id) WHERE gu.group_id = $group_id |
||||
$order_clause"; |
||||
} |
||||
|
||||
if ($_configuration['multiple_access_urls']==true) { |
||||
$tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
||||
$access_url_id = api_get_current_access_url_id(); |
||||
if ($access_url_id != -1){ |
||||
$sql="SELECT u.user_id, lastname, firstname, username, id_session |
||||
FROM $tbl_user u |
||||
LEFT JOIN $tbl_session_rel_user |
||||
ON $tbl_session_rel_user.id_user = u.user_id AND id_session = '$id_session' |
||||
INNER JOIN $tbl_user_rel_access_url url_user ON (url_user.user_id=u.user_id) |
||||
WHERE access_url_id = $access_url_id $where_filter |
||||
$order_clause"; |
||||
} |
||||
} |
||||
|
||||
$result = Database::query($sql,__FILE__,__LINE__); |
||||
$Users = Database::store_result($result); |
||||
|
||||
foreach ($Users as $user) { |
||||
if($user['group_id'] != $group_id) |
||||
$nosessionUsersList[$user['user_id']] = $user ; |
||||
} |
||||
var_dump($nosessionUsersList); |
||||
$user_anonymous=api_get_anonymous_id(); |
||||
/* foreach($nosessionUsersList as $key_user_list =>$value_user_list) { |
||||
if ($nosessionUsersList[$key_user_list]['user_id']==$user_anonymous) { |
||||
unset($nosessionUsersList[$key_user_list]); |
||||
} |
||||
}*/ |
||||
|
||||
//filling the correct users in list |
||||
$sql="SELECT u.user_id, lastname, firstname, username, group_id |
||||
FROM $tbl_user u |
||||
LEFT JOIN $tbl_group_rel_user |
||||
ON $tbl_group_rel_user.user_id = u.user_id AND group_id = '$group_id' |
||||
$order_clause"; |
||||
|
||||
if ($_configuration['multiple_access_urls']==true) { |
||||
$tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
||||
$access_url_id = api_get_current_access_url_id(); |
||||
if ($access_url_id != -1){ |
||||
$sql="SELECT u.user_id, lastname, firstname, username, id_session |
||||
FROM $tbl_user u |
||||
LEFT JOIN $tbl_session_rel_user |
||||
ON $tbl_session_rel_user.id_user = u.user_id AND id_session = '$id_session' |
||||
INNER JOIN $tbl_user_rel_access_url url_user ON (url_user.user_id=u.user_id) |
||||
WHERE access_url_id = $access_url_id |
||||
$order_clause"; |
||||
} |
||||
} |
||||
$result=Database::query($sql,__FILE__,__LINE__); |
||||
$Users=Database::store_result($result); |
||||
|
||||
foreach($Users as $key_user_list =>$value_user_list) { |
||||
if ($Users[$key_user_list]['user_id']==$user_anonymous) { |
||||
unset($Users[$key_user_list]); |
||||
} |
||||
} |
||||
|
||||
foreach ($Users as $user) { |
||||
if($user['group_id'] == $group_id){ |
||||
$sessionUsersList[$user['user_id']] = $user; |
||||
if (array_key_exists($user['user_id'],$nosessionUsersList)) |
||||
unset($nosessionUsersList[$user['user_id']]); |
||||
} |
||||
} |
||||
} |
||||
|
||||
if ($add_type == 'multiple') { |
||||
//$link_add_type_unique = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.Security::remove_XSS($_GET['add']).'&add_type=unique">'.Display::return_icon('single.gif').get_lang('SessionAddTypeUnique').'</a>'; |
||||
//$link_add_type_multiple = Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple'); |
||||
} else { |
||||
//$link_add_type_unique = Display::return_icon('single.gif').get_lang('SessionAddTypeUnique'); |
||||
//$link_add_type_multiple = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.Security::remove_XSS($_GET['add']).'&add_type=multiple">'.Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>'; |
||||
/* |
||||
* <div class="actions"> |
||||
<?php echo $link_add_type_unique ?> | <?php echo $link_add_type_multiple ?> |
||||
</div> |
||||
*/ |
||||
} |
||||
|
||||
|
||||
?> |
||||
|
||||
|
||||
<?php echo '<div class="row"><div class="form_header">'.$tool_name.' ('.$session_info['name'].')</div></div><br/>'; ?> |
||||
|
||||
<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?page=<?php echo Security::remove_XSS($_GET['page']); ?>&id_session=<?php echo $id_session; ?><?php if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>>
|
||||
|
||||
<?php |
||||
if ($add_type=='multiple') { |
||||
if (is_array($extra_field_list)) { |
||||
if (is_array($new_field_list) && count($new_field_list)>0 ) { |
||||
echo '<h3>'.get_lang('FilterUsers').'</h3>'; |
||||
foreach ($new_field_list as $new_field) { |
||||
echo $new_field['name']; |
||||
$varname = 'field_'.$new_field['variable']; |
||||
echo ' <select name="'.$varname.'">'; |
||||
echo '<option value="0">--'.get_lang('Select').'--</option>'; |
||||
foreach ($new_field['data'] as $option) { |
||||
$checked=''; |
||||
if (isset($_POST[$varname])) { |
||||
if ($_POST[$varname]==$option[1]) { |
||||
$checked = 'selected="true"'; |
||||
} |
||||
} |
||||
echo '<option value="'.$option[1].'" '.$checked.'>'.$option[1].'</option>'; |
||||
} |
||||
echo '</select>'; |
||||
echo ' '; |
||||
} |
||||
echo '<input type="button" value="'.get_lang('Filter').'" onclick="validate_filter()" />'; |
||||
echo '<br /><br />'; |
||||
} |
||||
} |
||||
} |
||||
?> |
||||
|
||||
<input type="hidden" name="form_sent" value="1" /> |
||||
<input type="hidden" name="add_type" /> |
||||
|
||||
<?php |
||||
if(!empty($errorMsg)) { |
||||
Display::display_normal_message($errorMsg); //main API |
||||
} |
||||
?> |
||||
|
||||
<table border="0" cellpadding="5" cellspacing="0" width="100%"> |
||||
<!-- Users --> |
||||
<tr> |
||||
<td align="center"><b><?php echo get_lang('UserListInPlatform') ?> :</b>
|
||||
</td> |
||||
<td></td> |
||||
<td align="center"><b><?php echo get_lang('UserListInSession') ?> :</b></td>
|
||||
</tr> |
||||
|
||||
<?php if ($add_type=='multiple') { ?> |
||||
<tr> |
||||
<td align="center"> |
||||
|
||||
<?php echo get_lang('FirstLetterUser'); ?> :
|
||||
<select name="firstLetterUser" onchange = "xajax_search_users(this.value,'multiple')" > |
||||
<option value = "%">--</option> |
||||
<?php |
||||
echo Display :: get_alphabet_options(); |
||||
?> |
||||
</select> |
||||
</td> |
||||
<td align="center"> </td> |
||||
</tr> |
||||
<?php } ?> |
||||
|
||||
|
||||
<tr> |
||||
<td align="center"> |
||||
<div id="content_source"> |
||||
<?php |
||||
if (!($add_type=='multiple')) { |
||||
?> |
||||
<input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,'single')" /> |
||||
<div id="ajax_list_users_single"></div> |
||||
<?php |
||||
} else { |
||||
?> |
||||
<div id="ajax_list_users_multiple"> |
||||
<select id="origin_users" name="nosessionUsersList[]" multiple="multiple" size="15" style="width:360px;"> |
||||
<?php |
||||
foreach($nosessionUsersList as $enreg) { |
||||
?> |
||||
<option value="<?php echo $enreg['user_id']; ?>" <?php if(in_array($enreg['user_id'],$UserList)) echo 'selected="selected"'; ?>><?php echo api_get_person_name($enreg['firstname'], $enreg['lastname']).' ('.$enreg['username'].')'; ?></option>
|
||||
<?php |
||||
} |
||||
?> |
||||
</select> |
||||
</div> |
||||
<?php |
||||
} |
||||
unset($nosessionUsersList); |
||||
?> |
||||
</div> |
||||
</td> |
||||
<td width="10%" valign="middle" align="center"> |
||||
<?php |
||||
if ($ajax_search) { |
||||
?> |
||||
<button class="arrowl" type="button" onclick="remove_item(document.getElementById('destination_users'))" ></button> |
||||
<?php |
||||
} else { |
||||
?> |
||||
<button class="arrowr" type="button" onclick="moveItem(document.getElementById('origin_users'), document.getElementById('destination_users'))" onclick="moveItem(document.getElementById('origin_users'), document.getElementById('destination_users'))"></button> |
||||
<br /><br /> |
||||
<button class="arrowl" type="button" onclick="moveItem(document.getElementById('destination_users'), document.getElementById('origin_users'))" onclick="moveItem(document.getElementById('destination_users'), document.getElementById('origin_users'))"></button> |
||||
<?php |
||||
} |
||||
?> |
||||
<br /><br /><br /><br /><br /><br /> |
||||
</td> |
||||
<td align="center"> |
||||
<select id="destination_users" name="sessionUsersList[]" multiple="multiple" size="15" style="width:360px;"> |
||||
|
||||
<?php |
||||
foreach($sessionUsersList as $enreg) { |
||||
?> |
||||
<option value="<?php echo $enreg['user_id']; ?>"><?php echo $enreg['firstname'].' '.$enreg['lastname'].' ('.$enreg['username'].')'; ?></option>
|
||||
|
||||
<?php |
||||
} |
||||
|
||||
unset($sessionUsersList); |
||||
?> |
||||
|
||||
</select></td> |
||||
</tr> |
||||
<tr> |
||||
<td colspan="3" align="center"> |
||||
<br /> |
||||
<?php |
||||
if(isset($_GET['add'])) { |
||||
echo '<button class="save" type="button" value="" onclick="valide()" >'.get_lang('FinishSessionCreation').'</button>'; |
||||
} else { |
||||
//@todo see that the call to "valide()" doesn't duplicate the onsubmit of the form (necessary to avoid delete on "enter" key pressed) |
||||
echo '<button class="save" type="button" value="" onclick="valide()" >'.get_lang('SubscribeUsersToGroup').'</button>'; |
||||
|
||||
} |
||||
?> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
||||
|
||||
<script type="text/javascript"> |
||||
<!-- |
||||
function moveItem(origin , destination){ |
||||
|
||||
for(var i = 0 ; i<origin.options.length ; i++) { |
||||
if(origin.options[i].selected) { |
||||
destination.options[destination.length] = new Option(origin.options[i].text,origin.options[i].value); |
||||
origin.options[i]=null; |
||||
i = i-1; |
||||
} |
||||
} |
||||
destination.selectedIndex = -1; |
||||
sortOptions(destination.options); |
||||
|
||||
} |
||||
|
||||
function sortOptions(options) { |
||||
|
||||
newOptions = new Array(); |
||||
for (i = 0 ; i<options.length ; i++) |
||||
newOptions[i] = options[i]; |
||||
|
||||
newOptions = newOptions.sort(mysort); |
||||
options.length = 0; |
||||
for(i = 0 ; i < newOptions.length ; i++) |
||||
options[i] = newOptions[i]; |
||||
|
||||
} |
||||
|
||||
function mysort(a, b){ |
||||
if(a.text.toLowerCase() > b.text.toLowerCase()){ |
||||
return 1; |
||||
} |
||||
if(a.text.toLowerCase() < b.text.toLowerCase()){ |
||||
return -1; |
||||
} |
||||
return 0; |
||||
} |
||||
|
||||
function valide(){ |
||||
var options = document.getElementById('destination_users').options; |
||||
for (i = 0 ; i<options.length ; i++) |
||||
options[i].selected = true; |
||||
document.forms.formulaire.submit(); |
||||
} |
||||
|
||||
|
||||
function loadUsersInSelect(select){ |
||||
|
||||
var xhr_object = null; |
||||
|
||||
if(window.XMLHttpRequest) // Firefox |
||||
xhr_object = new XMLHttpRequest(); |
||||
else if(window.ActiveXObject) // Internet Explorer |
||||
xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); |
||||
else // XMLHttpRequest non supporté par le navigateur |
||||
alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); |
||||
|
||||
//xhr_object.open("GET", "loadUsersInSelect.ajax.php?id_session=<?php echo $id_session ?>&letter="+select.options[select.selectedIndex].text, false);
|
||||
xhr_object.open("POST", "loadUsersInSelect.ajax.php"); |
||||
|
||||
xhr_object.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); |
||||
|
||||
|
||||
nosessionUsers = makepost(document.getElementById('origin_users')); |
||||
sessionUsers = makepost(document.getElementById('destination_users')); |
||||
nosessionClasses = makepost(document.getElementById('origin_classes')); |
||||
sessionClasses = makepost(document.getElementById('destination_classes')); |
||||
xhr_object.send("nosessionusers="+nosessionUsers+"&sessionusers="+sessionUsers+"&nosessionclasses="+nosessionClasses+"&sessionclasses="+sessionClasses); |
||||
|
||||
xhr_object.onreadystatechange = function() { |
||||
if(xhr_object.readyState == 4) { |
||||
document.getElementById('content_source').innerHTML = result = xhr_object.responseText; |
||||
//alert(xhr_object.responseText); |
||||
} |
||||
} |
||||
} |
||||
|
||||
function makepost(select){ |
||||
|
||||
var options = select.options; |
||||
var ret = ""; |
||||
for (i = 0 ; i<options.length ; i++) |
||||
ret = ret + options[i].value +'::'+options[i].text+";;"; |
||||
|
||||
return ret; |
||||
|
||||
} |
||||
--> |
||||
|
||||
</script> |
||||
<?php |
||||
/* |
||||
============================================================================== |
||||
FOOTER |
||||
============================================================================== |
||||
*/ |
||||
Display::display_footer(); |
||||
?> |
@ -0,0 +1,148 @@ |
||||
<?php |
||||
/* For licensing terms, see /dokeos_license.txt */ |
||||
/** |
||||
============================================================================== |
||||
* @package dokeos.admin |
||||
============================================================================== |
||||
*/ |
||||
|
||||
// Language files that should be included |
||||
$language_file = array('admin', 'registration'); |
||||
|
||||
$cidReset = true; |
||||
|
||||
// Including necessary libraries. |
||||
require '../inc/global.inc.php'; |
||||
$libpath = api_get_path(LIBRARY_PATH); |
||||
require_once $libpath.'fileManage.lib.php'; |
||||
require_once $libpath.'fileUpload.lib.php'; |
||||
require_once $libpath.'group_portal_manager.lib.php'; |
||||
require_once $libpath.'formvalidator/FormValidator.class.php'; |
||||
require_once $libpath.'image.lib.php'; |
||||
|
||||
// Section for the tabs |
||||
$this_section = SECTION_PLATFORM_ADMIN; |
||||
|
||||
// User permissions |
||||
api_protect_admin_script(); |
||||
|
||||
// Database table definitions |
||||
$table_admin = Database :: get_main_table(TABLE_MAIN_ADMIN); |
||||
$table_user = Database :: get_main_table(TABLE_MAIN_USER); |
||||
$database = Database::get_main_database(); |
||||
|
||||
if (!empty($_GET['message'])) { |
||||
$message = urldecode($_GET['message']); |
||||
} |
||||
|
||||
$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
||||
$tool_name = get_lang('AddGroup'); |
||||
|
||||
// Create the form |
||||
$form = new FormValidator('group_add'); |
||||
$form->addElement('header', '', $tool_name); |
||||
|
||||
// name |
||||
$form->addElement('text', 'name', get_lang('Name')); |
||||
$form->applyFilter('name', 'html_filter'); |
||||
$form->applyFilter('name', 'trim'); |
||||
$form->addRule('name', get_lang('ThisFieldIsRequired'), 'required'); |
||||
|
||||
// Description |
||||
$form->addElement('text', 'description', get_lang('Description')); |
||||
$form->applyFilter('description', 'html_filter'); |
||||
$form->applyFilter('description', 'trim'); |
||||
|
||||
|
||||
// url |
||||
$form->addElement('text', 'url', get_lang('URL')); |
||||
$form->applyFilter('url', 'html_filter'); |
||||
$form->applyFilter('url', 'trim'); |
||||
|
||||
// Picture |
||||
$form->addElement('file', 'picture', get_lang('AddPicture')); |
||||
$allowed_picture_types = array ('jpg', 'jpeg', 'png', 'gif'); |
||||
$form->addRule('picture', get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', 'filetype', $allowed_picture_types); |
||||
|
||||
// Status |
||||
$status = array(); |
||||
$status[GROUP_PERMISSION_OPEN] = get_lang('Open'); |
||||
$status[GROUP_PERMISSION_CLOSED] = get_lang('Closed'); |
||||
$form->addElement('select', 'visibility', get_lang('GroupPermissions'), $status); |
||||
|
||||
// Set default values |
||||
$defaults['status'] = GROUP_PERMISSION_OPEN; |
||||
|
||||
$form->setDefaults($defaults); |
||||
|
||||
// Submit button |
||||
$form->addElement('style_submit_button', 'submit', get_lang('Add'), 'class="add"'); |
||||
|
||||
// Validate form |
||||
if( $form->validate()) { |
||||
$check = Security::check_token('post'); |
||||
if ($check) { |
||||
$values = $form->exportValues(); |
||||
|
||||
$picture_element = & $form->getElement('picture'); |
||||
$picture = $picture_element->getValue(); |
||||
$picture_uri = ''; |
||||
$name = $values['name']; |
||||
$description = $values['description']; |
||||
$url = $values['url']; |
||||
$status = intval($values['visibility']); |
||||
$picture = $_FILES['picture']; |
||||
|
||||
$group_id = GroupPortalManager::add($name, $description, $url, $status); |
||||
|
||||
if (!empty($picture['name'])) { |
||||
$picture_uri = GroupPortalManager::update_group_picture($group_id, $_FILES['picture']['name'], $_FILES['picture']['tmp_name']); |
||||
GroupPortalManager::update($group_id, $name, $description, $url,$status, $picture_uri); |
||||
} |
||||
|
||||
//@todo send emails |
||||
|
||||
/* if (!empty($email) && $send_mail) { |
||||
$recipient_name = api_get_person_name($firstname, $lastname, null, PERSON_NAME_EMAIL_ADDRESS); |
||||
$emailsubject = '['.api_get_setting('siteName').'] '.get_lang('YourReg').' '.api_get_setting('siteName'); |
||||
|
||||
$sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS); |
||||
$email_admin = api_get_setting('emailAdministrator'); |
||||
|
||||
if ($_configuration['multiple_access_urls'] == true) { |
||||
$access_url_id = api_get_current_access_url_id(); |
||||
if ($access_url_id != -1) { |
||||
$url = api_get_access_url($access_url_id); |
||||
$emailbody = get_lang('Dear')." ".stripslashes(api_get_person_name($firstname, $lastname)).",\n\n".get_lang('YouAreReg')." ".api_get_setting('siteName') ." ".get_lang('WithTheFollowingSettings')."\n\n".get_lang('Username')." : ". $username ."\n". get_lang('Pass')." : ".stripslashes($password)."\n\n" .get_lang('Address') ." ". api_get_setting('siteName') ." ". get_lang('Is') ." : ". $url['url'] ."\n\n". get_lang('Problem'). "\n\n". get_lang('Formula').",\n\n".api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n". get_lang('Manager'). " ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n" .get_lang('Email') ." : ".api_get_setting('emailAdministrator'); |
||||
} |
||||
} |
||||
else { |
||||
$emailbody = get_lang('Dear')." ".stripslashes(api_get_person_name($firstname, $lastname)).",\n\n".get_lang('YouAreReg')." ".api_get_setting('siteName') ." ".get_lang('WithTheFollowingSettings')."\n\n".get_lang('Username')." : ". $username ."\n". get_lang('Pass')." : ".stripslashes($password)."\n\n" .get_lang('Address') ." ". api_get_setting('siteName') ." ". get_lang('Is') ." : ". $_configuration['root_web'] ."\n\n". get_lang('Problem'). "\n\n". get_lang('Formula').",\n\n".api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n". get_lang('Manager'). " ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n" .get_lang('Email') ." : ".api_get_setting('emailAdministrator'); |
||||
} |
||||
@api_mail($recipient_name, $email, $emailsubject, $emailbody, $sender_name, $email_admin); |
||||
}*/ |
||||
|
||||
Security::clear_token(); |
||||
$tok = Security::get_token(); |
||||
header('Location: group_list.php?action=show_message&message='.urlencode(get_lang('GroupAdded')).'&sec_token='.$tok); |
||||
exit (); |
||||
} |
||||
} else { |
||||
if (isset($_POST['submit'])) { |
||||
Security::clear_token(); |
||||
} |
||||
$token = Security::get_token(); |
||||
$form->addElement('hidden', 'sec_token'); |
||||
$form->setConstants(array('sec_token' => $token)); |
||||
} |
||||
|
||||
// Display form |
||||
Display::display_header($tool_name); |
||||
//api_display_tool_title($tool_name); |
||||
if(!empty($message)){ |
||||
Display::display_normal_message(stripslashes($message)); |
||||
} |
||||
$form->display(); |
||||
|
||||
// Footer |
||||
Display::display_footer(); |
@ -0,0 +1,143 @@ |
||||
<?php // $Id: user_edit.php 22233 2009-07-20 09:54:05Z ivantcholakov $
|
||||
/* For licensing terms, see /dokeos_license.txt */ |
||||
/** |
||||
============================================================================== |
||||
* @package dokeos.admin |
||||
============================================================================== |
||||
*/ |
||||
// Language files that should be included |
||||
$language_file = array('admin'); |
||||
$cidReset = true; |
||||
include '../inc/global.inc.php'; |
||||
$this_section = SECTION_PLATFORM_ADMIN; |
||||
api_protect_admin_script(); |
||||
|
||||
$libpath = api_get_path(LIBRARY_PATH); |
||||
require_once $libpath.'fileManage.lib.php'; |
||||
require_once $libpath.'fileUpload.lib.php'; |
||||
require_once $libpath.'group_portal_manager.lib.php'; |
||||
require_once $libpath.'formvalidator/FormValidator.class.php'; |
||||
require_once $libpath.'image.lib.php'; |
||||
require_once $libpath.'mail.lib.inc.php'; |
||||
|
||||
$group_id = isset($_GET['id']) ? intval($_GET['id']) : intval($_POST['id']); |
||||
$tool_name = get_lang('GroupEdit'); |
||||
|
||||
$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin')); |
||||
$interbreadcrumb[] = array('url' => 'group_list.php','name' => get_lang('GroupList')); |
||||
|
||||
$table_group = Database::get_main_table(TABLE_MAIN_GROUP); |
||||
|
||||
$sql = "SELECT * FROM $table_group WHERE id = '".$group_id."'"; |
||||
$res = Database::query($sql, __FILE__, __LINE__); |
||||
if (Database::num_rows($res) != 1) { |
||||
header('Location: group_list.php'); |
||||
exit; |
||||
} |
||||
|
||||
$group_data = Database::fetch_array($res, 'ASSOC'); |
||||
|
||||
// Create the form |
||||
$form = new FormValidator('group_edit', 'post', '', '', array('style' => 'width: 60%; float: '.($text_dir == 'rtl' ? 'right;' : 'left;'))); |
||||
$form->addElement('header', '', $tool_name); |
||||
$form->addElement('hidden', 'id', $group_id); |
||||
|
||||
// name |
||||
$form->addElement('text', 'name', get_lang('Name')); |
||||
$form->applyFilter('name', 'html_filter'); |
||||
$form->applyFilter('name', 'trim'); |
||||
$form->addRule('name', get_lang('ThisFieldIsRequired'), 'required'); |
||||
|
||||
// Description |
||||
$form->addElement('text', 'description', get_lang('Description')); |
||||
$form->applyFilter('description', 'html_filter'); |
||||
$form->applyFilter('description', 'trim'); |
||||
|
||||
// url |
||||
$form->addElement('text', 'url', get_lang('URL')); |
||||
$form->applyFilter('url', 'html_filter'); |
||||
$form->applyFilter('url', 'trim'); |
||||
|
||||
// Picture |
||||
$form->addElement('file', 'picture', get_lang('AddPicture')); |
||||
$allowed_picture_types = array ('jpg', 'jpeg', 'png', 'gif'); |
||||
$form->addRule('picture', get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', 'filetype', $allowed_picture_types); |
||||
if (strlen($group_data['picture_uri']) > 0) { |
||||
$form->addElement('checkbox', 'delete_picture', '', get_lang('DelImage')); |
||||
} |
||||
|
||||
|
||||
// Status |
||||
$status = array(); |
||||
$status[GROUP_PERMISSION_OPEN] = get_lang('Open'); |
||||
$status[GROUP_PERMISSION_CLOSED] = get_lang('Closed'); |
||||
|
||||
$form->addElement('select', 'visibility', get_lang('GroupPermissions'), $status, array()); |
||||
|
||||
// Submit button |
||||
$form->addElement('style_submit_button', 'submit', get_lang('ModifyInformation'), 'class="save"'); |
||||
|
||||
// Set default values |
||||
$form->setDefaults($group_data); |
||||
|
||||
// Validate form |
||||
if ( $form->validate()) { |
||||
$group = $form->exportValues(); |
||||
|
||||
$picture_element = & $form->getElement('picture'); |
||||
$picture = $picture_element->getValue(); |
||||
|
||||
$picture_uri = $group_data['picture_uri']; |
||||
if ($group['delete_picture']) { |
||||
$picture_uri = GroupPortalManager::delete_group_picture($group_id); |
||||
} |
||||
elseif (!empty($picture['name'])) { |
||||
$picture_uri = GroupPortalManager::update_group_picture($group_id, $_FILES['picture']['name'], $_FILES['picture']['tmp_name']); |
||||
} |
||||
|
||||
$name = $group['name']; |
||||
$description = $group['description']; |
||||
$url = $group['url']; |
||||
$status = intval($group['visibility']); |
||||
|
||||
GroupPortalManager::update($group_id, $name, $description, $url, $status, $picture_uri); |
||||
$tok = Security::get_token(); |
||||
header('Location: group_list.php?action=show_message&message='.urlencode(get_lang('GroupUpdated')).'&sec_token='.$tok); |
||||
exit(); |
||||
} |
||||
|
||||
Display::display_header($tool_name); |
||||
|
||||
// Group picture |
||||
$image_path = GroupPortalManager::get_group_picture_path_by_id($group_id,'web'); |
||||
$image_dir = $image_path['dir']; |
||||
$image = $image_path['file']; |
||||
$image_file = ($image != '' ? $image_dir.$image : api_get_path(WEB_CODE_PATH).'img/unknown_group.jpg'); |
||||
$image_size = api_getimagesize($image_file); |
||||
|
||||
$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').'; padding:5px;" '; |
||||
|
||||
if ($image_size[0] > 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; |
||||
$big_image_size = api_getimagesize($big_image); |
||||
$big_image_width = $big_image_size[0]; |
||||
$big_image_height = $big_image_size[1]; |
||||
$url_big_image = $big_image.'?rnd='.time(); |
||||
|
||||
if ($image == '') { |
||||
echo '<img '.$img_attributes.' />'; |
||||
} else { |
||||
echo '<input type="image" '.$img_attributes.' onclick="javascript: return show_image(\''.$url_big_image.'\',\''.$big_image_width.'\',\''.$big_image_height.'\');"/>'; |
||||
} |
||||
|
||||
// Display form |
||||
$form->display(); |
||||
|
||||
// Footer |
||||
Display::display_footer(); |
@ -0,0 +1,439 @@ |
||||
<?php // $Id: user_list.php 22292 2009-07-22 18:32:32Z herodoto $
|
||||
/* For licensing terms, see /dokeos_license.txt */ |
||||
/** |
||||
============================================================================== |
||||
@author Bart Mollet |
||||
* @package dokeos.admin |
||||
============================================================================== |
||||
*/ |
||||
|
||||
// name of the language file that needs to be included |
||||
$language_file = array ('registration','admin'); |
||||
$cidReset = true; |
||||
require ('../inc/global.inc.php'); |
||||
require_once (api_get_path(LIBRARY_PATH).'sortabletable.class.php'); |
||||
require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php'); |
||||
require_once (api_get_path(LIBRARY_PATH).'security.lib.php'); |
||||
require_once(api_get_path(LIBRARY_PATH).'xajax/xajax.inc.php'); |
||||
require_once (api_get_path(LIBRARY_PATH).'usermanager.lib.php'); |
||||
require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php'; |
||||
|
||||
$this_section = SECTION_PLATFORM_ADMIN; |
||||
api_protect_admin_script(true); |
||||
|
||||
|
||||
/** |
||||
* Get the total number of users on the platform |
||||
* @see SortableTable#get_total_number_of_items() |
||||
*/ |
||||
function get_number_of_groups() |
||||
{ |
||||
$group_table = Database :: get_main_table(TABLE_MAIN_GROUP); |
||||
$sql = "SELECT COUNT(g.id) AS total_number_of_items FROM $group_table g"; |
||||
|
||||
// adding the filter to see the user's only of the current access_url |
||||
/* |
||||
global $_configuration; |
||||
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls']==true && api_get_current_access_url_id()!=-1) { |
||||
$access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
||||
$sql.= " INNER JOIN $access_url_rel_user_table url_rel_user ON (u.user_id=url_rel_user.user_id)"; |
||||
} |
||||
*/ |
||||
if ( isset ($_GET['keyword'])) { |
||||
$keyword = Database::escape_string($_GET['keyword']); |
||||
$sql .= " WHERE (g.name LIKE '%".$keyword."%' OR g.description LIKE '%".$keyword."%' OR g.url LIKE '%".$keyword."%' )"; |
||||
} |
||||
|
||||
// adding the filter to see the user's only of the current access_url |
||||
/* |
||||
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls']==true && api_get_current_access_url_id()!=-1) { |
||||
$sql.= " AND url_rel_user.access_url_id=".api_get_current_access_url_id(); |
||||
}*/ |
||||
|
||||
$res = Database::query($sql, __FILE__, __LINE__); |
||||
$obj = Database::fetch_object($res); |
||||
return $obj->total_number_of_items; |
||||
} |
||||
/** |
||||
* Get the users to display on the current page (fill the sortable-table) |
||||
* @param int offset of first user to recover |
||||
* @param int Number of users to get |
||||
* @param int Column to sort on |
||||
* @param string Order (ASC,DESC) |
||||
* @see SortableTable#get_table_data($from) |
||||
*/ |
||||
function get_group_data($from, $number_of_items, $column, $direction) |
||||
{ |
||||
$group_table = Database :: get_main_table(TABLE_MAIN_GROUP); |
||||
|
||||
$sql = "SELECT |
||||
g.id AS col0, |
||||
g.name AS col1, |
||||
g.description AS col2, |
||||
g.visibility AS col3, |
||||
g.id AS col4 |
||||
FROM $group_table g "; |
||||
|
||||
// adding the filter to see the user's only of the current access_url |
||||
/*global $_configuration; |
||||
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls']==true && api_get_current_access_url_id()!=-1) { |
||||
$access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
||||
$sql.= " INNER JOIN $access_url_rel_user_table url_rel_user ON (u.user_id=url_rel_user.user_id)"; |
||||
}*/ |
||||
|
||||
if (isset ($_GET['keyword'])) { |
||||
$keyword = Database::escape_string($_GET['keyword']); |
||||
$sql .= " WHERE (g.name LIKE '%".$keyword."%' OR g.description LIKE '%".$keyword."%' OR g.url LIKE '%".$keyword."%' )"; |
||||
} |
||||
/* |
||||
// adding the filter to see the user's only of the current access_url |
||||
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls']==true && api_get_current_access_url_id()!=-1) { |
||||
$sql.= " AND url_rel_user.access_url_id=".api_get_current_access_url_id(); |
||||
}*/ |
||||
|
||||
if (!in_array($direction, array('ASC','DESC'))) { |
||||
$direction = 'ASC'; |
||||
} |
||||
$column = intval($column); |
||||
$from = intval($from); |
||||
$number_of_items = intval($number_of_items); |
||||
|
||||
$sql .= " ORDER BY col$column $direction "; |
||||
$sql .= " LIMIT $from,$number_of_items"; |
||||
|
||||
$res = Database::query($sql, __FILE__, __LINE__); |
||||
|
||||
$users = array (); |
||||
$t = time(); |
||||
while ($group = Database::fetch_row($res)) { |
||||
// forget about the expiration date field |
||||
$groups[] = $group; |
||||
} |
||||
return $groups; |
||||
} |
||||
|
||||
|
||||
function get_recent_group_data($from =0 , $number_of_items = 5, $column, $direction) |
||||
{ |
||||
$group_table = Database :: get_main_table(TABLE_MAIN_GROUP); |
||||
|
||||
$sql = "SELECT |
||||
g.id AS col0, |
||||
g.name AS col1, |
||||
g.description AS col2, |
||||
g.visibility AS col3, |
||||
g.id AS col4 |
||||
FROM $group_table g "; |
||||
|
||||
// adding the filter to see the user's only of the current access_url |
||||
/*global $_configuration; |
||||
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls']==true && api_get_current_access_url_id()!=-1) { |
||||
$access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
||||
$sql.= " INNER JOIN $access_url_rel_user_table url_rel_user ON (u.user_id=url_rel_user.user_id)"; |
||||
}*/ |
||||
|
||||
if (isset ($_GET['keyword'])) { |
||||
$keyword = Database::escape_string($_GET['keyword']); |
||||
$sql .= " WHERE (g.name LIKE '%".$keyword."%' OR g.description LIKE '%".$keyword."%' OR g.url LIKE '%".$keyword."%' )"; |
||||
} |
||||
/* |
||||
// adding the filter to see the user's only of the current access_url |
||||
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls']==true && api_get_current_access_url_id()!=-1) { |
||||
$sql.= " AND url_rel_user.access_url_id=".api_get_current_access_url_id(); |
||||
}*/ |
||||
|
||||
if (!in_array($direction, array('ASC','DESC'))) { |
||||
$direction = 'ASC'; |
||||
} |
||||
$column = intval($column); |
||||
$from = intval($from); |
||||
$number_of_items = intval($number_of_items); |
||||
|
||||
$sql .= " ORDER BY col$column $direction "; |
||||
$sql .= " LIMIT $from,$number_of_items"; |
||||
|
||||
$res = Database::query($sql, __FILE__, __LINE__); |
||||
|
||||
$users = array (); |
||||
$t = time(); |
||||
while ($group = Database::fetch_row($res)) { |
||||
// forget about the expiration date field |
||||
$groups[] = $group; |
||||
} |
||||
return $groups; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* Build the modify-column of the table |
||||
* @param int The user id |
||||
* @param string URL params to add to table links |
||||
* @param array Row of elements to alter |
||||
* @return string Some HTML-code with modify-buttons |
||||
*/ |
||||
function modify_filter($group_id,$url_params,$row) |
||||
{ |
||||
global $charset; |
||||
global $_user; |
||||
global $_admins_list; |
||||
if (api_is_platform_admin()) { |
||||
$result .= '<a href="'.api_get_path(WEB_CODE_PATH).'admin/add_users_to_group.php?id='.$group_id.'">'.Display::return_icon('add_user_big.gif',get_lang('AddUsersToGroup')).'</a>'; |
||||
$result .= '<a href="group_edit.php?id='.$group_id.'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a> '; |
||||
$result .= '<a href="group_list.php?action=delete_group&group_id='.$group_id.'&'.$url_params.'&sec_token='.$_SESSION['sec_token'].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset))."'".')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>'; |
||||
|
||||
|
||||
} |
||||
return $result; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* Build the active-column of the table to lock or unlock a certain user |
||||
* lock = the user can no longer use this account |
||||
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University |
||||
* @param int $active the current state of the account |
||||
* @param int $user_id The user id |
||||
* @param string $url_params |
||||
* @return string Some HTML-code with the lock/unlock button |
||||
*/ |
||||
function active_filter($active, $url_params, $row) { |
||||
global $_user; |
||||
|
||||
if ($active=='1') { |
||||
$action='lock'; |
||||
$image='right'; |
||||
} elseif ($active=='-1') { |
||||
$action='edit'; |
||||
$image='expired'; |
||||
} elseif ($active=='0') { |
||||
$action='unlock'; |
||||
$image='wrong'; |
||||
} |
||||
|
||||
if ($action=='edit') { |
||||
$result = Display::return_icon($image.'.gif', get_lang('AccountExpired')); |
||||
}elseif ($row['0']<>$_user['user_id']) { // you cannot lock yourself out otherwise you could disable all the accounts including your own => everybody is locked out and nobody can change it anymore. |
||||
$result = '<a href="user_list.php?action='.$action.'&user_id='.$row['0'].'&'.$url_params.'&sec_token='.$_SESSION['sec_token'].'">'.Display::return_icon($image.'.gif', get_lang(ucfirst($action))).'</a>'; |
||||
} |
||||
return $result; |
||||
} |
||||
|
||||
/** |
||||
* Lock or unlock a user |
||||
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University |
||||
* @param int $status, do we want to lock the user ($status=lock) or unlock it ($status=unlock) |
||||
* @param int $user_id The user id |
||||
* @return language variable |
||||
*/ |
||||
function lock_unlock_user($status,$user_id) |
||||
{ |
||||
$user_table = Database :: get_main_table(TABLE_MAIN_USER); |
||||
if ($status=='lock') |
||||
{ |
||||
$status_db='0'; |
||||
$return_message=get_lang('UserLocked'); |
||||
} |
||||
if ($status=='unlock') |
||||
{ |
||||
$status_db='1'; |
||||
$return_message=get_lang('UserUnlocked'); |
||||
} |
||||
|
||||
if(($status_db=='1' OR $status_db=='0') AND is_numeric($user_id)) |
||||
{ |
||||
$sql="UPDATE $user_table SET active='".Database::escape_string($status_db)."' WHERE user_id='".Database::escape_string($user_id)."'"; |
||||
$result = Database::query($sql, __FILE__, __LINE__); |
||||
} |
||||
|
||||
if ($result) |
||||
{ |
||||
return $return_message; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Instead of displaying the integer of the status, we give a translation for the status |
||||
* |
||||
* @param integer $status |
||||
* @return string translation |
||||
* |
||||
* @version march 2008 |
||||
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium |
||||
*/ |
||||
function status_filter($status) |
||||
{ |
||||
$statusname = api_get_status_langvars(); |
||||
return $statusname[$status]; |
||||
} |
||||
|
||||
|
||||
/** |
||||
============================================================================== |
||||
INIT SECTION |
||||
============================================================================== |
||||
*/ |
||||
$action = $_GET["action"]; |
||||
|
||||
if (isset ($_GET['search']) && $_GET['search'] == 'advanced') { |
||||
$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin')); |
||||
$interbreadcrumb[] = array ("url" => 'user_list.php', "name" => get_lang('UserList')); |
||||
$tool_name = get_lang('SearchAUser'); |
||||
Display :: display_header($tool_name); |
||||
//api_display_tool_title($tool_name); |
||||
$form = new FormValidator('advanced_search','get'); |
||||
$form->addElement('header', '', $tool_name); |
||||
$form->add_textfield('keyword_firstname',get_lang('FirstName'),false); |
||||
$form->add_textfield('keyword_lastname',get_lang('LastName'),false); |
||||
$form->add_textfield('keyword_username',get_lang('LoginName'),false); |
||||
$form->add_textfield('keyword_email',get_lang('Email'),false); |
||||
$form->add_textfield('keyword_officialcode',get_lang('OfficialCode'),false); |
||||
$status_options = array(); |
||||
$status_options['%'] = get_lang('All'); |
||||
$status_options[STUDENT] = get_lang('Student'); |
||||
$status_options[COURSEMANAGER] = get_lang('Teacher'); |
||||
$status_options[SESSIONADMIN] = get_lang('Administrator');// |
||||
$form->addElement('select','keyword_status',get_lang('Status'),$status_options); |
||||
$active_group = array(); |
||||
$active_group[] = $form->createElement('checkbox','keyword_active','',get_lang('Active')); |
||||
$active_group[] = $form->createElement('checkbox','keyword_inactive','',get_lang('Inactive')); |
||||
$form->addGroup($active_group,'',get_lang('ActiveAccount'),'<br/>',false); |
||||
$form->addElement('style_submit_button', 'submit',get_lang('SearchUsers'),'class="search"'); |
||||
$defaults['keyword_active'] = 1; |
||||
$defaults['keyword_inactive'] = 1; |
||||
$form->setDefaults($defaults); |
||||
$form->display(); |
||||
} |
||||
else |
||||
{ |
||||
$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin')); |
||||
$tool_name = get_lang('UserList'); |
||||
Display :: display_header($tool_name, ""); |
||||
|
||||
//api_display_tool_title($tool_name); |
||||
if (isset ($_GET['action'])) { |
||||
$check = Security::check_token('get'); |
||||
if($check) { |
||||
switch ($_GET['action']) { |
||||
case 'show_message' : |
||||
if (!empty($_GET['warn'])) { |
||||
// to prevent too long messages |
||||
if ($_GET['warn'] == 'session_message'){ |
||||
$_GET['warn'] = $_SESSION['session_message_import_users']; |
||||
} |
||||
Display::display_warning_message(urldecode($_GET['warn']),false); |
||||
} |
||||
if (!empty($_GET['message'])) { |
||||
Display :: display_confirmation_message(stripslashes($_GET['message'])); |
||||
} |
||||
break; |
||||
case 'delete_group' : |
||||
if (api_is_platform_admin()) { |
||||
if (GroupPortalManager :: delete($_GET['group_id'])) { |
||||
Display :: display_confirmation_message(get_lang('GroupDeleted')); |
||||
} else { |
||||
Display :: display_error_message(get_lang('CannotDeleteGroup')); |
||||
} |
||||
} |
||||
break; |
||||
case 'lock' : |
||||
$message=lock_unlock_user('lock',$_GET['user_id']); |
||||
Display :: display_normal_message($message); |
||||
break; |
||||
case 'unlock'; |
||||
$message=lock_unlock_user('unlock',$_GET['user_id']); |
||||
Display :: display_normal_message($message); |
||||
break; |
||||
|
||||
} |
||||
Security::clear_token(); |
||||
} |
||||
} |
||||
if (isset ($_POST['action'])) |
||||
{ |
||||
$check = Security::check_token('get'); |
||||
if($check) |
||||
{ |
||||
switch ($_POST['action']) |
||||
{ |
||||
case 'delete' : |
||||
if (api_is_platform_admin()) { |
||||
$number_of_selected_users = count($_POST['id']); |
||||
$number_of_deleted_users = 0; |
||||
if (is_array($_POST['id'])) { |
||||
foreach ($_POST['id'] as $index => $user_id) |
||||
{ |
||||
if($user_id != $_user['user_id']) |
||||
{ |
||||
if(UserManager :: delete_user($user_id)) |
||||
{ |
||||
$number_of_deleted_users++; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
if($number_of_selected_users == $number_of_deleted_users) |
||||
{ |
||||
Display :: display_confirmation_message(get_lang('SelectedUsersDeleted')); |
||||
} |
||||
else |
||||
{ |
||||
Display :: display_error_message(get_lang('SomeUsersNotDeleted')); |
||||
} |
||||
} |
||||
break; |
||||
} |
||||
Security::clear_token(); |
||||
} |
||||
} |
||||
// Create a search-box |
||||
$form = new FormValidator('search_simple','get','','',null,false); |
||||
$renderer =& $form->defaultRenderer(); |
||||
$renderer->setElementTemplate('<span>{element}</span> '); |
||||
$form->addElement('text','keyword',get_lang('keyword')); |
||||
$form->addElement('style_submit_button', 'submit',get_lang('Search'),'class="search"'); |
||||
//$form->addElement('static','search_advanced_link',null,'<a href="user_list.php?search=advanced">'.get_lang('AdvancedSearch').'</a>'); |
||||
echo '<div class="actions" style="width:100%;">'; |
||||
if (api_is_platform_admin()) { |
||||
echo '<span style="float:right; padding-top:7px;">'. |
||||
'<a href="'.api_get_path(WEB_CODE_PATH).'admin/group_add.php">'.Display::return_icon('add_user_big.gif',get_lang('AddUsers')).get_lang('AddGroup').'</a>'. |
||||
'</span>'; |
||||
} |
||||
$form->display(); |
||||
echo '</div>'; |
||||
if (isset ($_GET['keyword'])) { |
||||
$parameters = array ('keyword' => Security::remove_XSS($_GET['keyword'])); |
||||
} |
||||
// Create a sortable table with user-data |
||||
$parameters['sec_token'] = Security::get_token(); |
||||
|
||||
// get the list of all admins to mark them in the users list |
||||
$admin_table = Database::get_main_table(TABLE_MAIN_ADMIN); |
||||
$sql_admin = "SELECT user_id FROM $admin_table"; |
||||
$res_admin = Database::query($sql_admin); |
||||
$_admins_list = array(); |
||||
while ($row_admin = Database::fetch_row($res_admin)) { |
||||
$_admins_list[] = $row_admin[0]; |
||||
} |
||||
|
||||
$table = new SortableTable('users', 'get_number_of_groups', 'get_group_data', 2); |
||||
$table->set_additional_parameters($parameters); |
||||
$table->set_header(0, '', false); |
||||
$table->set_header(1, get_lang('Name')); |
||||
$table->set_header(2, get_lang('Description')); |
||||
$table->set_header(3, get_lang('Visibility')); |
||||
$table->set_header(4, '', false); |
||||
$table->set_column_filter(4, 'modify_filter'); |
||||
//$table->set_column_filter(6, 'status_filter'); |
||||
//$table->set_column_filter(7, 'active_filter'); |
||||
//$table->set_column_filter(8, 'modify_filter'); |
||||
if (api_is_platform_admin()) |
||||
$table->set_form_actions(array ('delete' => get_lang('DeleteFromPlatform'))); |
||||
$table->display(); |
||||
} |
||||
/* |
||||
============================================================================== |
||||
FOOTER |
||||
============================================================================== |
||||
*/ |
||||
Display :: display_footer(); |
||||
?> |
File diff suppressed because it is too large
Load Diff
@ -1,29 +1,7 @@ |
||||
<?php // $Id: notify.php 20962 2009-05-25 03:15:53Z iflorespaz $
|
||||
/* |
||||
============================================================================== |
||||
Dokeos - elearning and course management software |
||||
|
||||
Copyright (c) 2009 Dokeos SPRL |
||||
Copyright (c) 2009 Julio Montoya Armas <gugli100@gmail.com> |
||||
Copyright (c) Facultad de Matematicas, UADY (México) |
||||
Copyright (c) Evie, Free University of Brussels (Belgium) |
||||
|
||||
For a full list of contributors, see "credits.txt". |
||||
The full license can be read in "license.txt". |
||||
|
||||
This program is free software; you can redistribute it and/or |
||||
modify it under the terms of the GNU General Public License |
||||
as published by the Free Software Foundation; either version 2 |
||||
of the License, or (at your option) any later version. |
||||
|
||||
See the GNU General Public License for more details. |
||||
|
||||
Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium |
||||
Mail: info@dokeos.com |
||||
============================================================================== |
||||
*/ |
||||
/* For licensing terms, see /dokeos_license.txt */ |
||||
require_once '../inc/global.inc.php'; |
||||
require_once api_get_path(LIBRARY_PATH).'message.lib.php'; |
||||
header("Cache-Control: no-cache, must-revalidate"); |
||||
echo get_new_messages(); |
||||
echo MessageManager::get_new_messages(); |
||||
?> |
@ -0,0 +1,150 @@ |
||||
<?php |
||||
/* For licensing terms, see /dokeos_license.txt */ |
||||
|
||||
$language_file = array('admin'); |
||||
require '../inc/global.inc.php'; |
||||
require_once api_get_path(CONFIGURATION_PATH).'profile.conf.php'; |
||||
require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php'; |
||||
require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php'; |
||||
require_once api_get_path(LIBRARY_PATH).'image.lib.php'; |
||||
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php'; |
||||
require_once api_get_path(LIBRARY_PATH).'social.lib.php'; |
||||
|
||||
$this_section = SECTION_SOCIAL; |
||||
|
||||
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.js" type="text/javascript" language="javascript"></script>'; //jQuery |
||||
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-1.1.3.1.pack.js" type="text/javascript"></script>'; |
||||
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.history_remote.pack.js" type="text/javascript"></script>'; |
||||
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.tabs.pack.js" type="text/javascript"></script>'; |
||||
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/thickbox.js" type="text/javascript" language="javascript"></script>'; |
||||
$htmlHeadXtra[] = '<script type="text/javascript"> |
||||
|
||||
|
||||
function add_group (my_action,name_rs) { |
||||
if(my_action=="show") { |
||||
$("div#div_content_messages").html(""); |
||||
$("div#div_content_table_data").html(""); |
||||
$(".confirmation-message").remove(); |
||||
$(".normal-message").remove(); |
||||
$(".error-message").remove(); |
||||
$.ajax({ |
||||
contentType: "application/x-www-form-urlencoded", |
||||
type: "GET", |
||||
url: "group_add.php", |
||||
data:"rs="+name_rs, |
||||
success: function(datos) { |
||||
$("div#div_add_group").html(datos); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
function delete_friend (element_div) { |
||||
id_image=$(element_div).attr("id"); |
||||
user_id=id_image.split("_"); |
||||
if (confirm("'.get_lang('Delete', '').'")) { |
||||
$.ajax({ |
||||
contentType: "application/x-www-form-urlencoded", |
||||
type: "POST", |
||||
url: "../social/register_friend.php", |
||||
data: "delete_friend_id="+user_id[1], |
||||
success: function(datos) { |
||||
//alert(datos); |
||||
$("div#"+"div_"+user_id[1]).hide("slow"); |
||||
$("div#"+"div_"+user_id[1]).html(""); |
||||
clear_form (); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function search_image_social(element_html) { |
||||
name_search=$(element_html).attr("value"); |
||||
$.ajax({ |
||||
contentType: "application/x-www-form-urlencoded", |
||||
type: "POST", |
||||
url: "../social/show_search_image.inc.php", |
||||
data: "search_name_q="+name_search, |
||||
success: function(datos) { |
||||
$("div#div_content_table").html(datos); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
function show_icon_delete(element_html) { |
||||
elem_id=$(element_html).attr("id"); |
||||
id_elem=elem_id.split("_"); |
||||
ident="#img_"+id_elem[1]; |
||||
$(ident).attr("src","../img/delete.gif"); |
||||
$(ident).attr("alt","'.get_lang('Delete', '').'"); |
||||
$(ident).attr("title","'.get_lang('Delete', '').'"); |
||||
} |
||||
|
||||
|
||||
function hide_icon_delete(element_html) { |
||||
elem_id=$(element_html).attr("id"); |
||||
id_elem=elem_id.split("_"); |
||||
ident="#img_"+id_elem[1]; |
||||
$(ident).attr("src","../img/blank.gif"); |
||||
$(ident).attr("alt",""); |
||||
$(ident).attr("title",""); |
||||
} |
||||
|
||||
|
||||
</script>'; |
||||
|
||||
$interbreadcrumb[]= array ('url' =>'home.php','name' => get_lang('Social')); |
||||
|
||||
Display :: display_header($tool_name, 'Groups'); |
||||
SocialManager::show_social_menu(); |
||||
|
||||
echo '<div class="actions-title">'; |
||||
echo get_lang('MyFriends'); |
||||
echo '</div>'; |
||||
|
||||
|
||||
//$list_path_friends=array(); |
||||
$request=api_is_xml_http_request(); |
||||
$language_variable=api_xml_http_response_encode(get_lang('Contacts')); |
||||
//api_display_tool_title($language_variable); |
||||
|
||||
$user_id=api_get_user_id(); |
||||
$image_path = UserManager::get_user_picture_path_by_id ($user_id,'web',false,true); |
||||
?> |
||||
<div align="center" > |
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="social-content-table"> |
||||
<tr> |
||||
<td height="25" valign="top"> |
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="social-subtitle-search"> |
||||
<tr> |
||||
<td width="100%" valign="top" class="social-align-box"> <?php echo api_xml_http_response_encode(get_lang('Search')) .' : '; ?> |
||||
<input class="social-search-image" type="text" class="search-image" id="id_search_image" name="id_search_image" value="" onkeyup="search_image_social(this)" /> |
||||
</td> |
||||
</tr> |
||||
</table></td> |
||||
</tr> |
||||
<tr> |
||||
<td height="175" valign="top"> |
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0" > |
||||
<tr> |
||||
<td height="153" valign="top"> |
||||
<?php |
||||
echo '<div id="div_content_table">'; |
||||
require_once 'show_search_image.inc.php'; |
||||
echo '</div>'; |
||||
?> |
||||
</td> |
||||
</tr> |
||||
</table></td> |
||||
</tr> |
||||
</table> |
||||
</div> |
||||
<?php |
||||
Display :: display_footer(); |
||||
?> |
@ -0,0 +1,78 @@ |
||||
<?php |
||||
$language_file= 'admin'; |
||||
$cidReset=true; |
||||
require_once '../inc/global.inc.php'; |
||||
require_once api_get_path(LIBRARY_PATH).'/formvalidator/FormValidator.class.php'; |
||||
$request=api_is_xml_http_request(); |
||||
$nameTools = api_xml_http_response_encode(get_lang('AddGroup')); |
||||
|
||||
global $charset; |
||||
$table_message = Database::get_main_table(TABLE_MESSAGE); |
||||
$request=api_is_xml_http_request(); |
||||
if ($request===true) { |
||||
$form = new FormValidator('add_group','post','index.php?add_group=1#remote-tab-7'); |
||||
} else { |
||||
$form = new FormValidator('add_group'); |
||||
} |
||||
|
||||
// name |
||||
$form->addElement('text', 'name', get_lang('Name')); |
||||
$form->applyFilter('name', 'html_filter'); |
||||
$form->applyFilter('name', 'trim'); |
||||
$form->addRule('name', get_lang('ThisFieldIsRequired'), 'required'); |
||||
|
||||
// Description |
||||
$form->addElement('text', 'description', get_lang('Description')); |
||||
$form->applyFilter('description', 'html_filter'); |
||||
$form->applyFilter('description', 'trim'); |
||||
|
||||
|
||||
// url |
||||
$form->addElement('text', 'url', get_lang('URL')); |
||||
$form->applyFilter('url', 'html_filter'); |
||||
$form->applyFilter('url', 'trim'); |
||||
|
||||
// Picture |
||||
$form->addElement('file', 'picture', get_lang('AddPicture')); |
||||
|
||||
$allowed_picture_types = array ('jpg', 'jpeg', 'png', 'gif'); |
||||
|
||||
$form->addRule('picture', get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', 'filetype', $allowed_picture_types); |
||||
|
||||
|
||||
/* |
||||
$form->add_textfield('id_text_name', api_xml_http_response_encode(get_lang('SendMessageTo')),true,array('size' => 40,'id'=>'id_text_name','onkeyup'=>'send_request_and_search()','autocomplete'=>'off','style'=>'padding:0px')); |
||||
$form->addRule('id_text_name', api_xml_http_response_encode(get_lang('ThisFieldIsRequired')), 'required'); |
||||
$form->addElement('html','<div id="id_div_search" style="padding:0px" class="message-select-box" > </div>'); |
||||
$form->addElement('hidden','user_list',0,array('id'=>'user_list')); |
||||
|
||||
$form->add_textfield('title', api_xml_http_response_encode(get_lang('Title'))); |
||||
$form->add_html_editor('content', '', false, false, array('ToolbarSet' => 'Messages', 'Width' => '95%', 'Height' => '250')); |
||||
if (isset($_GET['re_id'])) { |
||||
$form->addElement('hidden','re_id',Security::remove_XSS($_GET['re_id'])); |
||||
$form->addElement('hidden','save_form','save_form'); |
||||
} |
||||
|
||||
*/ |
||||
|
||||
$form->addElement('style_submit_button','add_group', api_xml_http_response_encode(get_lang('AddGroup')),'class="save"'); |
||||
|
||||
$form->setRequiredNote(api_xml_http_response_encode('<span class="form_required">*</span> <small>'.get_lang('ThisFieldIsRequired').'</small>')); |
||||
$form->setDefaults($default); |
||||
if ($form->validate()) { |
||||
$values = $form->exportValues(); |
||||
var_dump($values); |
||||
$receiver_user_id = $values['user_list']; |
||||
$title = $values['title']; |
||||
$content = $values['content']; |
||||
//all is well, send the message |
||||
//MessageManager::send_message($receiver_user_id, $title, $content); |
||||
//MessageManager::display_success_message($receiver_user_id); |
||||
} else { |
||||
$form->display(); |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
?> |
@ -0,0 +1,17 @@ |
||||
<?php |
||||
/* For licensing terms, see /dokeos_license.txt */ |
||||
|
||||
$language_file = array('admin'); |
||||
require '../inc/global.inc.php'; |
||||
require_once api_get_path(CONFIGURATION_PATH).'profile.conf.php'; |
||||
require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php'; |
||||
require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php'; |
||||
require_once api_get_path(LIBRARY_PATH).'image.lib.php'; |
||||
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php'; |
||||
require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php'; |
||||
Display :: display_header($tool_name, "User"); |
||||
|
||||
$group_id = intval($_GET['id']); |
||||
|
||||
Display :: display_footer(); |
||||
?> |
@ -0,0 +1,120 @@ |
||||
<?php |
||||
/* For licensing terms, see /dokeos_license.txt */ |
||||
|
||||
$language_file = array('admin'); |
||||
require '../inc/global.inc.php'; |
||||
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php'; |
||||
require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php'; |
||||
require_once api_get_path(LIBRARY_PATH).'social.lib.php'; |
||||
|
||||
$this_section = SECTION_SOCIAL; |
||||
|
||||
$interbreadcrumb[]= array ('url' =>'home.php','name' => get_lang('Social')); |
||||
Display :: display_header($tool_name, 'Groups'); |
||||
|
||||
//show the action menu |
||||
SocialManager::show_social_menu(); |
||||
echo '<div class="actions-title">'; |
||||
echo get_lang('Groups'); |
||||
echo '</div>'; |
||||
|
||||
$group_id = intval($_GET['id']); |
||||
|
||||
if ($group_id != 0 ) { |
||||
$group_info = GroupPortalManager::get_group_data($group_id); |
||||
$picture = GroupPortalManager::get_picture_group($group_id, $group_info['picture_uri'],160,'medium_'); |
||||
$tags = GroupPortalManager::get_group_tags($group_id,true); |
||||
$users = GroupPortalManager::get_users_by_group($group_id,true); |
||||
|
||||
|
||||
//var_dump($users); |
||||
|
||||
|
||||
//Group's title |
||||
echo '<h1>'.$group_info['name'].'</h1>'; |
||||
|
||||
//image |
||||
echo '<div id="group_image">'; |
||||
echo $img = '<img src="'.$picture['file'].'" />'; |
||||
echo '</div>'; |
||||
|
||||
//description |
||||
echo '<div id="group_description">'; |
||||
echo $group_info['description']; |
||||
echo '</div>'; |
||||
|
||||
//Privacy |
||||
echo '<div id="group_privacy">'; |
||||
echo get_lang('Privacy').' : '; |
||||
if ($group_info['visibility']== GROUP_PERMISSION_OPEN) { |
||||
echo get_lang('ThisIsAnOpenGroup'); |
||||
} elseif ($group_info['visibility']== GROUP_PERMISSION_CLOSED) { |
||||
echo get_lang('ThisIsACloseGroup'); |
||||
} |
||||
echo '</div>'; |
||||
|
||||
//group tags |
||||
if (!empty($tags)) { |
||||
echo '<div id="group_tags">'; |
||||
echo get_lang('Tags').' : '.$tags; |
||||
echo '</div>'; |
||||
} |
||||
|
||||
echo '<div id="group_members">'; |
||||
echo get_lang('Members').' : '; |
||||
foreach($users as $user) { |
||||
echo $user['picture_uri'].$user['firstname'].$user['lastname'].'<br />'; |
||||
} |
||||
echo '</div>'; |
||||
|
||||
|
||||
echo '<div id="group_permissions">'; |
||||
if (in_array(api_get_user_id(), $users)) { |
||||
//im a member |
||||
if (isset($users[api_get_user_id()]) && $users[api_get_user_id()]['relation_info']!='') { |
||||
$my_group_role = $users[api_get_get_user_id()]['relation_info']; |
||||
// just a reader |
||||
if ($my_group_role == GROUP_USER_PERMISSION_READER) { |
||||
echo 'Im just a reader'; |
||||
echo 'Invite others'; |
||||
echo 'Leave group'; |
||||
//the main admin |
||||
} elseif ($my_group_role == GROUP_USER_PERMISSION_ADMIN) { |
||||
echo 'Imm the admin'; |
||||
echo 'Edit group'; |
||||
echo 'Invite others'; |
||||
} |
||||
} else { |
||||
//im not a member |
||||
echo 'I should register'; |
||||
} |
||||
} else { |
||||
//im not a member |
||||
echo 'I should register'; |
||||
} |
||||
echo '</div>'; |
||||
|
||||
} else { |
||||
echo '<h1>'.get_lang('Newest').'</h1>'; |
||||
echo '<h1>'.get_lang('Popular').'</h1>'; |
||||
echo '<h1>'.get_lang('MyGroups').'</h1>'; |
||||
|
||||
$results = GroupPortalManager::get_groups_by_user(api_get_user_id(), 0, true); |
||||
$groups = array(); |
||||
foreach ($results as $result) { |
||||
$id = $result['id']; |
||||
$url_open = '<a href="groups.php?id='.$id.'">'; |
||||
$url_close = '</a>'; |
||||
|
||||
$groups[]= array($url_open.$result['picture_uri'].$url_close, $url_open.$result['name'].$url_close); |
||||
} |
||||
|
||||
Display::display_sortable_grid('search_users', array(), $groups, array('hide_navigation'=>true, 'per_page' => 100), $query_vars, false, array(true, true, true,false)); |
||||
|
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
Display :: display_footer(); |
||||
?> |
@ -0,0 +1,611 @@ |
||||
<?php //$id: $
|
||||
/* For licensing terms, see /dokeos_license.txt */ |
||||
/** |
||||
* This is the home of a social network user, here we should show the latest info/status of our friends |
||||
* @author Julio Montoya <gugli100@gmail.com> |
||||
* @package dokeos.social |
||||
*/ |
||||
|
||||
$language_file = array('registration','messages','userInfo','admin','forum','blog'); |
||||
$cidReset = true; |
||||
require '../inc/global.inc.php'; |
||||
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php'; |
||||
require_once api_get_path(LIBRARY_PATH).'social.lib.php'; |
||||
require_once api_get_path(LIBRARY_PATH).'array.lib.php'; |
||||
$user_id = api_get_user_id(); |
||||
$show_full_profile = true; |
||||
//social tab |
||||
$this_section = SECTION_SOCIAL; |
||||
|
||||
//I'm your friend? I can see your profile? |
||||
if (isset($_GET['u'])) { |
||||
$user_id = (int) Database::escape_string($_GET['u']); |
||||
// It's me! |
||||
if (api_get_user_id() != $user_id) { |
||||
$user_info = UserManager::get_user_info_by_id($user_id); |
||||
$show_full_profile = false; |
||||
if ($user_info==false) { |
||||
// user does no exist !! |
||||
api_not_allowed(); |
||||
} else { |
||||
//checking the relationship between me and my friend |
||||
$my_status= SocialManager::get_relation_between_contacts(api_get_user_id(), $user_id); |
||||
if (in_array($my_status, array(SOCIALPARENT, SOCIALFRIEND, SOCIALGOODFRIEND))) { |
||||
$show_full_profile = true; |
||||
} |
||||
//checking the relationship between my friend and me |
||||
$my_friend_status = SocialManager::get_relation_between_contacts($user_id, api_get_user_id()); |
||||
if (in_array($my_friend_status, array(SOCIALPARENT, SOCIALFRIEND, SOCIALGOODFRIEND))) { |
||||
$show_full_profile = true; |
||||
} else { |
||||
// im probably not a good friend |
||||
$show_full_profile = false; |
||||
} |
||||
} |
||||
} else { |
||||
$user_info = UserManager::get_user_info_by_id($user_id); |
||||
} |
||||
} else { |
||||
$user_info = UserManager::get_user_info_by_id($user_id); |
||||
} |
||||
|
||||
$libpath = api_get_path(LIBRARY_PATH); |
||||
require_once api_get_path(SYS_CODE_PATH).'calendar/myagenda.inc.php'; |
||||
require_once api_get_path(SYS_CODE_PATH).'announcements/announcements.inc.php'; |
||||
require_once $libpath.'course.lib.php'; |
||||
require_once $libpath.'formvalidator/FormValidator.class.php'; |
||||
require_once $libpath.'magpierss/rss_fetch.inc'; |
||||
|
||||
api_block_anonymous_users(); |
||||
|
||||
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.js" type="text/javascript" language="javascript"></script>'; //jQuery |
||||
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.corners.min.js" type="text/javascript" language="javascript"></script>'; //jQuery corner |
||||
$htmlHeadXtra[] = '<script type="text/javascript" src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/thickbox.js"></script>'; |
||||
$htmlHeadXtra[] = '<link rel="stylesheet" href="'.api_get_path(WEB_LIBRARY_PATH).'javascript/thickbox.css" type="text/css" media="projection, screen">'; |
||||
$htmlHeadXtra[] = ' |
||||
<script type="text/javascript"> |
||||
function toogle_function (element_html, course_code){ |
||||
elem_id=$(element_html).attr("id"); |
||||
id_elem=elem_id.split("_"); |
||||
ident="div#div_group_"+id_elem[1]; |
||||
|
||||
id_button="#btn_"+id_elem[1]; |
||||
elem_src=$(id_button).attr("src"); |
||||
image_show=elem_src.split("/"); |
||||
my_image=image_show[2]; |
||||
var content = \'social_content\' + id_elem[1]; |
||||
if (my_image=="nolines_plus.gif") { |
||||
$(id_button).attr("src","../img/nolines_minus.gif"); var action = "load_course"; |
||||
$("div#"+content).show("slow"); |
||||
} else { |
||||
$("div#"+content).hide("slow"); |
||||
$(id_button).attr("src","../img/nolines_plus.gif"); var action = "unload"; |
||||
return false; |
||||
} |
||||
|
||||
$.ajax({ |
||||
contentType: "application/x-www-form-urlencoded", |
||||
beforeSend: function(objeto) { |
||||
$("div#"+content).html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); }, |
||||
type: "POST", |
||||
url: "../social/data_personal.inc.php", |
||||
data: "load_ajax="+id_elem+"&action="+action+"&course_code="+course_code, |
||||
success: function(datos) { |
||||
//$("div#"+name_div_id).hide("slow"); |
||||
$("div#"+content).html(datos); |
||||
} |
||||
}); |
||||
} |
||||
</script>'; |
||||
$htmlHeadXtra[] = '<script type="text/javascript"> |
||||
$(document).ready(function (){ |
||||
$("input#id_btn_send_invitation").bind("click", function(){ |
||||
if (confirm("'.get_lang('SendMessageInvitation', '').'")) { |
||||
$("#form_register_friend").submit(); |
||||
} |
||||
}); |
||||
}); |
||||
function change_panel (mypanel_id,myuser_id) { |
||||
$.ajax({ |
||||
contentType: "application/x-www-form-urlencoded", |
||||
beforeSend: function(objeto) { |
||||
$("#id_content_panel").html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); }, |
||||
type: "POST", |
||||
url: "../messages/send_message.php", |
||||
data: "panel_id="+mypanel_id+"&user_id="+myuser_id, |
||||
success: function(datos) { |
||||
$("div#id_content_panel_init").html(datos); |
||||
$("div#display_response_id").html(""); |
||||
} |
||||
}); |
||||
} |
||||
function action_database_panel (option_id,myuser_id) { |
||||
|
||||
if (option_id==5) { |
||||
my_txt_subject=$("#txt_subject_id").val(); |
||||
} else { |
||||
my_txt_subject="clear"; |
||||
} |
||||
my_txt_content=$("#txt_area_invite").val(); |
||||
if (my_txt_content.length==0 || my_txt_subject.length==0) { |
||||
$("#display_response_id").html(" '.get_lang('MessageInvitationNotSent', '').'"); |
||||
setTimeout("message_information_display()",3000); |
||||
return false; |
||||
} |
||||
$.ajax({ |
||||
contentType: "application/x-www-form-urlencoded", |
||||
beforeSend: function(objeto) { |
||||
$("#display_response_id").html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); }, |
||||
type: "POST", |
||||
url: "../messages/send_message.php", |
||||
data: "panel_id="+option_id+"&user_id="+myuser_id+"&txt_subject="+my_txt_subject+"&txt_content="+my_txt_content, |
||||
success: function(datos) { |
||||
$("#display_response_id").html(datos); |
||||
} |
||||
}); |
||||
} |
||||
function display_hide () { |
||||
setTimeout("hide_display_message()",3000); |
||||
} |
||||
function message_information_display() { |
||||
$("#display_response_id").html(""); |
||||
} |
||||
function hide_display_message () { |
||||
$("div#display_response_id").html(""); |
||||
try { |
||||
$("#txt_subject_id").val(""); |
||||
$("#txt_area_invite").val(""); |
||||
}catch(e) { |
||||
$("#txt_area_invite").val(""); |
||||
} |
||||
} |
||||
function register_friend(element_input) { |
||||
if(confirm("'.get_lang('AddToFriends').'")) { |
||||
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]; |
||||
$.ajax({ |
||||
contentType: "application/x-www-form-urlencoded", |
||||
beforeSend: function(objeto) { |
||||
$("div#dpending_"+user_friend_id).html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); }, |
||||
type: "POST", |
||||
url: "../social/register_friend.php", |
||||
data: "friend_id="+user_friend_id+"&is_my_friend="+"friend", |
||||
success: function(datos) { |
||||
$("form").submit() |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
</script>'; |
||||
if (isset($_GET['shared'])) { |
||||
$my_link='../social/index.php'; |
||||
$link_shared='shared='.Security::remove_XSS($_GET['shared']); |
||||
} else { |
||||
$my_link='../auth/profile.php'; |
||||
$link_shared=''; |
||||
} |
||||
$interbreadcrumb[]= array ('url' =>$my_link,'name' => get_lang('ModifyProfile') ); |
||||
$interbreadcrumb[]= array ( |
||||
'url' => '../social/profile.php?'.$link_shared.'#remote-tab-1', |
||||
'name' => get_lang('ViewMySharedProfile') |
||||
); |
||||
|
||||
if (isset($_GET['u']) && is_numeric($_GET['u'])) { |
||||
$info_user=api_get_user_info($_GET['u']); |
||||
$interbreadcrumb[]= array ( |
||||
'url' => 'javascript: void(0);', |
||||
'name' => api_get_person_name($info_user['firstName'], $info_user['lastName']) |
||||
); |
||||
} |
||||
if (isset($_GET['u'])) { |
||||
$param_user='u='.Security::remove_XSS($_GET['u']); |
||||
}else { |
||||
$info_user=api_get_user_info(api_get_user_id()); |
||||
$param_user=''; |
||||
} |
||||
$_SESSION['social_user_id'] = $user_id; |
||||
|
||||
|
||||
/** |
||||
* Display |
||||
*/ |
||||
Display :: display_header(null); |
||||
|
||||
// @todo here we must show the user information as read only |
||||
//User picture size is calculated from SYSTEM path |
||||
|
||||
$img_array= UserManager::get_user_picture_path_by_id($user_id,'web',true,true); |
||||
|
||||
//print_r($user_info); |
||||
// Added by Ivan Tcholakov, 03-APR-2009. |
||||
if (USE_JQUERY_CORNERS_SCRIPT) { |
||||
echo $s="<script>$(document).ready( function(){ |
||||
$('.rounded').corners(); |
||||
});</script>"; |
||||
} |
||||
|
||||
|
||||
//echo '<div id="actions">'; |
||||
//echo '<a href="../auth/profile.php?show=1"">'.Display::return_icon('edit.gif').' '.api_convert_encoding(get_lang('EditInformation'),'UTF-8',$charset).'</a>'; |
||||
//echo '</div>'; |
||||
|
||||
//Setting some course info |
||||
$my_user_id=isset($_GET['u']) ? Security::remove_XSS($_GET['u']) : api_get_user_id(); |
||||
$personal_course_list = UserManager::get_personal_session_course_list($my_user_id); |
||||
$course_list_code = array(); |
||||
$i=1; |
||||
//print_r($personal_course_list); |
||||
|
||||
|
||||
|
||||
if (is_array($personal_course_list)) { |
||||
foreach ($personal_course_list as $my_course) { |
||||
if ($i<=10) { |
||||
$list[] = SocialManager::get_logged_user_course_html($my_course,$i); |
||||
//$course_list_code[] = array('code'=>$my_course['c'],'dbName'=>$my_course['db'], 'title'=>$my_course['i']); cause double |
||||
$course_list_code[] = array('code'=>$my_course['c'],'dbName'=>$my_course['db']); |
||||
|
||||
} else { |
||||
break; |
||||
} |
||||
$i++; |
||||
} |
||||
//to avoid repeted courses |
||||
$course_list_code = array_unique_dimensional($course_list_code); |
||||
} |
||||
|
||||
|
||||
echo '<div class="actions">'; |
||||
echo '<a href="profile.php">'.Display::return_icon('shared_profile.png').' '.get_lang('MySharedProfile').'</a>'; |
||||
echo '<a href="friends.php">'.Display::return_icon('lp_users.png').' '.get_lang('Friends').'</a>'; |
||||
echo '<a href="../messages/inbox.php">'.Display::return_icon('inbox.png').' '.get_lang('Inbox').'</a>'; |
||||
echo '<a href="group.php">'.Display::return_icon('group.gif').' '.get_lang('MyGroups').'</a>'; |
||||
echo '<a href="/main/social/search.php">'.Display::return_icon('search.gif').' '.get_lang('Search').'</a>'; |
||||
|
||||
echo '<span style="float:right; padding-top:7px;">'. |
||||
'<a href="/main/auth/profile.php?show=1">'.Display::return_icon('edit.gif').' '.get_lang('Configuration').'</a>'; |
||||
'</span>'; |
||||
|
||||
echo '</div>'; |
||||
|
||||
|
||||
echo '<div class="actions-title">'; |
||||
if ($user_id == api_get_user_id()) |
||||
echo get_lang('ViewMySharedProfile'); |
||||
else |
||||
echo get_lang('ViewSharedProfile').' - '.api_get_person_name($user_info['firstname'], $user_info['lastname']); |
||||
|
||||
echo '</div>'; |
||||
|
||||
echo '<div id="social-profile-wrapper">'; |
||||
// RIGHT COLUMN |
||||
echo '<div id="social-profile-right">'; |
||||
//---- FRIENDS |
||||
|
||||
if ($show_full_profile) { |
||||
$list_path_friends= $list_path_normal_friends = $list_path_parents = array(); |
||||
|
||||
$list_path_good_friends = SocialManager::get_list_path_web_by_user_id($user_id, SOCIALGOODFRIEND); |
||||
$list_path_normal_friends = SocialManager::get_list_path_web_by_user_id($user_id, SOCIALFRIEND); |
||||
$list_path_parents = SocialManager::get_list_path_web_by_user_id($user_id, SOCIALPARENT); |
||||
|
||||
$list_path_friends = array_merge_recursive($list_path_good_friends, $list_path_normal_friends, $list_path_parents); |
||||
|
||||
$friend_html=''; |
||||
$number_of_images=3; |
||||
$number_friends=0; |
||||
$list_friends_id=array(); |
||||
$list_friends_dir=array(); |
||||
$list_friends_file=array(); |
||||
|
||||
if (count($list_path_friends)!=0) { |
||||
$friends_count = count($list_path_friends['id_friend']); |
||||
|
||||
for ($z=0;$z< $friends_count ;$z++) { |
||||
$list_friends_id[] = $list_path_friends['id_friend'][$z]['friend_user_id']; |
||||
$list_friends_dir[] = $list_path_friends['path_friend'][$z]['dir']; |
||||
$list_friends_file[]= $list_path_friends['path_friend'][$z]['file']; |
||||
} |
||||
$number_friends= count($list_friends_dir); |
||||
$number_loop = ($number_friends/$number_of_images); |
||||
$loop_friends = ceil($number_loop); |
||||
$j=0; |
||||
$friend_html .= '<div class="sectiontitle">'.get_lang('SocialFriend').'</div>'; |
||||
$friend_html.= '<div id="friend-container" class="social-friend-container">'; |
||||
$friend_html.= '<div id="friend-header">'; |
||||
//$friend_html.= $friends_count.' '.get_lang('Friends'); |
||||
if ($friends_count == 1) |
||||
$friend_html.= '<div style="float:left;">'.$friends_count.' '.get_lang('Friend').'</div>'; |
||||
else |
||||
$friend_html.= '<div style="float:left;">'.$friends_count.' '.get_lang('Friends').'</div>'; |
||||
if (api_get_user_id() == $user_id) |
||||
$friend_html.= '<div style="float:right;"><a href="index.php?#remote-tab-6">'.get_lang('SeeAll').'</a></div>'; |
||||
$friend_html.= '</div>'; // close div friend-header |
||||
|
||||
for ($k=0;$k<$loop_friends;$k++) { |
||||
if ($j==$number_of_images) { |
||||
$number_of_images=$number_of_images*2; |
||||
} |
||||
while ($j<$number_of_images) { |
||||
if ($list_friends_file[$j]<>"") { |
||||
$my_user_info=api_get_user_info($list_friends_id[$j]); |
||||
$name_user=api_get_person_name($my_user_info['firstName'], $my_user_info['lastName']); |
||||
$friend_html.='<div id=div_'.$list_friends_id[$j].' class="image_friend_network" ><span><center>'; |
||||
// the height = 92 must be the sqme in the image_friend_network span style in default.css |
||||
$friends_profile = SocialManager::get_picture_user($list_friends_id[$j], $list_friends_file[$j], 92, 'medium_', 'width="85" height="90" '); |
||||
$friend_html.='<a href="profile.php?u='.$list_friends_id[$j].'&'.$link_shared.'">'; |
||||
$friend_html.='<img src="'.$friends_profile['file'].'" '.$friends_profile['style'].' id="imgfriend_'.$list_friends_id[$j].'" title="'.$name_user.'" />'; |
||||
$friend_html.= '</center></span>'; |
||||
$friend_html.= '<center class="friend">'.api_get_person_name($my_user_info['firstName'], $my_user_info['lastName']).'</a></center>'; |
||||
$friend_html.= '</div>'; |
||||
} |
||||
$j++; |
||||
} |
||||
} |
||||
} else { |
||||
// No friends!! :( |
||||
$friend_html .= '<div class="sectiontitle">'.get_lang('Friends').'</div>'; |
||||
$friend_html.= '<div id="friend-container" class="social-friend-container">'; |
||||
$friend_html.= '<div id="friend-header">'; |
||||
$friend_html.= '<div style="float:left; padding:0px 8px 0px 8px;">'.get_lang('NoFriendsInYourContactList').'<br /><a href="'.api_get_path(WEB_PATH).'whoisonline.php">'.get_lang('TryAndFindSomeFriends').'</a></div>'; |
||||
$friend_html.= '</div>'; // close div friend-header |
||||
} |
||||
$friend_html.= '</div>'; |
||||
echo $friend_html; |
||||
//Pending invitations |
||||
if (!isset($_GET['u']) || (isset($_GET['u']) && $_GET['u']==api_get_user_id())) { |
||||
$pending_invitations = SocialManager::get_list_invitation_of_friends_by_user_id(api_get_user_id()); |
||||
$list_get_path_web=SocialManager::get_list_web_path_user_invitation_by_user_id(api_get_user_id()); |
||||
$count_pending_invitations = count($pending_invitations); |
||||
//echo '<div class="clear"></div><br />'; |
||||
//javascript:register_friend(this) |
||||
//var_dump($pending_invitations); |
||||
echo '<div class="clear"></div><br />'; |
||||
echo '<div id="social-profile-invitations" >'; |
||||
if ($count_pending_invitations > 0) { |
||||
echo '<div class="sectiontitle">'; |
||||
echo api_convert_encoding(get_lang('PendingInvitations'),$charset,'UTF-8'); |
||||
echo '</div><br />'; |
||||
for ($i=0;$i<$count_pending_invitations;$i++) { |
||||
//var_dump($invitations); |
||||
echo '<div id="dpending_'.$pending_invitations[$i]['user_sender_id'].'" class="friend_invitations">'; |
||||
echo '<div style="float:left;width:60px;" >'; |
||||
echo '<img style="margin-bottom:5px;" src="'.$list_get_path_web[$i]['dir'].'/'.$list_get_path_web[$i]['file'].'" width="60px">'; |
||||
echo '</div>'; |
||||
echo '<div style="padding-left:70px;">'; |
||||
echo ' '.api_convert_encoding(substr($pending_invitations[$i]['content'],0,50),$charset,'UTF-8'); |
||||
echo '<br />'; |
||||
echo '<a id="btn_accepted_'.$pending_invitations[$i]['user_sender_id'].'" onclick="register_friend(this)" href="javascript:void(0)">'.get_lang('SocialAddToFriends').'</a>'; |
||||
echo '<div id="id_response"> </div>'; |
||||
echo '</div>'; |
||||
echo '</div>'; |
||||
echo '<div class="clear"></div>'; |
||||
} |
||||
} |
||||
echo '</div>'; |
||||
} |
||||
|
||||
//--Productions |
||||
$production_list = UserManager::build_production_list($user_id); |
||||
if (!empty($production_list )) { |
||||
echo '<div class="clear"></div><br />'; |
||||
echo '<div class="sectiontitle">'; |
||||
echo get_lang('MyProductions'); |
||||
echo '</div>'; |
||||
echo '<div class="rounded1">'; |
||||
echo $production_list; |
||||
echo '</div>'; |
||||
} |
||||
|
||||
// Images uploaded by course |
||||
$file_list = ''; |
||||
if (is_array($course_list_code) && count($course_list_code)>0) { |
||||
foreach ($course_list_code as $course) { |
||||
$file_list.= UserManager::get_user_upload_files_by_course($user_id,$course['code']); |
||||
} |
||||
} |
||||
|
||||
if (!empty($file_list)) { |
||||
echo '<div class="clear"></div><br />'; |
||||
echo '<div class="sectiontitle">'; |
||||
echo get_lang('ImagesUploaded'); |
||||
echo '</div><br />'; |
||||
echo '</br><div class="social-content-information">'; |
||||
echo $file_list; |
||||
echo '</div>'; |
||||
} |
||||
|
||||
//loading this information |
||||
|
||||
//-- Competences |
||||
if (!empty($user_info['competences']) || !empty($user_info['diplomas']) || !empty($user_info['openarea']) || !empty($user_info['teach']) ) { |
||||
echo '<div class="clear"></div>'; |
||||
echo '<div class="sectiontitle">'; |
||||
echo get_lang('MoreInformation'); |
||||
echo '</div>'; |
||||
} |
||||
echo '<div class="social-content-competences">'; |
||||
$cut_size = 220; |
||||
if (!empty($user_info['competences'])) { |
||||
echo '<br />'; |
||||
echo '<div class="social-background-content" style="width:100%;">'; |
||||
echo '<div class="social-actions-message">'.get_lang('MyCompetences').'</div>'; |
||||
echo cut($user_info['competences'],$cut_size); |
||||
echo '</div>'; |
||||
echo '<br />'; |
||||
} |
||||
|
||||
if (!empty($user_info['diplomas'])) { |
||||
echo '<div class="social-background-content" style="width:100%;" >'; |
||||
echo '<div class="social-actions-message">'.get_lang('MyDiplomas').'</div>'; |
||||
echo cut($user_info['diplomas'],$cut_size); |
||||
echo '</div>'; |
||||
echo '<br />'; |
||||
} |
||||
if (!empty($user_info['openarea'])) { |
||||
echo '<div class="social-background-content" style="width:100%;" >'; |
||||
echo '<div class="social-actions-message">'.get_lang('MyPersonalOpenArea').'</div>'; |
||||
echo cut($user_info['openarea'],$cut_size); |
||||
echo '</div>'; |
||||
echo '<br />'; |
||||
} |
||||
if (!empty($user_info['teach'])) { |
||||
echo '<div class="social-background-content" style="width:100%;" >'; |
||||
echo '<div class="social-actions-message">'.get_lang('MyTeach').'</div>'; |
||||
echo cut($user_info['teach'],$cut_size); |
||||
echo '</div>'; |
||||
echo '<br />'; |
||||
} |
||||
echo '</div>'; |
||||
} else { |
||||
echo '<div class="clear"></div><br />'; |
||||
} |
||||
|
||||
echo '</div>'; // end of content section |
||||
|
||||
|
||||
echo '<div id="social-profile-container">'; |
||||
// LEFT COLUMN |
||||
echo '<div id="social-profile-left">'; |
||||
|
||||
//--- User image |
||||
echo '<div class="social-content-image">'; |
||||
echo '<div class="social-background-content" style="width:95%;" align="center">'; |
||||
echo '<br/>'; |
||||
echo '<a href="../auth/profile.php?show=1"><img src='.$img_array['dir'].$img_array['file'].' /></a><br /><br />'; |
||||
echo '</div>'; |
||||
echo '</div>'; |
||||
|
||||
// Send message or Add to friend links |
||||
/*if (!$show_full_profile) { |
||||
echo ' <a href="../messages/send_message_to_userfriend.inc.php?height=365&width=610&user_friend='.$user_id.'&view=profile" class="thickbox" title="'.get_lang('SendMessage').'">'.Display::return_icon('message_new.png').' '.get_lang('SendMessage').'</a><br />'; |
||||
}*/ |
||||
|
||||
// Extra information |
||||
|
||||
if ($show_full_profile) { |
||||
//-- Extra Data |
||||
$t_uf = Database :: get_main_table(TABLE_MAIN_USER_FIELD); |
||||
$t_ufo = Database :: get_main_table(TABLE_MAIN_USER_FIELD_OPTIONS); |
||||
$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 class="sectiontitle">'; |
||||
$extra_information .= get_lang('ExtraInformation'); |
||||
$extra_information .= '</div><br />'; |
||||
$extra_information .='<div class="social-content-information">'; |
||||
$extra_information_value = ''; |
||||
foreach($extra_user_data as $key=>$data) { |
||||
// get display text, visibility and type from user_field table |
||||
$field_variable = str_replace('extra_','',$key); |
||||
$sql = "SELECT field_display_text,field_visible,field_type,id FROM $t_uf WHERE field_variable ='$field_variable'"; |
||||
$res_field = Database::query($sql,__FILE__,__LINE__); |
||||
$row_field = Database::fetch_row($res_field); |
||||
$field_display_text = $row_field[0]; |
||||
$field_visible = $row_field[1]; |
||||
$field_type = $row_field[2]; |
||||
$field_id = $row_field[3]; |
||||
if ($field_visible == 1) { |
||||
if (is_array($data)) { |
||||
$extra_information_value .= '<strong>'.ucfirst($field_display_text).':</strong> '.implode(',',$data).'<br />'; |
||||
} else { |
||||
if ($field_type == USER_FIELD_TYPE_DOUBLE_SELECT) { |
||||
$id_options = explode(';',$data); |
||||
$value_options = array(); |
||||
// get option display text from user_field_options table |
||||
foreach ($id_options as $id_option) { |
||||
$sql = "SELECT option_display_text FROM $t_ufo WHERE id = '$id_option'"; |
||||
$res_options = Database::query($sql,__FILE__,__LINE__); |
||||
$row_options = Database::fetch_row($res_options); |
||||
$value_options[] = $row_options[0]; |
||||
} |
||||
$extra_information_value .= '<strong>'.ucfirst($field_display_text).':</strong> '.implode(' ',$value_options).'<br />'; |
||||
} elseif($field_type == USER_FIELD_TYPE_TAG ) { |
||||
$user_tags = UserManager::get_user_tags($user_id, $field_id); |
||||
$tag_tmp = array(); |
||||
foreach ($user_tags as $tags) { |
||||
//$tag_tmp[] = $tags['tag']; |
||||
$tag_tmp[] = '<a href="../tag/?q='.$tags['tag'].'">'.$tags['tag'].'</a>'; |
||||
} |
||||
if (is_array($user_tags) && count($user_tags)>0) { |
||||
$extra_information_value .= '<strong>'.ucfirst($field_display_text).':</strong> '.implode(', ',$tag_tmp).'<br />'; |
||||
} |
||||
} else { |
||||
$extra_information_value .= '<strong>'.ucfirst($field_display_text).':</strong> '.$data.'<br />'; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
// if there are information to show |
||||
if (!empty($extra_information_value)) { |
||||
$extra_information .= $extra_information_value; |
||||
} |
||||
$extra_information .= '</div>'; |
||||
$extra_information .= '<br /><br />'; |
||||
} |
||||
// if there are information to show |
||||
if (!empty($extra_information_value)) |
||||
echo $extra_information; |
||||
|
||||
|
||||
// ---- My Agenda Items |
||||
$my_agenda_items = show_simple_personal_agenda($user_id); |
||||
if (!empty($my_agenda_items)) { |
||||
echo '<div class="sectiontitle">'; |
||||
echo get_lang('MyAgenda'); |
||||
echo '</div>'; |
||||
$tbl_personal_agenda = Database :: get_user_personal_table(TABLE_PERSONAL_AGENDA); |
||||
echo '<div class="social-content-agenda">'; |
||||
echo '<div class="social-background-content">'; |
||||
echo $my_agenda_items; |
||||
echo '</div>'; |
||||
|
||||
echo '<br /><br />'; |
||||
echo '</div>'; |
||||
} |
||||
|
||||
//-----Announcements |
||||
$announcement_content = ''; |
||||
$my_announcement_by_user_id=isset($_GET['u']) ? Security::remove_XSS($_GET['u']) : api_get_user_id(); |
||||
|
||||
foreach ($course_list_code as $course) { |
||||
$content = get_all_annoucement_by_user_course($course['dbName'],$my_announcement_by_user_id); |
||||
$course_info=api_get_course_info($course['code']); |
||||
if (!empty($content)) { |
||||
$announcement_content.= '<div class="social-background-content" style="width:100%">'; |
||||
$announcement_content.= '<div class="actions">'.$course_info['name'].'</div>'; |
||||
$announcement_content.= $content; |
||||
$announcement_content.= '</div>'; |
||||
$announcement_content.= '<br/>'; |
||||
} |
||||
|
||||
} |
||||
|
||||
if(!empty($announcement_content)) { |
||||
echo '<div class="sectiontitle">'; |
||||
echo get_lang('Announcements'); |
||||
echo '</div><br/>'; |
||||
echo '<div class="social-content-announcements">'; |
||||
echo $announcement_content.'<br/>'; |
||||
echo '</div>'; |
||||
} |
||||
} |
||||
echo '</div>'; |
||||
|
||||
|
||||
// CENTER COLUMN |
||||
|
||||
|
||||
echo '<div id="social-profile-content">'; |
||||
|
||||
//--- Basic Information |
||||
|
||||
echo 'ssss'; |
||||
echo '</div>'; |
||||
echo '</div>'; |
||||
echo '</div>'; //from the main |
||||
echo '<form id="id_reload" name="id_reload" action="profile.php"> </form>'; |
||||
Display :: display_footer(); |
@ -0,0 +1,128 @@ |
||||
<?php |
||||
/* For licensing terms, see /dokeos_license.txt */ |
||||
|
||||
$language_file = array('registration','messages','userInfo','admin'); |
||||
require '../inc/global.inc.php'; |
||||
require_once api_get_path(LIBRARY_PATH).'image.lib.php'; |
||||
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php'; |
||||
require_once api_get_path(LIBRARY_PATH).'social.lib.php'; |
||||
$this_section = SECTION_SOCIAL; |
||||
|
||||
$interbreadcrumb[]= array ('url' =>'home.php','name' => get_lang('Social')); |
||||
|
||||
Display :: display_header($tool_name, 'Groups'); |
||||
SocialManager::show_social_menu(); |
||||
echo '<div class="actions-title">'; |
||||
echo get_lang('Invitations'); |
||||
echo '</div>'; |
||||
|
||||
|
||||
api_block_anonymous_users(); |
||||
$request=api_is_xml_http_request(); |
||||
$language_variable=api_xml_http_response_encode(get_lang('PendingInvitations')); |
||||
$language_comment=api_xml_http_response_encode(get_lang('SocialInvitesComment')); |
||||
//api_display_tool_title($language_variable); |
||||
?> |
||||
<div id="id_response" align="center"></div> |
||||
<?php |
||||
$list_get_invitation=array(); |
||||
$list_get_path_web=array(); |
||||
$user_id=api_get_user_id(); |
||||
$list_get_invitation=SocialManager::get_list_invitation_of_friends_by_user_id($user_id); |
||||
$list_get_path_web=SocialManager::get_list_web_path_user_invitation_by_user_id($user_id); |
||||
$number_loop=count($list_get_invitation); |
||||
if ($number_loop==0) { |
||||
Display::display_normal_message(api_xml_http_response_encode(get_lang('YouDontHaveInvites'))); |
||||
} |
||||
for ($i=0;$i<$number_loop;$i++) { |
||||
?> |
||||
<div id="<?php echo 'id_'.$list_get_invitation[$i]['user_sender_id'] ?>" align="center">
|
||||
<table width="600" border="0" cellpadding="0" cellspacing="0"> |
||||
<tr> |
||||
<td width="600" height="20" valign="top"><table width="100%" border="0" |
||||
cellpadding="0" cellspacing="0" bgcolor="#9DACBF"> |
||||
<tr> |
||||
<td width="600" height="20" valign="top" style="padding:4px;"><div align="left"><b><?php echo api_xml_http_response_encode(get_lang('RequestContact')); ?></b></div></td>
|
||||
</tr> |
||||
</table></td> |
||||
</tr> |
||||
<tr> |
||||
<td height="135" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"> |
||||
<tr> |
||||
<td width="600" height="135" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"> |
||||
<tr> |
||||
<td width="600" height="110" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"> |
||||
<tr> |
||||
<td width="100" height="110" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#C8D5E4"> |
||||
<tr> |
||||
<td width="100" height="110" style="padding:4px;" > |
||||
<?php $friends_profile = SocialManager::get_picture_user($list_get_invitation[$i]['user_sender_id'], $list_get_path_web[$i]['file'], 92); ?> |
||||
<center><img src="<?php echo $friends_profile['file']; ?>" <?php echo $friends_profile['style']; ?> /></center></td>
|
||||
</tr> |
||||
</table></td> |
||||
<td width="500" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> |
||||
<tr> |
||||
<td width="500" height="22" valign="top"> |
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0"> |
||||
<tr> |
||||
<td width="500" height="22" valign="top" style="padding:2px;"> |
||||
<?php |
||||
$user_id=$list_get_invitation[$i]['user_sender_id']; |
||||
$user_info=api_get_user_info($user_id); |
||||
echo api_xml_http_response_encode(api_get_person_name($user_info['firstName'], $user_info['lastName'])); |
||||
?></td> |
||||
</tr> |
||||
</table></td> |
||||
</tr> |
||||
<tr> |
||||
<td height="5" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"> |
||||
|
||||
<tr> |
||||
<td width="500" height="5"></td> |
||||
</tr> |
||||
</table></td> |
||||
</tr> |
||||
<tr> |
||||
<td height="22" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"> |
||||
<tr> |
||||
<td width="500" height="22" valign="top" style="padding:2px;"><?php |
||||
$title=get_lang($list_get_invitation[$i]['title']); |
||||
$content=get_lang($list_get_invitation[$i]['content']); |
||||
echo api_xml_http_response_encode($title.' : '.$content); |
||||
?> </td> |
||||
</tr> |
||||
</table></td> |
||||
</tr> |
||||
<tr> |
||||
<td height="61" valign="top" style="padding:2px;"><?php |
||||
$date=$list_get_invitation[$i]['send_date']; |
||||
echo api_xml_http_response_encode(get_lang('DateSend').' : '.$date); |
||||
?></td> |
||||
</tr> |
||||
</table></td> |
||||
</tr> |
||||
</table></td> |
||||
</tr> |
||||
<tr> |
||||
<td height="25" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#9DACBF"> |
||||
<tr> |
||||
<td width="600" height="25" valign="top" style="padding:4px;"><div align="right"> |
||||
<button class="save" name="btn_accepted" type="submit" id="<?php echo "btn_accepted_".$user_id ?>" value="<?php echo api_xml_http_response_encode(get_lang('Accept'));?>"onclick="javascript:register_friend(this)"><?php echo api_xml_http_response_encode(get_lang('Accept')) ?></button>
|
||||
<button class="cancel" name="btn_denied" type="submit" id="<?php echo "btn_deniedst_".$user_id ?>" value="<?php echo api_xml_http_response_encode(get_lang('Deny')); ?>" onclick="javascript:denied_friend(this)" ><?php echo api_xml_http_response_encode(get_lang('Deny'))?></button>
|
||||
</div></td> |
||||
</tr> |
||||
</table></td> |
||||
</tr> |
||||
|
||||
</table></td> |
||||
</tr> |
||||
|
||||
</table></td> |
||||
</tr> |
||||
</table> |
||||
</div> |
||||
<br/> |
||||
<?php |
||||
} |
||||
Display::display_footer(); |
||||
?> |
@ -0,0 +1,148 @@ |
||||
<?php |
||||
/* For licensing terms, see /dokeos_license.txt */ |
||||
|
||||
$language_file = array('registration','messages','userInfo','admin','forum','blog'); |
||||
require_once '../inc/global.inc.php'; |
||||
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php'; |
||||
require_once api_get_path(LIBRARY_PATH).'social.lib.php'; |
||||
require_once api_get_path(LIBRARY_PATH).'course.lib.php'; |
||||
Display :: display_header(''); |
||||
// @todo here we must show the user information as read only |
||||
//User picture size is calculated from SYSTEM path |
||||
$user_info= UserManager::get_user_info_by_id(api_get_user_id()); |
||||
$img_array= UserManager::get_user_picture_path_by_id(api_get_user_id(),'web',true,true); |
||||
|
||||
if (isset($_POST['load_ajax'])) { |
||||
require_once api_get_path(LIBRARY_PATH).'blog.lib.php'; |
||||
require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php'; |
||||
$user_id = intval($_SESSION['social_user_id']); |
||||
if ($_POST['action']) {$action = $_POST['action'];} |
||||
switch($action) { |
||||
case 'load_course' : |
||||
$course_db = $_POST['course_code']; |
||||
// @todo goto the course link |
||||
//echo '<a href="'.api_get_path(WEB_COURSE_PATH).$course_directory.'/?id_session='.$my_course['id_session'].'">'.get_lang('GotoCourse').'</a>'; |
||||
$course_id=CourseManager::get_course_id_by_database_name($course_db); |
||||
|
||||
if (api_is_user_of_course($course_id,api_get_user_id())) { |
||||
|
||||
$table_forums = Database :: get_course_table(TABLE_FORUM,$course_db); |
||||
$table_threads = Database :: get_course_table(TABLE_FORUM_THREAD,$course_db); |
||||
$table_posts = Database :: get_course_table(TABLE_FORUM_POST,$course_db); |
||||
$table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY,$course_db); |
||||
$table_users = Database :: get_main_table(TABLE_MAIN_USER); |
||||
|
||||
//------Forum messages |
||||
|
||||
$forum_result = get_all_post_from_user($user_id, $course_db); |
||||
$all_result_data = 0; |
||||
if ($forum_result !='') { |
||||
api_display_tool_title(get_lang('Forum')); |
||||
echo '<div class="social-background-content" style="background:#FAF9F6; padding:0px;" >'; |
||||
echo api_xml_http_response_encode($forum_result); |
||||
echo '</div>'; |
||||
echo '<br />'; |
||||
$all_result_data++; |
||||
} |
||||
|
||||
//------Blog posts |
||||
$result = get_blog_post_from_user($course_db, $user_id); |
||||
if (!empty($result)) { |
||||
echo '<div class="clear"></div><br />'; |
||||
api_display_tool_title(api_xml_http_response_encode(get_lang('BlogPosts'))); |
||||
echo '<div class="social-background-content" style="background:#FAF9F6; padding:0px;">'; |
||||
echo api_xml_http_response_encode($result); |
||||
echo '</div>'; |
||||
echo '<br />'; |
||||
$all_result_data++; |
||||
} |
||||
|
||||
//------Blog comments |
||||
$result = get_blog_comment_from_user($course_db, $user_id); |
||||
if (!empty($result)) { |
||||
api_display_tool_title(api_xml_http_response_encode(get_lang('BlogComments'))); |
||||
echo '<div class="social-background-content" style="background:#FAF9F6; padding:0px;">'; |
||||
echo api_xml_http_response_encode($result); |
||||
echo '</div>'; |
||||
echo '<br />'; |
||||
$all_result_data++; |
||||
} |
||||
if ($all_result_data == 0) { |
||||
echo api_xml_http_response_encode(get_lang('NoDataAvailable')); |
||||
} |
||||
|
||||
} else { |
||||
echo '<div class="clear"></div><br />'; |
||||
api_display_tool_title(api_xml_http_response_encode(get_lang('Details'))); |
||||
echo '<div class="social-background-content" style="background:#FAF9F6; padding:0px;">'; |
||||
echo api_xml_http_response_encode(get_lang('UserNonRegisteredAtTheCourse')); |
||||
echo '<div class="clear"></div><br />'; |
||||
echo '</div>'; |
||||
echo '<div class="clear"></div><br />'; |
||||
} |
||||
break; |
||||
case 'unload_course' : |
||||
//echo 'load2'; |
||||
break; |
||||
default: |
||||
|
||||
} |
||||
} else { |
||||
// normal behavior |
||||
$request=api_is_xml_http_request(); |
||||
$language_variable=api_xml_http_response_encode(get_lang('PersonalData')); |
||||
//api_display_tool_title($language_variable); |
||||
|
||||
echo '<div class="actions">'; |
||||
echo '<a href="../auth/profile.php?show=1"">'.Display::return_icon('edit.gif',api_xml_http_response_encode(get_lang('EditInformation'))).' '.api_xml_http_response_encode(get_lang('EditInformation')).'</a> '; |
||||
if (api_get_setting('allow_social_tool')=='true' && api_get_setting('allow_message_tool')=='true' && api_get_user_id()<>2 && api_get_user_id()<>0) { |
||||
echo '<a href="../social/profile.php?shared=true">'.Display::return_icon('shared_profile.png',api_xml_http_response_encode(get_lang('ViewSharedProfile'))).' '.api_xml_http_response_encode(get_lang('ViewSharedProfile')).'</a>'; |
||||
} |
||||
echo '</div>'; |
||||
echo '<div id="profile_container">'; |
||||
echo '<div class="social-profile-info" style="float:left;position:relative">'; |
||||
echo '<dl><dt>'.api_xml_http_response_encode(get_lang('UserName')).'</dt> |
||||
<dd>'. api_xml_http_response_encode($user_info['username']).' </dd></dl>'; |
||||
if (api_is_western_name_order()) { |
||||
echo '<dl><dt>'.api_xml_http_response_encode(get_lang('FirstName')).'</dt> |
||||
<dd>'. api_xml_http_response_encode($user_info['firstname']).'</dd></dl>'; |
||||
echo '<dl><dt>'.api_xml_http_response_encode(get_lang('LastName')).'</dt> |
||||
<dd>'. api_xml_http_response_encode($user_info['lastname']).'</dd></dl>'; |
||||
} else { |
||||
echo '<dl><dt>'.api_xml_http_response_encode(get_lang('LastName')).'</dt><dd>'. api_xml_http_response_encode($user_info['lastname']).'</dd></dl>'; |
||||
echo '<dl><dt>'.api_xml_http_response_encode(get_lang('FirstName')).'</dt><dd>'. api_xml_http_response_encode($user_info['firstname']).'</dd></dl>'; |
||||
} |
||||
echo '<dl><dt>'.api_xml_http_response_encode(get_lang('OfficialCode')).'</dt> |
||||
<dd>'. api_xml_http_response_encode($user_info['official_code']).'</dd></dl>'; |
||||
echo '<dl><dt>'.api_xml_http_response_encode(get_lang('Email')).'</dt> |
||||
<dd>'. api_xml_http_response_encode($user_info['email']).'</dd></dl>'; |
||||
echo '<dl><dt>'.api_xml_http_response_encode(get_lang('Phone')).'</dt> |
||||
<dd>'. api_xml_http_response_encode($user_info['phone']).'</dd></dl>'; |
||||
echo '</div>'; |
||||
echo '<div style="float:left;position:relative">'; |
||||
echo '<div id="picture" style="width:200px;float:left;position:relative;margin-top:10px;">'; |
||||
echo '<img src='.$img_array['dir'].$img_array['file'].' />'; |
||||
echo '</div>'; |
||||
/*if (api_get_setting('allow_message_tool')=='true') { |
||||
require_once api_get_path(LIBRARY_PATH).'message.lib.php'; |
||||
$number_of_new_messages = MessageManager::get_new_messages(); |
||||
$number_of_outbox_message=MessageManager::get_number_of_messages_sent(); |
||||
$cant_out_box=' ('.$number_of_outbox_message.')'; |
||||
$cant_msg = ' ('.$number_of_new_messages.')'; |
||||
$number_of_new_messages_of_friend=SocialManager::get_message_number_invitation_by_user_id(api_get_user_id()); |
||||
//echo '<div class="message-view" style="display:none;">'.get_lang('ViewMessages').'</div>'; |
||||
echo '<div class="message-content" style="float:right" > |
||||
<h2 class="message-title" style="margin-top:0">'.get_lang('Messages').'</h2> |
||||
<p> |
||||
<a href="../social/index.php#remote-tab-2" class="message-body">'.get_lang('Inbox').$cant_msg.' </a><br /> |
||||
<a href="../social/index.php#remote-tab-3" class="message-body">'.get_lang('Outbox').$cant_out_box.'</a><br /> |
||||
</p>'; |
||||
echo '<img src="../img/delete.gif" alt="'.get_lang('Close').'" title="'.get_lang('Close').'" class="message-delete" onclick="delete_message_js()" />'; |
||||
if ($number_of_new_messages_of_friend>0) { |
||||
echo '<br/>'; |
||||
} |
||||
echo '</div>'; |
||||
}*/ |
||||
echo '</div>'; |
||||
} |
||||
?> |
Loading…
Reference in new issue