示例#1
0
 /**
  * This function changes the modify column of the sortable table
  *
  * @param integer $survey_id the id of the survey
  * @param bool $drh
  * @return string html code that are the actions that can be performed on any survey
  *
  * @author Patrick Cool <*****@*****.**>, Ghent University
  * @version January 2007
  */
 static function modify_filter($survey_id, $drh = false)
 {
     $survey_id = Security::remove_XSS($survey_id);
     $return = '';
     if ($drh) {
         return '<a href="' . api_get_path(WEB_CODE_PATH) . 'survey/reporting.php?' . api_get_cidreq() . '&survey_id=' . $survey_id . '">' . Display::return_icon('stats.png', get_lang('Reporting'), '', ICON_SIZE_SMALL) . '</a>';
     }
     // Coach can see that only if the survey is in his session
     if (api_is_allowed_to_edit() || api_is_element_in_the_session(TOOL_SURVEY, $survey_id)) {
         $return .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'survey/create_new_survey.php?' . api_get_cidreq() . '&action=edit&survey_id=' . $survey_id . '">' . Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . '</a>';
         if (SurveyManager::survey_generation_hash_available()) {
             $return .= Display::url(Display::return_icon('new_link.png', get_lang('GenerateSurveyAccessLink'), '', ICON_SIZE_SMALL), api_get_path(WEB_CODE_PATH) . 'survey/generate_link.php?survey_id=' . $survey_id . '&' . api_get_cidreq());
         }
         $return .= Display::url(Display::return_icon('copy.png', get_lang('DuplicateSurvey'), '', ICON_SIZE_SMALL), 'survey_list.php?action=copy_survey&survey_id=' . $survey_id . '&' . api_get_cidreq());
         $return .= ' <a href="' . api_get_path(WEB_CODE_PATH) . 'survey/survey_list.php?' . api_get_cidreq() . '&action=empty&survey_id=' . $survey_id . '" onclick="javascript: if(!confirm(\'' . addslashes(api_htmlentities(get_lang("EmptySurvey") . '?')) . '\')) return false;">' . Display::return_icon('clean.png', get_lang('EmptySurvey'), '', ICON_SIZE_SMALL) . '</a>&nbsp;';
     }
     $return .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'survey/preview.php?' . api_get_cidreq() . '&survey_id=' . $survey_id . '">' . Display::return_icon('preview_view.png', get_lang('Preview'), '', ICON_SIZE_SMALL) . '</a>&nbsp;';
     $return .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'survey/survey_invite.php?' . api_get_cidreq() . '&survey_id=' . $survey_id . '">' . Display::return_icon('mail_send.png', get_lang('Publish'), '', ICON_SIZE_SMALL) . '</a>&nbsp;';
     $return .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'survey/reporting.php?' . api_get_cidreq() . '&survey_id=' . $survey_id . '">' . Display::return_icon('stats.png', get_lang('Reporting'), '', ICON_SIZE_SMALL) . '</a>';
     if (api_is_allowed_to_edit() || api_is_element_in_the_session(TOOL_SURVEY, $survey_id)) {
         $return .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'survey/survey_list.php?' . api_get_cidreq() . '&action=delete&survey_id=' . $survey_id . '" onclick="javascript: if(!confirm(\'' . addslashes(api_htmlentities(get_lang("DeleteSurvey") . '?', ENT_QUOTES)) . '\')) return false;">' . Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>&nbsp;';
     }
     return $return;
 }
示例#2
0
<?php

/* For licensing terms, see /license.txt */
require_once '../inc/global.inc.php';
if (!api_is_allowed_to_edit(false, true)) {
    api_not_allowed(true);
}
$survey_id = isset($_REQUEST['survey_id']) ? intval($_REQUEST['survey_id']) : null;
if (empty($survey_id)) {
    api_not_allowed(true);
}
$survey_data = SurveyManager::get_survey($survey_id);
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'survey/survey_list.php', 'name' => get_lang('SurveyList'));
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'survey/survey.php?survey_id=' . $survey_id, 'name' => strip_tags($survey_data['title']));
Display::display_header(get_lang('Survey'), 'Survey');
if (!SurveyManager::survey_generation_hash_available()) {
    api_not_allowed(true);
}
$link = SurveyManager::generate_survey_link($survey_id, api_get_course_int_id(), api_get_session_id(), api_get_group_id());
echo '<div class="row">';
echo '<div class="span12" style="text-align:center">';
echo Display::url(get_lang('GenerateSurveyAccessLink'), $link, array('class' => 'btn btn-primary btn-large'));
echo '</div>';
echo '<div class="span12">';
echo get_lang('GenerateSurveyAccessLinkExplanation');
echo '<pre>';
echo $link;
echo '</pre>';
echo '</div>';
echo '</div>';