generate_link.php 1.3 KB

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