Merge with c4d84f45cfcdd94584ac4367acaf4f067c2de132

skala
Ivan Tcholakov 16 years ago
commit 1f4c57f8bf
  1. 1
      main/inc/lib/fckeditor/editor/plugins/ImageManager/Classes/ImageManager.php
  2. 62
      main/newscorm/lp_add_item.php
  3. 134
      main/tracking/courseLog.php
  4. 2
      main/tracking/courseLogCSV.php
  5. 2
      main/tracking/course_access_details.php
  6. 2
      main/tracking/logins_details.php
  7. 2
      main/tracking/personnalLog.php
  8. 3
      main/tracking/toolaccess_details.php
  9. 3
      main/tracking/userLog.php
  10. 3
      main/tracking/userlogCSV.php
  11. 64
      main/user/subscribe_user.php
  12. 146
      main/user/user.php
  13. 4
      main/user/userInfo.php
  14. 3
      main/user/user_add.php
  15. 22
      main/wiki/index.php
  16. 22
      main/wiki/wiki.inc.php
  17. 4
      user_portal.php
  18. 2
      whoisonline.php
  19. 2
      whoisonlinesession.php

@ -542,6 +542,7 @@ class ImageManager
return false;
}
$file['name'] = replace_dangerous_char($file['name'], 'strict');
$file_name = $file['name'];
$extension = explode('.', $file_name);
$count = count($extension);

@ -67,11 +67,72 @@ $language_file = "learnpath";
$htmlHeadXtra[] = '
<script type="text/javascript">
var temp=false;
var temp2=false;
var use_document_title='.api_get_setting('use_document_title').';
var load_default_template = '. ((isset($_POST['submit']) || empty($_SERVER['QUERY_STRING'])) ? 'false' : 'true' ) .';
function FCKeditor_OnComplete( editorInstance )
{
editorInstance.Events.AttachEvent( \'OnSelectionChange\', check_for_title ) ;
document.getElementById(\'frmModel\').innerHTML = "<iframe height=890px width=230px; frameborder=0 src=\''.api_get_path(WEB_LIBRARY_PATH).'fckeditor/editor/fckdialogframe.html \'>";
}
function check_for_title()
{
if(temp==true){
// This functions shows that you can interact directly with the editor area
// DOM. In this way you have the freedom to do anything you want with it.
// Get the editor instance that we want to interact with.
var oEditor = FCKeditorAPI.GetInstance(\'content_lp\') ;
// Get the Editor Area DOM (Document object).
var oDOM = oEditor.EditorDocument ;
var iLength ;
var contentText ;
var contentTextArray;
var bestandsnaamNieuw = "";
var bestandsnaamOud = "";
// The are two diffent ways to get the text (without HTML markups).
// It is browser specific.
if( document.all ) // If Internet Explorer.
{
contentText = oDOM.body.innerText ;
}
else // If Gecko.
{
var r = oDOM.createRange() ;
r.selectNodeContents( oDOM.body ) ;
contentText = r.toString() ;
}
var index=contentText.indexOf("/*<![CDATA");
contentText=contentText.substr(0,index);
// Compose title if there is none
contentTextArray = contentText.split(\' \') ;
var x=0;
for(x=0; (x<5 && x<contentTextArray.length); x++)
{
if(x < 4)
{
bestandsnaamNieuw += contentTextArray[x] + \' \';
}
else
{
bestandsnaamNieuw += contentTextArray[x];
}
}
}
temp=true;
}
function InnerDialogLoaded()
{
if (document.all)
@ -87,7 +148,6 @@ function InnerDialogLoaded()
return B.ClickFrame();
};
</script>';
$htmlHeadXtra[] = $_SESSION['oLP']->create_js();

@ -34,7 +34,6 @@ if (isset($_GET['from']) && $_GET['from'] == 'myspace') {
$this_section = SECTION_COURSES;
}
$is_allowedToTrack = $is_courseAdmin || $is_platformAdmin || $is_courseCoach || $is_sessionAdmin;
if (!$is_allowedToTrack) {
@ -44,11 +43,11 @@ if (!$is_allowedToTrack) {
exit;
}
// including additional libraries
require_once '../newscorm/learnpath.class.php';
require_once '../newscorm/learnpathItem.class.php';
require_once '../newscorm/learnpathList.class.php';
require_once '../newscorm/scorm.class.php';
require_once '../newscorm/scormItem.class.php';
require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpath.class.php';
require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpathItem.class.php';
require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpathList.class.php';
require_once api_get_path(SYS_CODE_PATH).'newscorm/scorm.class.php';
require_once api_get_path(SYS_CODE_PATH).'newscorm/scormItem.class.php';
require_once api_get_path(LIBRARY_PATH).'tracking.lib.php';
require_once api_get_path(LIBRARY_PATH).'course.lib.php';
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
@ -123,7 +122,7 @@ $nameTools = get_lang('Tracking');
Display::display_header($nameTools, 'Tracking');
require api_get_path(LIBRARY_PATH).'statsUtils.lib.inc.php';
require '../resourcelinker/resourcelinker.inc.php';
require api_get_path(SYS_CODE_PATH).'resourcelinker/resourcelinker.inc.php';
$a_students = CourseManager :: get_student_list_from_course_code($_course['id'], true, (empty($_SESSION['id_session']) ? null : $_SESSION['id_session']));
$nbStudents = count($a_students);
@ -152,7 +151,7 @@ if ($_GET['studentlist'] == 'false') {
} else {
echo get_lang('StudentsTracking').' | <a href="courseLog.php?'.api_get_cidreq().'&studentlist=false">'.get_lang('CourseTracking').'</a>';
}
echo '&nbsp;<a href="#" onclick="window.print()"><img align="absbottom" src="../img/printmgr.gif">&nbsp;'.get_lang('Print').'</a>';
echo '&nbsp;<a href="javascript: void(0);" onclick="javascript: window.print();"><img align="absbottom" src="../img/printmgr.gif">&nbsp;'.get_lang('Print').'</a>';
if($_GET['studentlist'] == 'false') {
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&export=csv&studentlist=false"><img align="absbottom" src="../img/excel.gif">&nbsp;'.get_lang('ExportAsCSV').'</a>';
} else {
@ -164,11 +163,9 @@ echo '</div>';
if ($_GET['studentlist'] == 'false') {
echo'<br /><br />';
/***************************
* LEARNING PATHS
***************************/
echo '<div class="report_section">
<h4>
<img src="../img/scormbuilder.gif" align="absbottom">&nbsp;'.get_lang('AverageProgressInLearnpath').'
@ -179,7 +176,7 @@ if($_GET['studentlist'] == 'false') {
$flat_list = $list->get_flat_list();
if ($export_csv) {
$temp=array(get_lang('AverageProgressInLearnpath'),'');
$temp = array(get_lang('AverageProgressInLearnpath', ''), '');
$csv_content[] = array('', '');
$csv_content[] = $temp;
}
@ -188,16 +185,21 @@ if($_GET['studentlist'] == 'false') {
foreach ($flat_list as $lp_id => $lp) {
$lp_avg_progress = 0;
foreach ($a_students as $student_id => $student) {
// get the progress in learning pathes
$lp_avg_progress += learnpath::get_db_progress($lp_id, $student_id);
}
if ($nbStudents > 0) {
$lp_avg_progress = $lp_avg_progress / $nbStudents;
} else {
$lp_avg_progress = null;
}
// Separated presentation logic.
if (is_null($lp_avg_progress)) {
$lp_avg_progress = '0%';
} else {
$lp_avg_progress = round($lp_avg_progress, 1).'%';
}
echo '<tr><td>'.$lp['lp_name'].'</td><td align="right">'.round($lp_avg_progress,1).' %</td></tr>';
echo '<tr><td>'.$lp['lp_name'].'</td><td align="right">'.$lp_avg_progress.'</td></tr>';
if ($export_csv) {
$temp = array($lp['lp_name'], $lp_avg_progress);
$csv_content[] = $temp;
@ -206,12 +208,13 @@ if($_GET['studentlist'] == 'false') {
} else {
echo '<tr><td>'.get_lang('NoLearningPath').'</td></tr>';
if ($export_csv) {
$temp=array(get_lang('NoLearningPath'),'');
$temp = array(get_lang('NoLearningPath', ''), '');
$csv_content[] = $temp;
}
}
echo '</table></div>';
echo '<div class="clear"></div>';
/***************************
* EXERCICES
***************************/
@ -245,11 +248,8 @@ if($_GET['studentlist'] == 'false') {
$count_students = count($student_ids);
while ($quiz = Database::fetch_array($rs)) {
$quiz_avg_score = 0;
if ($count_students > 0) {
foreach ($student_ids as $student_id) {
// get the scorn in exercises
$sql = 'SELECT exe_result , exe_weighting
FROM '.$TABLETRACK_EXERCISES.'
@ -269,16 +269,14 @@ if($_GET['studentlist'] == 'false') {
$avg_student_score += round(($attempt['exe_result'] / $exe_weight * 100), 2);
}
}
if ($nb_attempts > 0) {
$avg_student_score = $avg_student_score / $nb_attempts;
}
$quiz_avg_score += $avg_student_score;
}
}
$count_students = ($count_students == 0 || is_null($count_students) || $count_students == '') ? 1 : $count_students;
echo '<tr><td>'.$quiz['title'].'</td><td align="right">'.round(($quiz_avg_score/$count_students),2).' %</td></tr>';
echo '<tr><td>'.$quiz['title'].'</td><td align="right">'.round(($quiz_avg_score / $count_students), 2).'%'.'</td></tr>';
if ($export_csv) {
$temp = array($quiz['title'], $quiz_avg_score);
$csv_content[] = $temp;
@ -287,7 +285,7 @@ if($_GET['studentlist'] == 'false') {
} else {
echo '<tr><td>'.get_lang('NoExercises').'</td></tr>';
if ($export_csv) {
$temp=array(get_lang('NoExercises'),'');
$temp = array(get_lang('NoExercises', ''), '');
$csv_content[] = $temp;
}
}
@ -309,9 +307,9 @@ if($_GET['studentlist'] == 'false') {
$count_number_of_threads_by_course = Tracking :: count_number_of_threads_by_course($_course['id']);
if ($export_csv) {
$csv_content[] = array(get_lang('Forum'), '');
$csv_content[] = array(get_lang('ForumForumsNumber'),$count_number_of_forums_by_course);
$csv_content[] = array(get_lang('ForumThreadsNumber'),$count_number_of_threads_by_course);
$csv_content[] = array(get_lang('ForumPostsNumber'),$count_number_of_posts_by_course);
$csv_content[] = array(get_lang('ForumForumsNumber', ''), $count_number_of_forums_by_course);
$csv_content[] = array(get_lang('ForumThreadsNumber', ''), $count_number_of_threads_by_course);
$csv_content[] = array(get_lang('ForumPostsNumber', ''), $count_number_of_posts_by_course);
}
echo '<tr><td>'.get_lang('ForumForumsNumber').'</td><td align="right">'.$count_number_of_forums_by_course.'</td></tr>';
echo '<tr><td>'.get_lang('ForumThreadsNumber').'</td><td align="right">'.$count_number_of_threads_by_course.'</td></tr>';
@ -330,15 +328,14 @@ if($_GET['studentlist'] == 'false') {
<table class="data_table">';
$chat_connections_during_last_x_days_by_course = Tracking :: chat_connections_during_last_x_days_by_course($_course['id'], 7);
if ($export_csv) {
$csv_content[] = array(get_lang('Chat'),'');
$csv_content[] = array(sprintf(get_lang('ChatConnectionsDuringLastXDays'),'7'),$chat_connections_during_last_x_days_by_course);
$csv_content[] = array(get_lang('Chat', ''), '');
$csv_content[] = array(sprintf(get_lang('ChatConnectionsDuringLastXDays', ''), '7'), $chat_connections_during_last_x_days_by_course);
}
echo '<tr><td>'.sprintf(get_lang('ChatConnectionsDuringLastXDays'), '7').'</td><td align="right">'.$chat_connections_during_last_x_days_by_course.'</td></tr>';
echo '</table></div>';
echo '<div class="clear"></div>';
/**********************
* TOOLS
**********************/
@ -368,20 +365,17 @@ if($_GET['studentlist'] == 'false') {
<td align="right">'.$row['count_access_tool'].' '.get_lang('Clicks').'</td>
</tr>';
if ($export_csv) {
$temp=array(get_lang(ucfirst($row['access_tool'])),$row['count_access_tool'].' '.get_lang('Clicks'));
$temp = array(get_lang(ucfirst($row['access_tool']), ''), $row['count_access_tool'].' '.get_lang('Clicks', ''));
$csv_content[] = $temp;
}
}
echo '</table></div>';
echo '<div class="clear"></div>';
/***************************
* DOCUMENTS
***************************/
if ($_GET['num'] == 0 or empty($_GET['num'])) {
$num = 3;
$link = '&nbsp;-&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&studentlist=false&num=1#ancle">'.get_lang('SeeDetail').'</a>';
@ -390,14 +384,12 @@ if($_GET['studentlist'] == 'false') {
$link = '&nbsp;-&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&studentlist=false&num=0#ancle">'.get_lang('ViewMinus').'</a>';
}
echo '<a name="ancle" id="a"></a><div class="report_section">
<h4>
<img src="../img/documents.gif" align="absbottom">&nbsp;'.get_lang('DocumentsMostDownloaded').$link.'
</h4>
<table class="data_table">';
$sql = "SELECT down_doc_path, COUNT(DISTINCT down_user_id), COUNT(down_doc_path) as count_down
FROM $TABLETRACK_DOWNLOADS
WHERE down_cours_id = '$_cid'
@ -407,7 +399,7 @@ if($_GET['studentlist'] == 'false') {
$rs = api_sql_query($sql, __FILE__, __LINE__);
if ($export_csv) {
$temp=array(get_lang('DocumentsMostDownloaded'),'');
$temp = array(get_lang('DocumentsMostDownloaded', ''), '');
$csv_content[] = array('', '');
$csv_content[] = $temp;
}
@ -418,16 +410,15 @@ if($_GET['studentlist'] == 'false') {
<td>'.$row['down_doc_path'].'</td>
<td align="right">'.$row['count_down'].' '.get_lang('Clicks').'</td>
</tr>';
if ($export_csv) {
$temp=array($row['down_doc_path'],$row['count_down'].' '.get_lang('Clicks'));
$temp = array($row['down_doc_path'], $row['count_down'].' '.get_lang('Clicks', ''));
$csv_content[] = $temp;
}
}
} else {
echo '<tr><td>'.get_lang('NoDocumentDownloaded').'</td></tr>';
if ($export_csv) {
$temp=array(get_lang('NoDocumentDownloaded'),'');
$temp = array(get_lang('NoDocumentDownloaded', ''),'');
$csv_content[] = $temp;
}
}
@ -435,11 +426,9 @@ if($_GET['studentlist'] == 'false') {
echo '<div class="clear"></div>';
/***************************
* LINKS
***************************/
echo '<div class="report_section">
<h4>
<img src="../img/link.gif" align="absbottom">&nbsp;'.get_lang('LinksMostClicked').'
@ -468,7 +457,7 @@ if($_GET['studentlist'] == 'false') {
<td align="right">'.$row['count_visits'].' '.get_lang('Clicks').'</td>
</tr>';
if ($export_csv){
$temp=array($row['title'],$row['count_visits'].' '.get_lang('Clicks'));
$temp = array($row['title'],$row['count_visits'].' '.get_lang('Clicks', ''));
$csv_content[] = $temp;
}
}
@ -516,15 +505,26 @@ if($_GET['studentlist'] == 'false') {
$form -> display();
// END : form to remind inactives susers
if ($export_csv) {
$is_western_name_order = api_is_western_name_order(PERSON_NAME_DATA_EXPORT);
} else {
$is_western_name_order = api_is_western_name_order();
}
$sort_by_first_name = api_sort_by_first_name();
$tracking_column = isset($_GET['tracking_column']) ? $_GET['tracking_column'] : 0;
$tracking_column = isset($_GET['tracking_column']) ? $_GET['tracking_column'] : ($is_western_name_order xor $sort_by_first_name) ? 2 : 1;
$tracking_direction = isset($_GET['tracking_direction']) ? $_GET['tracking_direction'] : 'DESC';
if (count($a_students) > 0) {
$table = new SortableTable('tracking', 'count_student_in_course');
$table -> set_header(0, get_lang('OfficialCode'), false, 'align="center"');
$table = new SortableTable('tracking', 'count_student_in_course', null, ($is_western_name_order xor $sort_by_first_name) ? 2 : 1);
$table -> set_header(0, get_lang('OfficialCode'), true, 'align="center"');
if ($is_western_name_order) {
$table -> set_header(1, get_lang('FirstName'), true, 'align="center"');
$table -> set_header(2, get_lang('LastName'), true, 'align="center"');
} else {
$table -> set_header(1, get_lang('LastName'), true, 'align="center"');
$table -> set_header(2, get_lang('FirstName'), false, 'align="center"');
$table -> set_header(2, get_lang('FirstName'), true, 'align="center"');
}
$table -> set_header(3, get_lang('TrainingTime'), false);
$table -> set_header(4, get_lang('CourseProgress'), false);
$table -> set_header(5, get_lang('Score'), false);
@ -549,8 +549,13 @@ if($_GET['studentlist'] == 'false') {
$row = array();
$row[] = $student_datas['official_code'];
if ($is_western_name_order) {
$row[] = $student_datas['firstname'];
$row[] = $student_datas['lastname'];
} else {
$row[] = $student_datas['lastname'];
$row[] = $student_datas['firstname'];
}
$row[] = api_time_to_hms($avg_time_spent);
if (is_null($avg_student_score)) {$avg_student_score=0;}
if (is_null($avg_student_progress)) {$avg_student_progress=0;}
@ -572,7 +577,6 @@ if($_GET['studentlist'] == 'false') {
$row[] = '<center><a href="../mySpace/myStudents.php?student='.$student_id.'&details=true&course='.$course_code.'&origin=tracking_course'.$from.'"><img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a></center>';
$all_datas[] = $row;
}
usort($all_datas, 'sort_users');
@ -600,23 +604,37 @@ if($_GET['studentlist'] == 'false') {
// send the csv file if asked
if ($export_csv) {
if ($is_western_name_order) {
$csv_headers = array (
get_lang('OfficialCode'),
get_lang('LastName'),
get_lang('FirstName'),
get_lang('TrainingTime'),
get_lang('CourseProgress'),
get_lang('Score'),
get_lang('Student_publication'),
get_lang('Messages'),
get_lang('FirstLogin'),
get_lang('LatestLogin')
get_lang('OfficialCode', ''),
get_lang('FirstName', ''),
get_lang('LastName', ''),
get_lang('TrainingTime', ''),
get_lang('CourseProgress', ''),
get_lang('Score', ''),
get_lang('Student_publication', ''),
get_lang('Messages', ''),
get_lang('FirstLogin', ''),
get_lang('LatestLogin', '')
);
} else {
$csv_headers = array (
get_lang('OfficialCode', ''),
get_lang('LastName', ''),
get_lang('FirstName', ''),
get_lang('TrainingTime', ''),
get_lang('CourseProgress', ''),
get_lang('Score', ''),
get_lang('Student_publication', ''),
get_lang('Messages', ''),
get_lang('FirstLogin', ''),
get_lang('LatestLogin', '')
);
}
ob_end_clean();
array_unshift($csv_content, $csv_headers); // adding headers before the content
Export :: export_table_csv($csv_content, 'reporting_student_list');
}
}
?>
</table>

@ -34,6 +34,8 @@
==============================================================================
*/
// TODO: Is this file deprecated?
/*
==============================================================================
INIT SECTION

@ -32,6 +32,8 @@
==============================================================================
*/
// TODO: Is this file deprecated?
/*
==============================================================================
INIT SECTION

@ -32,6 +32,8 @@
==============================================================================
*/
// TODO: Is this file deprecated?
/*
==============================================================================
INIT SECTION

@ -32,6 +32,8 @@
==============================================================================
*/
// TODO: Is this file deprecated?
/*
==============================================================================
INIT SECTION

@ -21,6 +21,9 @@
Mail: info@dokeos.com
==============================================================================
*/
// TODO: Is this file deprecated?
/**
==============================================================================
* @author Thomas Depraetere

@ -22,6 +22,9 @@
Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
==============================================================================
*/
// TODO: Is this file deprecated?
/**
==============================================================================
* @package dokeos.tracking

@ -22,6 +22,9 @@
Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
==============================================================================
*/
// TODO: Is this file deprecated?
/**
==============================================================================
* @package dokeos.tracking

@ -254,13 +254,17 @@ function get_user_data($from, $number_of_items, $column, $direction) {
$user_table = Database :: get_main_table(TABLE_MAIN_USER);
$course_user_table = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$tbl_session_rel_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$is_western_name_order = api_is_western_name_order();
if (isset($_REQUEST['type']) && $_REQUEST['type']=='teacher') {
if (!empty($_SESSION["id_session"])) {
$sql = "SELECT
u.user_id AS col0,
u.official_code AS col1,
u.lastname AS col2,
u.firstname AS col3,
".($is_western_name_order
? "u.firstname AS col2,
u.lastname AS col3,"
: "u.lastname AS col2,
u.firstname AS col3,")."
u.email AS col4,
u.active AS col5,
u.user_id AS col6
@ -271,8 +275,11 @@ function get_user_data($from, $number_of_items, $column, $direction) {
$sql = "SELECT
u.user_id AS col0,
u.official_code AS col1,
u.lastname AS col2,
u.firstname AS col3,
".($is_western_name_order
? "u.firstname AS col2,
u.lastname AS col3,"
: "u.lastname AS col2,
u.firstname AS col3,")."
u.email AS col4,
u.active AS col5,
u.user_id AS col6
@ -280,18 +287,19 @@ function get_user_data($from, $number_of_items, $column, $direction) {
LEFT JOIN $course_user_table cu on u.user_id = cu.user_id and course_code='".$_SESSION['_course']['id']."'
WHERE cu.user_id IS NULL";
//showing only the courses of the current Dokeos access_url_id
global $_configuration;
if ($_configuration['multiple_access_urls']==true) {
$url_access_id = api_get_current_access_url_id();
if ($url_access_id !=-1) {
$tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$sql = "SELECT
u.user_id AS col0,
u.official_code AS col1,
u.lastname AS col2,
u.firstname AS col3,
".($is_western_name_order
? "u.firstname AS col2,
u.lastname AS col3,"
: "u.lastname AS col2,
u.firstname AS col3,")."
u.email AS col4,
u.active AS col5,
u.user_id AS col6
@ -302,16 +310,17 @@ function get_user_data($from, $number_of_items, $column, $direction) {
WHERE cu.user_id IS NULL AND access_url_id= $url_access_id ";
}
}
}
} else {
if (!empty($_SESSION["id_session"])) {
$sql = "SELECT
u.user_id AS col0,
u.official_code AS col1,
u.lastname AS col2,
u.firstname AS col3,
".($is_western_name_order
? "u.firstname AS col2,
u.lastname AS col3,"
: "u.lastname AS col2,
u.firstname AS col3,")."
u.email AS col4,
u.active AS col5,
u.user_id AS col6
@ -323,8 +332,11 @@ function get_user_data($from, $number_of_items, $column, $direction) {
$sql = "SELECT
u.user_id AS col0,
u.official_code AS col1,
u.lastname AS col2,
u.firstname AS col3,
".($is_western_name_order
? "u.firstname AS col2,
u.lastname AS col3,"
: "u.lastname AS col2,
u.firstname AS col3,")."
u.email AS col4,
u.active AS col5,
u.user_id AS col6
@ -337,12 +349,14 @@ function get_user_data($from, $number_of_items, $column, $direction) {
$url_access_id = api_get_current_access_url_id();
if ($url_access_id !=-1) {
$tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$sql = "SELECT
u.user_id AS col0,
u.official_code AS col1,
u.lastname AS col2,
u.firstname AS col3,
".($is_western_name_order
? "u.firstname AS col2,
u.lastname AS col3,"
: "u.lastname AS col2,
u.firstname AS col3,")."
u.email AS col4,
u.active AS col5,
u.user_id AS col6
@ -366,7 +380,11 @@ function get_user_data($from, $number_of_items, $column, $direction) {
while ($user = Database::fetch_row($res)) {
$users[] = $user;
$_SESSION['session_user_id'][] = $user[0];
$_SESSION['session_user_name'][]=$user[3].' '.$user[2];
if ($is_western_name_order) {
$_SESSION['session_user_name'][] = api_get_person_name($user[2], $user[3]);
} else {
$_SESSION['session_user_name'][] = api_get_person_name($user[3], $user[2]);
}
}
return $users;
}
@ -418,6 +436,8 @@ function active_filter($active, $url_params, $row) {
}
$is_western_name_order = api_is_western_name_order();
$sort_by_first_name = api_sort_by_first_name();
// Build search-form
echo '<div class="actions">';
@ -438,15 +458,20 @@ $form->display();
echo '</div>';
// Build table
$table = new SortableTable('users', 'get_number_of_users', 'get_user_data', 2);
$table = new SortableTable('users', 'get_number_of_users', 'get_user_data', ($is_western_name_order xor $sort_by_first_name) ? 3 : 2);
$parameters['keyword'] = $_REQUEST['keyword'];
$parameters ['type'] = $_REQUEST['type'];
$table->set_additional_parameters($parameters);
$col = 0;
$table->set_header($col ++, '', false);
$table->set_header($col ++, get_lang('OfficialCode'));
if (api_is_western_name_order()) {
$table->set_header($col ++, get_lang('FirstName'));
$table->set_header($col ++, get_lang('LastName'));
} else {
$table->set_header($col ++, get_lang('LastName'));
$table->set_header($col ++, get_lang('FirstName'));
}
$table->set_header($col ++, get_lang('Email'));
$table->set_column_filter($col -1, 'email_filter');
$table->set_header($col ++, get_lang('Active'),false);
@ -463,7 +488,6 @@ if ( !empty($_POST['keyword'])) {
// Display table
$table->display();
/*
==============================================================================
FOOTER

@ -30,7 +30,7 @@
// name of the language file that needs to be included
$language_file = array('registration', 'admin', 'userInfo');
$use_anonymous = true;
require_once ("../inc/global.inc.php");
require_once '../inc/global.inc.php';
$this_section = SECTION_COURSES;
// notice for unauthorized people.
@ -40,17 +40,17 @@ api_protect_course_script(true);
Libraries
-----------------------------------------------------------
*/
require_once (api_get_path(LIBRARY_PATH)."debug.lib.inc.php");
require_once (api_get_path(LIBRARY_PATH)."export.lib.inc.php");
require_once (api_get_path(LIBRARY_PATH)."course.lib.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).'usermanager.lib.php');
require_once (api_get_path(LIBRARY_PATH).'groupmanager.lib.php');
require_once api_get_path(LIBRARY_PATH).'debug.lib.inc.php';
require_once api_get_path(LIBRARY_PATH).'export.lib.inc.php';
require_once api_get_path(LIBRARY_PATH).'course.lib.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).'usermanager.lib.php';
require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
//CHECK KEYS
if (!isset ($_cid)) {
header("location: ".$_configuration['root_web']);
header('location: '.$_configuration['root_web']);
}
/*
@ -60,6 +60,8 @@ require_once (api_get_path(LIBRARY_PATH).'groupmanager.lib.php');
*/
$currentCourseID = Database::escape_string($_course['sysCode']);
$is_western_name_order = api_is_western_name_order();
$sort_by_first_name = api_sort_by_first_name();
/*--------------------------------------
Unregistering a user section
@ -88,8 +90,9 @@ if (api_is_allowed_to_edit()) {
switch ($_GET['action']) {
case 'export' :
$table_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$session_id=0;
$table_users = Database::get_main_table(TABLE_MAIN_USER);
$session_id = 0;
$is_western_name_order = api_is_western_name_order(PERSON_NAME_DATA_EXPORT);
$data = array();
$a_users = array();
@ -98,15 +101,15 @@ if (api_is_allowed_to_edit()) {
if (api_get_setting('use_session_mode') == 'true') {
$session_id = intval($_SESSION['id_session']);
$table_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$sql_query = "SELECT DISTINCT user.user_id, user.lastname, user.firstname, user.email, user.official_code
$sql_query = "SELECT DISTINCT user.user_id, ".($is_western_name_order ? "user.firstname, user.lastname" : "user.lastname, user.firstname").", user.email, user.official_code
FROM $table_session_course_user as session_course_user, $table_users as user
WHERE `course_code` = '$currentCourseID' AND session_course_user.id_user = user.user_id ";
if ($session_id != 0) {
$sql_query .= ' AND id_session = '.$session_id;
}
$sql_query.=' ORDER BY user.lastname';
$rs = api_sql_query($sql_query, __FILE__, __LINE__);
$sql_query .= $sort_by_first_name ? ' ORDER BY user.firstname, user.lastname' : ' ORDER BY user.lastname, user.firstname';
$rs = Database::query($sql_query, __FILE__, __LINE__);
while ($user = Database:: fetch_array($rs, 'ASSOC')) {
$data[] = $user;
//$user_infos = Database :: get_user_info_from_id($user['user_id']);
@ -117,18 +120,15 @@ if (api_is_allowed_to_edit()) {
if ($session_id == 0) {
// users directly subscribed to the course
$table_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$sql_query = "SELECT DISTINCT user.user_id, user.lastname, user.firstname, user.email, user.official_code
FROM $table_course_user as course_user, $table_users as user WHERE `course_code` = '$currentCourseID' AND course_user.user_id = user.user_id ORDER BY user.lastname";
$rs = api_sql_query($sql_query, __FILE__, __LINE__);
$sql_query = "SELECT DISTINCT user.user_id, ".($is_western_name_order ? "user.firstname, user.lastname" : "user.lastname, user.firstname").", user.email, user.official_code
FROM $table_course_user as course_user, $table_users as user WHERE `course_code` = '$currentCourseID' AND course_user.user_id = user.user_id ".($sort_by_first_name ? "ORDER BY user.firstname, user.lastname" : "ORDER BY user.lastname, user.firstname");
$rs = Database::query($sql_query, __FILE__, __LINE__);
while ($user = Database::fetch_array($rs, 'ASSOC')) {
$data[] = $user;
$a_users[$user['user_id']] = $user;
}
}
switch ($_GET['type']) {
case 'csv' :
Export::export_table_csv($a_users);
@ -155,18 +155,16 @@ if (api_is_allowed_to_edit()) {
INNER JOIN '.$tbl_session_rel_course.' rel_course
ON rel_course.id_session = reluser.id_session
WHERE user.user_id = "'.$user_id.'"
AND rel_course.course_code = "'.$currentCourseID.'"
ORDER BY lastname, firstname';
$result=api_sql_query($sql,__FILE__,__LINE__);
AND rel_course.course_code = "'.$currentCourseID.'"';
$result = Database::query($sql, __FILE__ ,__LINE__);
$row = Database::fetch_array($result, 'ASSOC');
if ($row['user_id'] == $user_id || $row['user_id'] == "") {
CourseManager::unsubscribe_user($_GET['user_id'], $_SESSION['_course']['sysCode']);
$message = get_lang('UserUnsubscribed');
} else {
$message = get_lang('ThisStudentIsSubscribeThroughASession');
}
}
}
} // end if allowed to edit
@ -238,9 +236,9 @@ function show_users_in_virtual_courses() {
} else {
$status = " - ";
}
$full_name = $lastname.", ".$firstname;
if ( $lastname == "" || $firstname == '') {
$full_name = api_get_person_name($firstname, $lastname);
if ($lastname == '' || $firstname == '') {
$full_name = $loginname;
}
@ -276,13 +274,9 @@ if (!$is_allowed_in_course) {
} else {
$tool_name = get_lang('Users');
}
Display::display_header($tool_name, "User");
} else {
?> <link rel="stylesheet" type="text/css" href="<?php echo api_get_path(WEB_CODE_PATH); ?>css/default.css" /> <?php
}
if (isset($message)) {
@ -332,10 +326,8 @@ if ( api_is_allowed_to_edit()) {
echo '</div>';
}
/*
if (1) // platform setting api_get_setting('subscribe_user_by_coach')
{
if (!api_is_allowed_to_edit() && $is_courseTutor)
{
if (1) // platform setting api_get_setting('subscribe_user_by_coach') {
if (!api_is_allowed_to_edit() && $is_courseTutor) {
echo "<div align=\"right\">";
echo '<a href="subscribe_user.php?'.api_get_cidreq().'">'.Display::return_icon('add_user_big.gif',get_lang("SubscribeUserToCourse")).'&nbsp;'.get_lang("SubscribeUserToCourse").'</a>';
echo "</div>";
@ -371,13 +363,11 @@ if (1) // platform setting api_get_setting('subscribe_user_by_coach')
*/
function get_number_of_users() {
$counter = 0;
if (!empty($_SESSION["id_session"])){
$a_course_users = CourseManager :: get_user_list_from_course_code($_SESSION['_course']['id'], true, $_SESSION['id_session']);
} else {
$a_course_users = CourseManager :: get_user_list_from_course_code($_SESSION['_course']['id'], true);
}
foreach ($a_course_users as $user_id => $o_course_user) {
if ((isset($_GET['keyword']) && search_keyword($o_course_user['firstname'], $o_course_user['lastname'], $o_course_user['username'], $o_course_user['official_code'], $_GET['keyword'])) || !isset($_GET['keyword']) || empty($_GET['keyword'])) {
$counter++;
@ -387,12 +377,11 @@ function get_number_of_users() {
}
function search_keyword($firstname, $lastname, $username, $official_code, $keyword) {
if (strripos($firstname,$keyword)!==false || strripos($lastname,$keyword)!==false || strripos($username,$keyword)!==false || strripos($official_code,$keyword)!==false) {
if (api_strripos($firstname, $keyword) !== false || api_strripos($lastname, $keyword) !== false || api_strripos($username, $keyword) !== false || api_strripos($official_code, $keyword) !== false) {
return true;
} else {
return false;
}
}
@ -402,25 +391,49 @@ function search_keyword($firstname,$lastname,$username,$official_code,$keyword)
function get_user_data($from, $number_of_items, $column, $direction) {
global $origin;
global $is_western_name_order;
global $sort_by_first_name;
$a_users = array();
// limit
if (!isset($_GET['keyword']) || empty($_GET['keyword']))
if (!isset($_GET['keyword']) || empty($_GET['keyword'])) {
$limit = 'LIMIT '.intval($from).','.intval($number_of_items);
// order by
switch ($column) {
case 1 : $order_by = 'ORDER BY user.firstname';break;
case 2 : $order_by = 'ORDER BY user.lastname';break;
case 5 : $order_by = 'ORDER BY user.official_code';break;
default: $order_by = 'ORDER BY user.lastname';break;
}
if (!in_array($direction, array('ASC', 'DESC'))) {
$direction = 'ASC';
}
$order_by .= ' '.$direction;
// order by
if (api_is_allowed_to_edit()) {
$column--;
}
switch ($column) {
case 1:
if ($is_western_name_order) {
$order_by = 'ORDER BY user.firstname '.$direction.', user.lastname '.$direction;
} else {
$order_by = 'ORDER BY user.lastname '.$direction.', user.firstname '.$direction;
}
break;
case 2:
if ($is_western_name_order) {
$order_by = 'ORDER BY user.lastname '.$direction.', user.firstname '.$direction;
} else {
$order_by = 'ORDER BY user.firstname '.$direction.', user.lastname '.$direction;
}
break;
case 5:
$order_by = 'ORDER BY user.official_code '.$direction;
break;
default:
if ($sort_by_first_name) {
$order_by = 'ORDER BY user.firstname '.$direction.', user.lastname '.$direction;
} else {
$order_by = 'ORDER BY user.lastname '.$direction.', user.firstname '.$direction;
}
break;
}
if (!empty($_SESSION["id_session"])) {
$a_course_users = CourseManager :: get_user_list_from_course_code($_SESSION['_course']['id'], true, $_SESSION['id_session'], $limit, $order_by);
@ -440,19 +453,24 @@ function get_user_data($from, $number_of_items, $column, $direction) {
$image_path = UserManager::get_user_picture_path_by_id($user_id, 'web', false, true);
$user_profile = UserManager::get_picture_user($user_id, $image_path['file'], 22, '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="'.$o_course_user['firstname'].' '.$o_course_user['lastname'].'" title="'.$o_course_user['firstname'].' '.$o_course_user['lastname'].'" /></a></center>';
$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="'.$o_course_user['firstname'].' '.$o_course_user['lastname'].'" title="'.$o_course_user['firstname'].' '.$o_course_user['lastname'].'" /></center>';
$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>';
}
$temp[] = $photo;
if ($is_western_name_order) {
$temp[] = $o_course_user['firstname'];
$temp[] = $o_course_user['lastname'];
} else {
$temp[] = $o_course_user['lastname'];
$temp[] = $o_course_user['firstname'];
}
$temp[] = $o_course_user['role'];
$temp[] = implode(', ', $groups_name); //Group
$temp[] = $o_course_user['official_code'];
// deprecated feature
if (isset($o_course_user['tutor_id']) && $o_course_user['tutor_id'] == 1) {
$temp[] = get_lang('Tutor');
@ -475,16 +493,19 @@ function get_user_data($from, $number_of_items, $column, $direction) {
$image_repository = $image_path['dir'];
$existing_image = $image_path['file'];
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="'.$image_repository.$existing_image.'" alt="'.$o_course_user['firstname'].' '.$o_course_user['lastname'].'" width="22" height="22" title="'.$o_course_user['firstname'].' '.$o_course_user['lastname'].'" /></a></center>';
}
else
{
$photo= '<center><img src="'.$image_repository.$existing_image.'" alt="'.$o_course_user['firstname'].' '.$o_course_user['lastname'].'" width="22" height="22" title="'.$o_course_user['firstname'].' '.$o_course_user['lastname'].'" /></center>';
$photo= '<center><a href="userInfo.php?'.api_get_cidreq().'&origin='.$origin.'&amp;uInfo='.$user_id.'" title="'.get_lang('Info').'" ><img src="'.$image_repository.$existing_image.'" alt="'.api_get_person_name($o_course_user['firstname'], $o_course_user['lastname']).'" width="22" height="22" title="'.api_get_person_name($o_course_user['firstname'], $o_course_user['lastname']).'" /></a></center>';
} else {
$photo= '<center><img src="'.$image_repository.$existing_image.'" alt="'.api_get_person_name($o_course_user['firstname'], $o_course_user['lastname']).'" width="22" height="22" title="'.api_get_person_name($o_course_user['firstname'], $o_course_user['lastname']).'" /></center>';
}
$temp[] = $photo;
if ($is_western_name_order) {
$temp[] = $o_course_user['firstname'];
$temp[] = $o_course_user['lastname'];
} else {
$temp[] = $o_course_user['lastname'];
$temp[] = $o_course_user['firstname'];
}
$temp[] = $o_course_user['role'];
$temp[] = implode(', ', $groups_name);//Group
$temp[] = $o_course_user['official_code'];
@ -499,7 +520,6 @@ function get_user_data($from, $number_of_items, $column, $direction) {
}
/**
* Build the active-column of the table to lock or unlock a certain user
* lock = the user can no longer use this account
@ -515,7 +535,6 @@ function active_filter($active, $url_params, $row) {
$action='AccountActive';
$image='right';
}
if ($active=='0') {
$action='AccountInactive';
$image='wrong';
@ -555,8 +574,9 @@ function modify_filter($user_id) {
return $result;
}
$default_column = ($is_western_name_order xor $sort_by_first_name) ? 3 : 2;
$default_column = api_is_allowed_to_edit() ? 2 : 1;
$table = new SortableTable('users', 'get_number_of_users', 'get_user_data', $default_column);
$parameters['keyword'] = $_GET['keyword'];
$table->set_additional_parameters($parameters);
@ -566,8 +586,13 @@ if ( api_is_allowed_to_edit()) {
$table->set_header($header_nr++, '', false);
}
$table->set_header($header_nr++, get_lang('Photo'), false);
if (is_western_name_order) {
$table->set_header($header_nr++, get_lang('FirstName'));
$table->set_header($header_nr++, get_lang('LastName'));
} else {
$table->set_header($header_nr++, get_lang('LastName'));
$table->set_header($header_nr++, get_lang('FirstName'));
}
$table->set_header($header_nr++, get_lang('Description'), false);
$table->set_header($header_nr++, get_lang('GroupSingle'), false);
$table->set_header($header_nr++, get_lang('OfficialCode'));
@ -586,9 +611,6 @@ if ( api_is_allowed_to_edit()) {
}
}
$table->display();
if (!empty($_GET['keyword']) && !empty($_GET['submit'])) {
@ -596,7 +618,7 @@ if ( !empty($_GET['keyword']) && !empty($_GET['submit']) ) {
echo '<br/>'.get_lang('SearchResultsFor').' <span style="font-style: italic ;"> '.$keyword_name.' </span><br>';
}
if (api_get_setting('allow_user_headings') == 'true' && $is_courseAdmin && api_is_allowed_to_edit() && $origin != 'learnpath') { // only course administrators see this line
if (get_setting('allow_user_headings') == 'true' && $is_courseAdmin && api_is_allowed_to_edit() && $origin != 'learnpath') { // only course administrators see this line
echo "<div align=\"right\">", "<form method=\"post\" action=\"userInfo.php\">", get_lang("CourseAdministratorOnly"), " : ", "<input type=\"submit\" name=\"viewDefList\" value=\"".get_lang("DefineHeadings")."\" />", "</form>", "</div>\n";
}

@ -413,7 +413,7 @@ elseif ($displayMode == "viewMainInfoEdit")
"<td>", get_lang('CourseManager'), "</td>\n",
"</tr>\n",
"<tr align=\"center\">",
"<td align=\"left\"><b>", htmlize($mainUserInfo['firstName']), " ", htmlize($mainUserInfo['lastName']), "</b></td>\n",
"<td align=\"left\"><b>", htmlize(api_get_person_name($mainUserInfo['firstName'], $mainUserInfo['lastName'])), "</b></td>\n",
"<td align=\"left\"><input type=\"text\" name =\"role\" value=\"", $mainUserInfo['role'], "\" maxlength=\"40\" /></td>",
"<td><input class=\"checkbox\" type=\"checkbox\" name=\"promoteTutor\" value=\"1\" ", $tutorChecked, " /></td>";
@ -494,7 +494,7 @@ elseif ($displayMode == "viewContentList") // default display
"<tr align=\"center\">\n",
"<td align=\"left\"><b>",htmlize($mainUserInfo['firstName'])," ",htmlize($mainUserInfo['lastName']),"</b></td>\n",
"<td align=\"left\"><b>",htmlize(api_get_person_name($mainUserInfo['firstName'], $mainUserInfo['lastName'])),"</b></td>\n",
"<td align=\"left\">",htmlize($mainUserInfo['role']),"</td>";
//DISPLAY TABLE CONTENT

@ -20,6 +20,9 @@
Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
==============================================================================
*/
// TODO: Is this file deprecated?
/**
==============================================================================
* @package dokeos.user

@ -364,7 +364,7 @@ if ($_GET['view'])
$userinfo=Database::get_user_info_from_id($last_row['is_editing']);
$is_being_edited= get_lang('ThisPageisBeginEditedBy').' <a href=../user/userInfo.php?uInfo='.$userinfo['user_id'].'>'.$userinfo['firstname'].', '.$userinfo['lastname'].'</a>. '.get_lang('ThisPageisBeginEditedTryLater').' '.date( "i",$rest_time).' '.get_lang('MinMinutes').'';
$is_being_edited= get_lang('ThisPageisBeginEditedBy').' <a href=../user/userInfo.php?uInfo='.$userinfo['user_id'].'>'.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).'</a>. '.get_lang('ThisPageisBeginEditedTryLater').' '.date( "i",$rest_time).' '.get_lang('MinMinutes').'';
Display::display_normal_message($is_being_edited, false);
}
@ -585,7 +585,7 @@ if ($_GET['action']=='mactiveusers')
$userinfo=Database::get_user_info_from_id($obj->user_id);
$row = array ();
$row[] = $obj->user_id <>0 ? '<a href="../user/userInfo.php?uInfo='.$userinfo['user_id'].'">'.$userinfo['lastname'].', '.$userinfo['firstname'].'</a><a href="'.api_get_self().'?cidReq='.$_course[id].'&action=usercontrib&user_id='.urlencode($row['user_id']).'&group_id='.Security::remove_XSS($_GET['group_id']).'"></a>' : get_lang('Anonymous').' ('.$obj->user_ip.')';
$row[] = $obj->user_id <>0 ? '<a href="../user/userInfo.php?uInfo='.$userinfo['user_id'].'">'.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).'</a><a href="'.api_get_self().'?cidReq='.$_course[id].'&action=usercontrib&user_id='.urlencode($row['user_id']).'&group_id='.Security::remove_XSS($_GET['group_id']).'"></a>' : get_lang('Anonymous').' ('.$obj->user_ip.')';
$row[] ='<a href="'.api_get_self().'?cidReq='.$_course[id].'&action=usercontrib&user_id='.urlencode($obj->user_id).'&group_id='.Security::remove_XSS($_GET['group_id']).'">'.$obj->NUM_EDIT.'</a>';
$rows[] = $row;
}
@ -605,7 +605,7 @@ if ($_GET['action']=='usercontrib')
{
$userinfo=Database::get_user_info_from_id(Security::remove_XSS($_GET['user_id']));
echo '<div class="actions">'.get_lang('UserContributions').': <a href="../user/userInfo.php?uInfo='.$userinfo['user_id'].'">'.$userinfo['lastname'].', '.$userinfo['firstname'].'</a><a href="'.api_get_self().'?cidReq='.$_course[id].'&action=usercontrib&user_id='.urlencode($row['user_id']).'&group_id='.Security::remove_XSS($_GET['group_id']).'"></a></div>';
echo '<div class="actions">'.get_lang('UserContributions').': <a href="../user/userInfo.php?uInfo='.$userinfo['user_id'].'">'.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).'</a><a href="'.api_get_self().'?cidReq='.$_course[id].'&action=usercontrib&user_id='.urlencode($row['user_id']).'&group_id='.Security::remove_XSS($_GET['group_id']).'"></a></div>';
if(api_is_allowed_to_edit() || api_is_platform_admin()) //only by professors if page is hidden
@ -1147,7 +1147,7 @@ if ($_GET['action']=='links')
$row = array ();
$row[] =$ShowAssignment;
$row[] = '<a href="'.api_get_self().'?cidReq='.$_course[id].'&action=showpage&title='.urlencode($obj->reflink).'&group_id='.Security::remove_XSS($_GET['group_id']).'">'.Security::remove_XSS($obj->title).'</a>';
$row[] = $obj->user_id <>0 ? '<a href="../user/userInfo.php?uInfo='.$userinfo['user_id'].'">'.$userinfo['lastname'].', '.$userinfo['firstname'].'</a>' : get_lang('Anonymous').' ('.$obj->user_ip.')';
$row[] = $obj->user_id <>0 ? '<a href="../user/userInfo.php?uInfo='.$userinfo['user_id'].'">'.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).'</a>' : get_lang('Anonymous').' ('.$obj->user_ip.')';
$row[] = $year.'-'.$month.'-'.$day.' '.$hours.":".$minutes.":".$seconds;
$rows[] = $row;
}
@ -1462,7 +1462,7 @@ if ($_GET['action']=='edit')
$userinfo=Database::get_user_info_from_id($row['is_editing']);
$is_being_edited= get_lang('ThisPageisBeginEditedBy').' <a href=../user/userInfo.php?uInfo='.$userinfo['user_id'].'>'.$userinfo['firstname'].', '.$userinfo['lastname'].'</a>. '.get_lang('ThisPageisBeginEditedTryLater').' '.date( "i",$rest_time).' '.get_lang('MinMinutes').'';
$is_being_edited= get_lang('ThisPageisBeginEditedBy').' <a href=../user/userInfo.php?uInfo='.$userinfo['user_id'].'>'.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).'</a>. '.get_lang('ThisPageisBeginEditedTryLater').' '.date( "i",$rest_time).' '.get_lang('MinMinutes').'';
Display::display_normal_message($is_being_edited, false);
exit;
}
@ -1754,7 +1754,7 @@ if ($_GET['action']=='history' or Security::remove_XSS($_POST['HistoryDifference
echo ' '.get_lang('By').' ';
if ($row['user_id']<>0)
{
echo '<a href="../user/userInfo.php?uInfo='.$userinfo['user_id'].'">'.$userinfo['lastname'].', '.$userinfo['firstname'].'</a>';
echo '<a href="../user/userInfo.php?uInfo='.$userinfo['user_id'].'">'.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).'</a>';
}
else
{
@ -1952,7 +1952,7 @@ if ($_GET['action']=='recentchanges')
$row[] = $ShowAssignment.$icon_task;
$row[] = '<a href="'.api_get_self().'?cidReq='.$_course[id].'&action=showpage&title='.urlencode($obj->reflink).'&amp;view='.$obj->id.'&group_id='.Security::remove_XSS($_GET['group_id']).'">'.$obj->title.'</a>';
$row[] = $obj->version>1 ? get_lang('EditedBy') : get_lang('AddedBy');
$row[] = $obj->user_id <>0 ? '<a href="../user/userInfo.php?uInfo='.$userinfo['user_id'].'">'.$userinfo['lastname'].', '.$userinfo['firstname'].'</a>' : get_lang('Anonymous').' ('.$obj->user_ip.')';
$row[] = $obj->user_id <>0 ? '<a href="../user/userInfo.php?uInfo='.$userinfo['user_id'].'">'.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).'</a>' : get_lang('Anonymous').' ('.$obj->user_ip.')';
$rows[] = $row;
}
@ -2039,7 +2039,7 @@ if ($_GET['action']=='allpages')
$row = array ();
$row[] =$ShowAssignment.$icon_task;
$row[] = '<a href="'.api_get_self().'?cidReq='.$_course[id].'&action=showpage&title='.urlencode(Security::remove_XSS($obj->reflink)).'&group_id='.Security::remove_XSS($_GET['group_id']).'">'.Security::remove_XSS($obj->title).'</a>';
$row[] = $obj->user_id <>0 ? '<a href="../user/userInfo.php?uInfo='.$userinfo['user_id'].'">'.$userinfo['lastname'].', '.$userinfo['firstname'].'</a>' : get_lang('Anonymous').' ('.$obj->user_ip.')';
$row[] = $obj->user_id <>0 ? '<a href="../user/userInfo.php?uInfo='.$userinfo['user_id'].'">'.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).'</a>' : get_lang('Anonymous').' ('.$obj->user_ip.')';
$row[] = $year.'-'.$month.'-'.$day.' '.$hours.":".$minutes.":".$seconds;
if(api_is_allowed_to_edit()|| api_is_platform_admin())
@ -2187,7 +2187,7 @@ if ($_GET['action']=='discuss')
echo $icon_assignment.'&nbsp;&nbsp;&nbsp;'.$row['title'];
echo ' ('.get_lang('MostRecentVersionBy').' <a href="../user/userInfo.php?uInfo='.$lastuserinfo['user_id'].'">'.$lastuserinfo['firstname'].' '.$lastuserinfo['lastname'].'</a> '.$lastversiondate.$countWPost.')'.$avg_WPost_score.' '; //TODO: read avg score
echo ' ('.get_lang('MostRecentVersionBy').' <a href="../user/userInfo.php?uInfo='.$lastuserinfo['user_id'].'">'.api_get_person_name($lastuserinfo['firstname'], $lastuserinfo['lastname']).'</a> '.$lastversiondate.$countWPost.')'.$avg_WPost_score.' '; //TODO: read avg score
echo '</div>';
@ -2303,7 +2303,7 @@ if ($_GET['action']=='discuss')
require_once api_get_path(INCLUDE_PATH).'/lib/usermanager.lib.php';
$user_id=$row['userc_id'];
$name=$userinfo['lastname']." ".$userinfo['firstname'];
$name = api_get_person_name($userinfo['firstname'], $userinfo['lastname']);
$attrb=array();
if ($user_id<>0)
{
@ -2359,7 +2359,7 @@ if ($_GET['action']=='discuss')
echo '<p><table>';
echo '<tr>';
echo '<td rowspan="2">'.$author_photo.'</td>';
echo '<td style=" color:#999999"><a href="../user/userInfo.php?uInfo='.$userinfo['user_id'].'">'.$userinfo['lastname'].', '.$userinfo['firstname'].'</a> ('.$author_status.') '.$row['dtime'].' - '.get_lang('Rating').': '.$row['p_score'].' '.$imagerating.' </td>';
echo '<td style=" color:#999999"><a href="../user/userInfo.php?uInfo='.$userinfo['user_id'].'">'.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).'</a> ('.$author_status.') '.$row['dtime'].' - '.get_lang('Rating').': '.$row['p_score'].' '.$imagerating.' </td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.$row['comment'].'</td>';

@ -766,7 +766,7 @@ function display_wiki_entry()
$KeyVisibility=$row['visibility'];
// second, show the last version
$sql='SELECT * FROM '.$tbl_wiki.', '.$tbl_wiki_conf.' WHERE '.$tbl_wiki_conf.'.page_id='.$tbl_wiki.'.page_id AND '.$tbl_wiki.'.reflink="'.html_entity_decode(Database::escape_string(stripslashes(urldecode($page)))).'" AND '.$tbl_wiki.'.'.$groupfilter.' '.$filter.' ORDER BY id DESC';
$sql='SELECT * FROM '.$tbl_wiki.', '.$tbl_wiki_conf.' WHERE '.$tbl_wiki_conf.'.page_id='.$tbl_wiki.'.page_id AND '.$tbl_wiki.'.reflink="'.api_html_entity_decode(Database::escape_string(stripslashes(urldecode($page)))).'" AND '.$tbl_wiki.'.'.$groupfilter.' '.$filter.' ORDER BY id DESC';
$result=Database::query($sql,__LINE__,__FILE__);
$row=Database::fetch_array($result); // we do not need a while loop since we are always displaying the last version
@ -1593,7 +1593,7 @@ function check_emailcue($id_or_ref, $type, $lastime='', $lastuser='')
//first, current author and time
//Who is the author?
$userinfo= Database::get_user_info_from_id($lastuser);
$email_user_author= get_lang('EditedBy').': '.$userinfo['firstname'].' '.$userinfo['lastname'];
$email_user_author= get_lang('EditedBy').': '.api_get_person_name($userinfo['firstname'], $userinfo['lastname']);
//When ?
$year = substr($lastime, 0, 4);
@ -1632,7 +1632,7 @@ function check_emailcue($id_or_ref, $type, $lastime='', $lastuser='')
//first, current author and time
//Who is the author of last message?
$userinfo= Database::get_user_info_from_id($lastuser);
$email_user_author= get_lang('AddedBy').': '.$userinfo['firstname'].' '.$userinfo['lastname'];
$email_user_author= get_lang('AddedBy').': '.api_get_person_name($userinfo['firstname'], $userinfo['lastname']);
//When ?
$year = substr($lastime, 0, 4);
@ -1679,7 +1679,7 @@ function check_emailcue($id_or_ref, $type, $lastime='', $lastuser='')
//Who is the author?
$userinfo= Database::get_user_info_from_id($row['user_id']);
$email_user_author= get_lang('AddedBy').': '.$userinfo['firstname'].' '.$userinfo['lastname'];
$email_user_author= get_lang('AddedBy').': '.api_get_person_name($userinfo['firstname'], $userinfo['lastname']);
//When ?
$year = substr($row['dtime'], 0, 4);
@ -1718,7 +1718,7 @@ function check_emailcue($id_or_ref, $type, $lastime='', $lastuser='')
//Who is the author?
$userinfo= Database::get_user_info_from_id(api_get_user_id()); //current user
$email_user_author= get_lang('DeletedBy').': '.$userinfo['firstname'].' '.$userinfo['lastname'];
$email_user_author= get_lang('DeletedBy').': '.api_get_person_name($userinfo['firstname'], $userinfo['lastname']);
//When ?
@ -1741,12 +1741,12 @@ function check_emailcue($id_or_ref, $type, $lastime='', $lastuser='')
if(empty($charset)){$charset='ISO-8859-1';}
$headers = 'Content-Type: text/html; charset='. $charset;
$userinfo = Database::get_user_info_from_id($row['user_id']); //$row['user_id'] obtained from tbl_wiki_mailcue
$name_to = $userinfo['firstname'].' '.$userinfo['lastname'];
$name_to = api_get_person_name($userinfo['firstname'], $userinfo['lastname'], null, PERSON_NAME_EMAIL_ADDRESS);
$email_to = $userinfo['email'];
$sender_name = api_get_setting('emailAdministrator');
$sender_email = api_get_setting('emailAdministrator');
$email_subject = get_lang('EmailWikiChanges').' - '.$_course['official_code'];
$email_body = get_lang('DearUser').' '.$userinfo['firstname'].' '.$userinfo['lastname'].',<br /><br />';
$email_body = get_lang('DearUser').' '.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).',<br /><br />';
$email_body .= $emailtext.' <strong>'.$_course['name'].' - '.$group_name.'</strong><br /><br /><br />';
$email_body .= $email_user_author.' ('.$email_date_changes.')<br /><br /><br />';
$email_body .= $email_assignment.'<br /><br /><br />';
@ -1881,7 +1881,7 @@ function auto_add_page_users($assignment_type)
$link2teacher=$_POST['title']= $title_orig."_uass".api_get_user_id();
//first: teacher name, photo, and assignment description (original content)
$content_orig_A='<div align="center" style="font-size:24px; background-color: #F5F8FB; border:double">'.$photo.get_lang('Teacher').': '.$userinfo['firstname'].' '.$userinfo['lastname'].'</div><br/><div>';
$content_orig_A='<div align="center" style="font-size:24px; background-color: #F5F8FB; border:double">'.$photo.get_lang('Teacher').': '.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).'</div><br/><div>';
$content_orig_B='<h1>'.get_lang('AssignmentDescription').'</h1></div><br/>'.$_POST['content'];
//Second: student list (names, photo and links to their works).
@ -1896,7 +1896,7 @@ function auto_add_page_users($assignment_type)
$image_path = UserManager::get_user_picture_path_by_id($assig_user_id,'web',false, true);
$image_repository = $image_path['dir'];
$existing_image = $image_path['file'];
$name= $o_user_to_add['lastname'].', '.$o_user_to_add['firstname'];
$name = api_get_person_name($o_user_to_add['firstname'], $o_user_to_add['lastname']);
$photo= '<img src="'.$image_repository.$existing_image.'" alt="'.$name.'" width="40" height="50" align="bottom" title="'.$name.'" />';
$is_tutor_of_group = GroupManager :: is_tutor_of_group($assig_user_id,$_clean['group_id']); //student is tutor
@ -1926,7 +1926,7 @@ function auto_add_page_users($assignment_type)
$_POST['content']='<div align="center" style="font-size:24px; background-color: #F5F8FB; border:double">'.$photo.get_lang('Student').': '.$name.'</div>[['.$link2teacher.' | '.get_lang('AssignmentLinktoTeacherPage').']] '; //If $content_orig_B is added here, the task written by the professor was copied to the page of each student. TODO: config options
//AssignmentLinktoTeacherPage
$all_students_pages[] = '<li>'.$o_user_to_add['lastname'].', '.$o_user_to_add['firstname'].' [['.$_POST['title']."_uass".$assig_user_id.' | '.$photo.']] '.$status_in_group.'</li>';
$all_students_pages[] = '<li>'.api_get_person_name($o_user_to_add['firstname'], $o_user_to_add['lastname']).' [['.$_POST['title']."_uass".$assig_user_id.' | '.$photo.']] '.$status_in_group.'</li>';
$_POST['assignment']=2;
@ -2031,7 +2031,7 @@ function display_wiki_search_results($search_term, $search_content=0)
$row = array ();
$row[] =$ShowAssignment;
$row[] = '<a href="'.api_get_self().'?cidReq='.$_course[id].'&action=showpage&title='.urlencode($obj->reflink).'&group_id='.Security::remove_XSS($_GET['group_id']).'">'.$obj->title.'</a>';
$row[] = $obj->user_id <>0 ? '<a href="../user/userInfo.php?uInfo='.$userinfo['user_id'].'">'.$userinfo['lastname'].', '.$userinfo['firstname'].'</a>' : get_lang('Anonymous').' ('.$obj->user_ip.')';
$row[] = $obj->user_id <>0 ? '<a href="../user/userInfo.php?uInfo='.$userinfo['user_id'].'">'.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).'</a>' : get_lang('Anonymous').' ('.$obj->user_ip.')';
$row[] = $year.'-'.$month.'-'.$day.' '.$hours.":".$minutes.":".$seconds;
if(api_is_allowed_to_edit()|| api_is_platform_admin())

@ -543,13 +543,13 @@ function get_logged_user_course_html($my_course) {
if ( $my_course['date_start']=='0000-00-00' ) {
$session['dates'] = get_lang('WithoutTimeLimits');
if ( api_get_setting('show_session_coach') === 'true' ) {
$session['coach'] = get_lang('GeneralCoach').': '.$sessioncoach['lastname'].' '.$sessioncoach['firstname'];
$session['coach'] = get_lang('GeneralCoach').': '.api_get_person_name($sessioncoach['firstname'], $sessioncoach['lastname']);
}
$active = true;
} else {
$session ['dates'] = ' - '.get_lang('From').' '.$my_course['date_start'].' '.get_lang('To').' '.$my_course['date_end'];
if ( api_get_setting('show_session_coach') === 'true' ) {
$session['coach'] = get_lang('GeneralCoach').': '.$sessioncoach['lastname'].' '.$sessioncoach['firstname'];
$session['coach'] = get_lang('GeneralCoach').': '.api_get_person_name($sessioncoach['firstname'], $sessioncoach['lastname']);
}
$active = ($date_start <= $now && $date_end >= $now)?true:false;
}

@ -132,7 +132,7 @@ function display_user_list($user_list, $_plugins)
$friends_profile = UserFriend::get_picture_user($uid, $image_array['file'], 92, 'medium_', ' width="90" height="90" ');
//reduce image
$table_row[] = '<center><a href="'.$url.'"><img src="'.$friends_profile['file'].'" '.$friends_profile['style'].' border="1"></a></center>';
$table_row[] = '<a href="'.$url.'">'.$user_info['firstName'].' '.$user_info['lastName'].'</a>';
$table_row[] = '<a href="'.$url.'">'.api_get_person_name($user_info['firstName'], $user_info['lastName']).'</a>';
//$table_row[] = '<a href="'.$url.'">'.$user_info['lastName'].'</a>';

@ -80,7 +80,7 @@ Display::display_header(get_lang('UserOnlineListSession'));
last_access.access_date,
last_access.access_cours_code,
last_access.access_session_id,
CONCAT(user.lastname,' ',user.firstname) as name,
".(api_is_western_name_order() ? "CONCAT(user.firstname,' ',user.lastname)" : "CONCAT(user.lastname,' ',user.firstname)")." as name,
user.email
FROM ".Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LASTACCESS)." AS last_access
INNER JOIN ".Database::get_main_table(TABLE_MAIN_USER)." AS user

Loading…
Cancel
Save