Exemplo n.º 1
0
require_once '../inc/global.inc.php';
$this_section = SECTION_COURSES;
$current_course_tool = TOOL_SURVEY;
api_protect_course_script(true);
$action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : null;
// Tracking
Event::event_access_tool(TOOL_SURVEY);
/** @todo
 * This has to be moved to a more appropriate place (after the display_header
 * of the code)
 */
$courseInfo = api_get_course_info();
$isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh(api_get_user_id(), $courseInfo);
if ($isDrhOfCourse) {
    Display::display_header(get_lang('SurveyList'));
    SurveyUtil::displaySurveyListForDrh();
    Display::display_footer();
    exit;
}
if (!api_is_allowed_to_edit(false, true)) {
    // Coach can see this
    Display::display_header(get_lang('SurveyList'));
    SurveyUtil::getSurveyList(api_get_user_id());
    Display::display_footer();
    exit;
}
$extend_rights_for_coachs = api_get_setting('extend_rights_for_coach_on_survey');
// Database table definitions
$table_survey = Database::get_course_table(TABLE_SURVEY);
$table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION);
$table_course = Database::get_main_table(TABLE_MAIN_COURSE);