|
@@ -55,7 +55,7 @@ Display::display_header($tool_name);
|
|
|
|
|
|
// Getting all the people who have filled this survey
|
|
|
$answered_data = SurveyManager::get_people_who_filled_survey($survey_id);
|
|
|
-if ($survey_data['anonymous'] == 1) {
|
|
|
+if ($survey_data['anonymous'] == 1 && !api_get_configuration_value('survey_anonymous_show_answered')) {
|
|
|
echo Display::return_message(
|
|
|
get_lang('AnonymousSurveyCannotKnowWhoAnswered').' '.count(
|
|
|
$answered_data
|
|
@@ -95,20 +95,13 @@ echo ' </tr>';
|
|
|
|
|
|
$course_id = api_get_course_int_id();
|
|
|
$sessionId = api_get_session_id();
|
|
|
-$sessionCondition = api_get_session_condition($sessionId);
|
|
|
|
|
|
-$sql = "SELECT survey_invitation.*, user.firstname, user.lastname, user.email
|
|
|
- FROM $table_survey_invitation survey_invitation
|
|
|
- LEFT JOIN $table_user user
|
|
|
- ON (survey_invitation.user = user.id AND survey_invitation.c_id = $course_id)
|
|
|
- WHERE
|
|
|
- survey_invitation.survey_code = '".Database::escape_string($survey_data['code'])."' $sessionCondition";
|
|
|
+$sentIntitations = SurveyUtil::getSentInvitations($survey_data['code'], $course_id, $sessionId);
|
|
|
|
|
|
-$res = Database::query($sql);
|
|
|
-while ($row = Database::fetch_assoc($res)) {
|
|
|
+foreach ($sentIntitations as $row) {
|
|
|
if (!$_GET['view'] || $_GET['view'] == 'invited' ||
|
|
|
- ($_GET['view'] == 'answered' && in_array($row['user'], $answered_data)) ||
|
|
|
- ($_GET['view'] == 'unanswered' && !in_array($row['user'], $answered_data))
|
|
|
+ ($_GET['view'] == 'answered' && in_array($row['user'], $answered_data) && count($answered_data) > 1) ||
|
|
|
+ ($_GET['view'] == 'unanswered' && !in_array($row['user'], $answered_data) && count($answered_data) > 1)
|
|
|
) {
|
|
|
echo '<tr>';
|
|
|
if (is_numeric($row['user'])) {
|
|
@@ -122,7 +115,8 @@ while ($row = Database::fetch_assoc($res)) {
|
|
|
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')) {
|
|
|
+ if (in_array($row['user'], $answered_data) && !api_get_configuration_value('hide_survey_reporting_button') &&
|
|
|
+ !api_get_configuration_value('survey_anonymous_show_answered')) {
|
|
|
echo '<a href="'.
|
|
|
api_get_path(WEB_CODE_PATH).
|
|
|
'survey/reporting.php?action=userreport&survey_id='.$survey_id.'&user='.$row['user'].'&'.api_get_cidreq().'">'.
|