'index.php', "name" => get_lang('PlatformAdmin')); $interbreadcrumb[] = array ("url" => 'user_list.php', "name" => get_lang('UserList')); if( ! isset($_GET['user_id'])) { api_not_allowed(); } $user = api_get_user_info($_GET['user_id']); $tool_name = $user['firstName'].' '.$user['lastName'].(empty($user['official_code'])?'':' ('.$user['official_code'].')'); Display::display_header($tool_name); $table_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER); $table_course = Database :: get_main_table(TABLE_MAIN_COURSE); if( isset($_GET['action']) ) { switch($_GET['action']) { case 'unsubscribe': if( CourseManager::get_user_in_course_status($_GET['user_id'],$_GET['course_code']) == STUDENT) { CourseManager::unsubscribe_user($_GET['user_id'],$_GET['course_code']); Display::display_normal_message(get_lang('UserUnsubscribed')); } else { Display::display_error_message(get_lang('CannotUnsubscribeUserFromCourse')); } break; } } api_display_tool_title($tool_name); if ($user['picture_uri'] != '') { echo '

'; } echo '

'. ($user['status'] == 1 ? get_lang('Teacher') : get_lang('Student')).'

'; echo '

'.Display :: encrypted_mailto_link($user['mail'], $user['mail']).'

'; /** * Show the courses in which this user is subscribed */ $sql = 'SELECT * FROM '.$table_course_user.' cu, '.$table_course.' c WHERE cu.user_id = '.$user['user_id'].' AND cu.course_code = c.code'; $res = api_sql_query($sql,__FILE__,__LINE__); if (mysql_num_rows($res) > 0) { $header[] = array (get_lang('Code'), true); $header[] = array (get_lang('Title'), true); $header[] = array (get_lang('Status'), true); $header[] = array ('', false); $data = array (); while ($course = mysql_fetch_object($res)) { $row = array (); $row[] = $course->code; $row[] = $course->title; $row[] = $course->status == STUDENT ? get_lang('Student') : get_lang('Teacher'); $tools = ''. '' . ''.get_lang('Edit').''; if( $course->status == STUDENT ) { $tools .= ''; } $row[] = $tools; $data[] = $row; } echo '

'.get_lang('Courses').'

'; echo '
'; Display :: display_sortable_table($header, $data, array (), array (), array ('user_id' => $_GET['user_id'])); echo '
'; } else { echo '

'.get_lang('NoCoursesForThisUser').'

'; } /** * Show the classes in which this user is subscribed */ $table_class_user = Database :: get_main_table(TABLE_MAIN_CLASS_USER); $table_class = Database :: get_main_table(TABLE_MAIN_CLASS); $sql = 'SELECT * FROM '.$table_class_user.' cu, '.$table_class.' c WHERE cu.user_id = '.$user['user_id'].' AND cu.class_id = c.id'; $res = api_sql_query($sql,__FILE__,__LINE__); if (mysql_num_rows($res) > 0) { $header = array(); $header[] = array (get_lang('ClassName'), true); $header[] = array ('', false); $data = array (); while ($class = mysql_fetch_object($res)) { $row = array(); $row[] = $class->name; $row[] = ''; $data[] = $row; } echo '

'.get_lang('Classes').'

'; echo '
'; Display :: display_sortable_table($header, $data, array (), array (), array ('user_id' => $_GET['user_id'])); echo '
'; } else { echo '

'.get_lang('NoClassesForThisUser').'

'; } /* ============================================================================== FOOTER ============================================================================== */ Display::display_footer(); ?>