';
-echo Display::return_icon(
- 'statistics.png',
- get_lang('CreateNewSurvey'),
- array('style'=>'display:inline-block; margin-right:5px;'),
- ICON_SIZE_SMALL
-);
-echo strip_tags($survey_data['survey_title']).'
';
}
// Displaying the survey introduction
@@ -522,7 +517,7 @@ if (!isset($_GET['show'])) {
$paged_questions_sec = array();
if (!empty($survey_data['survey_introduction'])) {
- echo '
';
}
$limit = 0;
}
@@ -726,6 +721,7 @@ if (isset($_GET['show']) || isset($_POST['personality'])) {
$questions[$row['sort']]['type'] = $row['type'];
$questions[$row['sort']]['options'][$row['question_option_id']] = $row['option_text'];
$questions[$row['sort']]['maximum_score'] = $row['max_value'];
+ $questions[$row['sort']]['sort'] = $row['sort'];
} else {
// If the type is a pagebreak we are finished loading the questions for this page
break;
@@ -1029,6 +1025,7 @@ if (isset($_GET['show']) || isset($_POST['personality'])) {
$questions[$row['sort']]['survey_group_sec1'] = $row['survey_group_sec1'];
$questions[$row['sort']]['survey_group_sec2'] = $row['survey_group_sec2'];
$questions[$row['sort']]['survey_group_pri'] = $row['survey_group_pri'];
+ $questions[$row['sort']]['sort'] = $row['sort'];
} else {
// If the type is a pagebreak we are finished loading the questions for this page
break;
@@ -1150,12 +1147,14 @@ if (isset($_GET['show']) || isset($_POST['personality'])) {
$questions[$row['sort']]['survey_group_sec1'] = $row['survey_group_sec1'];
$questions[$row['sort']]['survey_group_sec2'] = $row['survey_group_sec2'];
$questions[$row['sort']]['survey_group_pri'] = $row['survey_group_pri'];
+ $questions[$row['sort']]['sort'] = $row['sort'];
} else {
// If the type is a page break we are finished loading the questions for this page
break;
}
$counter++;
}
+ var_Dump($questions);
}
}
} else { // In case it's another type than 0 or 1
@@ -1195,7 +1194,7 @@ $p_l = isset($_POST['language']) ? Security::remove_XSS($_POST['language']) : ''
$add_parameters = isset($_GET['user_id']) ? 'user_id='.intval($_GET['user_id']).'&' : '';
$url = api_get_self().'?'.api_get_cidreq().'&'.$add_parameters.'course='.$g_c.'&invitationcode='.$g_ic.'&show='.$show;
-$form = new FormValidator('question', 'post', $url);
+$form = new FormValidator('question', 'post', $url, null, null, FormValidator::LAYOUT_INLINE);
$form->addHidden('language', $p_l);
if (isset($questions) && is_array($questions)) {
@@ -1203,25 +1202,28 @@ if (isset($questions) && is_array($questions)) {
$ch_type = 'ch_'.$question['type'];
$display = new $ch_type;
// @todo move this in a function.
- $form->addHtml('
');
- $form->addHtml($question['survey_question']);
+ $form->addHtml('
');
+ //$form->addHtml('
');
+ $form->addHtml('
'.$question['sort'].'. '.strip_tags($question['survey_question']).'
');
+ //$form->addHtml($question['survey_question']);
$display->render($form, $question);
- $form->addHtml('');
+ $form->addHtml('
');
}
}
+$form->addHtml('
');
if ($survey_data['survey_type'] === '0') {
if ($survey_data['show_form_profile'] == 0) {
// The normal survey as always
if (($show < $numberofpages) || !$_GET['show']) {
if ($show == 0) {
- $form->addButton('next_survey_page', get_lang('StartSurvey'), 'arrow-right', 'success', 'large');
+ $form->addButton('next_survey_page', get_lang('StartSurvey'), 'arrow-right', 'success');
} else {
- $form->addButton('next_survey_page', get_lang('Next'), 'arrow-right');
+ $form->addButton('next_survey_page', get_lang('Next'), 'arrow-right', 'success');
}
}
if ($show >= $numberofpages && $_GET['show']) {
- $form->addButton('finish_survey', get_lang('FinishSurvey'), 'arrow-right');
+ $form->addButton('finish_survey', get_lang('FinishSurvey'), 'arrow-right', 'success');
}
} else {
// The normal survey as always but with the form profile
@@ -1229,14 +1231,14 @@ if ($survey_data['survey_type'] === '0') {
$numberofpages = count($paged_questions);
if (($show < $numberofpages) || !$_GET['show']) { //$show = $_GET['show'] + 1
if ($show == 0) {
- $form->addButton('next_survey_page', get_lang('StartSurvey'), 'arrow-right', 'success', 'large');
+ $form->addButton('next_survey_page', get_lang('StartSurvey'), 'arrow-right', 'success');
} else {
- $form->addButton('next_survey_page', get_lang('Next'), 'arrow-right');
+ $form->addButton('next_survey_page', get_lang('Next'), 'arrow-right', 'success');
}
}
if ($show >= $numberofpages && $_GET['show']) {
- $form->addButton('finish_survey', get_lang('FinishSurvey'), 'arrow-right');
+ $form->addButton('finish_survey', get_lang('FinishSurvey'), 'arrow-right', 'success');
}
}
}
@@ -1255,7 +1257,7 @@ if ($survey_data['survey_type'] === '0') {
if ($personality == 0) {
if (($show <= $numberofpages) || !$_GET['show']) {
- $form->addButton('next_survey_page', get_lang('Next'), 'arrow-right');
+ $form->addButton('next_survey_page', get_lang('Next'), 'arrow-right', 'success');
if ($survey_data['one_question_per_page'] == 0) {
if ($personality >= 0) {
$form->addHidden('personality', $personality);
@@ -1277,10 +1279,10 @@ if ($survey_data['survey_type'] === '0') {
} elseif ($personality > 0) {
if ($survey_data['one_question_per_page'] == 1) {
if ($show >= $numberofpages) {
- $form->addButton('finish_survey', get_lang('FinishSurvey'), 'arrow-right');
+ $form->addButton('finish_survey', get_lang('FinishSurvey'), 'arrow-right', 'success');
} else {
$form->addHidden('personality', $personality);
- $form->addButton('next_survey_page', get_lang('Next'), 'arrow-right');
+ $form->addButton('next_survey_page', get_lang('Next'), 'arrow-right', 'success');
}
} else {
// if the personality test hidden input was set.
@@ -1289,12 +1291,13 @@ if ($survey_data['survey_type'] === '0') {
}
} elseif ($survey_data['form_fields'] == '') {
// This is the case when the show_profile_form is true but there are not form_fields
- $form->addButton('next_survey_page', get_lang('Next'), 'arrow-right');
+ $form->addButton('next_survey_page', get_lang('Next'), 'arrow-right', 'success');
} elseif (!is_array($user_data)) {
// If the user is not registered in the platform we do not show the form to update his information
- $form->addButton('next_survey_page', get_lang('Next'), 'arrow-right');
+ $form->addButton('next_survey_page', get_lang('Next'), 'arrow-right', 'success');
}
}
+$form->addHtml('
');
$form->display();
// Footer
diff --git a/main/survey/preview.php b/main/survey/preview.php
index bf8d6e811a..c9d604dbb5 100755
--- a/main/survey/preview.php
+++ b/main/survey/preview.php
@@ -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;
@@ -206,7 +207,7 @@ if (api_is_course_admin() ||
$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) {
$ch_type = 'ch_'.$question['type'];
@@ -251,6 +252,14 @@ if (api_is_course_admin() ||
}
$form->addHtml('
');
$form->display();
+
+ if ($courseInfo) {
+ echo Display::toolbarButton(
+ get_lang('ReturnToCourseHomepage'),
+ api_get_course_url($courseInfo['code']),
+ 'home'
+ );
+ }
} else {
echo Display::return_message(get_lang('NotAllowed'), 'error', false);
}
diff --git a/main/survey/surveyUtil.class.php b/main/survey/surveyUtil.class.php
index 39bbd8f326..faa6f58d3c 100755
--- a/main/survey/surveyUtil.class.php
+++ b/main/survey/surveyUtil.class.php
@@ -2511,9 +2511,18 @@ class SurveyUtil
$table->set_header(6, get_lang('AvailableUntil'));
$table->set_header(7, get_lang('Invite'));
$table->set_header(8, get_lang('Anonymous'));
- $table->set_header(9, get_lang('Modify'), false, 'width="150"');
+
+ if (api_get_configuration_value('allow_mandatory_survey')) {
+ $table->set_header(9, get_lang('IsMandatory'));
+ $table->set_header(10, get_lang('Modify'), false, 'width="150"');
+ $table->set_column_filter(9, 'anonymous_filter');
+ $table->set_column_filter(10, 'modify_filter_drh');
+ } else {
+ $table->set_header(9, get_lang('Modify'), false, 'width="150"');
+ $table->set_column_filter(9, 'modify_filter_drh');
+ }
+
$table->set_column_filter(8, 'anonymous_filter');
- $table->set_column_filter(9, 'modify_filter_drh');
$table->display();
}
@@ -2554,9 +2563,18 @@ class SurveyUtil
$table->set_header(6, get_lang('AvailableUntil'));
$table->set_header(7, get_lang('Invite'));
$table->set_header(8, get_lang('Anonymous'));
- $table->set_header(9, get_lang('Modify'), false, 'width="150"');
+
+ if (api_get_configuration_value('allow_mandatory_survey')) {
+ $table->set_header(9, get_lang('IsMandatory'));
+ $table->set_header(10, get_lang('Modify'), false, 'width="150"');
+ $table->set_column_filter(9, 'anonymous_filter');
+ $table->set_column_filter(10, 'modify_filter');
+ } else {
+ $table->set_header(9, get_lang('Modify'), false, 'width="150"');
+ $table->set_column_filter(9, 'modify_filter');
+ }
+
$table->set_column_filter(8, 'anonymous_filter');
- $table->set_column_filter(9, 'modify_filter');
$table->set_form_actions(array('delete' => get_lang('DeleteSurvey')));
$table->display();
}
@@ -2593,9 +2611,18 @@ class SurveyUtil
$table->set_header(6, get_lang('AvailableUntil'));
$table->set_header(7, get_lang('Invite'));
$table->set_header(8, get_lang('Anonymous'));
- $table->set_header(9, get_lang('Modify'), false, 'width="130"');
+
+ if (api_get_configuration_value('allow_mandatory_survey')) {
+ $table->set_header(9, get_lang('Modify'), false, 'width="130"');
+ $table->set_header(10, get_lang('Modify'), false, 'width="130"');
+ $table->set_column_filter(9, 'anonymous_filter');
+ $table->set_column_filter(10, 'modify_filter_for_coach');
+ } else {
+ $table->set_header(9, get_lang('Modify'), false, 'width="130"');
+ $table->set_column_filter(9, 'modify_filter_for_coach');
+ }
+
$table->set_column_filter(8, 'anonymous_filter');
- $table->set_column_filter(9, 'modify_filter_for_coach');
$table->display();
}
@@ -2766,6 +2793,7 @@ class SurveyUtil
$table_survey = Database::get_course_table(TABLE_SURVEY);
$table_user = Database::get_main_table(TABLE_MAIN_USER);
$table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION);
+ $mandatoryAllowed = api_get_configuration_value('allow_mandatory_survey');
$_user = api_get_user_info();
// Searching
@@ -2814,6 +2842,8 @@ class SurveyUtil
$res = Database::query($sql);
$surveys = array();
$array = array();
+ $efv = new ExtraFieldValue('survey');
+
while ($survey = Database::fetch_array($res)) {
$array[0] = $survey[0];
$array[1] = Display::url(
@@ -2839,7 +2869,15 @@ class SurveyUtil
);
$array[8] = $survey[8];
- $array[9] = $survey[9];
+
+ if ($mandatoryAllowed) {
+ $efvMandatory = $efv->get_values_by_handler_and_field_variable($survey[9], 'is_mandatory');
+
+ $array[9] = $efvMandatory ? $efvMandatory['value'] : 0;
+ $array[10] = $survey[9];
+ } else {
+ $array[9] = $survey[9];
+ }
if ($isDrh) {
$array[1] = $survey[1];
@@ -2860,6 +2898,7 @@ class SurveyUtil
*/
public static function get_survey_data_for_coach($from, $number_of_items, $column, $direction)
{
+ $mandatoryAllowed = api_get_configuration_value('allow_mandatory_survey');
$survey_tree = new SurveyTree();
//$last_version_surveys = $survey_tree->get_last_children_from_branch($survey_tree->surveylist);
$last_version_surveys = $survey_tree->surveylist;
@@ -2884,6 +2923,7 @@ class SurveyUtil
$table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION);
$table_user = Database::get_main_table(TABLE_MAIN_USER);
$course_id = api_get_course_int_id();
+ $efv = new ExtraFieldValue('survey');
$sql = "SELECT
survey.survey_id AS col0,
@@ -2908,6 +2948,11 @@ class SurveyUtil
$res = Database::query($sql);
$surveys = array();
while ($survey = Database::fetch_array($res)) {
+ if ($mandatoryAllowed) {
+ $survey['col10'] = $survey['col9'];
+ $efvMandatory = $efv->get_values_by_handler_and_field_variable($survey['col9'], 'is_mandatory');
+ $survey['col9'] = $efvMandatory['value'];
+ }
$surveys[] = $survey;
}
@@ -2928,6 +2973,7 @@ class SurveyUtil
$course_id = $_course['real_id'];
$user_id = intval($user_id);
$sessionId = api_get_session_id();
+ $mandatoryAllowed = api_get_configuration_value('allow_mandatory_survey');
// Database table definitions
$table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION);
@@ -2949,6 +2995,9 @@ class SurveyUtil
echo '
';
echo ' | '.get_lang('SurveyName').' | ';
echo ' '.get_lang('Anonymous').' | ';
+ if ($mandatoryAllowed) {
+ echo ''.get_lang('IsMandatory').' | ';
+ }
echo '
';
echo '';
echo '
';
@@ -2972,6 +3021,8 @@ class SurveyUtil
";
$result = Database::query($sql);
+ $efv = new ExtraFieldValue('survey');
+
while ($row = Database::fetch_array($result, 'ASSOC')) {
echo '';
if ($row['answered'] == 0) {
@@ -2999,6 +3050,11 @@ class SurveyUtil
echo '| ';
echo ($row['anonymous'] == 1) ? get_lang('Yes') : get_lang('No');
echo ' | ';
+ if ($mandatoryAllowed) {
+ $efvMandatory = $efv->get_values_by_handler_and_field_variable($row['survey_id'], 'is_mandatory');
+ echo ''.($efvMandatory['value'] ? get_lang('Yes') : get_lang('No')).' | ';
+ }
+
echo '
';
}
echo '';
diff --git a/main/template/default/announcement/slider.tpl b/main/template/default/announcement/slider.tpl
index 16f6241b83..a9b4ed06c5 100644
--- a/main/template/default/announcement/slider.tpl
+++ b/main/template/default/announcement/slider.tpl
@@ -1,4 +1,6 @@
-
+
diff --git a/main/template/default/announcement/view.tpl b/main/template/default/announcement/view.tpl
index cda3110a5f..0747b48445 100644
--- a/main/template/default/announcement/view.tpl
+++ b/main/template/default/announcement/view.tpl
@@ -1,4 +1,6 @@
-
+
{% if not announcement is empty %}
diff --git a/main/template/default/layout/hot_courses.tpl b/main/template/default/layout/hot_courses.tpl
index 64d1d017e1..5b931341ac 100755
--- a/main/template/default/layout/hot_courses.tpl
+++ b/main/template/default/layout/hot_courses.tpl
@@ -21,7 +21,7 @@ $(document).ready( function() {
});