Exemple #1
0
            echo $item;
        }
    }
}
echo '</div>';
$sessions = array();
if (empty($session_id)) {
    // Getting courses followed by a coach (No session courses)
    $courses = CourseManager::get_course_list_as_coach($user_id, false);
    if (isset($courses[0])) {
        $courses = $courses[0];
    }
    //Getting students from courses and courses in sessions (To show the total students that the user follows)
    $students = CourseManager::get_user_list_from_courses_as_coach($user_id);
    // Sessions for the coach
    $sessions = SessionManager::get_sessions_coached_by_user($user_id);
    //If is drh
    if ($is_drh) {
        $students = array_keys(UserManager::get_users_followed_by_drh($user_id, STUDENT));
        $courses_of_the_platform = CourseManager::get_courses_followed_by_drh($user_id);
        foreach ($courses_of_the_platform as $course) {
            $courses[$course['real_id']] = $course['real_id'];
        }
        $sessions = SessionManager::get_sessions_followed_by_drh($user_id);
    }
    //Courses for the user
    $count_courses = count($courses);
    //Sessions for the user
    $count_sessions = count($sessions);
    //Students
    $nb_students = count($students);
Exemple #2
0
 /**
  * Get course list as coach
  *
  * @param     int        user id
  * @return    array    course list
  *
  *  */
 public static function get_course_list_as_coach($user_id, $include_courses_in_sessions = false)
 {
     //1. Getting courses as teacher (No session)
     $courses_temp = CourseManager::get_course_list_of_user_as_course_admin($user_id);
     $courses_as_admin = array();
     if (!empty($courses_temp)) {
         foreach ($courses_temp as $course_item) {
             $courses_as_admin[0][$course_item['real_id']] = $course_item['real_id'];
         }
     }
     //2. Include courses in sessions
     if ($include_courses_in_sessions) {
         $sessions = SessionManager::get_sessions_coached_by_user($user_id);
         if (!empty($sessions)) {
             foreach ($sessions as $session_item) {
                 $courses = Tracking::get_courses_followed_by_coach($user_id, $session_item['id']);
                 if (is_array($courses)) {
                     foreach ($courses as $course_item) {
                         $courses_as_admin[$session_item['id']][$course_item] = $course_item;
                     }
                 }
             }
         }
     }
     return $courses_as_admin;
 }
Exemple #3
0
            echo $item;
        }
    }
    if (count($a_sessions) > 0) {
        echo '<span style="float:right">';
        echo Display::url(Display::return_icon('printer.png', get_lang('Print'), array(), 32), 'javascript: void(0);', array('onclick' => 'javascript: window.print();'));
        echo Display::url(Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), array(), 32), api_get_self() . '?export=csv');
        echo '</span>';
    }
    echo '</div>';
    echo Display::page_header(get_lang('YourSessionsList'));
} else {
    /*if (api_is_platform_admin()) {
    		$a_sessions = SessionManager::get_sessions_list();
    	} else {*/
    $a_sessions = SessionManager::get_sessions_coached_by_user($id_coach);
    //}
}
$nb_sessions = count($a_sessions);
if ($export_csv) {
    $csv_content = array();
}
if ($nb_sessions > 0) {
    $table = new SortableTable('tracking', 'count_sessions_coached');
    $table->set_header(0, get_lang('Title'));
    $table->set_header(1, get_lang('Date'));
    $table->set_header(2, get_lang('NbCoursesPerSession'));
    $table->set_header(3, get_lang('Details'), false);
    $all_data = array();
    foreach ($a_sessions as $session) {
        $row = array();
		</th>
		<th>
			<?php 
echo get_lang('Email');
?>
		</th>
		<th>
			<?php 
echo get_lang('Chat');
?>
		</th>
	</tr>
<?php 
$session_is_coach = array();
if (isset($_user['user_id']) && $_user['user_id'] != '') {
    $session_is_coach = SessionManager::get_sessions_coached_by_user(api_get_user_id());
    $students_online = array();
    $now = api_get_utc_datetime();
    $time_limit = api_get_setting('time_limit_whosonline');
    $online_time = time() - $time_limit * 60;
    $current_date = api_get_utc_datetime($online_time);
    foreach ($session_is_coach as $session) {
        $sql = "SELECT \tDISTINCT last_access.access_user_id,\n\t\t\t\t\t\t\tlast_access.access_date,\n\t\t\t\t\t\t\tlast_access.c_id,\n\t\t\t\t\t\t\tlast_access.access_session_id,\n\t\t\t\t\t\t\tcourse.code,\n\t\t\t\t\t\t\t" . (api_is_western_name_order() ? "CONCAT(user.firstname,' ',user.lastname)" : "CONCAT(user.lastname,' ',user.firstname)") . " as name,\n\t\t\t\t\t\t\tuser.email\n\t\t\t\t\tFROM " . Database::get_main_table(TABLE_STATISTIC_TRACK_E_LASTACCESS) . " AS last_access\n\t\t\t\t\tINNER JOIN " . Database::get_main_table(TABLE_MAIN_USER) . " AS user\n\t\t\t\t\t    ON user.user_id = last_access.access_user_id\n\t\t\t\t\tINNER JOIN " . Database::get_main_table(TABLE_MAIN_COURSE) . " AS course\n\t\t\t\t\t    ON course.id = last_access.c_id\n\t\t\t\t\tWHERE access_session_id='" . $session['id'] . "' AND access_date >= '{$current_date}'\n\t\t\t\t\tGROUP BY access_user_id";
        $result = Database::query($sql);
        while ($user_list = Database::fetch_array($result)) {
            $students_online[$user_list['access_user_id']] = $user_list;
        }
    }
    if (count($students_online) > 0) {
        foreach ($students_online as $student_online) {
            echo "<tr><td>";