|
|
|
|
@ -22,6 +22,7 @@ $table_user = Database:: get_main_table(TABLE_MAIN_USER); |
|
|
|
|
$table_survey_invitation = Database:: get_course_table(TABLE_SURVEY_INVITATION); |
|
|
|
|
|
|
|
|
|
$course_id = api_get_course_int_id(); |
|
|
|
|
$courseInfo = $course_id ? api_get_course_info_by_id($course_id) : []; |
|
|
|
|
$userId = api_get_user_id(); |
|
|
|
|
$surveyId = intval($_GET['survey_id']); |
|
|
|
|
$userInvited = 0; |
|
|
|
|
@ -159,8 +160,8 @@ if (api_is_course_admin() || |
|
|
|
|
survey_question.question_id = survey_question_option.question_id AND |
|
|
|
|
survey_question_option.c_id = $course_id |
|
|
|
|
WHERE |
|
|
|
|
survey_question.survey_id = '".intval($survey_id)."' AND |
|
|
|
|
survey_question.question_id IN (".Database::escape_string(implode(',',$paged_questions[$_GET['show']]), null, false).") AND |
|
|
|
|
survey_question.survey_id = '".$survey_id."' AND |
|
|
|
|
survey_question.question_id IN (".Database::escape_string(implode(',', $paged_questions[$_GET['show']]), null, false).") AND |
|
|
|
|
survey_question.c_id = $course_id |
|
|
|
|
ORDER BY survey_question.sort, survey_question_option.sort ASC"; |
|
|
|
|
|
|
|
|
|
@ -191,19 +192,19 @@ if (api_is_course_admin() || |
|
|
|
|
WHERE |
|
|
|
|
c_id = $course_id AND |
|
|
|
|
type='".Database::escape_string('pagebreak')."' AND |
|
|
|
|
survey_id='".intval($survey_id)."'"; |
|
|
|
|
survey_id='".$survey_id."'"; |
|
|
|
|
$result = Database::query($sql); |
|
|
|
|
$numberofpages = Database::num_rows($result) + 1; |
|
|
|
|
|
|
|
|
|
// Displaying the form with the questions |
|
|
|
|
if (isset($_GET['show'])) { |
|
|
|
|
$show = (int)$_GET['show'] + 1; |
|
|
|
|
$show = (int) $_GET['show'] + 1; |
|
|
|
|
} else { |
|
|
|
|
$show = 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$url = api_get_self().'?survey_id='.Security::remove_XSS($survey_id).'&show='.$show; |
|
|
|
|
$form = new FormValidator('question', 'post', $url); |
|
|
|
|
$url = api_get_self().'?survey_id='.$survey_id.'&show='.$show; |
|
|
|
|
$form = new FormValidator('question-survey', 'post', $url, null, null, FormValidator::LAYOUT_INLINE); |
|
|
|
|
|
|
|
|
|
if (is_array($questions) && count($questions) > 0) { |
|
|
|
|
foreach ($questions as $key => & $question) { |
|
|
|
|
@ -224,13 +225,22 @@ if (api_is_course_admin() || |
|
|
|
|
$form->addButton('next_survey_page', get_lang('NextQuestion'), 'arrow-right'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($show >= $numberofpages && $_GET['show'] || (isset($_GET['show']) && count($questions) == 0)) { |
|
|
|
|
if ($questions_exists == false) { |
|
|
|
|
echo '<p>'.get_lang('ThereAreNotQuestionsForthisSurvey').'</p>'; |
|
|
|
|
} |
|
|
|
|
$form->addButton('finish_survey', get_lang('FinishSurvey'), 'arrow-right'); |
|
|
|
|
$form->addButton('finish_survey', get_lang('FinishSurvey'), 'arrow-right', 'success'); |
|
|
|
|
} |
|
|
|
|
$form->display(); |
|
|
|
|
|
|
|
|
|
if ($courseInfo) { |
|
|
|
|
echo '<br><p>'.Display::toolbarButton( |
|
|
|
|
get_lang('ReturnToCourseHomepage'), |
|
|
|
|
api_get_course_url($courseInfo['code']), |
|
|
|
|
'home' |
|
|
|
|
).'</p>'; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
Display :: display_error_message(get_lang('NotAllowed'), false); |
|
|
|
|
} |
|
|
|
|
|