find($surveyId); if (null === $survey) { api_not_allowed(true); } $surveyId = $survey->getIid(); $view = $_GET['view'] ?? 'invited'; $urlname = strip_tags( api_substr(api_html_entity_decode($survey->getTitle(), ENT_QUOTES), 0, 40) ); if (api_strlen(strip_tags($survey->getTitle())) > 40) { $urlname .= '...'; } // Breadcrumbs $interbreadcrumb[] = [ 'url' => api_get_path(WEB_CODE_PATH).'survey/survey_list.php', 'name' => get_lang('Survey list'), ]; $interbreadcrumb[] = [ 'url' => api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$surveyId, 'name' => $urlname, ]; Display::display_header($tool_name); $course_id = api_get_course_int_id(); $sessionId = api_get_session_id(); $sentInvitations = SurveyUtil::getSentInvitations($survey->getIid(), $course_id, $sessionId); // Getting all the people who have filled this survey $answered_data = SurveyManager::get_people_who_filled_survey($surveyId); $invitationsCount = count($sentInvitations); $answeredCount = count($answered_data); $unAnsweredCount = count($sentInvitations) - count($answered_data); if (1 == $survey->getAnonymous() && ('true' !== api_get_setting('survey.survey_anonymous_show_answered'))) { echo Display::return_message( get_lang('This survey is anonymous. You can\'t see who answered.').' '.$answeredCount.' '.get_lang( 'people answered' ) ); $answered_data = []; } if (1 == $survey->getAnonymous()) { if ($answeredCount < 2) { $answeredCount = 0; $unAnsweredCount = $invitationsCount; } } $url = api_get_self().'?survey_id='.$surveyId.'&'.api_get_cidreq(); echo '
'; echo ''.get_lang('User').' | '; echo ''.get_lang('Invitation date').' | '; switch ($view) { case 'unanswered': echo ''.get_lang('Survey invitation link').' | '; break; default: echo ''.get_lang('Answered').' | '; break; } echo '||||
---|---|---|---|---|---|---|---|
'; echo UserManager::getUserProfileLink($userInfo); echo ' | '; } else { echo ''.$user.' | '; } echo ''.Display::dateToStringAgoAndLongDate($row['invitation_date']).' | '; if (in_array($user, $answered_data)) { if (!$surveyAnonymousShowAnswered && !$hideSurveyReportingButton) { echo ''; echo ''. get_lang('View answers').''; echo ' | '; } else { if (1 == $survey->getAnonymous() && $answeredCount > 1) { echo ''.get_lang('Answered').' | '; } else { echo '- | '; } } } else { if ('unanswered' === $view) { echo ''; $code = $row['invitation_code']; $link = SurveyUtil::generateFillSurveyLink($survey, $code, $course, $sessionId); $link = Display::input('text', 'copy_'.$id, $link, ['id' => 'copy_'.$id, 'class' => '']); $link .= ' '.Display::url( Display::getMdiIcon('content-copy').get_lang('Copy text'), 'javascript:void()', ['onclick' => "copyTextToClipBoard('copy_".$id."')", 'class' => 'btn btn--primary btn-sm'] ); echo $link; echo ' | '; } else { echo '- | '; } } echo '
'; echo UserManager::getUserProfileLink($userInfo); echo ' | '; } else { echo ''.$row['user'].' | '; } echo ''.Display::dateToStringAgoAndLongDate($row['invitation_date']).' | '; echo ''; $code = $row['invitation_code']; $link = SurveyUtil::generateFillSurveyLink($survey, $code, $course, $sessionId); $link = Display::input('text', 'copy_'.$id, $link, ['id' => 'copy_'.$id, 'class' => '']); $link .= ' '.Display::url( Display::getMdiIcon('content-copy').get_lang('Copy text'), 'javascript:void()', ['onclick' => "copyTextToClipBoard('copy_".$id."')", 'class' => 'btn btn--primary btn-sm'] ); echo $link; echo ' |