* @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); // course module $phase = required_param('phase', PARAM_INT); // the code of the new phase $confirm = optional_param('confirm', false, PARAM_BOOL); // confirmation $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); $teamwork = new teamwork($teamwork, $cm, $course); $PAGE->set_url($teamwork->switchphase_url($phase), array('cmid' => $cmid, 'phase' => $phase)); require_login($course, false, $cm); require_capability('mod/teamwork:switchphase', $PAGE->context); if ($confirm) { if (!confirm_sesskey()) { throw new moodle_exception('confirmsesskeybad'); } if (!$teamwork->switch_phase($phase)) { print_error('errorswitchingphase', 'teamwork', $teamwork->view_url()); } redirect($teamwork->view_url()); } $PAGE->set_title($teamwork->name); $PAGE->set_heading($course->fullname); $PAGE->navbar->add(get_string('switchingphase', 'teamwork')); //