Ejemplo n.º 1
0
 /**
  * Adds a dependency description to the question name
  * @param stdClass $item
  * @param HTML_QuickForm_element $element
  */
 protected function add_item_dependencies($item, $element)
 {
     $allitems = $this->structure->get_items();
     if ($item->dependitem && ($this->mode == self::MODE_EDIT || $this->mode == self::MODE_VIEW_TEMPLATE)) {
         if (isset($allitems[$item->dependitem])) {
             $dependitem = $allitems[$item->dependitem];
             $name = $element->getLabel();
             $name .= html_writer::span(' (' . format_string($dependitem->label) . '->' . $item->dependvalue . ')', 'feedback_depend');
             $element->setLabel($name);
         }
     }
 }
Ejemplo n.º 2
0
/**
 * the first page to view the feedback
 *
 * @author Andreas Grabs
 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
 * @package mod_feedback
 */
require_once __DIR__ . '/../../config.php';
require_once $CFG->dirroot . '/mod/feedback/lib.php';
$id = required_param('id', PARAM_INT);
$courseid = optional_param('courseid', false, PARAM_INT);
$current_tab = 'view';
list($course, $cm) = get_course_and_cm_from_cmid($id, 'feedback');
require_course_login($course, true, $cm);
$feedback = $PAGE->activityrecord;
$feedbackcompletion = new mod_feedback_completion($feedback, $cm, $courseid);
$context = context_module::instance($cm->id);
if ($course->id == SITEID) {
    $PAGE->set_pagelayout('incourse');
}
$PAGE->set_url('/mod/feedback/view.php', array('id' => $cm->id));
$PAGE->set_title($feedback->name);
$PAGE->set_heading($course->fullname);
// Check access to the given courseid.
if ($courseid and $courseid != SITEID) {
    require_course_login(get_course($courseid));
    // This overwrites the object $COURSE .
}
// Check whether the feedback is mapped to the given courseid.
if (!has_capability('mod/feedback:edititems', $context) && !$feedbackcompletion->check_course_is_mapped()) {
    echo $OUTPUT->header();
Ejemplo n.º 3
0
$courseid = optional_param('courseid', null, PARAM_INT);
////////////////////////////////////////////////////////
//get the objects
////////////////////////////////////////////////////////
list($course, $cm) = get_course_and_cm_from_cmid($id, 'feedback');
$baseurl = new moodle_url('/mod/feedback/show_entries.php', array('id' => $cm->id));
$PAGE->set_url(new moodle_url($baseurl, array('userid' => $userid, 'showcompleted' => $showcompleted, 'delete' => $deleteid)));
$context = context_module::instance($cm->id);
require_login($course, true, $cm);
$feedback = $PAGE->activityrecord;
require_capability('mod/feedback:viewreports', $context);
if ($deleteid) {
    // This is a request to delete a reponse.
    require_capability('mod/feedback:deletesubmissions', $context);
    require_sesskey();
    $feedbackstructure = new mod_feedback_completion($feedback, $cm, 0, true, $deleteid);
    feedback_delete_completed($feedbackstructure->get_completed(), $feedback, $cm);
    redirect($baseurl);
} else {
    if ($showcompleted || $userid) {
        // Viewing individual response.
        $feedbackstructure = new mod_feedback_completion($feedback, $cm, 0, true, $showcompleted, $userid);
    } else {
        // Viewing list of reponses.
        $feedbackstructure = new mod_feedback_structure($feedback, $cm, $courseid);
    }
}
$responsestable = new mod_feedback_responses_table($feedbackstructure);
$anonresponsestable = new mod_feedback_responses_anon_table($feedbackstructure);
if ($responsestable->is_downloading()) {
    $responsestable->download();
Ejemplo n.º 4
0
 */
require_once "../../config.php";
require_once "lib.php";
require_once $CFG->libdir . '/completionlib.php';
feedback_init_feedback_session();
$id = required_param('id', PARAM_INT);
$courseid = optional_param('courseid', null, PARAM_INT);
$gopage = optional_param('gopage', 0, PARAM_INT);
list($course, $cm) = get_course_and_cm_from_cmid($id, 'feedback');
$feedback = $DB->get_record("feedback", array("id" => $cm->instance), '*', MUST_EXIST);
$urlparams = array('id' => $cm->id, 'gopage' => $gopage, 'courseid' => $courseid);
$PAGE->set_url('/mod/feedback/complete.php', $urlparams);
require_course_login($course, true, $cm);
$PAGE->set_activity_record($feedback);
$context = context_module::instance($cm->id);
$feedbackcompletion = new mod_feedback_completion($feedback, $cm, $courseid);
$courseid = $feedbackcompletion->get_courseid();
// Check whether the feedback is mapped to the given courseid.
if (!has_capability('mod/feedback:edititems', $context) && !$feedbackcompletion->check_course_is_mapped()) {
    echo $OUTPUT->header();
    echo $OUTPUT->notification(get_string('cannotaccess', 'mod_feedback'));
    echo $OUTPUT->footer();
    exit;
}
//check whether the given courseid exists
if ($courseid and $courseid != SITEID) {
    require_course_login(get_course($courseid));
    // This overwrites the object $COURSE .
}
if (!$feedbackcompletion->can_complete()) {
    print_error('error');