generate_link.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. require_once __DIR__.'/../inc/global.inc.php';
  4. if (!api_is_allowed_to_edit(false, true)) {
  5. api_not_allowed(true);
  6. }
  7. $survey_id = isset($_REQUEST['survey_id']) ? intval($_REQUEST['survey_id']) : null;
  8. if (empty($survey_id)) {
  9. api_not_allowed(true);
  10. }
  11. $survey_data = SurveyManager::get_survey($survey_id);
  12. $interbreadcrumb[] = array(
  13. 'url' => api_get_path(WEB_CODE_PATH).'survey/survey_list.php',
  14. 'name' => get_lang('SurveyList'),
  15. );
  16. $interbreadcrumb[] = array(
  17. 'url' => api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id,
  18. 'name' => strip_tags($survey_data['title']),
  19. );
  20. Display::display_header(get_lang('Survey'), 'Survey');
  21. if (!SurveyManager::survey_generation_hash_available()) {
  22. api_not_allowed(true);
  23. }
  24. $link = SurveyManager::generate_survey_link(
  25. $survey_id,
  26. api_get_course_int_id(),
  27. api_get_session_id(),
  28. api_get_group_id()
  29. );
  30. echo '<div class="row">';
  31. echo '<div class="col-md-12">';
  32. echo Display::url(get_lang('GoToSurvey'), $link, array('class' => 'btn btn-primary btn-large'));
  33. echo '</div>';
  34. echo '<div class="col-md-12">';
  35. echo get_lang('GenerateSurveyAccessLinkExplanation');
  36. echo '<pre>';
  37. echo $link;
  38. echo '</pre>';
  39. echo '</div>';
  40. echo '</div>';