.
/**
* shows an analysed view of a feedback on the mainsite
*
* @author Andreas Grabs
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package mod_feedback
*/
require_once("../../config.php");
require_once("lib.php");
$current_tab = 'analysis';
$id = required_param('id', PARAM_INT); //the POST dominated the GET
$coursefilter = optional_param('coursefilter', '0', PARAM_INT);
$courseitemfilter = optional_param('courseitemfilter', '0', PARAM_INT);
$courseitemfiltertyp = optional_param('courseitemfiltertyp', '0', PARAM_ALPHANUM);
$searchcourse = optional_param('searchcourse', '', PARAM_RAW);
$courseid = optional_param('courseid', false, PARAM_INT);
$url = new moodle_url('/mod/feedback/analysis_course.php', array('id'=>$id));
if ($courseid !== false) {
$url->param('courseid', $courseid);
}
if ($coursefilter !== '0') {
$url->param('coursefilter', $coursefilter);
}
if ($courseitemfilter !== '0') {
$url->param('courseitemfilter', $courseitemfilter);
}
if ($courseitemfiltertyp !== '0') {
$url->param('courseitemfiltertyp', $courseitemfiltertyp);
}
if ($searchcourse !== '') {
$url->param('searchcourse', $searchcourse);
}
$PAGE->set_url($url);
if (($searchcourse OR $courseitemfilter OR $coursefilter) AND !confirm_sesskey()) {
print_error('invalidsesskey');
}
if (! $cm = get_coursemodule_from_id('feedback', $id)) {
print_error('invalidcoursemodule');
}
if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
print_error('coursemisconf');
}
if (! $feedback = $DB->get_record("feedback", array("id"=>$cm->instance))) {
print_error('invalidcoursemodule');
}
$context = context_module::instance($cm->id);
require_login($course, true, $cm);
if (!($feedback->publish_stats OR has_capability('mod/feedback:viewreports', $context))) {
print_error('error');
}
/// Print the page header
$strfeedbacks = get_string("modulenameplural", "feedback");
$strfeedback = get_string("modulename", "feedback");
$PAGE->set_heading($course->fullname);
$PAGE->set_title($feedback->name);
echo $OUTPUT->header();
/// print the tabs
require('tabs.php');
//print the analysed items
echo $OUTPUT->box_start('generalbox boxaligncenter boxwidthwide');
if (has_capability('mod/feedback:viewreports', $context)) {
//button "export to excel"
echo $OUTPUT->container_start('mdl-align');
$aurl = new moodle_url('analysis_to_excel.php',
array('sesskey' => sesskey(),
'id' => $id,
'coursefilter' => $coursefilter));
echo $OUTPUT->single_button($aurl, get_string('export_to_excel', 'feedback'));
echo $OUTPUT->container_end();
}
//get the groupid
//lstgroupid is the choosen id
$mygroupid = false;
//get completed feedbacks
$completedscount = feedback_get_completeds_group_count($feedback, $mygroupid, $coursefilter);
//show the count
echo ''.get_string('completed_feedbacks', 'feedback').': '.$completedscount. '
';
// get the items of the feedback
$params = array('feedback' => $feedback->id, 'hasvalue' => 1);
$items = $DB->get_records('feedback_item', $params, 'position');
//show the count
if (is_array($items)) {
echo ''.get_string('questions', 'feedback').': ' .count($items). '