Esempio n. 1
0
 public function definition()
 {
     global $CFG, $DB;
     $editoroptions = feedback_get_editor_options();
     $mform =& $this->_form;
     //-------------------------------------------------------------------------------
     $mform->addElement('header', 'general', get_string('general', 'form'));
     $mform->addElement('text', 'name', get_string('name', 'feedback'), array('size' => '64'));
     $mform->setType('name', PARAM_TEXT);
     $mform->addRule('name', null, 'required', null, 'client');
     $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
     $this->standard_intro_elements(get_string('description', 'feedback'));
     //-------------------------------------------------------------------------------
     $mform->addElement('header', 'timinghdr', get_string('availability'));
     $mform->addElement('date_time_selector', 'timeopen', get_string('feedbackopen', 'feedback'), array('optional' => true));
     $mform->addElement('date_time_selector', 'timeclose', get_string('feedbackclose', 'feedback'), array('optional' => true));
     //-------------------------------------------------------------------------------
     $mform->addElement('header', 'feedbackhdr', get_string('questionandsubmission', 'feedback'));
     $options = array();
     $options[1] = get_string('anonymous', 'feedback');
     $options[2] = get_string('non_anonymous', 'feedback');
     $mform->addElement('select', 'anonymous', get_string('anonymous_edit', 'feedback'), $options);
     // check if there is existing responses to this feedback
     if (is_numeric($this->_instance) and $this->_instance and $feedback = $DB->get_record("feedback", array("id" => $this->_instance))) {
         $completed_feedback_count = feedback_get_completeds_group_count($feedback);
     } else {
         $completed_feedback_count = false;
     }
     if ($completed_feedback_count) {
         $multiple_submit_value = $feedback->multiple_submit ? get_string('yes') : get_string('no');
         $mform->addElement('text', 'multiple_submit_static', get_string('multiplesubmit', 'feedback'), array('size' => '4', 'disabled' => 'disabled', 'value' => $multiple_submit_value));
         $mform->setType('multiple_submit_static', PARAM_RAW);
         $mform->addElement('hidden', 'multiple_submit', '');
         $mform->setType('multiple_submit', PARAM_INT);
         $mform->addHelpButton('multiple_submit_static', 'multiplesubmit', 'feedback');
     } else {
         $mform->addElement('selectyesno', 'multiple_submit', get_string('multiplesubmit', 'feedback'));
         $mform->addHelpButton('multiple_submit', 'multiplesubmit', 'feedback');
     }
     $mform->addElement('selectyesno', 'email_notification', get_string('email_notification', 'feedback'));
     $mform->addHelpButton('email_notification', 'email_notification', 'feedback');
     $mform->addElement('selectyesno', 'autonumbering', get_string('autonumbering', 'feedback'));
     $mform->addHelpButton('autonumbering', 'autonumbering', 'feedback');
     //-------------------------------------------------------------------------------
     $mform->addElement('header', 'aftersubmithdr', get_string('after_submit', 'feedback'));
     $mform->addElement('selectyesno', 'publish_stats', get_string('show_analysepage_after_submit', 'feedback'));
     $mform->addElement('editor', 'page_after_submit_editor', get_string("page_after_submit", "feedback"), null, $editoroptions);
     $mform->setType('page_after_submit_editor', PARAM_RAW);
     $mform->addElement('text', 'site_after_submit', get_string('url_for_continue', 'feedback'), array('size' => '64', 'maxlength' => '255'));
     $mform->setType('site_after_submit', PARAM_TEXT);
     $mform->addHelpButton('site_after_submit', 'url_for_continue', 'feedback');
     //-------------------------------------------------------------------------------
     $this->standard_coursemodule_elements();
     //-------------------------------------------------------------------------------
     // buttons
     $this->add_action_buttons();
 }
Esempio n. 2
0
require('tabs.php');

$previewimg = $OUTPUT->pix_icon('t/preview', get_string('preview'));
$previewlnk = '<a href="'.$CFG->wwwroot.'/mod/feedback/print.php?id='.$id.'">'.$previewimg.'</a>';

echo $OUTPUT->heading(format_text($feedback->name.' '.$previewlnk));

//show some infos to the feedback
if (has_capability('mod/feedback:edititems', $context)) {
    //get the groupid
    $groupselect = groups_print_activity_menu($cm, $CFG->wwwroot.'/mod/feedback/view.php?id='.$cm->id, true);
    $mygroupid = groups_get_activity_group($cm);

    echo $OUTPUT->box_start('boxaligncenter boxwidthwide');
    echo $groupselect.'<div class="clearer">&nbsp;</div>';
    $completedscount = feedback_get_completeds_group_count($feedback, $mygroupid);
    echo $OUTPUT->box_start('feedback_info');
    echo '<span class="feedback_info">';
    echo get_string('completed_feedbacks', 'feedback').': ';
    echo '</span>';
    echo '<span class="feedback_info_value">';
    echo $completedscount;
    echo '</span>';
    echo $OUTPUT->box_end();

    $params = array('feedback'=>$feedback->id, 'hasvalue'=>1);
    $itemscount = $DB->count_records('feedback_item', $params);
    echo $OUTPUT->box_start('feedback_info');
    echo '<span class="feedback_info">';
    echo get_string('questions', 'feedback').': ';
    echo '</span>';
Esempio n. 3
0
    //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 '<b>'.get_string('completed_feedbacks', 'feedback').': '.$completedscount. '</b><br />';

// 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 '<b>'.get_string('questions', 'feedback').': ' .count($items). ' </b><hr />';
    echo '<a href="analysis_course.php?id=' . $id . '&courseid='.$courseid.'">';
    echo get_string('show_all', 'feedback');
    echo '</a>';
} else {
    $items=array();
Esempio n. 4
0
 function definition()
 {
     global $CFG;
     $mform =& $this->_form;
     //-------------------------------------------------------------------------------
     $mform->addElement('header', 'general', get_string('general', 'form'));
     $mform->addElement('text', 'name', get_string('name', 'feedback'), array('size' => '64'));
     $mform->setType('name', PARAM_TEXT);
     $mform->addRule('name', null, 'required', null, 'client');
     $mform->addElement('htmleditor', 'summary', get_string("description", "feedback"), array('rows' => 20));
     $mform->setType('summary', PARAM_RAW);
     $mform->addRule('summary', null, 'required', null, 'client');
     //-------------------------------------------------------------------------------
     $mform->addElement('header', 'timinghdr', get_string('timing', 'form'));
     $enableopengroup = array();
     $enableopengroup[] =& $mform->createElement('checkbox', 'openenable', get_string('feedbackopen', 'feedback'));
     $enableopengroup[] =& $mform->createElement('date_time_selector', 'timeopen', '');
     $mform->addGroup($enableopengroup, 'enableopengroup', get_string('feedbackopen', 'feedback'), ' ', false);
     $mform->setHelpButton('enableopengroup', array('timeopen', get_string('feedbackopens', 'feedback'), 'feedback'));
     $mform->disabledIf('enableopengroup', 'openenable', 'notchecked');
     $enableclosegroup = array();
     $enableclosegroup[] =& $mform->createElement('checkbox', 'closeenable', get_string('feedbackclose', 'feedback'));
     $enableclosegroup[] =& $mform->createElement('date_time_selector', 'timeclose', '');
     $mform->addGroup($enableclosegroup, 'enableclosegroup', get_string('feedbackclose', 'feedback'), ' ', false);
     $mform->setHelpButton('enableclosegroup', array('timeclose', get_string('feedbackcloses', 'feedback'), 'feedback'));
     $mform->disabledIf('enableclosegroup', 'closeenable', 'notchecked');
     //-------------------------------------------------------------------------------
     $mform->addElement('header', 'feedbackhdr', get_string('feedback_options', 'feedback'));
     $options = array();
     $options[1] = get_string('anonymous', 'feedback');
     $options[2] = get_string('non_anonymous', 'feedback');
     $mform->addElement('select', 'anonymous', get_string('anonymous_edit', 'feedback'), $options);
     $mform->addElement('selectyesno', 'publish_stats', get_string('publish_stats_on_students', 'feedback'));
     $mform->addElement('selectyesno', 'email_notification', get_string('email_notification', 'feedback'));
     $mform->setHelpButton('email_notification', array('emailnotification', get_string('email_notification', 'feedback'), 'feedback'));
     // check if there is existing responses to this feedback
     if (is_numeric($this->_instance) and $this->_instance and $feedback = get_record("feedback", "id", $this->_instance)) {
         $completedFeedbackCount = feedback_get_completeds_group_count($feedback);
     } else {
         $completedFeedbackCount = false;
     }
     if ($completedFeedbackCount) {
         $multiple_submit_value = $feedback->multiple_submit ? get_string('yes') : get_string('no');
         $mform->addElement('text', 'multiple_submit_static', get_string('multiple_submit', 'feedback'), array('size' => '4', 'disabled' => 'disabled', 'value' => $multiple_submit_value));
         $mform->addElement('hidden', 'multiple_submit', '');
         $mform->setHelpButton('multiple_submit_static', array('multiplesubmit', get_string('multiple_submit', 'feedback'), 'feedback'));
     } else {
         $mform->addElement('selectyesno', 'multiple_submit', get_string('multiple_submit', 'feedback'));
         $mform->setHelpButton('multiple_submit', array('multiplesubmit', get_string('multiple_submit', 'feedback'), 'feedback'));
     }
     $mform->addElement('selectyesno', 'autonumbering', get_string('autonumbering', 'feedback'));
     $mform->setHelpButton('autonumbering', array('autonumbering', get_string('autonumbering', 'feedback'), 'feedback'));
     //-------------------------------------------------------------------------------
     $mform->addElement('header', 'aftersubmithdr', get_string('after_submit', 'feedback'));
     $mform->addElement('htmleditor', 'page_after_submit', get_string("page_after_submit", "feedback"), array('rows' => 20));
     $mform->setType('page_after_submit', PARAM_RAW);
     $mform->addElement('text', 'site_after_submit', get_string('url_for_continue_button', 'feedback'), array('size' => '64', 'maxlength' => '255'));
     $mform->setType('site_after_submit', PARAM_TEXT);
     $mform->setHelpButton('site_after_submit', array('url_for_continue', get_string('url_for_continue_button', 'feedback'), 'feedback'));
     //-------------------------------------------------------------------------------
     $features = new stdClass();
     $features->groups = true;
     $features->groupings = true;
     $features->groupmembersonly = true;
     $features->gradecat = false;
     $features->idnumber = false;
     $this->standard_coursemodule_elements($features);
     //-------------------------------------------------------------------------------
     // buttons
     $this->add_action_buttons();
 }
        $table->align = array("center", "left");
    }
} else {
    if (has_capability('mod/feedback:viewreports', $context)) {
        $table->head = array($strname, $strresponses);
        $table->align = array("left", "center");
    } else {
        $table->head = array($strname);
        $table->align = array("left");
    }
}
foreach ($feedbacks as $feedback) {
    //get the responses of each feedback
    $viewurl = new moodle_url('/mod/feedback/view.php', array('id' => $feedback->coursemodule));
    if (has_capability('mod/feedback:viewreports', $context)) {
        $completed_feedback_count = intval(feedback_get_completeds_group_count($feedback));
    }
    $dimmedclass = $feedback->visible ? '' : 'class="dimmed"';
    $link = '<a ' . $dimmedclass . ' href="' . $viewurl->out() . '">' . $feedback->name . '</a>';
    if ($usesections) {
        $tabledata = array(get_section_name($course, $feedback->section), $link);
    } else {
        $tabledata = array($link);
    }
    if (has_capability('mod/feedback:viewreports', $context)) {
        $tabledata[] = $completed_feedback_count;
    }
    $table->data[] = $tabledata;
}
echo "<br />";
echo html_writer::table($table);