Ejemplo n.º 1
0
$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.');
    }
    $strategy->save_edit_strategy_form($data);
    if (isset($data->saveandclose)) {
        redirect($teamwork->view_url());
    } elseif (isset($data->saveandpreview)) {
        redirect($teamwork->previewform_url());
    } else {
        // save and continue - redirect to self to prevent data being re-posted by pressing "Reload"
        redirect($PAGE->url);
    }
}
// Output starts here
echo $OUTPUT->header();
echo $OUTPUT->heading(format_string($teamwork->name));
echo $OUTPUT->heading(get_string('pluginname', 'teamworkform_' . $teamwork->strategy), 3);
$mform->display();
echo $OUTPUT->footer();
Ejemplo n.º 2
0
 * @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();