* @package mod_teamwork * @copyright 2009 David Mudrak <*****@*****.**> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once dirname(dirname(dirname(__FILE__))) . '/config.php'; require_once dirname(__FILE__) . '/locallib.php'; $cmid = required_param('cmid', PARAM_INT); $cm = get_coursemodule_from_id('teamwork', $cmid, 0, false, MUST_EXIST); $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST); require_login($course, false, $cm); require_capability('mod/teamwork:editdimensions', $PAGE->context); $teamwork = $DB->get_record('teamwork', array('id' => $cm->instance), '*', MUST_EXIST); $teamwork = new teamwork($teamwork, $cm, $course); // todo: check if there already is some assessment done and do not allowed the change of the form // once somebody already used it to assess $PAGE->set_url($teamwork->editform_url()); $PAGE->set_title($teamwork->name); $PAGE->set_heading($course->fullname); $PAGE->navbar->add(get_string('editingassessmentform', 'teamwork')); // load the grading strategy logic $strategy = $teamwork->grading_strategy_instance(); // load the form to edit the grading strategy dimensions $mform = $strategy->get_edit_strategy_form($PAGE->url); if ($mform->is_cancelled()) { redirect($teamwork->view_url()); } elseif ($data = $mform->get_data()) { if ($data->teamworkid != $teamwork->id or $data->strategy != $teamwork->strategy) { // this may happen if someone changes the teamwork setting while the user had the // editing form opened throw new invalid_parameter_exception('Invalid teamwork ID or the grading strategy has changed.'); }
* @copyright 2009 David Mudrak <*****@*****.**> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once dirname(dirname(dirname(__FILE__))) . '/config.php'; require_once dirname(__FILE__) . '/locallib.php'; $cmid = required_param('cmid', PARAM_INT); $cm = get_coursemodule_from_id('teamwork', $cmid, 0, false, MUST_EXIST); $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST); $teamwork = $DB->get_record('teamwork', array('id' => $cm->instance), '*', MUST_EXIST); require_login($course, false, $cm); if (isguestuser()) { print_error('guestsarenotallowed'); } $teamwork = new teamwork($teamwork, $cm, $course); require_capability('mod/teamwork:editdimensions', $teamwork->context); $PAGE->set_url($teamwork->previewform_url()); $PAGE->set_title($teamwork->name); $PAGE->set_heading($course->fullname); $PAGE->navbar->add(get_string('editingassessmentform', 'teamwork'), $teamwork->editform_url(), navigation_node::TYPE_CUSTOM); $PAGE->navbar->add(get_string('previewassessmentform', 'teamwork')); $currenttab = 'editform'; // load the grading strategy logic $strategy = $teamwork->grading_strategy_instance(); // load the assessment form $mform = $strategy->get_assessment_form($teamwork->editform_url(), 'preview'); // output starts here echo $OUTPUT->header(); echo $OUTPUT->heading(format_string($teamwork->name)); echo $OUTPUT->heading(get_string('assessmentform', 'teamwork'), 3); $mform->display(); echo $OUTPUT->footer();