Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/admin/roles/allow.php
Go to the documentation of this file.
00001 <?php
00002 
00003 // This file is part of Moodle - http://moodle.org/
00004 //
00005 // Moodle is free software: you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation, either version 3 of the License, or
00008 // (at your option) any later version.
00009 //
00010 // Moodle is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
00017 
00027 require_once(dirname(__FILE__) . '/../../config.php');
00028 require_once($CFG->libdir . '/adminlib.php');
00029 require_once($CFG->dirroot . '/' . $CFG->admin . '/roles/lib.php');
00030 
00031 $mode = required_param('mode', PARAM_ACTION);
00032 $classformode = array(
00033     'assign' => 'role_allow_assign_page',
00034     'override' => 'role_allow_override_page',
00035     'switch' => 'role_allow_switch_page'
00036 );
00037 if (!isset($classformode[$mode])) {
00038     print_error('invalidmode', '', '', $mode);
00039 }
00040 
00041 $baseurl = new moodle_url('/admin/roles/allow.php', array('mode'=>$mode));
00042 admin_externalpage_setup('defineroles', '', array(), $baseurl);
00043 
00044 $syscontext = get_context_instance(CONTEXT_SYSTEM);
00045 require_capability('moodle/role:manage', $syscontext);
00046 
00047 $controller = new $classformode[$mode]();
00048 
00049 if (optional_param('submit', false, PARAM_BOOL) && data_submitted() && confirm_sesskey()) {
00050     $controller->process_submission();
00051     mark_context_dirty($syscontext->path);
00052     add_to_log(SITEID, 'role', 'edit allow ' . $mode, str_replace($CFG->wwwroot . '/', '', $baseurl), '', '', $USER->id);
00053     redirect($baseurl);
00054 }
00055 
00056 $controller->load_current_settings();
00057 
00058 // Display the editing form.
00059 echo $OUTPUT->header();
00060 
00061 $currenttab = $mode;
00062 require('managetabs.php');
00063 
00064 $table = $controller->get_table();
00065 
00066 echo $OUTPUT->box($controller->get_intro_text());
00067 
00068 echo '<form action="' . $baseurl . '" method="post">';
00069 echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />';
00070 echo html_writer::table($table);
00071 echo '<div class="buttons"><input type="submit" name="submit" value="'.get_string('savechanges').'"/>';
00072 echo '</div></form>';
00073 
00074 echo $OUTPUT->footer();
 All Data Structures Namespaces Files Functions Variables Enumerations