/** * Special setup for docs page */ public function setup() { global $CFG; if ($this->action == 'docs') { require_once $CFG->libdir . '/adminlib.php'; admin_externalpage_setup('local_mr_docs'); } else { parent::setup(); } }
/** * Run controller action and render its view * * @return void */ public final function run() { // check if action exists $actionname = $this->action . '_action'; if (!method_exists($this, $actionname)) { print_error('invalidpage'); } // setup admin page and check page permission admin_externalpage_setup($this->pagename); $sitecontext = context_system::instance(); // You do not have the required permission to access this page. if (!has_capability('moodle/site:config', $sitecontext)) { print_error('pagepermission'); } // call the action $this->{$actionname}(); // render request view $this->view->render($this->request); }
<?php //$Id: user_bulk_message.php,v 1.7 2008/06/09 16:53:57 skodak Exp $ require_once '../../config.php'; require_once $CFG->libdir . '/adminlib.php'; require_once $CFG->dirroot . '/message/lib.php'; require_once 'user_message_form.php'; $msg = optional_param('msg', '', PARAM_CLEAN); $confirm = optional_param('confirm', 0, PARAM_BOOL); admin_externalpage_setup('userbulk'); require_capability('moodle/site:readallmessages', get_context_instance(CONTEXT_SYSTEM)); $return = $CFG->wwwroot . '/' . $CFG->admin . '/user/user_bulk.php'; if (empty($SESSION->bulk_users)) { redirect($return); } if (empty($CFG->messaging)) { print_error('messagingdisable', 'error'); } //TODO: add support for large number of users if ($confirm and !empty($msg) and confirm_sesskey()) { $in = implode(',', $SESSION->bulk_users); if ($rs = $DB->get_recordset_select('user', "id IN ({$in})", null)) { foreach ($rs as $user) { message_post_message($USER, $user, $msg, FORMAT_HTML, 'direct'); } $rs->close(); } redirect($return); } // disable html editor if not enabled in preferences if (!get_user_preferences('message_usehtmleditor', 0)) {
} else { $navlinks[] = array('name' => $fullname, 'link' => "{$CFG->wwwroot}/user/view.php?id={$userid}&course={$courseid}", 'type' => 'misc'); $navlinks[] = array('name' => $straction, 'link' => null, 'type' => 'misc'); $navigation = build_navigation($navlinks); print_header("{$course->fullname}: {$fullname}", $course->fullname, $navigation, "", "", true, " ", navmenu($course)); } $showroles = 1; $currenttab = 'assign'; include_once $CFG->dirroot . '/user/tabs.php'; } else { if ($context->contextlevel == CONTEXT_SYSTEM) { admin_externalpage_setup('assignroles', '', array('contextid' => $contextid, 'roleid' => $roleid)); admin_externalpage_print_header(''); } else { if ($context->contextlevel == CONTEXT_COURSE and $context->instanceid == SITEID) { admin_externalpage_setup('frontpageroles', '', array('contextid' => $contextid, 'roleid' => $roleid)); admin_externalpage_print_header(''); $currenttab = 'assign'; include_once 'tabs.php'; } else { $currenttab = 'assign'; include_once 'tabs.php'; } } } /// Process incoming role assignment if ($frm = data_submitted()) { if ($add and !empty($frm->addselect) and confirm_sesskey()) { foreach ($frm->addselect as $adduser) { if (!($adduser = clean_param($adduser, PARAM_INT))) { continue;
// GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * This script triggers a full purging of system caches, * this is useful mostly for developers who did not disable the caching. * * @package core * @copyright 2010 Petr Skoda {@link http://skodak.org} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once '../config.php'; require_once $CFG->libdir . '/adminlib.php'; $confirm = optional_param('confirm', 0, PARAM_BOOL); admin_externalpage_setup('purgecaches'); require_login(); require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)); if ($confirm) { require_sesskey(); // Valid request. Purge, and redisplay the form so it is easy to purge again // in the near future. purge_all_caches(); redirect(new moodle_url('/admin/purgecaches.php'), get_string('purgecachesfinished', 'admin')); } else { // Show a confirm form. echo $OUTPUT->header(); echo $OUTPUT->heading(get_string('purgecaches', 'admin')); $url = new moodle_url('/admin/purgecaches.php', array('sesskey' => sesskey(), 'confirm' => 1)); $button = new single_button($url, get_string('purgecaches', 'admin'), 'post'); // Cancel button takes them back to the page the were on, if possible,
<?php // $Id: maintenance.php,v 1.12 2007/04/30 17:08:44 skodak Exp $ // Enables/disables maintenance mode require '../config.php'; require_once $CFG->libdir . '/adminlib.php'; $action = optional_param('action', '', PARAM_ALPHA); admin_externalpage_setup('maintenancemode'); //Check folder exists if (!make_upload_directory(SITEID)) { // Site folder error("Could not create site folder. The site administrator needs to fix the file permissions"); } $filename = $CFG->dataroot . '/' . SITEID . '/maintenance.html'; if ($form = data_submitted()) { if (confirm_sesskey()) { if ($form->action == "disable") { unlink($filename); redirect('maintenance.php', get_string('sitemaintenanceoff', 'admin')); } else { $file = fopen($filename, 'w'); fwrite($file, stripslashes($form->text)); fclose($file); redirect('maintenance.php', get_string('sitemaintenanceon', 'admin')); } } } /// Print the header stuff admin_externalpage_print_header(); /// Print the appropriate form if (file_exists($filename)) {
*/ require '../config.php'; require_once $CFG->libdir . '/adminlib.php'; require_once $CFG->libdir . '/csvlib.class.php'; require_once $CFG->dirroot . '/user/profile/lib.php'; require_once $CFG->dirroot . '/group/lib.php'; require_once $CFG->dirroot . '/cohort/lib.php'; require_once 'uploaduserlib.php'; require_once 'uploaduser_form.php'; $iid = optional_param('iid', '', PARAM_INT); $previewrows = optional_param('previewrows', 10, PARAM_INT); @set_time_limit(60 * 60); // 1 hour should be enough raise_memory_limit(MEMORY_HUGE); require_login(); admin_externalpage_setup('uploadusers'); require_capability('moodle/site:uploadusers', get_context_instance(CONTEXT_SYSTEM)); $struserrenamed = get_string('userrenamed', 'admin'); $strusernotrenamedexists = get_string('usernotrenamedexists', 'error'); $strusernotrenamedmissing = get_string('usernotrenamedmissing', 'error'); $strusernotrenamedoff = get_string('usernotrenamedoff', 'error'); $strusernotrenamedadmin = get_string('usernotrenamedadmin', 'error'); $struserupdated = get_string('useraccountupdated', 'admin'); $strusernotupdated = get_string('usernotupdatederror', 'error'); $strusernotupdatednotexists = get_string('usernotupdatednotexists', 'error'); $strusernotupdatedadmin = get_string('usernotupdatedadmin', 'error'); $struseruptodate = get_string('useraccountuptodate', 'admin'); $struseradded = get_string('newuser'); $strusernotadded = get_string('usernotaddedregistered', 'error'); $strusernotaddederror = get_string('usernotaddederror', 'error'); $struserdeleted = get_string('userdeleted', 'admin');
// but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Event documentation. * * @package report_eventlist * @copyright 2014 Adrian Greeve <*****@*****.**> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once __DIR__ . '/../../config.php'; require_once $CFG->libdir . '/adminlib.php'; admin_externalpage_setup('reporteventlists'); // Retrieve all events in a list. $completelist = report_eventlist_list_generator::get_all_events_list(); $tabledata = array(); $components = array('0' => get_string('all', 'report_eventlist')); $edulevel = array('0' => get_string('all', 'report_eventlist')); $crud = array('0' => get_string('all', 'report_eventlist')); foreach ($completelist as $value) { $components[] = $value['component']; $edulevel[] = $value['edulevel']; $crud[] = $value['crud']; $tabledata[] = (object) $value; } $components = array_unique($components); $edulevel = array_unique($edulevel); $crud = array_unique($crud);
$navigation = build_navigation($navlinks); print_header($title, "{$fullname}", $navigation, "", "", true, " ", navmenu($course)); /// site header } else { $navlinks[] = array('name' => $fullname, 'link' => "{$CFG->wwwroot}/user/view.php?id={$userid}&course={$courseid}", 'type' => 'misc'); $navlinks[] = array('name' => $straction, 'link' => null, 'type' => 'misc'); $navigation = build_navigation($navlinks); print_header($title, $course->fullname, $navigation, "", "", true, " ", navmenu($course)); } $showroles = 1; $currenttab = 'override'; include_once $CFG->dirroot . '/user/tabs.php'; } else { if ($context->contextlevel == CONTEXT_COURSE and $context->instanceid == SITEID) { require_once $CFG->libdir . '/adminlib.php'; admin_externalpage_setup('frontpageroles', '', array('contextid' => $contextid, 'roleid' => $roleid), $CFG->wwwroot . '/' . $CFG->admin . '/roles/override.php'); admin_externalpage_print_header(); $currenttab = 'override'; include_once 'tabs.php'; } else { $currenttab = 'override'; include_once 'tabs.php'; } } print_heading_with_help($title, 'overrides'); if ($roleid) { /// Show UI for overriding roles. if (!empty($capabilities)) { print_box(get_string('nocapabilitiesincontext', 'role'), 'generalbox boxaligncenter'); } else { // Print the capabilities overrideable in this context
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Manage user profile fields. * @package core_user * @copyright 2007 onwards Shane Elliot {@link http://pukunui.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require '../../config.php'; require_once $CFG->libdir . '/adminlib.php'; require_once $CFG->dirroot . '/user/profile/lib.php'; require_once $CFG->dirroot . '/user/profile/definelib.php'; admin_externalpage_setup('profilefields'); $action = optional_param('action', '', PARAM_ALPHA); $redirect = $CFG->wwwroot . '/user/profile/index.php'; $strchangessaved = get_string('changessaved'); $strcancelled = get_string('cancelled'); $strdefaultcategory = get_string('profiledefaultcategory', 'admin'); $strnofields = get_string('profilenofieldsdefined', 'admin'); $strcreatefield = get_string('profilecreatefield', 'admin'); // Do we have any actions to perform before printing the header. switch ($action) { case 'movecategory': $id = required_param('id', PARAM_INT); $dir = required_param('dir', PARAM_ALPHA); if (confirm_sesskey()) { profile_move_category($id, $dir); }
// GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * InnoDB conversion tool. * * @package tool * @subpackage innodb * @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ define('NO_OUTPUT_BUFFERING', true); require_once '../../../config.php'; require_once $CFG->libdir . '/adminlib.php'; admin_externalpage_setup('toolinnodb'); $confirm = optional_param('confirm', 0, PARAM_BOOL); require_login(); require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)); echo $OUTPUT->header(); echo $OUTPUT->heading('Convert all MySQL tables from MYISAM to InnoDB'); if ($DB->get_dbfamily() != 'mysql') { notice('This function is for MySQL databases only!', new moodle_url('/admin/')); } if (data_submitted() and $confirm and confirm_sesskey()) { echo $OUTPUT->notification('Please be patient and wait for this to complete...', 'notifysuccess'); if ($tables = $DB->get_tables()) { $DB->set_debug(true); foreach ($tables as $table) { $fulltable = $DB->get_prefix() . $table; $DB->change_database_structure("ALTER TABLE {$fulltable} ENGINE=INNODB");
<?php //$Id$ ///This file only manages the installation of 1.6 lang packs. ///in downloads.moodle.org, they are store in separate directory /lang16 ///in local server, they are stored in $CFG->dataroot/lang ///This helps to avoid confusion. require_once '../config.php'; require_once $CFG->libdir . '/adminlib.php'; require_once $CFG->libdir . '/filelib.php'; require_once $CFG->libdir . '/componentlib.class.php'; admin_externalpage_setup('langimport'); if (!empty($CFG->skiplangupgrade)) { admin_externalpage_print_header(); print_box(get_string('langimportdisabled', 'admin')); print_footer(); die; } $mode = optional_param('mode', 0, PARAM_INT); //phase $pack = optional_param('pack', array(), PARAM_FILE); //pack to install $displaylang = $pack; $uninstalllang = optional_param('uninstalllang', '', PARAM_FILE); $confirm = optional_param('confirm', 0, PARAM_BOOL); $sitelang = optional_param('sitelangconfig', '', PARAM_FILE); define('INSTALLATION_OF_SELECTED_LANG', 2); define('DELETION_OF_SELECTED_LANG', 4); define('UPDATE_ALL_LANG', 5); $strlang = get_string('langimport', 'admin'); $strlanguage = get_string('language');
<?php // Allows the admin to configure blocks (hide/show, delete and configure) require_once '../config.php'; require_once $CFG->libdir . '/adminlib.php'; require_once $CFG->libdir . '/tablelib.php'; admin_externalpage_setup('manageblocks'); $confirm = optional_param('confirm', 0, PARAM_BOOL); $hide = optional_param('hide', 0, PARAM_INT); $show = optional_param('show', 0, PARAM_INT); $delete = optional_param('delete', 0, PARAM_INT); $unprotect = optional_param('unprotect', 0, PARAM_INT); $protect = optional_param('protect', 0, PARAM_INT); /// Print headings $strmanageblocks = get_string('manageblocks'); $strdelete = get_string('delete'); $strversion = get_string('version'); $strhide = get_string('hide'); $strshow = get_string('show'); $strsettings = get_string('settings'); $strcourses = get_string('blockinstances', 'admin'); $strname = get_string('name'); $strshowblockcourse = get_string('showblockcourse'); $strprotecthdr = get_string('blockprotect', 'admin') . $OUTPUT->help_icon('blockprotect', 'admin'); $strprotect = get_string('blockprotect', 'admin'); $strunprotect = get_string('blockunprotect', 'admin'); /// If data submitted, then process and store. if (!empty($hide) && confirm_sesskey()) { if (!($block = $DB->get_record('block', array('id' => $hide)))) { print_error('blockdoesnotexist', 'error'); }
<?php if (!isset($CFG)) { require '../config.php'; require_once $CFG->libdir . '/adminlib.php'; admin_externalpage_setup('oacleanup'); echo $OUTPUT->header(); online_assignment_cleanup(true); echo $OUTPUT->footer(); } function online_assignment_cleanup($output = false) { global $CFG, $DB, $OUTPUT; if ($output) { echo $OUTPUT->heading('Online Assignment Cleanup'); echo '<center>'; } /// We don't want to run this code if we are doing an upgrade from an assignment /// version earlier than 2005041400 /// because the assignment type field will not exist $amv = $DB->get_field('modules', 'version', array('name' => 'assignment')); if ((int) $amv < 2005041400) { if ($output) { echo '</center>'; } return; } /// get the module id for assignments from db $arecord = $DB->get_record('modules', array('name', 'assignment')); $aid = $arecord->id; /// get a list of all courses on this site
$type = optional_param('type', '', PARAM_PLUGIN); $downloadcontents = optional_param('downloadcontents', false, PARAM_BOOL); $context = context_system::instance(); $pagename = 'repositorycontroller'; if ($edit) { $pagename = 'repositoryinstanceedit'; } else { if ($delete) { $pagename = 'repositorydelete'; } else { if ($new) { $pagename = 'repositoryinstancenew'; } } } admin_externalpage_setup($pagename, '', null, new moodle_url('/admin/repositoryinstances.php')); require_capability('moodle/site:config', $context); $baseurl = new moodle_url("/{$CFG->admin}/repositoryinstance.php", array('sesskey' => sesskey())); $parenturl = new moodle_url("/{$CFG->admin}/repository.php", array('sesskey' => sesskey(), 'action' => 'edit')); if ($new) { $parenturl->param('repos', $new); } else { $parenturl->param('repos', $type); } $return = true; if (!empty($edit) || !empty($new)) { if (!empty($edit)) { $instance = repository::get_instance($edit); $instancetype = repository::get_type_by_id($instance->options['typeid']); $classname = 'repository_' . $instancetype->get_typename(); $configs = $instance->get_instance_option_names();
} // Check if we are returning from moodle.org registration and if so, we mark that fact to remove reminders if (!empty($id) and $id == $CFG->siteidentifier) { set_config('registered', time()); } // setup critical warnings before printing admin tree block $insecuredataroot = is_dataroot_insecure(true); $SESSION->admin_critical_warning = $insecuredataroot == INSECURE_DATAROOT_ERROR; $adminroot = admin_get_root(); // Check if there are any new admin settings which have still yet to be set if (any_new_admin_settings($adminroot)) { redirect('upgradesettings.php'); } // Everything should now be set up, and the user is an admin // Print default admin page with notifications. $errorsdisplayed = defined('WARN_DISPLAY_ERRORS_ENABLED'); $lastcron = $DB->get_field_sql('SELECT MAX(lastcron) FROM {modules}'); $cronoverdue = $lastcron < time() - 3600 * 24; $dbproblems = $DB->diagnose(); $maintenancemode = !empty($CFG->maintenance_enabled); $updateschecker = available_update_checker::instance(); $availableupdates = $updateschecker->get_update_info('core', array('minmaturity' => $CFG->updateminmaturity, 'notifybuilds' => $CFG->updatenotifybuilds)); $availableupdatesfetch = $updateschecker->get_last_timefetched(); admin_externalpage_setup('adminnotifications'); if ($fetchupdates) { require_sesskey(); $updateschecker->fetch(); redirect($PAGE->url); } $output = $PAGE->get_renderer('core', 'admin'); echo $output->admin_notifications_page($maturity, $insecuredataroot, $errorsdisplayed, $cronoverdue, $dbproblems, $maintenancemode, $availableupdates, $availableupdatesfetch);
require_once 'customfield_form.php'; $id = required_param('id', PARAM_INT); // ID in facetoface_session_field $d = optional_param('d', false, PARAM_BOOL); // set to true to delete the given field $confirm = optional_param('confirm', false, PARAM_BOOL); // delete confirmationx $field = null; if ($id > 0) { if (!$field = $DB->get_record('facetoface_session_field', array('id' => $id))) { print_error('error:fieldidincorrect', 'facetoface', '', $id); } } $PAGE->set_url('/mod/facetoface/customfield.php', array('id' => $id, 'd' => $d, 'confirm' => $confirm)); admin_externalpage_setup('managemodules'); // this is hacky, tehre should be a special hidden page for it $contextsystem = context_system::instance(); require_capability('moodle/site:config', $contextsystem); $returnurl = "$CFG->wwwroot/admin/settings.php?section=modsettingfacetoface"; // Header $title = get_string('addnewfield', 'facetoface'); if ($field != null) { $title = $field->name; } $PAGE->set_title($title);
require '../../config.php'; require_once $CFG->libdir . '/adminlib.php'; require_once "{$CFG->libdir}/externallib.php"; require_once $CFG->dirroot . "/" . $CFG->admin . "/webservice/testclient_forms.php"; $function = optional_param('function', '', PARAM_PLUGIN); $protocol = optional_param('protocol', '', PARAM_ALPHA); $authmethod = optional_param('authmethod', '', PARAM_ALPHA); $PAGE->set_url('/' . $CFG->admin . '/webservice/testclient.php'); $PAGE->navbar->ignore_active(true); $PAGE->navbar->add(get_string('administrationsite')); $PAGE->navbar->add(get_string('development', 'admin')); $PAGE->navbar->add(get_string('testclient', 'webservice'), new moodle_url('/' . $CFG->admin . '/webservice/testclient.php')); if (!empty($function)) { $PAGE->navbar->add($function); } admin_externalpage_setup('testclient'); // list of all available functions for testing $allfunctions = $DB->get_records('external_functions', array(), 'name ASC'); $functions = array(); foreach ($allfunctions as $f) { $finfo = external_api::external_function_info($f); if (!empty($finfo->testclientpath) and file_exists($CFG->dirroot . '/' . $finfo->testclientpath)) { //some plugins may want to have own test client forms include_once $CFG->dirroot . '/' . $finfo->testclientpath; } $class = $f->name . '_form'; if (class_exists($class)) { $functions[$f->name] = $f->name; continue; } }
// Check this is for a tool created from a tool proxy. $err = empty($id); if (!$err) { $type = lti_get_type_type_config($id); $err = empty($type->toolproxyid); } if ($err) { $redirect = new moodle_url('/mod/lti/typessettings.php', array('action' => $action, 'id' => $id, 'sesskey' => sesskey(), 'tab' => $tab)); redirect($redirect); } $pageurl = new moodle_url('/mod/lti/toolssettings.php'); if (!empty($id)) { $pageurl->param('id', $id); } $PAGE->set_url($pageurl); admin_externalpage_setup('managemodules'); // Hacky solution for printing the admin page. $redirect = "{$CFG->wwwroot}/{$CFG->admin}/settings.php?section=modsettinglti&tab={$tab}"; if ($action == 'accept') { lti_set_state_for_type($id, LTI_TOOL_STATE_CONFIGURED); redirect($redirect); } else { if ($action == 'reject' || $action == 'delete') { lti_set_state_for_type($id, LTI_TOOL_STATE_REJECTED); redirect($redirect); } } if (lti_request_is_using_ssl() && !empty($type->lti_secureicon)) { $type->oldicon = $type->lti_secureicon; } else { $type->oldicon = $type->lti_icon;
// GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Profiling tool import utility. * * @package tool_profiling * @copyright 2013 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once __DIR__ . '/../../../config.php'; require_once $CFG->libdir . '/adminlib.php'; require_once $CFG->libdir . '/xhprof/xhprof_moodle.php'; require_once __DIR__ . '/import_form.php'; admin_externalpage_setup('toolprofiling'); $PAGE->navbar->add(get_string('import', 'tool_profiling')); // Calculate export variables. $tempdir = 'profiling'; make_temp_directory($tempdir); // URL where we'll end, both on success and failure. $url = new moodle_url('/admin/tool/profiling/index.php'); // Instantiate the upload profiling runs form. $mform = new profiling_import_form(); // If there is any file to import. if ($data = $mform->get_data()) { $filename = $mform->get_new_filename('mprfile'); $file = $CFG->tempdir . '/' . $tempdir . '/' . $filename; $status = $mform->save_file('mprfile', $file); if ($status) { // File saved properly, let's import it.
// You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * This page provides the Administration -> ... -> Theme selector UI. * * @package core * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once __DIR__ . '/../config.php'; require_once $CFG->libdir . '/adminlib.php'; $choose = optional_param('choose', '', PARAM_PLUGIN); $reset = optional_param('reset', 0, PARAM_BOOL); $device = optional_param('device', '', PARAM_TEXT); $unsettheme = optional_param('unsettheme', 0, PARAM_BOOL); $confirmation = optional_param('confirmation', 0, PARAM_BOOL); admin_externalpage_setup('themeselector'); if (!empty($device)) { // Make sure the device requested is valid. $devices = core_useragent::get_device_type_list(); if (!in_array($device, $devices)) { // The provided device isn't a valid device throw an error. print_error('invaliddevicetype'); } } unset($SESSION->theme); if ($reset and confirm_sesskey()) { theme_reset_all_caches(); } else { if ($choose && $confirmation) { $theme = theme_config::load($choose); echo $OUTPUT->header();
// // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Script to show all the assignments that have not been upgraded after the main upgrade. * * @package tool_assignmentupgrade * @copyright 2012 NetSpot * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once dirname(__FILE__) . '/../../../config.php'; require_once $CFG->libdir . '/adminlib.php'; require_once $CFG->dirroot . '/admin/tool/assignmentupgrade/locallib.php'; require_sesskey(); $assignmentid = required_param('id', PARAM_INT); // admin_externalpage_setup calls require_login and checks moodle/site:config admin_externalpage_setup('assignmentupgrade', '', array(), tool_assignmentupgrade_url('upgradesingle', array('id' => $assignmentid))); $PAGE->navbar->add(get_string('upgradesingle', 'tool_assignmentupgrade')); $renderer = $PAGE->get_renderer('tool_assignmentupgrade'); $log = ''; list($summary, $success, $log) = tool_assignmentupgrade_upgrade_assignment($assignmentid); echo $renderer->header(); echo $renderer->heading(get_string('conversioncomplete', 'tool_assignmentupgrade')); echo $renderer->convert_assignment_result($summary, $success, $log); echo $renderer->continue_button(tool_assignmentupgrade_url('listnotupgraded')); echo $renderer->footer();
} echo $OUTPUT->container_start('buttons'); if (has_capability('moodle/course:create', $systemcontext)) { /// Print link to create a new course /// Get the 1st available category $options = array('category' => $CFG->defaultrequestcategory); echo $OUTPUT->single_button(new moodle_url('edit.php', $options), get_string('addnewcourse'), 'get'); } print_course_request_buttons($systemcontext); echo $OUTPUT->container_end(); echo $OUTPUT->footer(); exit; } /// Everything else is editing on mode. require_once $CFG->libdir . '/adminlib.php'; admin_externalpage_setup('coursemgmt'); /// Delete a category. if (!empty($delete) and confirm_sesskey()) { if (!($deletecat = $DB->get_record('course_categories', array('id' => $delete)))) { print_error('invalidcategoryid'); } $context = get_context_instance(CONTEXT_COURSECAT, $delete); require_capability('moodle/category:manage', $context); require_capability('moodle/category:manage', get_category_or_system_context($deletecat->parent)); $heading = 'Borrar materias'; require_once 'delete_category_form.php'; $mform = new delete_category_form(null, $deletecat); $mform->set_data(array('delete' => $delete)); if ($mform->is_cancelled()) { redirect('index.php'); } else {
<?php // $Id: enrol.php,v 1.34 2009/05/06 08:43:51 tjhunt Exp $ // enrol.php - allows admin to edit all enrollment variables // Yes, enrol is correct English spelling. require_once '../config.php'; require_once $CFG->libdir . '/adminlib.php'; $enrol = optional_param('enrol', $CFG->enrol, PARAM_SAFEDIR); $savesettings = optional_param('savesettings', 0, PARAM_BOOL); admin_externalpage_setup('enrolment'); if (!isset($CFG->sendcoursewelcomemessage)) { set_config('sendcoursewelcomemessage', 1); } require_once "{$CFG->dirroot}/enrol/enrol.class.php"; /// Open the factory class /// Save settings if ($frm = data_submitted() and !$savesettings) { if (!confirm_sesskey()) { print_error('confirmsesskeybad', 'error'); } if (empty($frm->enable)) { $frm->enable = array(); } if (empty($frm->default)) { $frm->default = ''; } if ($frm->default && $frm->default != 'manual' && !in_array($frm->default, $frm->enable)) { $frm->enable[] = $frm->default; } asort($frm->enable); $frm->enable = array_merge(array('manual'), $frm->enable);
$action = optional_param('action', '', PARAM_ALPHA); $scope = optional_param('scope', 'custom', PARAM_ALPHA); $PAGE->set_url('/grade/edit/outcome/import.php', array('courseid' => $courseid)); /// Make sure they can even access this course if ($courseid) { if (!($course = $DB->get_record('course', array('id' => $courseid)))) { print_error('nocourseid'); } require_login($course); $context = context_course::instance($course->id); if (empty($CFG->enableoutcomes)) { redirect('../../index.php?id=' . $courseid); } } else { require_once $CFG->libdir . '/adminlib.php'; admin_externalpage_setup('outcomes'); $context = context_system::instance(); } require_capability('moodle/grade:manageoutcomes', $context); $navigation = grade_build_nav(__FILE__, get_string('outcomes', 'grades'), $courseid); $upload_form = new import_outcomes_form(); // display import form if (!$upload_form->get_data()) { print_grade_page_head($courseid, 'outcome', 'import', get_string('importoutcomes', 'grades')); $upload_form->display(); echo $OUTPUT->footer(); die; } print_grade_page_head($courseid, 'outcome', 'import', get_string('importoutcomes', 'grades')); $imported_file = $CFG->tempdir . '/outcomeimport/importedfile_' . time() . '.csv'; make_temp_directory('outcomeimport');
<?php // Allows the admin to configure mnet stuff require __DIR__ . '/../../config.php'; require_once $CFG->libdir . '/adminlib.php'; include_once $CFG->dirroot . '/mnet/lib.php'; require_login(); admin_externalpage_setup('net'); $context = context_system::instance(); require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions"); $site = get_site(); $mnet = get_mnet_environment(); if (!extension_loaded('openssl')) { echo $OUTPUT->header(); set_config('mnet_dispatcher_mode', 'off'); print_error('requiresopenssl', 'mnet'); } if (!function_exists('curl_init')) { echo $OUTPUT->header(); set_config('mnet_dispatcher_mode', 'off'); print_error('nocurl', 'mnet'); } if (!isset($CFG->mnet_dispatcher_mode)) { set_config('mnet_dispatcher_mode', 'off'); } /// If data submitted, process and store if (($form = data_submitted()) && confirm_sesskey()) { if (!empty($form->submit) && $form->submit == get_string('savechanges')) { if (in_array($form->mode, array("off", "strict", "dangerous"))) { if (set_config('mnet_dispatcher_mode', $form->mode)) { redirect('index.php', get_string('changessaved'));
$context = get_context_instance(CONTEXT_SYSTEM); require_capability('moodle/site:config', $context, $USER->id, true, 'nopermissions'); /// Initialize variables. $hostid = optional_param('hostid', 0, PARAM_INT); $updra = optional_param('updateregisterall', 0, PARAM_INT); // first process the register all hosts setting if required if (!empty($updra)) { set_config('mnet_register_allhosts', optional_param('registerallhosts', 0, PARAM_INT)); redirect(new moodle_url('/admin/mnet/peers.php'), get_string('changessaved')); } $adminsection = 'mnetpeers'; if ($hostid && $DB->get_field('mnet_host', 'deleted', array('id' => $hostid)) != 1) { $adminsection = 'mnetpeer' . $hostid; } $PAGE->set_url('/admin/mnet/peers.php'); admin_externalpage_setup($adminsection); if (!extension_loaded('openssl')) { print_error('requiresopenssl', 'mnet'); } if (!function_exists('curl_init')) { print_error('nocurl', 'mnet'); } if (!function_exists('xmlrpc_encode_request')) { print_error('xmlrpc-missing', 'mnet'); } if (!isset($CFG->mnet_dispatcher_mode)) { set_config('mnet_dispatcher_mode', 'off'); } $mnet_peer = new mnet_peer(); $simpleform = new mnet_simple_host_form(); // the one that goes on the bottom of the main page
public function process($renderer) { qtype_ddmarker_convert_image_target_question($this->record, $this->imagetargetrecord->qimage, $this->answers); parent::process($renderer); //outputs progress message } } $categoryid = optional_param('categoryid', 0, PARAM_INT); $qcontextid = optional_param('contextid', 0, PARAM_INT); $questionid = optional_param('questionid', 0, PARAM_INT); $confirm = optional_param('confirm', 0, PARAM_INT); // Check the user is logged in. require_login(); $context = get_context_instance(CONTEXT_SYSTEM); require_capability('moodle/question:config', $context); admin_externalpage_setup('qtypeddmarkerfromimagetarget'); // Header. $renderer = $PAGE->get_renderer('qtype_ddmarker', 'list'); echo $renderer->header(); echo $renderer->heading(get_string('imagetargetconverter', 'qtype_ddmarker'), 2); $params = array(); $from = 'FROM {question_categories} cat, {question} q'; $where = ' WHERE q.qtype = \'imagetarget\' AND q.category = cat.id '; if ($qcontextid) { $qcontext = get_context_instance_by_id($qcontextid, MUST_EXIST); $from .= ', {context} context'; $where .= 'AND cat.contextid = context.id AND (context.path LIKE :path OR context.id = :id) '; $params['path'] = $qcontext->path . '/%'; $params['id'] = $qcontext->id; } else { if ($categoryid) {
* It handles redirection to the hub to continue the registration workflow process. * It also handles update operation by web service. */ require_once '../../config.php'; require_once $CFG->libdir . '/adminlib.php'; require_once $CFG->dirroot . '/' . $CFG->admin . '/registration/forms.php'; require_once $CFG->dirroot . '/webservice/lib.php'; require_once $CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php'; $huburl = required_param('huburl', PARAM_URL); $huburl = rtrim($huburl, "/"); if ($huburl == HUB_MOODLEORGHUBURL) { // register to Moodle.org admin_externalpage_setup('registrationmoodleorg'); } else { //register to a hub admin_externalpage_setup('registrationhub'); } $password = optional_param('password', '', PARAM_TEXT); $hubname = optional_param('hubname', '', PARAM_TEXT); $registrationmanager = new registration_manager(); $registeredhub = $registrationmanager->get_registeredhub($huburl); $siteregistrationform = new site_registration_form('', array('alreadyregistered' => !empty($registeredhub->token), 'huburl' => $huburl, 'hubname' => $hubname, 'password' => $password)); $fromform = $siteregistrationform->get_data(); if (!empty($fromform) and confirm_sesskey()) { //save the settings $cleanhuburl = clean_param($huburl, PARAM_ALPHANUMEXT); set_config('site_name_' . $cleanhuburl, $fromform->name, 'hub'); set_config('site_description_' . $cleanhuburl, $fromform->description, 'hub'); set_config('site_contactname_' . $cleanhuburl, $fromform->contactname, 'hub'); set_config('site_contactemail_' . $cleanhuburl, $fromform->contactemail, 'hub'); set_config('site_contactphone_' . $cleanhuburl, $fromform->contactphone, 'hub');
* * @package moodlecore * @subpackage questionengine * @copyright 2011 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once dirname(__FILE__) . '/../config.php'; require_once $CFG->libdir . '/questionlib.php'; require_once $CFG->libdir . '/adminlib.php'; require_once $CFG->libdir . '/pluginlib.php'; require_once $CFG->libdir . '/tablelib.php'; // Check permissions. require_login(); $systemcontext = context_system::instance(); require_capability('moodle/question:config', $systemcontext); admin_externalpage_setup('manageqbehaviours'); $thispageurl = new moodle_url('/admin/qbehaviours.php'); $behaviours = get_plugin_list('qbehaviour'); $pluginmanager = plugin_manager::instance(); // Get some data we will need - question counts and which types are needed. $counts = $DB->get_records_sql_menu("\n SELECT behaviour, COUNT(1)\n FROM {question_attempts} GROUP BY behaviour"); $needed = array(); $archetypal = array(); foreach ($behaviours as $behaviour => $notused) { if (!array_key_exists($behaviour, $counts)) { $counts[$behaviour] = 0; } $needed[$behaviour] = $counts[$behaviour] > 0 || $pluginmanager->other_plugins_that_require('qbehaviour_' . $behaviour); $archetypal[$behaviour] = question_engine::is_behaviour_archetypal($behaviour); } foreach ($counts as $behaviour => $count) {