/** * @param int $courseId * @param int $session_id * @return bool */ function api_coach_can_edit_view_results($courseId = null, $session_id = null) { $user_id = api_get_user_id(); if (empty($courseId)) { $courseId = api_get_course_int_id(); } if (empty($session_id)) { $session_id = api_get_session_id(); } if (api_is_platform_admin()) { return true; } $roles = api_detect_user_roles($user_id, $courseId, $session_id); if (in_array(SESSION_COURSE_COACH, $roles)) { //return api_get_setting('session_tutor_reports_visibility') == 'true'; return true; } else { if (in_array(COURSEMANAGER, $roles)) { return true; } return false; } }
*/ $sql = 'SELECT * FROM ' . $table_course_user . ' cu, ' . $table_course . ' c' . ' WHERE cu.user_id = ' . $user['user_id'] . ' AND cu.c_id = c.id ' . ' AND cu.relation_type <> ' . COURSE_RELATION_TYPE_RRHH . ' '; $res = Database::query($sql); if (Database::num_rows($res) > 0) { $header = array(); $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 = Database::fetch_object($res)) { $row = array(); $row[] = $course->code; $row[] = $course->title; //$row[] = $course->status == STUDENT ? get_lang('Student') : get_lang('Teacher'); $roles = api_detect_user_roles($user['user_id'], $course->id); $row[] = api_get_roles_to_string($roles); $tools = '<a href="course_information.php?code=' . $course->code . '">' . Display::return_icon('synthese_view.gif', get_lang('Overview')) . '</a>' . '<a href="' . api_get_path(WEB_COURSE_PATH) . $course->directory . '">' . Display::return_icon('course_home.gif', get_lang('CourseHomepage')) . '</a>' . '<a href="course_edit.php?courseId=' . $course->c_id . '">' . Display::return_icon('edit.gif', get_lang('Edit')) . '</a>'; if ($course->status == STUDENT) { $tools .= '<a href="user_information.php?action=unsubscribe&courseId=' . $course->c_id . '&user_id=' . $user['user_id'] . '">' . Display::return_icon('delete.png', get_lang('Delete')) . '</a>'; } $row[] = $tools; $data[] = $row; } echo Display::page_subheader(get_lang('Courses')); Display::display_sortable_table($header, $data, array(), array(), array('user_id' => intval($_GET['user_id']))); } else { Display::display_warning_message(get_lang('NoCoursesForThisUser')); } /** * Show the classes in which this user is subscribed