Avoiding warning messages, fixing minor PHP errors, commenting todo code

skala
Julio Montoya 14 years ago
parent e622a61871
commit ed4db6cd58
  1. 8
      main/admin/add_many_session_to_category.php
  2. 4
      main/admin/resume_session.php
  3. 2
      main/admin/session_category_list.php
  4. 10
      main/admin/session_list.php
  5. 433
      main/admin/user_list.php
  6. 1
      main/inc/lib/display.lib.php
  7. 3
      main/inc/lib/sessionmanager.lib.php
  8. 6
      main/messages/send_message_to_userfriend.inc.php
  9. 14
      user_portal.php

@ -8,7 +8,7 @@
// name of the language file that needs to be included // name of the language file that needs to be included
$language_file='admin'; $language_file='admin';
// resetting the course id // resetting the course id
$cidReset=true; $cidReset = true;
require_once '../inc/global.inc.php'; require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'add_many_session_to_category_functions.lib.php'; require_once api_get_path(LIBRARY_PATH).'add_many_session_to_category_functions.lib.php';
@ -125,7 +125,6 @@ if(isset($_GET['msg']) && $_GET['msg']=='ok'){
// display the dokeos header // display the dokeos header
Display::display_header($tool_name); Display::display_header($tool_name);
echo '<div class="row"><div class="form_header">'.$tool_name.' </div></div><br />'; echo '<div class="row"><div class="form_header">'.$tool_name.' </div></div><br />';
$where =''; $where ='';
@ -139,6 +138,11 @@ if((isset($_POST['CategorySessionId']) && $_POST['formSent'] == 0) || isset($_GE
} }
$rows_session_category = SessionManager::get_all_session_category(); $rows_session_category = SessionManager::get_all_session_category();
if (empty($rows_session_category)) {
Display::display_warning_message(get_lang('YouNeedToAddASessionCategoryFirst'));
Display::display_footer();
exit;
}
$sql = "SELECT id, name FROM $tbl_session $where ORDER BY name"; $sql = "SELECT id, name FROM $tbl_session $where ORDER BY name";
$result=Database::query($sql); $result=Database::query($sql);

@ -170,8 +170,8 @@ echo Display::tag('h3', $tool_name);
<?php <?php
require_once api_get_path(LIBRARY_PATH).'urlmanager.lib.php'; require_once api_get_path(LIBRARY_PATH).'urlmanager.lib.php';
global $_configuration;
if ($_configuration['multiple_access_urls']) { if (api_get_multiple_access_url()) {
echo '<tr><td>'; echo '<tr><td>';
echo get_lang('URL'); echo get_lang('URL');
echo '</td>'; echo '</td>';

@ -40,7 +40,7 @@ if ($action == 'delete_on_session' || $action == 'delete_off_session') {
exit(); exit();
} }
$interbreadcrumb[]=array("url" => "index.php","name" => get_lang('PlatformAdmin')); $interbreadcrumb[] = array("url" => "index.php","name" => get_lang('PlatformAdmin'));
if (isset ($_GET['search']) && $_GET['search'] == 'advanced') { if (isset ($_GET['search']) && $_GET['search'] == 'advanced') {
$interbreadcrumb[] = array ("url" => 'session_category_list.php', "name" => get_lang('ListSessionCategory')); $interbreadcrumb[] = array ("url" => 'session_category_list.php', "name" => get_lang('ListSessionCategory'));

@ -52,6 +52,8 @@ if ($action == 'delete') {
$interbreadcrumb[]=array("url" => "index.php","name" => get_lang('PlatformAdmin')); $interbreadcrumb[]=array("url" => "index.php","name" => get_lang('PlatformAdmin'));
$keyword_name = isset($_GET['keyword_name']) ? Security::remove_XSS($_GET['keyword_name']) : null;
//table for the search //table for the search
if (isset ($_GET['search']) && $_GET['search'] == 'advanced') { if (isset ($_GET['search']) && $_GET['search'] == 'advanced') {
@ -207,13 +209,15 @@ if (isset ($_GET['search']) && $_GET['search'] == 'advanced') {
echo '<div style="float:right;">'; echo '<div style="float:right;">';
if (!isset($_GET['id_category'])) { if (!isset($_GET['id_category'])) {
echo '<a href="'.api_get_path(WEB_CODE_PATH).'admin/session_add.php">'.Display::return_icon('new_session.png',get_lang('AddSession'),'','32').'</a>'; echo '<a href="'.api_get_path(WEB_CODE_PATH).'admin/session_add.php">'.Display::return_icon('new_session.png',get_lang('AddSession'),'','32').'</a>';
} }
echo '<a href="'.api_get_path(WEB_CODE_PATH).'admin/add_many_session_to_category.php?id_category='.intval($_GET['id_category']).'">'.Display::return_icon('session_to_category.png',get_lang('AddSessionsInCategories'),'','32').'</a>'; echo '<a href="'.api_get_path(WEB_CODE_PATH).'admin/add_many_session_to_category.php">'.Display::return_icon('session_to_category.png',get_lang('AddSessionsInCategories'),'','32').'</a>';
echo '<a href="'.api_get_path(WEB_CODE_PATH).'admin/session_category_list.php">'.Display::return_icon('folder.png',get_lang('ListSessionCategory'),'','32').'</a>'; echo '<a href="'.api_get_path(WEB_CODE_PATH).'admin/session_category_list.php">'.Display::return_icon('folder.png',get_lang('ListSessionCategory'),'','32').'</a>';
echo '</div>'; echo '</div>';
?> ?>
<form method="POST" action="session_list.php"> <form method="POST" action="session_list.php">
<input type="text" name="keyword_name" value="<?php echo Security::remove_XSS($_GET['keyword_name']); ?>"/> <input type="text" name="keyword_name" value="<?php echo $keyword_name; ?>"/>
<button class="search" type="submit" name="name" value="<?php echo get_lang('Search') ?>"><?php echo get_lang('Search') ?></button> <button class="search" type="submit" name="name" value="<?php echo get_lang('Search') ?>"><?php echo get_lang('Search') ?></button>
<a href="session_list.php?search=advanced"><?php echo get_lang('AdvancedSearch'); ?></a> <a href="session_list.php?search=advanced"><?php echo get_lang('AdvancedSearch'); ?></a>
</form> </form>

@ -119,14 +119,14 @@ $htmlHeadXtra[] = '<style type="text/css" media="screen, projection">
.blackboard_hide { .blackboard_hide {
display: none; display: none;
} }
'; </style>';
// xajax // xajax
$xajax = new xajax(); $xajax = new xajax();
$xajax->registerFunction('courses_of_user'); $xajax->registerFunction('courses_of_user');
//$xajax->registerFunction('empty_courses_of_user'); //$xajax->registerFunction('empty_courses_of_user');
$xajax->processRequests(); $xajax->processRequests();
/** /**
* Get a formatted list of courses for given user * Get a formatted list of courses for given user
* @param int User ID * @param int User ID
@ -214,9 +214,9 @@ function login_user($user_id) {
//Load $_user to be sure we clean it before logging in //Load $_user to be sure we clean it before logging in
global $uidReset, $loginFailed, $_configuration, $_user; global $uidReset, $loginFailed, $_configuration, $_user;
$main_user_table = Database :: get_main_table(TABLE_MAIN_USER); $main_user_table = Database::get_main_table(TABLE_MAIN_USER);
$main_admin_table = Database :: get_main_table(TABLE_MAIN_ADMIN); $main_admin_table = Database::get_main_table(TABLE_MAIN_ADMIN);
$track_e_login_table = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN); $track_e_login_table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN);
//logic //logic
@ -317,14 +317,12 @@ function login_user($user_id) {
* Get the total number of users on the platform * Get the total number of users on the platform
* @see SortableTable#get_total_number_of_items() * @see SortableTable#get_total_number_of_items()
*/ */
function get_number_of_users() function get_number_of_users() {
{
$user_table = Database :: get_main_table(TABLE_MAIN_USER); $user_table = Database :: get_main_table(TABLE_MAIN_USER);
$sql = "SELECT COUNT(u.user_id) AS total_number_of_items FROM $user_table u"; $sql = "SELECT COUNT(u.user_id) AS total_number_of_items FROM $user_table u";
// adding the filter to see the user's only of the current access_url // 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()) && api_get_multiple_access_url()) {
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls'] && api_get_current_access_url_id()!=-1) {
$access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); $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)"; $sql.= " INNER JOIN $access_url_rel_user_table url_rel_user ON (u.user_id=url_rel_user.user_id)";
} }
@ -384,7 +382,7 @@ function get_number_of_users()
} }
// adding the filter to see the user's only of the current access_url // 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'] && api_get_current_access_url_id()!=-1) { if ((api_is_platform_admin() || api_is_session_admin()) && api_get_multiple_access_url()) {
$sql.= " AND url_rel_user.access_url_id=".api_get_current_access_url_id(); $sql.= " AND url_rel_user.access_url_id=".api_get_current_access_url_id();
} }
@ -402,7 +400,7 @@ function get_number_of_users()
*/ */
function get_user_data($from, $number_of_items, $column, $direction) function get_user_data($from, $number_of_items, $column, $direction)
{ {
global $_configuration,$origin; global $origin;
$user_table = Database :: get_main_table(TABLE_MAIN_USER); $user_table = Database :: get_main_table(TABLE_MAIN_USER);
$admin_table = Database :: get_main_table(TABLE_MAIN_ADMIN); $admin_table = Database :: get_main_table(TABLE_MAIN_ADMIN);
@ -423,7 +421,7 @@ function get_user_data($from, $number_of_items, $column, $direction)
" FROM $user_table u "; " FROM $user_table u ";
// adding the filter to see the user's only of the current access_url // 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'] && api_get_current_access_url_id()!=-1) { if ((api_is_platform_admin() || api_is_session_admin()) && api_get_multiple_access_url()) {
$access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); $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)"; $sql.= " INNER JOIN $access_url_rel_user_table url_rel_user ON (u.user_id=url_rel_user.user_id)";
} }
@ -484,7 +482,7 @@ function get_user_data($from, $number_of_items, $column, $direction)
} }
// adding the filter to see the user's only of the current access_url // 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'] && api_get_current_access_url_id()!=-1) { if ((api_is_platform_admin() || api_is_session_admin()) && api_get_multiple_access_url()) {
$sql.= " AND url_rel_user.access_url_id=".api_get_current_access_url_id(); $sql.= " AND url_rel_user.access_url_id=".api_get_current_access_url_id();
} }
@ -560,6 +558,7 @@ function modify_filter($user_id,$url_params,$row) {
if ($row['7'] == $statusname[ANONYMOUS]) { if ($row['7'] == $statusname[ANONYMOUS]) {
$user_is_anonymous =true; $user_is_anonymous =true;
} }
$result = '';
if (!$user_is_anonymous) { if (!$user_is_anonymous) {
$result .= '<a href="javascript:void(0)" onclick="load_course_list(\'div_'.$user_id.'\','.$user_id.')"> $result .= '<a href="javascript:void(0)" onclick="load_course_list(\'div_'.$user_id.'\','.$user_id.')">
<img onclick="load_course_list(\'div_'.$user_id.'\','.$user_id.')" onmouseout="clear_course_list (\'div_'.$user_id.'\')" src="../img/course.gif" title="'.get_lang('Courses').'" alt="'.get_lang('Courses').'"/> <img onclick="load_course_list(\'div_'.$user_id.'\','.$user_id.')" onmouseout="clear_course_list (\'div_'.$user_id.'\')" src="../img/course.gif" title="'.get_lang('Courses').'" alt="'.get_lang('Courses').'"/>
@ -662,14 +661,14 @@ function active_filter($active, $url_params, $row) {
$image='wrong'; $image='wrong';
} }
$result = '';
if ($action=='edit') { if ($action=='edit') {
$result = Display::return_icon($image.'.gif', get_lang('AccountExpired')); $result = Display::return_icon($image.'.gif', get_lang('AccountExpired'));
} elseif ($row['0']<>$_user['user_id']) { } 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. // 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.'&amp;user_id='.$row['0'].'&amp;'.$url_params.'&amp;sec_token='.$_SESSION['sec_token'].'">'.Display::return_icon($image.'.gif', get_lang(ucfirst($action))).'</a>'; //$result = '<a href="user_list.php?action='.$action.'&amp;user_id='.$row['0'].'&amp;'.$url_params.'&amp;sec_token='.$_SESSION['sec_token'].'">'.Display::return_icon($image.'.gif', get_lang(ucfirst($action))).'</a>';
//$result = '<a href="'.api_get_path(WEB_AJAX_PATH).'user_manager.ajax.php?action=active_user&amp;user_id='.$row['0'].'&amp;'.$url_params.'&amp;sec_token='.$_SESSION['sec_token'].'">'; //$result = '<a href="'.api_get_path(WEB_AJAX_PATH).'user_manager.ajax.php?action=active_user&amp;user_id='.$row['0'].'&amp;'.$url_params.'&amp;sec_token='.$_SESSION['sec_token'].'">';
$result .=Display::return_icon($image.'.gif', get_lang(ucfirst($action)), array('onclick'=>'active_user(this);', 'id'=>'img_'.$row['0'])).'</a>'; $result = Display::return_icon($image.'.gif', get_lang(ucfirst($action)), array('onclick'=>'active_user(this);', 'id'=>'img_'.$row['0'])).'</a>';
//$result .= '<div>'; //$result .= '<div>';
} }
return $result; return $result;
@ -734,10 +733,6 @@ if ($_GET['action'] == "login_as" && isset ($login_as_user_id)) {
login_user($login_as_user_id); login_user($login_as_user_id);
} }
//if (isset ($_GET['search']) && $_GET['search'] == 'advanced')
//{}
//else
//{
if (isset($_GET['keyword']) || isset($_GET['keyword_firstname'])) { if (isset($_GET['keyword']) || isset($_GET['keyword_firstname'])) {
$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin')); $interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array ("url" => 'user_list.php', "name" => get_lang('UserList')); $interbreadcrumb[] = array ("url" => 'user_list.php', "name" => get_lang('UserList'));
@ -748,245 +743,239 @@ if (isset($_GET['keyword']) || isset($_GET['keyword_firstname'])) {
} }
Display :: display_header($tool_name, ""); Display :: display_header($tool_name, "");
//api_display_tool_title($tool_name); //api_display_tool_title($tool_name);
if (isset ($_GET['action'])) { if (isset ($_GET['action'])) {
$check = Security::check_token('get'); $check = Security::check_token('get');
if($check) { if ($check) {
switch ($_GET['action']) { switch ($_GET['action']) {
case 'show_message' : case 'show_message' :
if (!empty($_GET['warn'])) { if (!empty($_GET['warn'])) {
// to prevent too long messages // to prevent too long messages
if ($_GET['warn'] == 'session_message'){ if ($_GET['warn'] == 'session_message'){
$_GET['warn'] = $_SESSION['session_message_import_users']; $_GET['warn'] = $_SESSION['session_message_import_users'];
} }
Display::display_warning_message(urldecode($_GET['warn']),false); Display::display_warning_message(urldecode($_GET['warn']),false);
} }
if (!empty($_GET['message'])) { if (!empty($_GET['message'])) {
Display :: display_confirmation_message(stripslashes($_GET['message'])); Display :: display_confirmation_message(stripslashes($_GET['message']));
} }
break; break;
case 'delete_user' : case 'delete_user' :
if (api_is_platform_admin()) { if (api_is_platform_admin()) {
if ($delete_user_available) { if ($delete_user_available) {
if ($user_id != $_user['user_id'] && UserManager :: delete_user($_GET['user_id'])) { if ($user_id != $_user['user_id'] && UserManager :: delete_user($_GET['user_id'])) {
Display :: display_confirmation_message(get_lang('UserDeleted')); Display :: display_confirmation_message(get_lang('UserDeleted'));
} else {
Display :: display_error_message(get_lang('CannotDeleteUserBecauseOwnsCourse'));
}
} else { } else {
Display :: display_error_message(get_lang('CannotDeleteUser')); Display :: display_error_message(get_lang('CannotDeleteUserBecauseOwnsCourse'));
} }
} else {
Display :: display_error_message(get_lang('CannotDeleteUser'));
} }
break; }
case 'lock' : break;
$message=lock_unlock_user('lock',$_GET['user_id']); case 'lock' :
Display :: display_normal_message($message); $message=lock_unlock_user('lock',$_GET['user_id']);
break; Display :: display_normal_message($message);
case 'unlock'; break;
$message=lock_unlock_user('unlock',$_GET['user_id']); case 'unlock';
Display :: display_normal_message($message); $message=lock_unlock_user('unlock',$_GET['user_id']);
break; Display :: display_normal_message($message);
break;
}
Security::clear_token();
} }
Security::clear_token();
} }
if (isset ($_POST['action'])) }
{
$check = Security::check_token('get'); if (isset ($_POST['action'])) {
if($check) $check = Security::check_token('get');
{ if ($check) {
switch ($_POST['action']) switch ($_POST['action']) {
{ case 'delete' :
case 'delete' : if (api_is_platform_admin()) {
if (api_is_platform_admin()) { $number_of_selected_users = count($_POST['id']);
$number_of_selected_users = count($_POST['id']); $number_of_deleted_users = 0;
$number_of_deleted_users = 0; if (is_array($_POST['id'])) {
if (is_array($_POST['id'])) { foreach ($_POST['id'] as $index => $user_id)
foreach ($_POST['id'] as $index => $user_id) {
if($user_id != $_user['user_id'])
{ {
if($user_id != $_user['user_id']) if(UserManager :: delete_user($user_id))
{ {
if(UserManager :: delete_user($user_id)) $number_of_deleted_users++;
{
$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; if($number_of_selected_users == $number_of_deleted_users)
} {
Security::clear_token(); 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>');
$form->addElement('static','search_advanced_link',null,'<a href="javascript://" class = "advanced_parameters" onclick="display_advanced_search_form();"><span id="img_plus_and_minus">&nbsp;'.Display::return_icon('div_show.gif',get_lang('Show'),array('style'=>'vertical-align:middle')).' '.get_lang('AdvancedSearch').'</span></a>'); // 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>');
$form->addElement('static','search_advanced_link',null,'<a href="javascript://" class = "advanced_parameters" onclick="display_advanced_search_form();"><span id="img_plus_and_minus">&nbsp;'.Display::return_icon('div_show.gif',get_lang('Show'),array('style'=>'vertical-align:middle')).' '.get_lang('AdvancedSearch').'</span></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/user_add.php">'.Display::return_icon('new_user.png',get_lang('AddUsers'),'','32').'</a>'.
'</span>';
}
$form->display();
echo '</div>';
if (isset ($_GET['keyword'])) {
$parameters = array ('keyword' => Security::remove_XSS($_GET['keyword']));
} elseif (isset ($_GET['keyword_firstname'])) {
$parameters['keyword_firstname'] = Security::remove_XSS($_GET['keyword_firstname']);
$parameters['keyword_lastname'] = Security::remove_XSS($_GET['keyword_lastname']);
$parameters['keyword_email'] = Security::remove_XSS($_GET['keyword_email']);
$parameters['keyword_officialcode'] = Security::remove_XSS($_GET['keyword_officialcode']);
$parameters['keyword_status'] = Security::remove_XSS($_GET['keyword_status']);
$parameters['keyword_active'] = Security::remove_XSS($_GET['keyword_active']);
$parameters['keyword_inactive'] = Security::remove_XSS($_GET['keyword_inactive']);
}
// 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];
}
echo '<div class="actions" style="width:100%;">'; // display advaced search form
if (api_is_platform_admin()) { $form = new FormValidator('advanced_search','get');
echo '<span style="float:right; padding-top:7px;">'.
'<a href="'.api_get_path(WEB_CODE_PATH).'admin/user_add.php">'.Display::return_icon('new_user.png',get_lang('AddUsers'),'','32').'</a>'.
'</span>';
}
$form->display();
echo '</div>';
if (isset ($_GET['keyword'])) {
$parameters = array ('keyword' => Security::remove_XSS($_GET['keyword']));
} elseif (isset ($_GET['keyword_firstname'])) {
$parameters['keyword_firstname'] = Security::remove_XSS($_GET['keyword_firstname']);
$parameters['keyword_lastname'] = Security::remove_XSS($_GET['keyword_lastname']);
$parameters['keyword_email'] = Security::remove_XSS($_GET['keyword_email']);
$parameters['keyword_officialcode'] = Security::remove_XSS($_GET['keyword_officialcode']);
$parameters['keyword_status'] = Security::remove_XSS($_GET['keyword_status']);
$parameters['keyword_active'] = Security::remove_XSS($_GET['keyword_active']);
$parameters['keyword_inactive'] = Security::remove_XSS($_GET['keyword_inactive']);
}
// 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];
}
$image_path = UserManager::get_user_picture_path_by_id($user_id, 'web', false, true); $form->addElement('html','<div id="advanced_search_form" style="display:none;">');
$user_profile = UserManager::get_picture_user($user_id, $image_path['file'], 22, USER_IMAGE_SIZE_SMALL, ' width="22" height="22" ');
if (!api_is_anonymous()) {
$photo = '<center><a href="userInfo.php?'.api_get_cidreq().'&origin='.$origin.'&amp;uInfo='.$user_id.'" title="'.get_lang('Info').'" ><img src="'.$user_profile['file'].'" '.$user_profile['style'].' alt="'.api_get_person_name($o_course_user['firstname'], $o_course_user['lastname']).'" title="'.api_get_person_name($o_course_user['firstname'], $o_course_user['lastname']).'" /></a></center>';
} else {
$photo = '<center><img src="'.$user_profile['file'].'" '.$user_profile['style'].' alt="'.api_get_person_name($o_course_user['firstname'], $o_course_user['lastname']).'" title="'.api_get_person_name($o_course_user['firstname'], $o_course_user['lastname']).'" /></center>';
}
$form->addElement('header', '', get_lang('AdvancedSearch'));
// display advaced search form //$form->addElement('html', '<strong>'.get_lang('SearchAUser').'</strong>');
$form = new FormValidator('advanced_search','get');
$form->addElement('html','<div id="advanced_search_form" style="display:none;">'); $form->addElement('html', '<table>');
$form->addElement('header', '', get_lang('AdvancedSearch')); $form->addElement('html', '<tr><td>');
$form->add_textfield('keyword_firstname',get_lang('FirstName'),false,array('style'=>'margin-left:17px'));
$form->addElement('html', '</td><td width="200px;">');
$form->add_textfield('keyword_lastname',get_lang('LastName'),false,array('style'=>'margin-left:17px'));
$form->addElement('html', '</td></tr>');
//$form->addElement('html', '<strong>'.get_lang('SearchAUser').'</strong>'); $form->addElement('html', '<tr><td>');
$form->add_textfield('keyword_username',get_lang('LoginName'),false,array('style'=>'margin-left:17px'));
$form->addElement('html', '</td>');
$form->addElement('html', '<td>');
$form->add_textfield('keyword_email',get_lang('Email'),false,array('style'=>'margin-left:17px'));
$form->addElement('html', '</td></tr>');
$form->addElement('html', '<table>'); $form->addElement('html', '<tr><td>');
$form->add_textfield('keyword_officialcode',get_lang('OfficialCode'),false,array('style'=>'margin-left:17px'));
$form->addElement('html', '</td><td>');
$form->addElement('html', '<tr><td>'); $status_options = array();
$form->add_textfield('keyword_firstname',get_lang('FirstName'),false,array('style'=>'margin-left:17px')); $status_options['%'] = get_lang('All');
$form->addElement('html', '</td><td width="200px;">'); $status_options[STUDENT] = get_lang('Student');
$form->add_textfield('keyword_lastname',get_lang('LastName'),false,array('style'=>'margin-left:17px')); $status_options[COURSEMANAGER] = get_lang('Teacher');
$form->addElement('html', '</td></tr>'); $status_options[DRH] = get_lang('Drh');
$status_options[SESSIONADMIN] = get_lang('Administrator');
$form->addElement('select','keyword_status',get_lang('Profile'),$status_options, array('style'=>'margin-left:17px'));
$form->addElement('html', '</td></tr>');
$form->addElement('html', '<tr><td>');
$form->add_textfield('keyword_username',get_lang('LoginName'),false,array('style'=>'margin-left:17px'));
$form->addElement('html', '</td>');
$form->addElement('html', '<td>');
$form->add_textfield('keyword_email',get_lang('Email'),false,array('style'=>'margin-left:17px'));
$form->addElement('html', '</td></tr>');
$form->addElement('html', '<tr><td>');
$form->add_textfield('keyword_officialcode',get_lang('OfficialCode'),false,array('style'=>'margin-left:17px'));
$form->addElement('html', '</td><td>');
$status_options = array(); $form->addElement('html', '<tr><td>');
$status_options['%'] = get_lang('All'); $active_group = array();
$status_options[STUDENT] = get_lang('Student'); $active_group[] = $form->createElement('checkbox','keyword_active','',get_lang('Active'), array('style'=>'margin-left:17px'));
$status_options[COURSEMANAGER] = get_lang('Teacher'); $active_group[] = $form->createElement('checkbox','keyword_inactive','',get_lang('Inactive'),array('style'=>'margin-left:17px'));
$status_options[DRH] = get_lang('Drh'); $form->addGroup($active_group,'',get_lang('ActiveAccount'),'<br/>',false);
$status_options[SESSIONADMIN] = get_lang('Administrator'); $form->addElement('html', '</td><td>');
$form->addElement('select','keyword_status',get_lang('Profile'),$status_options, array('style'=>'margin-left:17px'));
$form->addElement('html', '</td></tr>');
/*
* @todo fix this code
$extra_data = UserManager::get_extra_fields( 0,10,5, 'ASC', true, 1);
var_dump($extra_data);
$extra_options = array();
if (!empty($extra_data)) {
$extra_options[0] = get_lang('All');
// get information about extra data for adding to input select
foreach ($extra_data as $field_variable => $field_value) {
$extra = UserManager::get_extra_field_information_by_name($field_variable);
$extra_options[$field_variable] = $extra['field_display_text'];
}
$form->addElement('html', '<tr><td>'); $form->addElement('select', 'keyword_extra_data', get_lang('ExtraData'), $extra_options, array('id'=>'input_select_extra_data', 'style'=>'margin-left:17px', 'onchange'=>'if(this.value!=0){document.getElementById(\'extra_data_text\').style.display=\'block\';document.getElementById(\'input_extra_text\').value = "";}else{document.getElementById(\'extra_data_text\').style.display=\'none\';}'));
$active_group = array(); $form->addElement('html', '<div id="extra_data_text" style="display:none;">');
$active_group[] = $form->createElement('checkbox','keyword_active','',get_lang('Active'), array('style'=>'margin-left:17px')); $form->add_textfield('keyword_extra_data_text', '', false, array('style'=>'margin-left:17px', 'id'=>'input_extra_text'));
$active_group[] = $form->createElement('checkbox','keyword_inactive','',get_lang('Inactive'),array('style'=>'margin-left:17px')); $form->addElement('html', '</div>');
$form->addGroup($active_group,'',get_lang('ActiveAccount'),'<br/>',false); } else {
$form->addElement('html', '</td><td>'); $form->addElement('html', '<div id="extra_data_text" style="display:none;">');
}*/
$extra_data = UserManager::get_extra_user_data($user_id, false, true, false, 1); $form->addElement('html', '</td></tr>');
$extra_options = array();
if (!empty($extra_data)) {
$extra_options[0] = get_lang('All');
// get information about extra data for adding to input select
foreach ($extra_data as $field_variable => $field_value) {
$extra = UserManager::get_extra_field_information_by_name($field_variable);
$extra_options[$field_variable] = $extra['field_display_text'];
}
$form->addElement('select', 'keyword_extra_data', get_lang('ExtraData'), $extra_options, array('id'=>'input_select_extra_data', 'style'=>'margin-left:17px', 'onchange'=>'if(this.value!=0){document.getElementById(\'extra_data_text\').style.display=\'block\';document.getElementById(\'input_extra_text\').value = "";}else{document.getElementById(\'extra_data_text\').style.display=\'none\';}')); $form->addElement('html', '<tr><td>');
$form->addElement('html', '<div id="extra_data_text" style="display:none;">'); $form->addElement('style_submit_button', 'submit',get_lang('SearchUsers'),'class="search"');
$form->add_textfield('keyword_extra_data_text', '', false, array('style'=>'margin-left:17px', 'id'=>'input_extra_text')); $form->addElement('html', '</td></tr>');
$form->addElement('html', '</div>');
} else {
$form->addElement('html', '<div id="extra_data_text" style="display:none;">');
}
$form->addElement('html', '</td></tr>'); $form->addElement('html', '</table>');
$form->addElement('html', '<tr><td>'); $defaults['keyword_active'] = 1;
$form->addElement('style_submit_button', 'submit',get_lang('SearchUsers'),'class="search"'); $defaults['keyword_inactive'] = 1;
$form->addElement('html', '</td></tr>'); $form->setDefaults($defaults);
$form->addElement('html','</div>');
$form->addElement('html', '</table>'); $form->display();
$defaults['keyword_active'] = 1; $table = new SortableTable('users', 'get_number_of_users', 'get_user_data', (api_is_western_name_order() xor api_sort_by_first_name()) ? 3 : 2);
$defaults['keyword_inactive'] = 1; $table->set_additional_parameters($parameters);
$form->setDefaults($defaults); $table->set_header(0, '', false, 'width="18px"');
$form -> addElement('html','</div>'); $table->set_header(1, get_lang('Photo'), false);
$table->set_header(2, get_lang('OfficialCode'));
if (api_is_western_name_order()) {
$table->set_header(3, get_lang('FirstName'));
$table->set_header(4, get_lang('LastName'));
} else {
$table->set_header(3, get_lang('LastName'));
$table->set_header(4, get_lang('FirstName'));
}
$table->set_header(5, get_lang('LoginName'));
$table->set_header(6, get_lang('Email'));
$table->set_header(7, get_lang('Profile'));
$table->set_header(8, get_lang('Active'),true, 'width="15px"');
$table->set_header(9, get_lang('Action'), false,'width="220px"');
$table->set_column_filter(3, 'user_filter');
$table->set_column_filter(4, 'user_filter');
$form->display(); $table->set_column_filter(6, 'email_filter');
$table->set_column_filter(7, 'status_filter');
$table->set_column_filter(8, 'active_filter');
$table->set_column_filter(9, 'modify_filter');
$table = new SortableTable('users', 'get_number_of_users', 'get_user_data', (api_is_western_name_order() xor api_sort_by_first_name()) ? 3 : 2); if (api_is_platform_admin())
$table->set_additional_parameters($parameters); $table->set_form_actions(array ('delete' => get_lang('DeleteFromPlatform')));
$table->set_header(0, '', false, 'width="18px"'); $table->display();
$table->set_header(1, get_lang('Photo'), false);
$table->set_header(2, get_lang('OfficialCode')); Display :: display_footer();
if (api_is_western_name_order()) {
$table->set_header(3, get_lang('FirstName'));
$table->set_header(4, get_lang('LastName'));
} else {
$table->set_header(3, get_lang('LastName'));
$table->set_header(4, get_lang('FirstName'));
}
$table->set_header(5, get_lang('LoginName'));
$table->set_header(6, get_lang('Email'));
$table->set_header(7, get_lang('Profile'));
$table->set_header(8, get_lang('Active'),true, 'width="15px"');
$table->set_header(9, get_lang('Action'), false,'width="220px"');
$table->set_column_filter(3, 'user_filter');
$table->set_column_filter(4, 'user_filter');
$table->set_column_filter(6, 'email_filter');
$table->set_column_filter(7, 'status_filter');
$table->set_column_filter(8, 'active_filter');
$table->set_column_filter(9, 'modify_filter');
if (api_is_platform_admin())
$table->set_form_actions(array ('delete' => get_lang('DeleteFromPlatform')));
$table->display();
//}
Display :: display_footer();

@ -464,6 +464,7 @@ class Display {
$hmail .= '&#'.ord($email { $hmail .= '&#'.ord($email {
$i }).';'; $i }).';';
} }
$hclickable_text = null;
// Encrypt clickable text if @ is present // Encrypt clickable text if @ is present
if (strpos($clickable_text, '@')) { if (strpos($clickable_text, '@')) {
for ($i = 0; $i < strlen($clickable_text); $i ++) { for ($i = 0; $i < strlen($clickable_text); $i ++) {

@ -1100,8 +1100,7 @@ class SessionManager {
* Get all session categories (filter by access_url_id) * Get all session categories (filter by access_url_id)
* @return mixed false if the session category does not exist, array if the session category exists * @return mixed false if the session category does not exist, array if the session category exists
*/ */
public static function get_all_session_category() { public static function get_all_session_category() {
$id = intval($id);
$tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY); $tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);
$id = api_get_current_access_url_id(); $id = api_get_current_access_url_id();
$sql = 'SELECT * FROM '.$tbl_session_category.' WHERE access_url_id ="'.$id.'" ORDER BY name ASC'; $sql = 'SELECT * FROM '.$tbl_session_category.' WHERE access_url_id ="'.$id.'" ORDER BY name ASC';

@ -33,10 +33,10 @@ if (api_get_setting('allow_message_tool')=='true') {
if ($panel == 1) { if ($panel == 1) {
//normal message //normal message
$user_info=api_get_user_info($userfriend_id); ?> $user_info=api_get_user_info($userfriend_id); ?>
<div id="display_response_id" style="height:200px;width=400px"> <div id="display_response_id" style="height:200px;width:400px">
<?php echo api_xml_http_response_encode(get_lang('To')); ?> :&nbsp;&nbsp;&nbsp;&nbsp;<?php echo api_xml_http_response_encode(api_get_person_name($user_info['firstName'], $user_info['lastName'])); ?> <?php echo api_xml_http_response_encode(get_lang('To')); ?> :&nbsp;&nbsp;<?php echo api_xml_http_response_encode(api_get_person_name($user_info['firstName'], $user_info['lastName'])); ?>
<br /> <br />
<br /><span style="color:red">*</span><?php echo api_xml_http_response_encode(get_lang('Subject')); ?> :<br /> <br /><span style="color:red"> * </span><?php echo api_xml_http_response_encode(get_lang('Subject')); ?> :<br />
<input id="txt_subject_id" type="text" style="width:400px;"><br/> <input id="txt_subject_id" type="text" style="width:400px;"><br/>
<br /><?php echo api_xml_http_response_encode(get_lang('Message')); ?> :<br /> <br /><?php echo api_xml_http_response_encode(get_lang('Message')); ?> :<br />
<textarea id="txt_area_invite" rows="5" cols="55"></textarea> <textarea id="txt_area_invite" rows="5" cols="55"></textarea>

@ -376,16 +376,20 @@ if (is_array($courses_tree)) {
// Courses inside the current session. // Courses inside the current session.
$date_session_start = $session['details']['date_start']; $date_session_start = $session['details']['date_start'];
$days_access_before_beginning = $session['details']['nb_days_access_before_beginning'] * 24 * 3600; $days_access_before_beginning = $session['details']['nb_days_access_before_beginning'] * 24 * 3600;
$session_now = time(); $session_now = time();
$html_courses_session = ''; $html_courses_session = '';
$count_courses_session = 0; $count_courses_session = 0;
foreach ($session['courses'] as $course) { foreach ($session['courses'] as $course) {
$is_coach_course = api_is_coach($session['details']['id'], $course['code']); $is_coach_course = api_is_coach($session['details']['id'], $course['code']);
if ($is_coach_course) { $allowed_time = 0;
$allowed_time = api_strtotime($date_session_start) - $days_access_before_beginning; if ($date_session_start != '0000-00-00') {
} else { if ($is_coach_course) {
$allowed_time = api_strtotime($date_session_start); $allowed_time = api_strtotime($date_session_start) - $days_access_before_beginning;
} } else {
$allowed_time = api_strtotime($date_session_start);
}
}
if ($session_now > $allowed_time) { //read only and accesible if ($session_now > $allowed_time) { //read only and accesible
if (api_get_setting('hide_courses_in_sessions') == 'false') { if (api_get_setting('hide_courses_in_sessions') == 'false') {
$c = CourseManager :: get_logged_user_course_html($course, $session['details']['id'], 'session_course_item',true); $c = CourseManager :: get_logged_user_course_html($course, $session['details']['id'], 'session_course_item',true);

Loading…
Cancel
Save