At the same time I also took the oppertunity to fix up the bugs within the feedback module that were making it un-usable
$string['entries_saved'] = 'Your answers have been saved. Thank you.';
$string['export_questions'] = 'Export questions';
$string['export_to_excel'] = 'Export to Excel';
+$string['feedbackadministration'] = 'Feedback administration';
$string['feedback:complete'] = 'Complete a feedback';
$string['feedback:createprivatetemplate'] = 'Create private template';
$string['feedback:createpublictemplate'] = 'Create public template';
$string['item_name'] = 'Question';
$string['items_are_required'] = 'Answers are required to starred questions.';
$string['label'] = 'Label';
-$string['line_labels'] = 'Label';
+$string['item_label'] = 'Label';
$string['line_values'] = 'Rating';
$string['mapcourse'] = 'Map course';
$string['mapcourses'] = 'Map feedback to courses';
$string['next_page'] = 'Next page';
$string['no_handler']='No action handler exists for';
$string['no_itemname'] = 'No itemname';
+$string['no_itemlabel'] = 'No label';
$string['no_items_available_yet'] = 'No questions have been set up yet';
$string['no_templates_available_yet'] = 'No templates available yet';
$string['non_anonymous'] = 'User\'s name will be logged and shown with answers';
}
$node2 = clone($this->mocknode);
+ $fakecontext = new stdClass;
+ $this->cache->coursecontext2 = $fakecontext;
$node2->initialise(navigation_node::TYPE_CATEGORY, 2);
$this->assertIsA($node2->get('initcall'), 'navigation_node');
if ($node2->get('initcall')) {
-<?php // $Id$
+<?php
+
/**
-* shows an analysed view of feedback
-*
-* @version $Id$
-* @author Andreas Grabs
-* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
-* @package feedback
-*/
+ * shows an analysed view of feedback
+ *
+ * @copyright Andreas Grabs
+ * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
+ * @package feedback
+ */
require_once("../../config.php");
require_once("lib.php");
$strfeedback = get_string("modulename", "feedback");
$buttontext = update_module_button($cm->id, $course->id, $strfeedback);
- $PAGE->navbar->add($strfeedbacks, new moodle_url($CFG->wwwroot.'/mod/feedback/index.php', array('id'=>$course->id)));
- $PAGE->navbar->add(format_string($feedback->name));
-
+ $PAGE->navbar->add(get_string('analysis','feedback'));
+ $PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/feedback/edit.php', array('id'=>$cm->id, 'course'=>$courseid)));
$PAGE->set_title(format_string($feedback->name));
$PAGE->set_button($buttontext);
echo $OUTPUT->header();
//get the class of item-typ
$itemclass = 'feedback_item_'.$item->typ;
//get the instance of the item-class
+ require_once($CFG->dirroot.'/mod/feedback/item/'.$item->typ.'/lib.php');
$itemobj = new $itemclass();
$itemnr++;
if($feedback->autonumbering) {
$strfeedbacks = get_string("modulenameplural", "feedback");
$strfeedback = get_string("modulename", "feedback");
$buttontext = update_module_button($cm->id, $course->id, $strfeedback);
-
- $PAGE->navbar->add($strfeedbacks, new moodle_url($CFG->wwwroot.'/mod/feedback/index.php', array('id'=>$course->id)));
- $PAGE->navbar->add(format_string($feedback->name));
-
+
+ $PAGE->navbar->add(get_string('feedback:complete', 'feedback'));
+ $PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/feedback/complete.php', array('id'=>$cm->id, 'gopage'=>$gopage, 'courseid'=>$course->id)));
$PAGE->set_title(format_string($feedback->name));
$PAGE->set_button($buttontext);
echo $OUTPUT->header();
$strfeedback = get_string("modulename", "feedback");
$buttontext = update_module_button($cm->id, $course->id, $strfeedback);
- $PAGE->navbar->add($strfeedbacks, new moodle_url($CFG->wwwroot.'/mod/feedback/index.php', array('id'=>$course->id)));
- $PAGE->navbar->add(format_string($feedback->name));
-
+ if ($do_show == 'edit') {
+ $PAGE->navbar->add(get_string('edit_items', 'feedback'));
+ } else {
+ $PAGE->navbar->add(get_string($do_show, 'feedback'));
+ }
+ $PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/feedback/edit.php', array('id'=>$cm->id, 'do_show'=>$do_show)));
$PAGE->set_title(format_string($feedback->name));
$PAGE->set_button($buttontext);
echo $OUTPUT->header();
}
}
+ require_once($CFG->dirroot.'/mod/feedback/item/'.$typ.'/lib.php');
+
////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
if(isset($formdata->cancel)){
define('FEEDBACK_ITEM_NAME_TEXTBOX_SIZE', 80);
define('FEEDBACK_ITEM_LABEL_TEXTBOX_SIZE', 20);
-class feedback_item_form extends moodleform {
-
+abstract class feedback_item_form extends moodleform {
function get_item_form() {
return $this->_form;
}
$widthAndHeight = explode('|',$item->presentation);
$itemwidth = isset($widthAndHeight[0]) ? $widthAndHeight[0] : 30;
$itemheight = isset($widthAndHeight[1]) ? $widthAndHeight[1] : 5;
- $item_form->selectwith->setValue($itemwidth);
+ $item_form->selectwidth->setValue($itemwidth);
$item_form->selectheight->setValue($itemheight);
return $item_form;
var $requiredcheck;
var $itemname;
var $itemlabel;
- var $selectwith;
+ var $selectwidth;
var $selectheight;
function definition() {
$this->itemname = $mform->addElement('text', 'itemname', get_string('item_name', 'feedback'), array('size="'.FEEDBACK_ITEM_NAME_TEXTBOX_SIZE.'"','maxlength="255"'));
$this->itemlabel = $mform->addElement('text', 'itemlabel', get_string('item_label', 'feedback'), array('size="'.FEEDBACK_ITEM_LABEL_TEXTBOX_SIZE.'"','maxlength="255"'));
- $this->selectwith = $mform->addElement('select',
+ $this->selectwidth = $mform->addElement('select',
'itemwidth',
get_string('textarea_width', 'feedback').' ',
array_slice(range(0,80),5,80,true));
$item->position = $data->position;
$item->required=0;
- if (isset($data->required)) {
- $item->required=$data->required;
+ if (!empty($data->required)) {
+ $item->required = $data->required;
}
return $DB->insert_record('feedback_item', $item);
* @return void
*/
function feedback_print_item($item, $value = false, $readonly = false, $edit = false, $highlightrequire = false){
+ global $CFG;
if($item->typ == 'pagebreak') return;
if($readonly)$ro = 'readonly="readonly" disabled="disabled"';
//get the class of the given item-typ
$itemclass = 'feedback_item_'.$item->typ;
+ if (!class_exists($itemclass)) {
+ require_once($CFG->dirroot.'/mod/feedback/item/'.$item->typ.'/lib.php');
+ }
//get the instance of the item-class
$itemobj = new $itemclass();
$itemobj->print_item($item, $value, $readonly, $edit, $highlightrequire);
* @return boolean
*/
function feedback_check_values($data, $firstitem, $lastitem) {
- global $DB;
+ global $DB, $CFG;
//get all items between the first- and lastitem
$select = "feedback = ?
//get the class of the item-typ
$itemclass = 'feedback_item_'.$item->typ;
+
+ if (!class_exists($itemclass)) {
+ require_once($CFG->dirroot.'/mod/feedback/item/'.$item->typ.'/lib.php');
+ }
+
//get the instance of the item-class
$itemobj = new $itemclass();
//get the class of item-typ
$itemclass = 'feedback_item_'.$itemnr[0];
//get the instance of item-class
+ if (!class_exists($itemclass)) {
+ require_once($CFG->dirroot.'/mod/feedback/item/'.$itemnr[0].'/lib.php');
+ }
$itemobj = new $itemclass();
//the kind of values can be absolutely different so we run create_value directly by the item-class
$value->value = $itemobj->create_value($data[$key]);
//get the class of item-typ
$itemclass = 'feedback_item_'.$itemnr[0];
//get the instace of the item-class
+ if (!class_exists($itemclass)) {
+ require_once($CFG->dirroot.'/mod/feedback/item/'.$itemnr[0].'/lib.php');
+ }
$itemobj = new $itemclass();
//the kind of values can be absolutely different so we run create_value directly by the item-class
$newvalue->value = $itemobj->create_value($data[$key]);
return $url;
}
}
+
+function feedback_extend_settings_navigation($settings, $module) {
+ global $PAGE, $USER, $OUTPUT, $CFG, $DB;
+
+ $feedback = $DB->get_record('feedback', array('id'=>$PAGE->cm->instance));
+ $feedbacknavkey = $settings->add(get_string('feedbackadministration', 'feedback'));
+ $feedbacknav = $settings->get($feedbacknavkey);
+ $feedbacknav->forceopen = true;
+
+ $capabilities = feedback_load_capabilities($PAGE->cm->id);
+
+ if($capabilities->edititems) {
+ $qkey = $feedbacknav->add(get_string('questions', 'feedback'));
+ $feedbacknav->get($qkey)->add(get_string('edit_items', 'feedback'), new moodle_url($CFG->wwwroot.'/mod/feedback/edit.php', array('id'=>$PAGE->cm->id, 'do_show'=>'edit')));
+ $feedbacknav->get($qkey)->add(get_string('export_questions', 'feedback'), new moodle_url($CFG->wwwroot.'/mod/feedback/export.php', array('id'=>$PAGE->cm->id, 'action'=>'exportfile')));
+ $feedbacknav->get($qkey)->add(get_string('import_questions', 'feedback'), new moodle_url($CFG->wwwroot.'/mod/feedback/import.php', array('id'=>$PAGE->cm->id)));
+ $feedbacknav->get($qkey)->add(get_string('templates', 'feedback'), new moodle_url($CFG->wwwroot.'/mod/feedback/edit.php', array('id'=>$PAGE->cm->id, 'do_show'=>'templates')));
+ }
+
+ if($capabilities->viewreports) {
+ if($feedback->course == SITEID){
+ $feedbacknav->add(get_string('analysis', 'feedback'), new moodle_url($CFG->wwwroot.'/mod/feedback/analysis_course.php', array('id'=>$PAGE->cm->id, 'course'=>$PAGE->course->id,'do_show'=>'analysis')));
+ }else {
+ $feedbacknav->add(get_string('analysis', 'feedback'), new moodle_url($CFG->wwwroot.'/mod/feedback/analysis.php', array('id'=>$PAGE->cm->id, 'course'=>$PAGE->course->id,'do_show'=>'analysis')));
+ }
+ }
+
+ if($capabilities->viewreports) {
+ $feedbacknav->add(get_string('show_entries', 'feedback'), new moodle_url($CFG->wwwroot.'/mod/feedback/show_entries.php', array('id'=>$PAGE->cm->id, 'do_show'=>'showentries')));
+ }
+
+ if (has_capability('moodle/course:manageactivities', $PAGE->cm->context)) {
+ $feedbacknav->add(get_string('updatethis', '', get_string('modulename', 'feedback')), new moodle_url($CFG->wwwroot.'/course/mod.php', array('update' => $PAGE->cm->id, 'return' => true, 'sesskey' => sesskey())));
+ }
+}
\ No newline at end of file
}
}
+ $PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/feedback/edit.php', array('id'=>$cm->id, 'do_show'=>$do_show)));
+
$capabilities = feedback_load_capabilities($cm->id);
require_login($course->id, true, $cm);
$strfeedback = get_string("modulename", "feedback");
$buttontext = update_module_button($cm->id, $course->id, $strfeedback);
- $PAGE->navbar->add($strfeedbacks, new moodle_url($CFG->wwwroot.'/mod/feedback/index.php', array('id'=>$course->id)));
- $PAGE->navbar->add(format_string($feedback->name));
-
+ $PAGE->navbar->add(get_string('show_entries','feedback'));
$PAGE->set_title(format_string($feedback->name));
$PAGE->set_button($buttontext);
echo $OUTPUT->header();
$strfeedbacks = get_string("modulenameplural", "feedback");
$strfeedback = get_string("modulename", "feedback");
$buttontext = update_module_button($cm->id, $course->id, $strfeedback);
-
- $PAGE->navbar->add($strfeedbacks, new moodle_url($CFG->wwwroot.'/mod/feedback/index.php', array('id'=>$course->id)));
- $PAGE->navbar->add(format_string($feedback->name));
+ $PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/feedback/view.php', array('id'=>$cm->id, 'do_show'=>'view')));
$PAGE->set_title(format_string($feedback->name));
$PAGE->set_button($buttontext);
echo $OUTPUT->header();