Minor - fix php error, add api_get_cidreq() in URLs

pull/2729/head
Julio Montoya 7 years ago
parent e775761113
commit d5fa7e188c
  1. 22
      main/survey/surveyUtil.class.php
  2. 14
      main/survey/survey_invitation.php
  3. 5
      main/survey/survey_invite.php

@ -480,16 +480,18 @@ class SurveyUtil
}
$ch_type = 'ch_'.$question['type'];
/** @var survey_question $display */
$display = new $ch_type();
$url = api_get_self();
$form = new FormValidator('question', 'post', $url);
$form->addHtml('<div class="survey_question_wrapper"><div class="survey_question">');
$form->addHtml($question['survey_question']);
$display->render($form, $question, $finalAnswer);
$form->addHtml('</div></div>');
$form->display();
if (class_exists($ch_type)) {
/** @var survey_question $display */
$display = new $ch_type();
$url = api_get_self();
$form = new FormValidator('question', 'post', $url);
$form->addHtml('<div class="survey_question_wrapper"><div class="survey_question">');
$form->addHtml($question['survey_question']);
$display->render($form, $question, $finalAnswer);
$form->addHtml('</div></div>');
$form->display();
}
}
}
}

@ -63,24 +63,25 @@ if ($survey_data['anonymous'] == 1) {
);
$answered_data = [];
}
$url = api_get_self().'?survey_id='.$survey_id.'&'.api_get_cidreq();
if (!isset($_GET['view']) || $_GET['view'] == 'invited') {
echo get_lang('ViewInvited').' | ';
} else {
echo ' <a href="'.api_get_self().'?survey_id='.$survey_id.'&view=invited">'.
echo ' <a href="'.$url.'&view=invited">'.
get_lang('ViewInvited').'</a> |';
}
if ($_GET['view'] == 'answered') {
echo get_lang('ViewAnswered').' | ';
} else {
echo ' <a href="'.api_get_self().'?survey_id='.$survey_id.'&view=answered">'.
echo ' <a href="'.$url.'&view=answered">'.
get_lang('ViewAnswered').'</a> |';
}
if ($_GET['view'] == 'unanswered') {
echo get_lang('ViewUnanswered');
} else {
echo ' <a href="'.api_get_self().'?survey_id='.$survey_id.'&view=unanswered">'.
echo ' <a href="'.$url.'&view=unanswered">'.
get_lang('ViewUnanswered').'</a>';
}
@ -118,11 +119,13 @@ while ($row = Database::fetch_assoc($res)) {
} else {
echo '<td>'.$row['user'].'</td>';
}
echo ' <td>'.api_get_local_time($row['invitation_date']).'</td>';
echo ' <td>'.Display::dateToStringAgoAndLongDate($row['invitation_date']).'</td>';
echo ' <td>';
if (in_array($row['user'], $answered_data) && !api_get_configuration_value('hide_survey_reporting_button')) {
echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=userreport&survey_id='.$survey_id.'&user='.$row['user'].'">'.
echo '<a href="'.
api_get_path(WEB_CODE_PATH).
'survey/reporting.php?action=userreport&survey_id='.$survey_id.'&user='.$row['user'].'&'.api_get_cidreq().'">'.
get_lang('ViewAnswers').'</a>';
} else {
echo '-';
@ -136,5 +139,4 @@ while ($row = Database::fetch_assoc($res)) {
// Closing the table
echo '</table>';
// Footer
Display::display_footer();

@ -237,11 +237,12 @@ if ($form->validate()) {
// Counting the number of people that are invited
$total_invited = SurveyUtil::update_count_invited($survey_data['code']);
$total_count = $count_course_users + $counter_additional_users;
$invitationUrl = api_get_path(WEB_CODE_PATH).'survey/survey_invitation.php?survey_id='.$survey_data['survey_id'].'&'.api_get_cidreq();
if ($total_invited > 0) {
$message = '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invitation.php?view=answered&survey_id='.$survey_data['survey_id'].'">'.
$message = '<a href="'.$invitationUrl.'&view=answered">'.
$survey_data['answered'].'</a> ';
$message .= get_lang('HaveAnswered').' ';
$message .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invitation.php?view=invited&survey_id='.$survey_data['survey_id'].'">'.
$message .= '<a href="'.$invitationUrl.'&view=invited">'.
$total_invited.'</a> ';
$message .= get_lang('WereInvited');
echo Display::return_message($message, 'normal', false);

Loading…
Cancel
Save