<?php /** * Landing page for this module * * @author Mark Nielsen * @version $Id$ * @package pagemenu **/ require_once '../../config.php'; require_once $CFG->dirroot . '/mod/pagemenu/locallib.php'; $id = optional_param('id', 0, PARAM_INT); // Course Module ID $a = optional_param('a', 0, PARAM_INT); // Instance ID list($cm, $course, $pagemenu) = pagemenu_get_basics($id, $a); require_login($course->id); require_capability('mod/pagemenu:view', get_context_instance(CONTEXT_MODULE, $cm->id)); pagemenu_print_header($cm, $course, $pagemenu); print_box(pagemenu_build_menu($pagemenu->id), 'boxwidthnormal boxaligncenter'); print_footer($course);
$link->save($data); } pagemenu_set_message(get_string('menuupdated', 'pagemenu'), 'notifysuccess'); redirect("{$CFG->wwwroot}/mod/pagemenu/edit.php?id={$cm->id}"); } else { if (!empty($linkaction)) { // These are special link actions that can be invoked by // a link class. EG: hide show page menu items if (!confirm_sesskey()) { error(get_string('confirmsesskeybad', 'error')); } if (!in_array($linkaction, pagemenu_get_links())) { error('Invalide link type'); } $link = mod_pagemenu_link::factory($linkaction); $link->handle_action(); redirect("{$CFG->wwwroot}/mod/pagemenu/edit.php?id={$cm->id}"); } } } pagemenu_print_header($cm, $course, $pagemenu, 'edit', $mform->focus()); // Don't display menu when editing a single link if (!($action == 'edit' and $linkid)) { echo pagemenu_build_menu($pagemenu->id, true); } // Print the form - remember it has duel purposes print_box_start('boxwidthwide boxaligncenter'); $mform->set_data($formdata); $mform->display(); print_box_end(); print_footer($course);