generate_link.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. require_once '../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('url' => api_get_path(WEB_CODE_PATH).'survey/survey_list.php', 'name' => get_lang('SurveyList'));
  13. $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id, 'name' => strip_tags($survey_data['title']));
  14. Display::display_header(get_lang('Survey'), 'Survey');
  15. if (!SurveyManager::survey_generation_hash_available()) {
  16. api_not_allowed(true);
  17. }
  18. $link = SurveyManager::generate_survey_link(
  19. $survey_id,
  20. api_get_course_int_id(),
  21. api_get_session_id(),
  22. api_get_group_id()
  23. );
  24. echo '<div class="row">';
  25. echo '<div class="span12" style="text-align:center">';
  26. echo Display::url(get_lang('GenerateSurveyAccessLink'), $link, array('class' => 'btn btn-primary btn-large'));
  27. echo '</div>';
  28. echo '<div class="span12">';
  29. echo get_lang('GenerateSurveyAccessLinkExplanation');
  30. echo '<pre>';
  31. echo $link;
  32. echo '</pre>';
  33. echo '</div>';
  34. echo '</div>';