[svn r16046] Coach user can send survey invitations. see FS#2792

skala
Julio Montoya 17 years ago
parent eab49cd21c
commit 4392b319e4
  1. 3
      main/survey/preview.php
  2. 20
      main/survey/survey.lib.php
  3. 2
      main/survey/survey_invite.php
  4. 14
      main/survey/survey_list.php

@ -23,6 +23,7 @@
* @package dokeos.survey
* @author unknown, the initial survey that did not make it in 1.8 because of bad code
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University: cleanup, refactoring and rewriting large parts of the code
* @author Julio Montoya Armas <gugli100@gmail.com>, Dokeos: Personality Test modifications
* @version $Id: survey_list.php 10680 2007-01-11 21:26:23Z pcool $
*
* @todo use quickforms for the forms
@ -73,7 +74,7 @@ Display :: display_header(get_lang('SurveyPreview'));
SurveyUtil::check_first_last_question($_GET['survey_id'], false);
// only a course admin is allowed to preview a survey: you are NOT a course admin => error message
if (!api_is_allowed_to_edit())
if (!api_is_allowed_to_edit(false,true))
{
Display :: display_error_message(get_lang('NotAllowed'), false);
}

@ -24,7 +24,7 @@
* @package dokeos.survey
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University: cleanup, refactoring and rewriting large parts (if not all) of the code
@author Julio Montoya Armas <gugli100@gmail.com>, Dokeos: Personality Test modification and rewriting large parts of the code
* @version $Id: survey.lib.php 16042 2008-08-21 16:47:15Z juliomontoya $
* @version $Id: survey.lib.php 16046 2008-08-21 22:24:17Z juliomontoya $
*
* @todo move this file to inc/lib
* @todo use consistent naming for the functions (save vs store for instance)
@ -4225,11 +4225,12 @@ class SurveyUtil {
$table->set_header(10, get_lang('Modify'), false,'width="120"');
$table->set_column_filter(9, 'anonymous_filter');
$table->set_column_filter(10, 'modify_filter');
$table->set_form_actions(array ('delete' => get_lang('DeleteSurvey')));
$table->display();
if (!api_is_course_coach())
$table->set_form_actions(array ('delete' => get_lang('DeleteSurvey')));
$table->display();
}
/**
* This function changes the modify column of the sortable table
*
@ -4243,14 +4244,19 @@ class SurveyUtil {
{
global $charset;
$survey_id = Security::remove_XSS($survey_id);
$return = '<a href="create_new_survey.php?'.api_get_cidreq().'&amp;action=edit&amp;survey_id='.$survey_id.'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>';
$return .= '<a href="survey_list.php?'.api_get_cidreq().'&amp;action=delete&amp;survey_id='.$survey_id.'" onclick="javascript:if(!confirm(\''.addslashes(htmlentities(get_lang("DeleteSurvey").'?',ENT_QUOTES,$charset)).'\')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>';
if (!api_is_course_coach())
$return = '<a href="create_new_survey.php?'.api_get_cidreq().'&amp;action=edit&amp;survey_id='.$survey_id.'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>';
if (!api_is_course_coach())
$return .= '<a href="survey_list.php?'.api_get_cidreq().'&amp;action=delete&amp;survey_id='.$survey_id.'" onclick="javascript:if(!confirm(\''.addslashes(htmlentities(get_lang("DeleteSurvey").'?',ENT_QUOTES,$charset)).'\')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>';
//$return .= '<a href="create_survey_in_another_language.php?id_survey='.$survey_id.'">'.Display::return_icon('copy.gif', get_lang('Copy')).'</a>';
//$return .= '<a href="survey.php?survey_id='.$survey_id.'">'.Display::return_icon('add.gif', get_lang('Add')).'</a>';
$return .= '<a href="preview.php?'.api_get_cidreq().'&amp;survey_id='.$survey_id.'">'.Display::return_icon('preview.gif', get_lang('Preview')).'</a>';
$return .= '<a href="survey_invite.php?'.api_get_cidreq().'&amp;survey_id='.$survey_id.'">'.Display::return_icon('survey_publish.gif', get_lang('Publish')).'</a>';
$return .= '<a href="survey_list.php?'.api_get_cidreq().'&amp;action=empty&amp;survey_id='.$survey_id.'" onclick="javascript:if(!confirm(\''.addslashes(htmlentities(get_lang("EmptySurvey").'?')).'\')) return false;">'.Display::return_icon('empty.gif', get_lang('EmptySurvey')).'</a>';
$return .= '<a href="reporting.php?'.api_get_cidreq().'&amp;survey_id='.$survey_id.'">'.Display::return_icon('statistics.gif', get_lang('Reporting')).'</a>';
if (!api_is_course_coach())
$return .= '<a href="reporting.php?'.api_get_cidreq().'&amp;survey_id='.$survey_id.'">'.Display::return_icon('statistics.gif', get_lang('Reporting')).'</a>';
return $return;
}
/**

@ -46,7 +46,7 @@ require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php'
require_once (api_get_path(LIBRARY_PATH)."mail.lib.inc.php");
/** @todo this has to be moved to a more appropriate place (after the display_header of the code)*/
if (!api_is_allowed_to_edit())
if (!api_is_allowed_to_edit(false,true))
{
Display :: display_header(get_lang('Survey'));
Display :: display_error_message(get_lang('NotAllowed'), false);

@ -26,7 +26,7 @@
* @author unknown, the initial survey that did not make it in 1.8 because of bad code
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University: cleanup, refactoring and rewriting large parts of the code
* @author Julio Montoya Armas <gugli100@gmail.com>, Dokeos: Personality Test modification and rewriting large parts of the code
* @version $Id: survey_list.php 15947 2008-08-07 16:12:49Z juliomontoya $
* @version $Id: survey_list.php 16046 2008-08-21 22:24:17Z juliomontoya $
*
* @todo use quickforms for the forms
*/
@ -43,7 +43,7 @@ require_once('survey.lib.php');
require_once (api_get_path(LIBRARY_PATH)."/course.lib.php");
/** @todo this has to be moved to a more appropriate place (after the display_header of the code)*/
if (!api_is_allowed_to_edit())
if (!api_is_allowed_to_edit(false,true)) //coach can see this
{
Display :: display_header(get_lang('SurveyList'));
SurveyUtil::survey_list_user($_user['user_id']);
@ -137,13 +137,15 @@ if ($_POST['action'])
}
}
// Action links
echo '<a href="create_new_survey.php?'.api_get_cidreq().'&amp;action=add">'.get_lang('CreateNewSurvey').'</a> | ';
if (!api_is_course_coach())
{
// Action links
echo '<a href="create_new_survey.php?'.api_get_cidreq().'&amp;action=add">'.get_lang('CreateNewSurvey').'</a> | ';
}
//echo '<a href="survey_all_courses.php">'.get_lang('CreateExistingSurvey').'</a> | ';
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;search=advanced">'.get_lang('Search').'</a>';
// Main content
//Main content
SurveyUtil::display_survey_list();
// Footer

Loading…
Cancel
Save