mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
MDL-14129, fixed hardcoded print_error for feedback module.
This commit is contained in:
parent
2ddba27f0a
commit
b149ffb421
@ -20,10 +20,15 @@ $string['confirmdeletetemplate'] = 'Are you sure you want to delete this templat
|
||||
$string['confirmusetemplate'] = 'Are you sure you want to use this template?';
|
||||
$string['average'] = 'Average';
|
||||
$string['bold'] = 'Bold';
|
||||
$string['cannotcreatetmpfeedback'] = 'Cannot create temporary feedback';
|
||||
$string['cannotcreatecompletedfeedback'] = 'Cannot create completed feedback';
|
||||
$stirng['cannotloadxml'] = 'failed to loading xml';
|
||||
$string['cannotunmap'] = 'Database problem, unable to unmap';
|
||||
$string['cannotmapfeedback'] = 'Database problem, unable to map feedback to course';
|
||||
$string['cannotsavetempl'] = 'saving templates is not allowed';
|
||||
$string['cancel_moving'] = 'Cancel moving';
|
||||
$string['captcha'] = 'Captcha';
|
||||
$string['captchanotset'] = 'Captcha hasn\'t been set.';
|
||||
$string['check_values'] = 'Possible responses';
|
||||
$string['checkbox'] = 'Multiple choice - multiple answers allowed (check boxes)';
|
||||
$string['check'] = 'Multiple choice - multiple answers';
|
||||
|
@ -28,15 +28,15 @@
|
||||
|
||||
if ($id) {
|
||||
if (! $cm = get_coursemodule_from_id('feedback', $id)) {
|
||||
error("Course Module ID was incorrect");
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
|
||||
if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
|
||||
error("Course is misconfigured");
|
||||
print_error('coursemisconf');
|
||||
}
|
||||
|
||||
if (! $feedback = $DB->get_record("feedback", array("id"=>$cm->instance))) {
|
||||
error("Course module is incorrect");
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,12 +63,12 @@
|
||||
require_course_login($course2); //this overwrites the object $course :-(
|
||||
$course = $DB->get_record("course", array("id"=>$cm->course)); // the workaround
|
||||
}else {
|
||||
error("courseid is not correct");
|
||||
print_error('invalidcourseid');
|
||||
}
|
||||
}
|
||||
|
||||
if( !( ((intval($feedback->publish_stats) == 1) AND $capabilities->viewanalysepage) || $capabilities->viewreports)) {
|
||||
error(get_string('error'));
|
||||
print_error('error');
|
||||
}
|
||||
|
||||
/// Print the page header
|
||||
|
@ -19,15 +19,15 @@
|
||||
|
||||
if ($id) {
|
||||
if (! $cm = get_coursemodule_from_id('feedback', $id)) {
|
||||
error("Course Module ID was incorrect");
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
|
||||
if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
|
||||
error("Course is misconfigured");
|
||||
print_error('coursemisconf');
|
||||
}
|
||||
|
||||
if (! $feedback = $DB->get_record("feedback", array("id"=>$cm->instance))) {
|
||||
error("Course module is incorrect");
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
}
|
||||
$capabilities = feedback_load_capabilities($cm->id);
|
||||
@ -35,7 +35,7 @@
|
||||
require_login($course->id, true, $cm);
|
||||
|
||||
if(!$capabilities->viewreports){
|
||||
error(get_string('error'));
|
||||
print_error('error');
|
||||
}
|
||||
|
||||
//buffering any output
|
||||
@ -59,7 +59,7 @@
|
||||
|
||||
//get the questions (item-names)
|
||||
if(!$items = $DB->get_records('feedback_item', array('feedback'=>$feedback->id, 'hasvalue'=>1), 'position')) {
|
||||
error(get_string('no_items_available_yet', 'feedback'), $CFG->wwwroot.'/mod/feedback/view.php?id='.$id);
|
||||
print_error('no_items_available_yet', 'feedback', $CFG->wwwroot.'/mod/feedback/view.php?id='.$id);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
@ -22,20 +22,20 @@
|
||||
|
||||
|
||||
if(($formdata = data_submitted()) AND !confirm_sesskey()) {
|
||||
error('no sesskey defined');
|
||||
print_error('invalidsesskey');
|
||||
}
|
||||
|
||||
if ($id) {
|
||||
if (! $cm = get_coursemodule_from_id('feedback', $id)) {
|
||||
error("Course Module ID was incorrect");
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
|
||||
if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
|
||||
error("Course is misconfigured");
|
||||
print_error('coursemisconf');
|
||||
}
|
||||
|
||||
if (! $feedback = $DB->get_record("feedback", array("id"=>$cm->instance))) {
|
||||
error("Course module is incorrect");
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
}
|
||||
$capabilities = feedback_load_capabilities($cm->id);
|
||||
@ -43,7 +43,7 @@
|
||||
require_login($course->id, true, $cm);
|
||||
|
||||
if(!$capabilities->edititems){
|
||||
error(get_string('error'));
|
||||
print_error('error');
|
||||
}
|
||||
|
||||
//if the typ is pagebreak so the item will be saved directly
|
||||
@ -61,8 +61,12 @@
|
||||
}else {
|
||||
$position = -1;
|
||||
$item = new stdClass();
|
||||
if ($position == '')$position = 0;
|
||||
if(!$typ)error('missing value "typ"', htmlspecialchars('edit.php?id='.$id));
|
||||
if ($position == '') {
|
||||
$position = 0;
|
||||
}
|
||||
if (!$typ) {
|
||||
print_error('typemissing', 'feedback', $CFG->wwwroot.'/mod/feedback/edit.php?id='.$id);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -17,20 +17,20 @@
|
||||
$action = optional_param('action', false, PARAM_ALPHA);
|
||||
|
||||
if(($formdata = data_submitted()) AND !confirm_sesskey()) {
|
||||
error('no sesskey defined');
|
||||
print_error('invalidsesskey');
|
||||
}
|
||||
|
||||
if ($id) {
|
||||
if (! $cm = get_coursemodule_from_id('feedback', $id)) {
|
||||
error("Course Module ID was incorrect");
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
|
||||
if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
|
||||
error("Course is misconfigured");
|
||||
print_error('coursemisconf');
|
||||
}
|
||||
|
||||
if (! $feedback = $DB->get_record("feedback", array("id"=>$cm->instance))) {
|
||||
error("Course module is incorrect");
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
}
|
||||
$capabilities = feedback_load_capabilities($cm->id);
|
||||
@ -38,7 +38,7 @@
|
||||
require_login($course->id, true, $cm);
|
||||
|
||||
if(!$capabilities->edititems){
|
||||
error('this action is not allowed');
|
||||
print_error('invalidaction');
|
||||
}
|
||||
|
||||
unset($filename);
|
||||
@ -57,10 +57,10 @@
|
||||
// process if we are happy file is ok
|
||||
if (isset($filename)) {
|
||||
if(!is_file($filename) OR !is_readable($filename)) {
|
||||
error('file not found or not readable');
|
||||
print_error('filenotreadable');
|
||||
}
|
||||
if(!$xmldata = feedback_load_xml_data($filename)) {
|
||||
error('failed to loading xml', 'edit.php?id='.$id);
|
||||
print_error('cannotloadxml', 'feedback', 'edit.php?id='.$id);
|
||||
}
|
||||
|
||||
$importerror = feedback_import_loaded_data($xmldata, $feedback->id);
|
||||
|
@ -5,20 +5,20 @@
|
||||
|
||||
if ($id) {
|
||||
if (! $cm = get_coursemodule_from_id('feedback', $id)) {
|
||||
error("Course Module ID was incorrect");
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
|
||||
if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
|
||||
error("Course is misconfigured");
|
||||
print_error('coursemisconf');
|
||||
}
|
||||
|
||||
if (! $feedback = $DB->get_record("feedback", array("id"=>$cm->instance))) {
|
||||
error("Course module is incorrect");
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
}
|
||||
|
||||
if(!isset($SESSION->feedback->item->captcha)) {
|
||||
error('not allowed');
|
||||
print_error('captchanotset', 'feedback');
|
||||
}
|
||||
|
||||
$height = 40;
|
||||
|
@ -965,7 +965,7 @@ function feedback_set_tmp_values($feedbackcompleted) {
|
||||
unset($tmpcpl->id);
|
||||
$tmpcpl->timemodified = time();
|
||||
if(!$tmpcpl->id = $DB->insert_record('feedback_completedtmp', $tmpcpl)) {
|
||||
error('failed create completedtmp');
|
||||
print_error('cannotcreatetmpfeedback', 'feedback');
|
||||
}
|
||||
//get all values of original-completed
|
||||
if(!$values = $DB->get_records('feedback_value', array('completed'=>$feedbackcompleted->id))) {
|
||||
@ -1002,7 +1002,7 @@ function feedback_save_tmp_values($feedbackcompletedtmp, $feedbackcompleted, $us
|
||||
$newcpl->userid = $userid;
|
||||
$newcpl->timemodified = time();
|
||||
if(!$newcpl->id = $DB->insert_record('feedback_completed', $newcpl)) {
|
||||
error('failed create completed');
|
||||
print_error('cannotcreatecompletedfeedback', 'feedback');
|
||||
}
|
||||
//get all values of tmp-completed
|
||||
if(!$values = $DB->get_records('feedback_valuetmp', array('completed'=>$feedbackcompletedtmp->id))) {
|
||||
|
@ -42,7 +42,7 @@
|
||||
require_login($course->id, true, $cm);
|
||||
|
||||
if (!$capabilities->mapcourse) {
|
||||
error ('access not allowed');
|
||||
print_error('invalidaccess');
|
||||
}
|
||||
|
||||
if ($coursefilter) {
|
||||
|
@ -16,21 +16,21 @@
|
||||
|
||||
if ($id) {
|
||||
if (! $cm = get_coursemodule_from_id('feedback', $id)) {
|
||||
error("Course Module ID was incorrect");
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
|
||||
if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
|
||||
error("Course is misconfigured");
|
||||
print_error('coursemisconf');
|
||||
}
|
||||
|
||||
if (! $feedback = $DB->get_record("feedback", array("id"=>$cm->instance))) {
|
||||
error("Course module is incorrect");
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
}
|
||||
$capabilities = feedback_load_capabilities($cm->id);
|
||||
|
||||
if (!$capabilities->mapcourse) {
|
||||
error ('access not allowed');
|
||||
print_error('invalidaccess');
|
||||
}
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
if ($DB->delete_records('feedback_sitecourse_map', array('id'=>$cmapid))) {
|
||||
redirect (htmlspecialchars('mapcourse.php?id='.$id));
|
||||
} else {
|
||||
error('Database problem, unable to unmap');
|
||||
print_error('cannotunmap', 'feedback');
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user