old admin blocks MDL-22475 Goodbye admin and admin_tree. You were good to us. But now we have Settings.
This commit is contained in:
@@ -1,225 +0,0 @@
|
||||
<?php
|
||||
|
||||
class block_admin extends block_list {
|
||||
function init() {
|
||||
$this->title = get_string('pluginname', 'block_admin');
|
||||
$this->version = 2007101509;
|
||||
}
|
||||
|
||||
function get_content() {
|
||||
global $CFG, $USER, $DB, $OUTPUT;
|
||||
|
||||
if ($this->content !== NULL) {
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
$this->content = new stdClass;
|
||||
$this->content->items = array();
|
||||
$this->content->icons = array();
|
||||
$this->content->footer = '';
|
||||
|
||||
$course = $this->page->course;
|
||||
|
||||
if (empty($CFG->loginhttps)) {
|
||||
$securewwwroot = $CFG->wwwroot;
|
||||
} else {
|
||||
$securewwwroot = str_replace('http:','https:',$CFG->wwwroot);
|
||||
}
|
||||
|
||||
$isenrolled = is_enrolled($this->page->context);
|
||||
$isviewing = is_viewing($this->page->context);
|
||||
|
||||
/// Course editing on/off
|
||||
if ($course->id !== SITEID and has_capability('moodle/course:update', $this->page->context)) {
|
||||
$this->content->icons[]='<img src="'.$OUTPUT->pix_url('i/edit') . '" class="icon" alt="" />';
|
||||
if ($this->page->user_is_editing()) {
|
||||
$this->content->items[]='<a href="view.php?id='.$course->id.'&edit=off&sesskey='.sesskey().'">'.get_string('turneditingoff').'</a>';
|
||||
} else {
|
||||
$this->content->items[]='<a href="view.php?id='.$course->id.'&edit=on&sesskey='.sesskey().'">'.get_string('turneditingon').'</a>';
|
||||
}
|
||||
|
||||
$this->content->items[]='<a href="'.$CFG->wwwroot.'/course/edit.php?id='.$course->id.'">'.get_string('settings').'</a>';
|
||||
$this->content->icons[]='<img src="'.$OUTPUT->pix_url('i/settings') . '" class="icon" alt="" />';
|
||||
}
|
||||
|
||||
/// Assign roles to the course
|
||||
if ($course->id != SITEID) {
|
||||
if (has_capability('moodle/role:assign', $this->page->context)) {
|
||||
$this->content->items[]='<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$this->page->context->id.'">'.get_string('assignroles', 'role').'</a>';
|
||||
$this->content->icons[]='<img src="'.$OUTPUT->pix_url('i/roles') . '" class="icon" alt="" />';
|
||||
} else if (get_overridable_roles($this->page->context, ROLENAME_ORIGINAL)) {
|
||||
$this->content->items[]='<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/roles/override.php?contextid='.$this->page->context->id.'">'.get_string('overridepermissions', 'role').'</a>';
|
||||
$this->content->icons[]='<img src="'.$OUTPUT->pix_url('i/roles') . '" class="icon" alt="" />';
|
||||
}
|
||||
}
|
||||
|
||||
/// View course grades (or just your own grades, same link)
|
||||
/// find all accessible reports
|
||||
if ($course->id !== SITEID and ($isenrolled or $isviewing)) {
|
||||
$reportavailable = false;
|
||||
if (has_capability('moodle/grade:viewall', $this->page->context)) {
|
||||
$reportavailable = true;
|
||||
} else if (!empty($course->showgrades)) {
|
||||
if ($reports = get_plugin_list('gradereport')) { // Get all installed reports
|
||||
arsort($reports); // user is last, we want to test it first
|
||||
foreach ($reports as $plugin => $plugindir) {
|
||||
if (has_capability('gradereport/'.$plugin.':view', $this->page->context)) {
|
||||
//stop when the first visible plugin is found
|
||||
$reportavailable = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($reportavailable) {
|
||||
$this->content->items[]='<a href="'.$CFG->wwwroot.'/grade/report/index.php?id='.$course->id.'">'.get_string('grades').'</a>';
|
||||
$this->content->icons[]='<img src="'.$OUTPUT->pix_url('i/grades') . '" class="icon" alt="" />';
|
||||
}
|
||||
}
|
||||
|
||||
/// Course outcomes (to help give it more prominence because it's important)
|
||||
if (!empty($CFG->enableoutcomes)) {
|
||||
if ($course->id!==SITEID and has_capability('moodle/course:update', $this->page->context)) {
|
||||
$this->content->items[]='<a href="'.$CFG->wwwroot.'/grade/edit/outcome/course.php?id='.$course->id.'">'.get_string('outcomes', 'grades').'</a>';
|
||||
$this->content->icons[]='<img src="'.$OUTPUT->pix_url('i/outcomes') . '" class="icon" alt="" />';
|
||||
}
|
||||
}
|
||||
|
||||
/// Manage metacourses
|
||||
if ($course->metacourse) {
|
||||
if (has_capability('moodle/course:managemetacourse', $this->page->context)) {
|
||||
$strchildcourses = get_string('childcourses');
|
||||
$this->content->items[]='<a href="'.$CFG->wwwroot.'/course/importstudents.php?id='.$course->id.'">'.$strchildcourses.'</a>';
|
||||
$this->content->icons[]='<img src="'.$OUTPUT->pix_url('i/course') . '" class="icon" alt="" />';
|
||||
} else if (has_capability('moodle/role:assign', $this->page->context)) {
|
||||
$strchildcourses = get_string('childcourses');
|
||||
$this->content->items[]='<span class="dimmed_text">'.$strchildcourses.'</span>';
|
||||
$this->content->icons[]='<img src="'.$OUTPUT->pix_url('i/course') . '" class="icon" alt="" />';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Manage groups in this course
|
||||
if (($course->id!==SITEID) && ($course->groupmode || !$course->groupmodeforce) && has_capability('moodle/course:managegroups', $this->page->context)) {
|
||||
$strgroups = get_string('groups');
|
||||
$this->content->items[]='<a title="'.$strgroups.'" href="'.$CFG->wwwroot.'/group/index.php?id='.$course->id.'">'.$strgroups.'</a>';
|
||||
$this->content->icons[]='<img src="'.$OUTPUT->pix_url('i/group') . '" class="icon" alt="" />';
|
||||
}
|
||||
|
||||
/// Backup this course
|
||||
if ($course->id!==SITEID and has_capability('moodle/backup:backupcourse', $this->page->context)) {
|
||||
$this->content->items[]='<a href="'.$CFG->wwwroot.'/backup/backup.php?id='.$course->id.'">'.get_string('backup').'</a>';
|
||||
$this->content->icons[]='<img src="'.$OUTPUT->pix_url('i/backup') . '" class="icon" alt="" />';
|
||||
}
|
||||
|
||||
/// Restore to this course
|
||||
if ($course->id !== SITEID and has_capability('moodle/restore:restorecourse', $this->page->context)) {
|
||||
$this->content->items[]='<a href="'.$CFG->wwwroot.'/files/index.php?id='.$course->id.'&wdir=/backupdata">'.get_string('restore').'</a>';
|
||||
$this->content->icons[]='<img src="'.$OUTPUT->pix_url('i/restore') . '" class="icon" alt="" />';
|
||||
}
|
||||
|
||||
/// Import data from other courses
|
||||
if ($course->id !== SITEID and has_capability('moodle/restore:restoretargetimport', $this->page->context)) {
|
||||
$this->content->items[]='<a href="'.$CFG->wwwroot.'/course/import.php?id='.$course->id.'">'.get_string('import').'</a>';
|
||||
$this->content->icons[]='<img src="'.$OUTPUT->pix_url('i/restore') . '" class="icon" alt="" />';
|
||||
}
|
||||
|
||||
/// Reset this course
|
||||
if ($course->id!==SITEID and has_capability('moodle/course:reset', $this->page->context)) {
|
||||
$this->content->items[]='<a href="'.$CFG->wwwroot.'/course/reset.php?id='.$course->id.'">'.get_string('reset').'</a>';
|
||||
$this->content->icons[]='<img src="'.$OUTPUT->pix_url('i/return') . '" class="icon" alt="" />';
|
||||
}
|
||||
|
||||
/// View course reports
|
||||
if ($course->id !== SITEID and has_capability('moodle/site:viewreports', $this->page->context)) { // basic capability for listing of reports
|
||||
$this->content->items[]='<a href="'.$CFG->wwwroot.'/course/report.php?id='.$course->id.'">'.get_string('reports').'</a>';
|
||||
$this->content->icons[]='<img src="'.$OUTPUT->pix_url('i/stats') . '" class="icon" alt="" />';
|
||||
}
|
||||
|
||||
/// Manage questions
|
||||
if ($course->id !== SITEID){
|
||||
$questionlink = '';
|
||||
$questioncaps = array(
|
||||
'moodle/question:add',
|
||||
'moodle/question:editmine',
|
||||
'moodle/question:editall',
|
||||
'moodle/question:viewmine',
|
||||
'moodle/question:viewall',
|
||||
'moodle/question:movemine',
|
||||
'moodle/question:moveall');
|
||||
foreach ($questioncaps as $questioncap){
|
||||
if (has_capability($questioncap, $this->page->context)){
|
||||
$questionlink = 'edit.php';
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$questionlink && has_capability('moodle/question:managecategory', $this->page->context)) {
|
||||
$questionlink = 'category.php';
|
||||
}
|
||||
if ($questionlink) {
|
||||
$this->content->items[]='<a href="'.$CFG->wwwroot.'/question/'.$questionlink.
|
||||
'?courseid='.$course->id.'">'.get_string('questions', 'quiz').'</a>';
|
||||
$this->content->icons[]='<img src="'.$OUTPUT->pix_url('i/questions') . '" class="icon" alt="" />';
|
||||
}
|
||||
}
|
||||
|
||||
/// Repository Instances
|
||||
require_once($CFG->dirroot.'/repository/lib.php');
|
||||
$editabletypes = repository::get_editable_types($this->page->context);
|
||||
if ($course->id !== SITEID && has_capability('moodle/course:update', $this->page->context) && !empty($editabletypes)) {
|
||||
$this->content->items[]='<a href="'.$CFG->wwwroot.'/repository/manage_instances.php?contextid='.$this->page->context->id.'">'.get_string('repositories').'</a>';
|
||||
$this->content->icons[]='<img src="'.$OUTPUT->pix_url('i/repository') . '" alt=""/>';
|
||||
}
|
||||
|
||||
/// Manage files
|
||||
if ($course->id !== SITEID and has_capability('moodle/course:managefiles', $this->page->context)) {
|
||||
$this->content->items[]='<a href="'.$CFG->wwwroot.'/files/index.php?id='.$course->id.'">'.get_string('files').'</a>';
|
||||
$this->content->icons[]='<img src="'.$OUTPUT->pix_url('i/files') . '" class="icon" alt=""/>';
|
||||
}
|
||||
|
||||
/// Authorize hooks
|
||||
if ($course->enrol == 'authorize' || (empty($course->enrol) && $CFG->enrol == 'authorize') && ($course->id!==SITEID)) {
|
||||
require_once($CFG->dirroot.'/enrol/authorize/const.php');
|
||||
$paymenturl = '<a href="'.$CFG->wwwroot.'/enrol/authorize/index.php?course='.$course->id.'">'.get_string('payments').'</a> ';
|
||||
if (has_capability('enrol/authorize:managepayments', $this->page->context)) {
|
||||
if ($cnt = $DB->count_records('enrol_authorize', array('status'=>AN_STATUS_AUTH, 'courseid'=>$course->id))) {
|
||||
$paymenturl .= '<a href="'.$CFG->wwwroot.'/enrol/authorize/index.php?status='.AN_STATUS_AUTH.'&course='.$course->id.'">'.get_string('paymentpending', 'moodle', $cnt).'</a>';
|
||||
}
|
||||
}
|
||||
$this->content->items[] = $paymenturl;
|
||||
$this->content->icons[] = '<img src="'.$OUTPUT->pix_url('i/payment') . '" class="icon" alt="" />';
|
||||
}
|
||||
|
||||
/// Unenrol link
|
||||
if (empty($course->metacourse) && ($course->id!==SITEID)) {
|
||||
if ($isenrolled) {
|
||||
if (has_capability('moodle/role:unassignself', $this->page->context, NULL, false) and get_user_roles($this->page->context, $USER->id, false)) { // Have some role
|
||||
$this->content->items[]='<a href="'.$CFG->wwwroot.'/course/unenrol.php?id='.$course->id.'">'.get_string('unenrolme', '', format_string($course->shortname)).'</a>';
|
||||
$this->content->icons[]='<img src="'.$OUTPUT->pix_url('i/user') . '" class="icon" alt="" />';
|
||||
}
|
||||
|
||||
} else if ($isviewing) {
|
||||
// inspector, manager, etc. - do not show anything
|
||||
} else {
|
||||
// access because otherwise they would not get into this course at all
|
||||
$this->content->items[]='<a href="'.$CFG->wwwroot.'/course/enrol.php?id='.$course->id.'">'.get_string('enrolme', '', format_string($course->shortname)).'</a>';
|
||||
$this->content->icons[]='<img src="'.$OUTPUT->pix_url('i/user') . '" class="icon" alt="" />';
|
||||
}
|
||||
}
|
||||
|
||||
/// Link to the user own profile if they are enrolled
|
||||
if ($isenrolled) {
|
||||
$this->content->items[]='<a href="'.$CFG->wwwroot.'/user/view.php?id='.$USER->id.'&course='.$course->id.'">'.get_string('profile').'</a>';
|
||||
$this->content->icons[]='<img src="'.$OUTPUT->pix_url('i/user') . '" alt="" />';
|
||||
}
|
||||
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
function applicable_formats() {
|
||||
return array('course' => true); // Not needed on site
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
<?php
|
||||
|
||||
// This file keeps track of upgrades to
|
||||
// the admin block
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// The commands in here will all be database-neutral,
|
||||
// using the methods of database_manager class
|
||||
//
|
||||
// Please do not forget to use upgrade_set_timeout()
|
||||
// before any action that may take longer time to finish.
|
||||
|
||||
function xmldb_block_admin_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
$result = true;
|
||||
|
||||
/// And upgrade begins here. For each one, you'll need one
|
||||
/// block of code similar to the next one. Please, delete
|
||||
/// this comment lines once this file start handling proper
|
||||
/// upgrade code.
|
||||
|
||||
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
|
||||
/// $result = result of database_manager methods
|
||||
/// }
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// 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/>.
|
||||
|
||||
/**
|
||||
* Strings for component 'block_admin', language 'en', branch 'MOODLE_20_STABLE'
|
||||
*
|
||||
* @package block_admin
|
||||
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['pluginname'] = 'Administration';
|
||||
@@ -1,75 +0,0 @@
|
||||
admin_tree = {
|
||||
numdivs: null,
|
||||
hiddennodes: null,
|
||||
closedimg: null,
|
||||
openimg: null,
|
||||
closedalt: null,
|
||||
openalt: null,
|
||||
|
||||
init: function(numdivs, expandnodes, openimg, closedimg, openalt, closedalt) {
|
||||
// Store the information we were passed in.
|
||||
admin_tree.openimg = openimg;
|
||||
admin_tree.closedimg = closedimg;
|
||||
admin_tree.openalt = openalt;
|
||||
admin_tree.closedalt = closedalt;
|
||||
admin_tree.numdivs = numdivs;
|
||||
|
||||
// Initialise the hiddennodes array.
|
||||
admin_tree.hiddennodes = new Array();
|
||||
for (var i = 1; i <= admin_tree.numdivs; i++) {
|
||||
admin_tree.hiddennodes[i] = null;
|
||||
}
|
||||
|
||||
// Collapse everything while adding the event handlers.
|
||||
for (var i = admin_tree.numdivs; i > 0; i--) {
|
||||
admin_tree.collapse(i);
|
||||
var togglelink = document.getElementById("vh_div" + i + "indicator").parentNode;
|
||||
togglelink.href = '#';
|
||||
YAHOO.util.Event.addListener(togglelink, 'click', admin_tree.toggle, i);
|
||||
}
|
||||
|
||||
// Re-expand the bits we want expanded.
|
||||
for (var i = 0; i < expandnodes.length; i++) {
|
||||
admin_tree.expand(expandnodes[i]);
|
||||
}
|
||||
},
|
||||
|
||||
toggle: function(e, i) {
|
||||
if (admin_tree.hiddennodes[i] === null) {
|
||||
admin_tree.collapse(i);
|
||||
} else {
|
||||
admin_tree.expand(i);
|
||||
}
|
||||
YAHOO.util.Event.preventDefault(e);
|
||||
},
|
||||
|
||||
collapse: function(i) {
|
||||
if (admin_tree.hiddennodes[i] !== null) {
|
||||
return;
|
||||
}
|
||||
var obj = document.getElementById("vh_div" + i);
|
||||
if (obj === null) {
|
||||
return;
|
||||
}
|
||||
var nothing = document.createElement("span");
|
||||
nothing.setAttribute("id", "vh_div" + i);
|
||||
admin_tree.hiddennodes[i] = obj;
|
||||
obj.parentNode.replaceChild(nothing, obj);
|
||||
var icon = document.getElementById("vh_div" + i + "indicator");
|
||||
icon.src = admin_tree.closedimg;
|
||||
icon.alt = admin_tree.closedalt;
|
||||
},
|
||||
|
||||
expand: function(i) {
|
||||
if (admin_tree.hiddennodes[i] === null) {
|
||||
return;
|
||||
}
|
||||
var nothing = document.getElementById("vh_div" + i);
|
||||
var obj = admin_tree.hiddennodes[i];
|
||||
admin_tree.hiddennodes[i] = null;
|
||||
nothing.parentNode.replaceChild(obj, nothing);
|
||||
var icon = document.getElementById("vh_div" + i + "indicator");
|
||||
icon.src = admin_tree.openimg;
|
||||
icon.alt = admin_tree.openalt;
|
||||
}
|
||||
};
|
||||
@@ -1,170 +0,0 @@
|
||||
<?php
|
||||
|
||||
class block_admin_tree extends block_base {
|
||||
|
||||
var $currentdepth;
|
||||
var $divcounter;
|
||||
var $tempcontent;
|
||||
var $destination;
|
||||
var $section = null;
|
||||
var $pathtosection = array();
|
||||
var $expandnodes = array();
|
||||
|
||||
function init() {
|
||||
$this->title = get_string('pluginname', 'block_admin_tree');
|
||||
$this->version = 2007101509;
|
||||
$this->currentdepth = 0;
|
||||
$this->divcounter = 1;
|
||||
$this->tempcontent = '';
|
||||
}
|
||||
|
||||
function applicable_formats() {
|
||||
if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
return array('site' => true, 'admin' => true, 'my' => true);
|
||||
} else {
|
||||
return array('site' => true, 'admin' => true);
|
||||
}
|
||||
}
|
||||
|
||||
function preferred_width() {
|
||||
return 210;
|
||||
}
|
||||
|
||||
function open_folder($visiblename) {
|
||||
global $OUTPUT;
|
||||
$strfolderopened = s(get_string('folderopened'));
|
||||
|
||||
$this->tempcontent .= '<div class="depth'.$this->currentdepth.'"><a name="d'.$this->divcounter.'">';
|
||||
$this->tempcontent .= '<img id="vh_div'.$this->divcounter.'indicator" src="'.$OUTPUT->pix_url('i/open') . '" alt="'.$strfolderopened.'" /> ';
|
||||
$this->tempcontent .= $visiblename.'</a></div><div id="vh_div'.$this->divcounter.'">'."\n";
|
||||
$this->currentdepth++;
|
||||
$this->divcounter++;
|
||||
}
|
||||
|
||||
function close_folder() {
|
||||
$this->currentdepth--;
|
||||
$this->tempcontent .= "</div>\n";
|
||||
}
|
||||
|
||||
function create_item($visiblename,$link,$icon,$class) {
|
||||
global $CFG;
|
||||
$this->tempcontent .= '<div class="depth'.$this->currentdepth.'"><a class="'.$class.'" href="'.$link.'"><img src="'.$icon.'" alt="" />'.
|
||||
$visiblename.'</a></div>'."\n";
|
||||
}
|
||||
|
||||
function build_tree (&$content) {
|
||||
global $CFG, $OUTPUT;
|
||||
if ($content instanceof admin_settingpage) {
|
||||
// show hidden pages in tree if hidden page active
|
||||
if ($content->check_access() and (($content->name == $this->section) or !$content->is_hidden())) {
|
||||
$class = ($content->name == $this->section) ? 'link current' : 'link';
|
||||
if ($content->is_hidden()) {
|
||||
$class .= ' hidden';
|
||||
}
|
||||
$this->create_item($content->visiblename, $CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section='.$content->name,$OUTPUT->pix_url('i/item'), $class);
|
||||
}
|
||||
} else if ($content instanceof admin_externalpage) {
|
||||
// show hidden pages in tree if hidden page active
|
||||
if ($content->check_access() and (($content->name == $this->section) or !$content->is_hidden())) {
|
||||
$class = ($content->name == $this->section) ? 'link current' : 'link';
|
||||
if ($content->name === 'adminnotifications') {
|
||||
if (admin_critical_warnings_present()) {
|
||||
$class .= ' criticalnotification';
|
||||
}
|
||||
}
|
||||
if ($content->is_hidden()) {
|
||||
$class .= ' hidden';
|
||||
}
|
||||
$this->create_item($content->visiblename, $content->url, $OUTPUT->pix_url('i/item'), $class);
|
||||
}
|
||||
} else if ($content instanceof admin_category) {
|
||||
if ($content->check_access() and !$content->is_hidden()) {
|
||||
|
||||
// check if the category we're currently printing is a parent category for the current page; if it is, we
|
||||
// make a note (in the javascript) that it has to be expanded after the page has loaded
|
||||
if ($this->section != '' and $this->pathtosection[count($this->pathtosection) - 1] == $content->name) {
|
||||
$this->expandnodes[] = $this->divcounter;
|
||||
array_pop($this->pathtosection);
|
||||
}
|
||||
|
||||
$this->open_folder($content->visiblename);
|
||||
|
||||
$entries = array_keys($content->children);
|
||||
|
||||
foreach ($entries as $entry) {
|
||||
$this->build_tree($content->children[$entry]);
|
||||
}
|
||||
|
||||
$this->close_folder();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function get_content() {
|
||||
global $CFG, $OUTPUT, $COURSE;
|
||||
|
||||
if ($this->content !== NULL) {
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
if (isguestuser() or !isloggedin()) {
|
||||
// shortcut - these users can not change any settings
|
||||
$this->content = '';
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($COURSE->shortname === '') {
|
||||
// remove admin block if site not fully configured yet
|
||||
$this->content = '';
|
||||
return '';
|
||||
}
|
||||
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
$adminroot = admin_get_root(false, false); // settings not required - only pages
|
||||
|
||||
$this->section = $this->page->url->param('section');
|
||||
if ($current = $adminroot->locate($this->section, true)) {
|
||||
$this->pathtosection = $current->path;
|
||||
array_pop($this->pathtosection);
|
||||
}
|
||||
|
||||
// we need to do this instead of $this->build_tree($adminroot) because the top-level folder
|
||||
// is redundant (and ideally ignored). (the top-level folder is "administration".)
|
||||
$entries = array_keys($adminroot->children);
|
||||
asort($entries);
|
||||
foreach ($entries as $entry) {
|
||||
$this->build_tree($adminroot->children[$entry]);
|
||||
}
|
||||
|
||||
if ($this->tempcontent !== '') {
|
||||
$this->page->requires->yui2_lib('event');
|
||||
$this->page->requires->js('/blocks/admin_tree/admintree.js');
|
||||
$this->page->requires->js_function_call('admin_tree.init',
|
||||
array($this->divcounter - 1, $this->expandnodes,
|
||||
$OUTPUT->pix_url('i/open'), $OUTPUT->pix_url('i/closed'),
|
||||
get_string('folderopened'), get_string('folderclosed')));
|
||||
|
||||
$this->content = new object();
|
||||
$this->content->text = '<div class="admintree">' . $this->tempcontent . "</div>\n";
|
||||
|
||||
// only do search if you have moodle/site:config
|
||||
if (has_capability('moodle/site:config',get_context_instance(CONTEXT_SYSTEM)) ) {
|
||||
$this->content->footer =
|
||||
'<div class="adminsearchform">'.
|
||||
'<form action="'.$CFG->wwwroot.'/'.$CFG->admin.'/search.php" method="get"><div>'.
|
||||
'<label for="query" class="accesshide">'.get_string('searchinsettings', 'admin').'</label>'.
|
||||
'<input type="text" name="query" id="query" size="8" value="'.s($adminroot->search).'" />'.
|
||||
'<input type="submit" value="'.get_string('search').'" /></div>'.
|
||||
'</form></div>';
|
||||
} else {
|
||||
$this->content->footer = '';
|
||||
}
|
||||
} else {
|
||||
$this->content = new object();
|
||||
$this->content->text = '';
|
||||
}
|
||||
|
||||
return $this->content;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// 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/>.
|
||||
|
||||
/**
|
||||
* Strings for component 'block_admin_tree', language 'en', branch 'MOODLE_20_STABLE'
|
||||
*
|
||||
* @package block_admin_tree
|
||||
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['pluginname'] = 'Site administration';
|
||||
@@ -1,5 +0,0 @@
|
||||
.block_admin_tree .admintree {text-align:left;}
|
||||
.block_admin_tree .admintree .depth1 {padding-left: 16px;}
|
||||
.block_admin_tree .admintree .depth2 {padding-left: 32px;}
|
||||
.block_admin_tree .admintree .depth3 {padding-left: 48px;}
|
||||
.block_admin_tree .admintree .depth4 {padding-left: 64px;}
|
||||
@@ -5842,9 +5842,7 @@ function print_plugin_tables() {
|
||||
'workshop');
|
||||
|
||||
$plugins_standard['blocks'] = array('activity_modules',
|
||||
'admin',
|
||||
'admin_bookmarks',
|
||||
'admin_tree',
|
||||
'blog_menu',
|
||||
'blog_recent',
|
||||
'blog_tags',
|
||||
|
||||
@@ -4052,6 +4052,16 @@ AND EXISTS (SELECT 'x'
|
||||
}
|
||||
|
||||
|
||||
if ($result && $oldversion < 2010051600) {
|
||||
|
||||
/// Delete the blocks completely. All the contexts, instances etc were cleaned up above in 2009082800
|
||||
$DB->delete_records('block', array('name'=>'admin'));
|
||||
$DB->delete_records('block', array('name'=>'admin_tree'));
|
||||
|
||||
/// Main savepoint reached
|
||||
upgrade_main_savepoint($result, 2010051600);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
// This is compared against the values stored in the database to determine
|
||||
// whether upgrades should be performed (see lib/db/*.php)
|
||||
|
||||
$version = 2010051500; // YYYYMMDD = date of the last version bump
|
||||
$version = 2010051600; // YYYYMMDD = date of the last version bump
|
||||
// XX = daily increments
|
||||
|
||||
$release = '2.0 Preview 1 (Build: 20100516)'; // Human-friendly version name
|
||||
|
||||
Reference in New Issue
Block a user