|
|
|
@ -34,11 +34,10 @@ $language_file = 'survey'; |
|
|
|
|
|
|
|
|
|
|
|
// including the global dokeos file |
|
|
|
// including the global dokeos file |
|
|
|
require ('../inc/global.inc.php'); |
|
|
|
require ('../inc/global.inc.php'); |
|
|
|
|
|
|
|
|
|
|
|
// including additional libraries |
|
|
|
|
|
|
|
//require_once (api_get_path(LIBRARY_PATH)."/survey.lib.php"); |
|
|
|
|
|
|
|
require_once('survey.lib.php'); |
|
|
|
require_once('survey.lib.php'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this_section=SECTION_COURSES; |
|
|
|
|
|
|
|
|
|
|
|
// Database table definitions |
|
|
|
// Database table definitions |
|
|
|
$table_survey = Database :: get_course_table(TABLE_SURVEY); |
|
|
|
$table_survey = Database :: get_course_table(TABLE_SURVEY); |
|
|
|
$table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION); |
|
|
|
$table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION); |
|
|
|
@ -56,7 +55,7 @@ if (!isset($_GET['survey_id']) OR !is_numeric($_GET['survey_id'])){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// getting the survey information |
|
|
|
// getting the survey information |
|
|
|
$survey_id = Security::remove_XSS($_GET['survey_id']); |
|
|
|
$survey_id = intval($_GET['survey_id']); |
|
|
|
$survey_data = survey_manager::get_survey($survey_id); |
|
|
|
$survey_data = survey_manager::get_survey($survey_id); |
|
|
|
|
|
|
|
|
|
|
|
if (empty($survey_data)) { |
|
|
|
if (empty($survey_data)) { |
|
|
|
@ -88,6 +87,8 @@ if (!api_is_allowed_to_edit(false,true)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Display :: display_error_message(get_lang('NotAllowed'), false); |
|
|
|
Display :: display_error_message(get_lang('NotAllowed'), false); |
|
|
|
}*/ |
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$counter_question = 0; |
|
|
|
// only a course admin is allowed to preview a survey: you are a course admin |
|
|
|
// only a course admin is allowed to preview a survey: you are a course admin |
|
|
|
if (api_is_course_admin() || (api_is_course_admin() && $_GET['isStudentView']=='true') || api_is_allowed_to_session_edit(false,true)) { |
|
|
|
if (api_is_course_admin() || (api_is_course_admin() && $_GET['isStudentView']=='true') || api_is_allowed_to_session_edit(false,true)) { |
|
|
|
// survey information |
|
|
|
// survey information |
|
|
|
@ -143,9 +144,7 @@ if (api_is_course_admin() || (api_is_course_admin() && $_GET['isStudentView']==' |
|
|
|
|
|
|
|
|
|
|
|
$result = Database::query($sql, __FILE__, __LINE__); |
|
|
|
$result = Database::query($sql, __FILE__, __LINE__); |
|
|
|
$question_counter_max = Database::num_rows($result); |
|
|
|
$question_counter_max = Database::num_rows($result); |
|
|
|
$counter = 0; |
|
|
|
|
|
|
|
$limit=0; |
|
|
|
$limit=0; |
|
|
|
$questions = array(); |
|
|
|
|
|
|
|
while ($row = Database::fetch_array($result)) |
|
|
|
while ($row = Database::fetch_array($result)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// if the type is not a pagebreak we store it in the $questions array |
|
|
|
// if the type is not a pagebreak we store it in the $questions array |
|
|
|
@ -164,7 +163,7 @@ if (api_is_course_admin() || (api_is_course_admin() && $_GET['isStudentView']==' |
|
|
|
{ |
|
|
|
{ |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
$counter++; |
|
|
|
$counter_question++; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -182,6 +181,7 @@ if (api_is_course_admin() || (api_is_course_admin() && $_GET['isStudentView']==' |
|
|
|
$show = 0; |
|
|
|
$show = 0; |
|
|
|
} |
|
|
|
} |
|
|
|
echo '<form id="question" name="question" method="post" action="'.api_get_self().'?survey_id='.Security::remove_XSS($survey_id).'&show='.$show.'">'; |
|
|
|
echo '<form id="question" name="question" method="post" action="'.api_get_self().'?survey_id='.Security::remove_XSS($survey_id).'&show='.$show.'">'; |
|
|
|
|
|
|
|
|
|
|
|
if(is_array($questions) && count($questions)>0) |
|
|
|
if(is_array($questions) && count($questions)>0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
foreach ($questions as $key=>$question) |
|
|
|
foreach ($questions as $key=>$question) |
|
|
|
@ -190,13 +190,16 @@ if (api_is_course_admin() || (api_is_course_admin() && $_GET['isStudentView']==' |
|
|
|
$display->render_question($question); |
|
|
|
$display->render_question($question); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (($show < $numberofpages) OR !$_GET['show']) |
|
|
|
|
|
|
|
|
|
|
|
if (($show < $numberofpages) || (!$_GET['show'] && count($questions) > 0)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
//echo '<a href="'.api_get_self().'?survey_id='.$survey_id.'&show='.$limit.'">NEXT</a>'; |
|
|
|
|
|
|
|
echo '<br /><button type="submit" name="next_survey_page" class="next">'.get_lang('NextQuestion').' </button>'; |
|
|
|
echo '<br /><button type="submit" name="next_survey_page" class="next">'.get_lang('NextQuestion').' </button>'; |
|
|
|
} |
|
|
|
} |
|
|
|
if ($show >= $numberofpages AND $_GET['show']) |
|
|
|
if ($show >= $numberofpages && $_GET['show'] || ( isset($_GET['show']) && count($questions) == 0)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if (count($questions) == 0) { |
|
|
|
|
|
|
|
echo '<p>'.get_lang('ThereAreNotQuestionsForthisSurvey').'</p>'; |
|
|
|
|
|
|
|
} |
|
|
|
echo '<button type="submit" name="finish_survey" class="next">'.get_lang('FinishSurvey').' </button>'; |
|
|
|
echo '<button type="submit" name="finish_survey" class="next">'.get_lang('FinishSurvey').' </button>'; |
|
|
|
} |
|
|
|
} |
|
|
|
echo '</form>'; |
|
|
|
echo '</form>'; |
|
|
|
@ -206,4 +209,3 @@ if (api_is_course_admin() || (api_is_course_admin() && $_GET['isStudentView']==' |
|
|
|
|
|
|
|
|
|
|
|
// Footer |
|
|
|
// Footer |
|
|
|
Display :: display_footer(); |
|
|
|
Display :: display_footer(); |
|
|
|
?> |
|
|
|
|
|
|
|
|