diff --git a/main/inc/lib/course.lib.php b/main/inc/lib/course.lib.php
index 1433888a66..9dc068d93c 100644
--- a/main/inc/lib/course.lib.php
+++ b/main/inc/lib/course.lib.php
@@ -1085,14 +1085,23 @@ class CourseManager
{
$session_id = intval($session_id);
$a_users = array();
- $table_users = Database :: get_main_table(TABLE_MAIN_USER);
-
+ $table_users = Database :: get_main_table(TABLE_MAIN_USER);
$where = array();
- $sql = 'SELECT DISTINCT user.user_id ';
- if ( $session_id == 0 ) {
+ if ( $session_id == 0 )
+ {
+ $sql = 'SELECT DISTINCT course_rel_user.status, user.user_id ';
+ }
+ else
+ {
+ $sql = 'SELECT DISTINCT user.user_id ';
+ }
+
+ if ( $session_id == 0 )
+ {
$sql .= ', course_rel_user.role, course_rel_user.tutor_id ';
- }
+ }
+
$sql .= ' FROM '.$table_users.' as user ';
if(api_get_setting('use_session_mode')=='true' && $with_session)
@@ -1121,17 +1130,20 @@ class CourseManager
$sql .= ' '.$order_by;
$sql .= ' '.$limit;
-
+
$rs = api_sql_query($sql, __FILE__, __LINE__);
while($user = Database::fetch_array($rs))
{
- $user_infos = Database :: get_user_info_from_id($user['user_id']);
- //$user_infos['status'] = $user['status'];
- if ( isset($user['role']) ) {
+ $user_infos = Database :: get_user_info_from_id($user['user_id']);
+ $user_infos['status'] = $user['status'];
+ //$user['status']=$user_infos['status'] ;
+ if ( isset($user['role']) )
+ {
$user_infos['role'] = $user['role'];
}
- if ( isset($user['tutor_id']) ) {
+ if ( isset($user['tutor_id']) )
+ {
$user_infos['tutor_id'] = $user['tutor_id'];
}
$a_users[$user['user_id']] = $user_infos;
diff --git a/main/user/user.php b/main/user/user.php
index c20ff0decf..d47b4b315c 100644
--- a/main/user/user.php
+++ b/main/user/user.php
@@ -518,7 +518,7 @@ function get_user_data($from, $number_of_items, $column, $direction)
$temp[] = $o_course_user['official_code'];
- /* // deprecated feature
+ // deprecated feature
if(isset($o_course_user['tutor_id']) && $o_course_user['tutor_id']==1)
{
$temp[] = get_lang('Tutor');
@@ -527,7 +527,7 @@ function get_user_data($from, $number_of_items, $column, $direction)
{
$temp[] = '-';
}
- */
+
if(isset($o_course_user['status']) && $o_course_user['status']==1)
{
$temp[] = get_lang('CourseManager');
@@ -653,10 +653,10 @@ $table->set_header($header_nr++, get_lang('OfficialCode'));
if( api_is_allowed_to_edit())
{
// deprecated feature
- // $table->set_header($header_nr++, get_lang('Tutor'),false);
+ $table->set_header($header_nr++, get_lang('Tutor'),false);
$table->set_header($header_nr++, get_lang('CourseManager'),false);
$table->set_header($header_nr++, get_lang('Active'),false);
- $table->set_column_filter(7,'active_filter');
+ $table->set_column_filter(8,'active_filter');
}
//actions column
diff --git a/main/user/userInfo.php b/main/user/userInfo.php
index b1faf708dc..4a2cedb2c8 100644
--- a/main/user/userInfo.php
+++ b/main/user/userInfo.php
@@ -1,9 +1,9 @@
- "user.php", "name" => get_lang('Users'));
+$interbreadcrumb[] = array ('url' => 'user.php', 'name' => get_lang('Users'));
if ($origin != 'learnpath')
{ //so we are not in learnpath tool
@@ -102,7 +102,6 @@ $courseCode = $currentCourseID = $_course['sysCode'];
$tbl_coursUser = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$userIdViewer = $_user['user_id']; // id fo the user currently online
-
//$userIdViewed = $_GET['userIdViewed']; // Id of the user we want to view
$allowedToEditContent = ($userIdViewer == $userIdViewed) || $is_platformAdmin;
@@ -190,7 +189,7 @@ if ($allowedToEditDef)
$userProperties['status'] = 1;
}
- /* deprecated feature
+ // deprecated feature
// is coach
if (isset ($_POST['promoteTutor']))
@@ -202,14 +201,14 @@ if ($allowedToEditDef)
$userProperties['tutor'] = 1;
}
}
- */
+
// role is a string
if (isset ($_POST['role']))
{
$role=$_POST['role'];
$userProperties['role'] = $role;
- }
-
+ }
+
update_user_course_properties($userIdViewed, $courseCode, $userProperties);
$displayMode = "viewContentList";
@@ -238,8 +237,7 @@ if ($allowedToEditContent)
}
elseif (!empty($_GET['editContent']))
{
- $displayMode = "viewContentEdit";
-
+ $displayMode = "viewContentEdit";
$userIdViewed = $userIdViewed;
}
}
@@ -355,14 +353,14 @@ elseif ($displayMode == "viewMainInfoEdit")
"
",
"\n",
"| ", get_lang('Name'), " | \n",
- "", get_lang('Role'), " | \n",
+ "", get_lang('Description'), " | \n",
+ "", get_lang('Tutor'), " | \n",
"", get_lang('CourseManager'), " | \n",
"
\n",
"",
"| ", htmlize($mainUserInfo['firstName']), " ", htmlize($mainUserInfo['lastName']), " | \n",
- " | ";
- //deprecated feature
- //" | ";
+ " | ",
+ " | ";
if (!($is_courseAdmin && $_user['user_id'] == $userIdViewed))
{
@@ -388,7 +386,8 @@ elseif ($displayMode == "viewMainInfoEdit")
}
}
- else{
+ else
+ {
Display :: display_normal_message(get_lang('ThisStudentIsSubscribeThroughASession'));
}
}
@@ -407,19 +406,20 @@ elseif ($displayMode == "viewContentList") // default display
$mainUserInfo = get_main_user_info($userIdViewed, $courseCode);
if ($mainUserInfo)
- {
-
+ {
$image_array=UserManager::get_user_picture_path_by_id($userIdViewed,'web',false,true);
echo '
';
//DISPLAY TABLE HEADING
if ($origin == 'learnpath') { $allowedToEditDef=false; $is_allowedToTrack=false; }
- //"",get_lang('Tutor')," | \n",
+
+ //"",get_lang('Tutor')," | \n",
echo "",
"\n",
"| ",get_lang('Name')," | \n",
- "",get_lang('Role')," | \n",
+ "",get_lang('Description')," | \n",
+ "",get_lang('Tutor')," | \n",
"",get_lang('CourseManager')," | \n",
($allowedToEditDef?"".get_lang('Edit')." | \n":""),
($is_allowedToTrack?"".get_lang('Tracking')." | \n":""),
@@ -430,8 +430,9 @@ elseif ($displayMode == "viewContentList") // default display
"",htmlize($mainUserInfo['firstName'])," ",htmlize($mainUserInfo['lastName'])," | \n",
"",htmlize($mainUserInfo['role'])," | ";
- //DISPLAY TABLE CONTENT
- /* deprecated feature
+ //DISPLAY TABLE CONTENT
+
+ // deprecated feature
if ($mainUserInfo['tutor_id'] == 1)
{
echo "",get_lang('Tutor')," | \n";
@@ -439,8 +440,7 @@ elseif ($displayMode == "viewContentList") // default display
else
{
echo " - | \n";
- }
- */
+ }
if ($mainUserInfo['status'] == 1)
{
diff --git a/main/user/userInfoLib.php b/main/user/userInfoLib.php
index 6ca605bce2..adffcdcfdf 100644
--- a/main/user/userInfoLib.php
+++ b/main/user/userInfoLib.php
@@ -264,11 +264,12 @@ function update_user_course_properties($user_id, $course_code, $properties)
}
//feature deprecated tutor_id = '".Database::escape_string($properties['tutor'])."'
- $sql = "UPDATE $tbl_coursUser
- SET ".$sqlChangeStatus."
- role = '".Database::escape_string($properties['role'])."'
- WHERE user_id = '".$user_id."'
- AND course_code = '".$course_code."'";
+ $sql = "UPDATE $tbl_coursUser
+ SET ".$sqlChangeStatus."
+ role = '".Database::escape_string($properties['role'])."',
+ tutor_id = '".Database::escape_string($properties['tutor'])."'
+ WHERE user_id = '".$user_id."'
+ AND course_code = '".$course_code."'";
$result = api_sql_query($sql,__FILE__,__LINE__);