MDL-19488 - allow the creation of a "Public" feedback

This commit is contained in:
Andreas Grabs
2011-10-13 11:10:15 +02:00
parent 485ec5941e
commit e70dab0646
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -99,7 +99,7 @@ if(isset($create_template_formdata->savetemplate) && $create_template_formdata->
$savereturn = 'notsaved_name';
}else {
//if the feedback is located on the frontpage then templates can be public
if($CFG->frontpage === $course->id && has_capability('mod/feedback:createpublictemplate', $context)) {
if(SITEID === $course->id && has_capability('mod/feedback:createpublictemplate', $context)) {
$create_template_formdata->ispublic = isset($create_template_formdata->ispublic) ? 1 : 0;
}else {
$create_template_formdata->ispublic = 0;
+1 -1
View File
@@ -145,7 +145,7 @@ class feedback_edit_create_template_form extends moodleform {
$elementgroup[] =& $mform->createElement('text', 'templatename', get_string('name', 'feedback'), array('size'=>'40', 'maxlength'=>'200'));
//If the feedback is located on the frontpage the we can create public templates
if($CFG->frontpage === $this->feedbackdata->course->id) {
if(SITEID === $this->feedbackdata->course->id) {
if(has_capability('mod/feedback:createpublictemplate', $this->feedbackdata->context)) {
$elementgroup[] =& $mform->createElement('checkbox', 'ispublic', get_string('public', 'feedback'), get_string('public', 'feedback'));
}
+1 -1
View File
@@ -1228,7 +1228,7 @@ function feedback_get_template_list($course, $onlyownorpublic = '') {
$templates = $DB->get_records('feedback_template', array('course'=>$course->id), 'name');
break;
case 'public':
$templates = $DB->get_records('feedback_template', array('course'=>$CFG->frontpage, 'ispublic'=>1), 'name');
$templates = $DB->get_records('feedback_template', array('course'=>SITEID, 'ispublic'=>1), 'name');
break;
}
return $templates;