"plusplus": false,
"predef": [
"M",
- "define"
+ "define",
+ "require"
],
"proto": false,
"regexdash": false,
module.exports = function(grunt) {
var path = require('path'),
+ fs = require('fs'),
tasks = {},
cwd = process.env.PWD || process.cwd();
args.push('--lint-stderr');
}
+ var execShifter = function() {
+
+ shifter = exec("node", args, {
+ cwd: cwd,
+ stdio: 'inherit',
+ env: process.env
+ });
+
+ // Tidy up after exec.
+ shifter.on('exit', function (code) {
+ if (code) {
+ grunt.fail.fatal('Shifter failed with code: ' + code);
+ } else {
+ grunt.log.ok('Shifter build complete.');
+ done();
+ }
+ });
+ };
+
// Actually run shifter.
- shifter = exec("node", args, {
- cwd: cwd,
- stdio: 'inherit',
- env: process.env
- });
-
- // Tidy up after exec.
- shifter.on('exit', function (code) {
- if (code) {
- grunt.fail.fatal('Shifter failed with code: ' + code);
- } else {
- grunt.log.ok('Shifter build complete.');
- done();
- }
- });
+ if (!options.recursive) {
+ execShifter();
+ } else {
+ // Check that there are yui modules otherwise shifter ends with exit code 1.
+ var found = false;
+ var hasYuiModules = function(directory, callback) {
+ fs.readdir(directory, function(err, files) {
+ if (err) {
+ return callback(err, null);
+ }
+
+ // If we already found a match there is no need to continue scanning.
+ if (found === true) {
+ return;
+ }
+
+ // We need to track the number of files to know when we return a result.
+ var pending = files.length;
+
+ // We first check files, so if there is a match we don't need further
+ // async calls and we just return a true.
+ for (var i = 0; i < files.length; i++) {
+ if (files[i] === 'yui') {
+ return callback(null, true);
+ }
+ }
+
+ // Iterate through subdirs if there were no matches.
+ files.forEach(function (file) {
+
+ var p = path.join(directory, file);
+ stat = fs.statSync(p);
+ if (!stat.isDirectory()) {
+ pending--;
+ } else {
+
+ // We defer the pending-1 until we scan the whole dir and subdirs.
+ hasYuiModules(p, function(err, result) {
+ if (err) {
+ return callback(err);
+ }
+
+ if (result === true) {
+ // Once we get a true we notify the caller.
+ found = true;
+ return callback(null, true);
+ }
+
+ pending--;
+ if (pending === 0) {
+ // Notify the caller that the whole dir has been scaned and there are no matches.
+ return callback(null, false);
+ }
+ });
+ }
+
+ // No subdirs here, otherwise the return would be deferred until all subdirs are scanned.
+ if (pending === 0) {
+ return callback(null, false);
+ }
+ });
+ });
+ };
+
+ hasYuiModules(cwd, function(err, result) {
+ if (err) {
+ grunt.fail.fatal(err.message);
+ }
+
+ if (result === true) {
+ execShifter();
+ } else {
+ grunt.log.ok('No YUI modules to build.');
+ done();
+ }
+ });
+ }
};
tasks.startup = function() {
--adminpass=PASSWORD Password for the moodle admin account,
required in non-interactive mode.
--adminemail=STRING Email address for the moodle admin account.
+--upgradekey=STRING The upgrade key to be set in the config.php, leave empty to not set it.
--non-interactive No interactive questions, installation fails if any
problem encountered.
--agree-license Indicates agreement with software license,
'adminuser' => 'admin',
'adminpass' => '',
'adminemail' => '',
+ 'upgradekey' => '',
'non-interactive' => false,
'agree-license' => false,
'allow-unstable' => false,
// set up language
$lang = clean_param($options['lang'], PARAM_SAFEDIR);
-if (file_exists($CFG->dirroot.'/install/lang/'.$lang)) {
+$languages = get_string_manager()->get_list_of_translations();
+if (array_key_exists($lang, $languages)) {
$CFG->lang = $lang;
}
//Fist select language
if ($interactive) {
cli_separator();
- $languages = get_string_manager()->get_list_of_translations();
// Do not put the langs into columns because it is not compatible with RTL.
- $langlist = implode("\n", $languages);
$default = $CFG->lang;
- cli_heading(get_string('availablelangs', 'install'));
- echo $langlist."\n";
+ cli_heading(get_string('chooselanguagehead', 'install'));
+ if (array_key_exists($default, $languages)) {
+ echo $default.' - '.$languages[$default]."\n";
+ }
+ if ($default !== 'en') {
+ echo 'en - English (en)'."\n";
+ }
+ echo '? - '.get_string('availablelangs', 'install')."\n";
$prompt = get_string('clitypevaluedefault', 'admin', $CFG->lang);
$error = '';
do {
echo $error;
$input = cli_input($prompt, $default);
- $input = clean_param($input, PARAM_SAFEDIR);
- if (!file_exists($CFG->dirroot.'/install/lang/'.$input)) {
- $error = get_string('cliincorrectvalueretry', 'admin')."\n";
+ if ($input === '?') {
+ echo implode("\n", $languages)."\n";
+ $error = "\n";
+
} else {
- $error = '';
+ $input = clean_param($input, PARAM_SAFEDIR);
+
+ if (!array_key_exists($input, $languages)) {
+ $error = get_string('cliincorrectvalueretry', 'admin')."\n";
+ } else {
+ $error = '';
+ }
}
} while ($error !== '');
$CFG->lang = $input;
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
}
+// Ask for the upgrade key.
+if ($interactive) {
+ cli_separator();
+ cli_heading(get_string('upgradekeyset', 'admin'));
+ if ($options['upgradekey'] !== '') {
+ $prompt = get_string('clitypevaluedefault', 'admin', $options['upgradekey']);
+ $options['upgradekey'] = cli_input($prompt, $options['upgradekey']);
+ } else {
+ $prompt = get_string('clitypevalue', 'admin');
+ $options['upgradekey'] = cli_input($prompt);
+ }
+}
+
+// Set the upgrade key if it was provided.
+if ($options['upgradekey'] !== '') {
+ $CFG->upgradekey = $options['upgradekey'];
+}
+
if ($interactive) {
if (!$options['agree-license']) {
cli_separator();
define('NO_OUTPUT_BUFFERING', true);
+if (isset($_POST['upgradekey'])) {
+ // Before you start reporting issues about the collision attacks against
+ // SHA-1, you should understand that we are not actually attempting to do
+ // any cryptography here. This is hashed purely so that the key is not
+ // that apparent in the address bar itself. Anyone who catches the HTTP
+ // traffic can immediately use it as a valid admin key.
+ header('Location: index.php?cache=0&upgradekeyhash='.sha1($_POST['upgradekey']));
+ die();
+}
+
if ((isset($_GET['cache']) and $_GET['cache'] === '0')
or (isset($_POST['cache']) and $_POST['cache'] === '0')
or (!isset($_POST['cache']) and !isset($_GET['cache']) and empty($_GET['sesskey']) and empty($_POST['sesskey']))) {
$agreelicense = optional_param('agreelicense', 0, PARAM_BOOL);
$fetchupdates = optional_param('fetchupdates', 0, PARAM_BOOL);
$newaddonreq = optional_param('installaddonrequest', null, PARAM_RAW);
+$upgradekeyhash = optional_param('upgradekeyhash', null, PARAM_ALPHANUM);
// Set up PAGE.
$url = new moodle_url('/admin/index.php');
$url->param('cache', $cache);
+if (isset($upgradekeyhash)) {
+ $url->param('upgradekeyhash', $upgradekeyhash);
+}
$PAGE->set_url($url);
unset($url);
$PAGE->set_heading($strinstallation . ' - Moodle ' . $CFG->target_release);
$output = $PAGE->get_renderer('core', 'admin');
- $url = new moodle_url('/admin/index.php', array('agreelicense' => 1, 'confirmrelease' => 1, 'lang' => $CFG->lang));
+ $url = new moodle_url($PAGE->url, array('agreelicense' => 1, 'confirmrelease' => 1, 'lang' => $CFG->lang));
echo $output->unsatisfied_dependencies_page($version, $failed, $url);
die();
}
// Detect config cache inconsistency, this happens when you switch branches on dev servers.
if ($CFG->version != $DB->get_field('config', 'value', array('name'=>'version'))) {
purge_all_caches();
- redirect(new moodle_url('/admin/index.php'), 'Config cache inconsistency detected, resetting caches...');
+ redirect(new moodle_url($PAGE->url), 'Config cache inconsistency detected, resetting caches...');
}
if (!$cache and $version > $CFG->version) { // upgrade
+ check_upgrade_key($upgradekeyhash);
+
// Warning about upgrading a test site.
$testsite = false;
if (defined('BEHAT_SITE_RUNNING')) {
$PAGE->set_heading($strplugincheck);
$PAGE->set_cacheable(false);
- $reloadurl = new moodle_url('/admin/index.php', array('confirmupgrade' => 1, 'confirmrelease' => 1, 'cache' => 0));
+ $reloadurl = new moodle_url($PAGE->url, array('confirmupgrade' => 1, 'confirmrelease' => 1, 'cache' => 0));
if ($fetchupdates) {
// No sesskey support guaranteed here, because sessions might not work yet.
}
echo $output->upgrade_plugin_check_page(core_plugin_manager::instance(), \core\update\checker::instance(),
- $version, $showallplugins, $reloadurl,
- new moodle_url('/admin/index.php', array('confirmupgrade'=>1, 'confirmrelease'=>1, 'confirmplugincheck'=>1, 'cache'=>0)));
+ $version, $showallplugins, $reloadurl, new moodle_url($PAGE->url, array(
+ 'confirmupgrade' => 1, 'confirmrelease' => 1, 'confirmplugincheck' => 1, 'cache' => 0)));
die();
} else {
// Always verify plugin dependencies!
$failed = array();
if (!core_plugin_manager::instance()->all_plugins_ok($version, $failed)) {
- $reloadurl = new moodle_url('/admin/index.php', array('confirmupgrade' => 1, 'confirmrelease' => 1, 'cache' => 0));
+ $reloadurl = new moodle_url($PAGE->url, array('confirmupgrade' => 1, 'confirmrelease' => 1, 'cache' => 0));
echo $output->unsatisfied_dependencies_page($version, $failed, $reloadurl);
die();
}
}
if (!$cache and moodle_needs_upgrading()) {
+
+ check_upgrade_key($upgradekeyhash);
+
if (!$PAGE->headerprinted) {
// means core upgrade or installation was not already done
echo $output->upgrade_plugin_check_page(core_plugin_manager::instance(), \core\update\checker::instance(),
$version, $showallplugins,
new moodle_url($PAGE->url),
- new moodle_url('/admin/index.php', array('confirmplugincheck'=>1, 'cache'=>0)));
+ new moodle_url($PAGE->url, array('confirmplugincheck' => 1, 'cache' => 0)));
die();
}
if (!core_plugin_manager::instance()->all_plugins_ok($version, $failed)) {
/** @var core_admin_renderer $output */
$output = $PAGE->get_renderer('core', 'admin');
- $reloadurl = new moodle_url('/admin/index.php', array('cache' => 0));
+ $reloadurl = new moodle_url($PAGE->url, array('cache' => 0));
echo $output->unsatisfied_dependencies_page($version, $failed, $reloadurl);
die();
}
$copyrightnotice = text_to_html(get_string('gpl3'));
$copyrightnotice = str_replace('target="_blank"', 'onclick="this.target=\'_blank\'"', $copyrightnotice); // extremely ugly validation hack
- $continue = new single_button(new moodle_url('/admin/index.php', array('lang'=>$CFG->lang, 'agreelicense'=>1)), get_string('continue'), 'get');
+ $continue = new single_button(new moodle_url($this->page->url, array(
+ 'lang' => $CFG->lang, 'agreelicense' => 1)), get_string('continue'), 'get');
$output .= $this->header();
$output .= $this->heading('<a href="http://moodle.org">Moodle</a> - Modular Object-Oriented Dynamic Learning Environment');
$output .= $this->environment_check_table($envstatus, $environment_results);
if (!$envstatus) {
- $output .= $this->upgrade_reload(new moodle_url('/admin/index.php', array('agreelicense' => 1, 'lang' => $CFG->lang)));
+ $output .= $this->upgrade_reload(new moodle_url($this->page->url, array('agreelicense' => 1, 'lang' => $CFG->lang)));
} else {
$output .= $this->notification(get_string('environmentok', 'admin'), 'notifysuccess');
- $output .= $this->continue_button(new moodle_url('/admin/index.php', array('agreelicense'=>1, 'confirmrelease'=>1, 'lang'=>$CFG->lang)));
+ $output .= $this->continue_button(new moodle_url($this->page->url, array(
+ 'agreelicense' => 1, 'confirmrelease' => 1, 'lang' => $CFG->lang)));
}
$output .= $this->footer();
public function upgrade_confirm_page($strnewversion, $maturity, $testsite) {
$output = '';
- $continueurl = new moodle_url('/admin/index.php', array('confirmupgrade' => 1, 'cache' => 0));
+ $continueurl = new moodle_url($this->page->url, array('confirmupgrade' => 1, 'cache' => 0));
$continue = new single_button($continueurl, get_string('continue'), 'get');
$cancelurl = new moodle_url('/admin/index.php');
$output .= $this->environment_check_table($envstatus, $environment_results);
if (!$envstatus) {
- $output .= $this->upgrade_reload(new moodle_url('/admin/index.php'), array('confirmupgrade' => 1, 'cache' => 0));
+ $output .= $this->upgrade_reload(new moodle_url($this->page->url, array('confirmupgrade' => 1, 'cache' => 0)));
} else {
$output .= $this->notification(get_string('environmentok', 'admin'), 'notifysuccess');
$output .= $this->box(get_string('langpackwillbeupdated', 'admin'), 'generalbox', 'notice');
}
- $output .= $this->continue_button(new moodle_url('/admin/index.php', array('confirmupgrade' => 1, 'confirmrelease' => 1, 'cache' => 0)));
+ $output .= $this->continue_button(new moodle_url($this->page->url, array(
+ 'confirmupgrade' => 1, 'confirmrelease' => 1, 'cache' => 0)));
}
$output .= $this->footer();
$out = $this->output->container_start('nonehighlighted', 'plugins-check-info');
$out .= $this->output->heading(get_string('nonehighlighted', 'core_plugin'));
if (empty($options['full'])) {
- $out .= html_writer::link(new moodle_url('/admin/index.php',
+ $out .= html_writer::link(new moodle_url($this->page->url,
array('confirmupgrade' => 1, 'confirmrelease' => 1, 'showallplugins' => 1, 'cache' => 0)),
get_string('nonehighlightedinfo', 'core_plugin'));
}
} else {
$out = $this->output->container_start('somehighlighted', 'plugins-check-info');
- $out .= $this->output->heading(get_string('somehighlighted', 'core_plugin', $sumofhighlighted));
if (empty($options['full'])) {
- $out .= html_writer::link(new moodle_url('/admin/index.php',
+ $out .= $this->output->heading(get_string('somehighlighted', 'core_plugin', $sumofhighlighted));
+ $out .= html_writer::link(new moodle_url($this->page->url,
array('confirmupgrade' => 1, 'confirmrelease' => 1, 'showallplugins' => 1, 'cache' => 0)),
get_string('somehighlightedinfo', 'core_plugin'));
} else {
- $out .= html_writer::link(new moodle_url('/admin/index.php',
+ $out .= $this->output->heading(get_string('somehighlightedall', 'core_plugin', $sumofhighlighted));
+ $out .= html_writer::link(new moodle_url($this->page->url,
array('confirmupgrade' => 1, 'confirmrelease' => 1, 'showallplugins' => 0, 'cache' => 0)),
get_string('somehighlightedonly', 'core_plugin'));
}
return $output;
}
+
+ /**
+ * Render a simple page for providing the upgrade key.
+ *
+ * @param moodle_url|string $url
+ * @return string
+ */
+ public function upgradekey_form_page($url) {
+
+ $output = '';
+ $output .= $this->header();
+ $output .= $this->container_start('upgradekeyreq');
+ $output .= $this->heading(get_string('upgradekeyreq', 'core_admin'));
+ $output .= html_writer::start_tag('form', array('method' => 'POST', 'action' => $url));
+ $output .= html_writer::empty_tag('input', array('name' => 'upgradekey', 'type' => 'password'));
+ $output .= html_writer::empty_tag('input', array('value' => get_string('submit'), 'type' => 'submit'));
+ $output .= html_writer::end_tag('form');
+ $output .= $this->container_end();
+ $output .= $this->footer();
+
+ return $output;
+ }
}
--- /dev/null
+<?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/>.
+
+/**
+ * This file processes AJAX requests and returns JSON
+ *
+ * This is a server part of yui permissions manager module
+ *
+ * @package core_role
+ * @copyright 2015 Martin Mastny
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+define('AJAX_SCRIPT', true);
+
+require(__DIR__ . '/../../config.php');
+
+$contextid = required_param('contextid', PARAM_INT);
+$getroles = optional_param('getroles', 0, PARAM_BOOL);
+
+list($context, $course, $cm) = get_context_info_array($contextid);
+
+require_login($course, false, $cm);
+require_capability('moodle/role:review', $context);
+require_sesskey();
+
+list($overridableroles, $overridecounts, $nameswithcounts) = get_overridable_roles($context,
+ ROLENAME_BOTH, true);
+
+if ($getroles) {
+ echo json_encode($overridableroles);
+ die();
+}
+
+$capability = required_param('capability', PARAM_CAPABILITY);
+$roleid = required_param('roleid', PARAM_INT);
+$action = required_param('action', PARAM_ALPHA);
+
+$capability = $DB->get_record('capabilities', array('name' => $capability), '*', MUST_EXIST);
+
+if (!isset($overridableroles[$roleid])) {
+ throw new moodle_exception('invalidarguments');
+}
+
+if (!has_capability('moodle/role:override', $context)) {
+ if (!has_capability('moodle/role:safeoverride', $context) || !is_safe_capability($capability)) {
+ require_capability('moodle/role:override', $context);
+ }
+}
+
+switch ($action) {
+ case 'allow':
+ role_change_permission($roleid, $context, $capability->name, CAP_ALLOW);
+ break;
+ case 'prevent':
+ role_change_permission($roleid, $context, $capability->name, CAP_PREVENT);
+ break;
+ case 'prohibit':
+ role_change_permission($roleid, $context, $capability->name, CAP_PROHIBIT);
+ break;
+ case 'unprohibit':
+ role_change_permission($roleid, $context, $capability->name, CAP_INHERIT);
+ break;
+ default:
+ throw new moodle_exception('invalidarguments');
+}
+
+echo json_encode($action);
+die();
\ No newline at end of file
$component = $capability->component;
// Start the row.
- echo '<tr class="' . implode(' ', array_unique(array_merge(array('rolecap'),
- $this->get_row_classes($capability)))) . '">';
+ $rowattributes = $this->get_row_attributes($capability);
+ // Handle class attributes same as other.
+ $rowclasses = array_unique(array_merge(array('rolecap'), $this->get_row_classes($capability)));
+ if (array_key_exists('class', $rowattributes)) {
+ $rowclasses = array_unique(array_merge($rowclasses, array($rowattributes['class'])));
+ }
+ $rowattributes['class'] = implode(' ', $rowclasses);
// Table cell for the capability name.
- echo '<th scope="row" class="name"><span class="cap-desc">' . get_capability_docs_link($capability) .
+ $contents = '<th scope="row" class="name"><span class="cap-desc">' . get_capability_docs_link($capability) .
'<span class="cap-name">' . $capability->name . '</span></span></th>';
// Add the cells specific to this table.
- $this->add_row_cells($capability);
+ $contents .= $this->add_row_cells($capability);
- // End the row.
- echo "</tr>\n";
+ echo html_writer::tag('tr', $contents, $rowattributes);
}
// End of the table.
return array();
}
+ /**
+ * For subclasses to override. Additional attributes to be added to
+ * each table row for the capability
+ *
+ * @param stdClass $capability the capability this row relates to.
+ * @return array attribute names and their values.
+ */
+ protected function get_row_attributes($capability) {
+ return array();
+ }
+
/**
* For subclasses to override. Output the data cells for this capability. The
* capability name cell will already have been output.
* You can rely on get_row_classes always being called before add_row_cells.
*
* @param stdClass $capability the capability this row relates to.
+ * @return string html of row cells
*/
protected abstract function add_row_cells($capability);
}
protected abstract function add_permission_cells($capability);
protected function add_row_cells($capability) {
- $this->add_permission_cells($capability);
+ $cells = $this->add_permission_cells($capability);
// One cell for each possible risk.
foreach ($this->allrisks as $riskname => $risk) {
- echo '<td class="risk ' . str_replace('risk', '', $riskname) . '">';
+ $cells .= '<td class="risk ' . str_replace('risk', '', $riskname) . '">';
if ($risk & (int)$capability->riskbitmask) {
- echo $this->get_risk_icon($riskname);
+ $cells .= $this->get_risk_icon($riskname);
}
- echo '</td>';
+ $cells .= '</td>';
}
+ return $cells;
}
/**
$a->fullname = $this->fullname;
$a->capability = $capability->name;
$a->context = $this->contextname;
- echo '<td>' . $result . '</td>';
+ return '<td>' . $result . '</td>';
}
}
protected function add_permission_cells($capability) {
// One cell for each possible permission.
+ $content = '';
foreach ($this->displaypermissions as $perm => $permname) {
$strperm = $this->strperms[$permname];
$extraclass = '';
if ($this->permissions[$capability->name] == $perm) {
$checked = 'checked="checked" ';
}
- echo '<td class="' . $permname . $extraclass . '">';
- echo '<label><input type="radio" name="' . $capability->name .
+ $content .= '<td class="' . $permname . $extraclass . '">';
+ $content .= '<label><input type="radio" name="' . $capability->name .
'" value="' . $perm . '" ' . $checked . '/> ';
- echo '<span class="note">' . $strperm . '</span>';
- echo '</label></td>';
+ $content .= '<span class="note">' . $strperm . '</span>';
+ $content .= '</label></td>';
}
+ return $content;
}
}
$perm = $this->permissions[$capability->name];
$permname = $this->allpermissions[$perm];
$defaultperm = $this->allpermissions[$this->parentpermissions[$capability->name]];
- echo '<td class="' . $permname . '">';
+ $content = '<td class="' . $permname . '">';
if ($perm == CAP_ALLOW || $perm == CAP_INHERIT) {
$checked = '';
if ($perm == CAP_ALLOW) {
$checked = 'checked="checked" ';
}
- echo '<input type="hidden" name="' . $capability->name . '" value="' . CAP_INHERIT . '" />';
- echo '<label><input type="checkbox" name="' . $capability->name .
+ $content .= '<input type="hidden" name="' . $capability->name . '" value="' . CAP_INHERIT . '" />';
+ $content .= '<label><input type="checkbox" name="' . $capability->name .
'" value="' . CAP_ALLOW . '" ' . $checked . '/> ' . $this->strallow . '</label>';
} else {
- echo '<input type="hidden" name="' . $capability->name . '" value="' . $perm . '" />';
- echo $this->strperms[$permname] . '<span class="note">' . $this->stradvmessage . '</span>';
+ $content .= '<input type="hidden" name="' . $capability->name . '" value="' . $perm . '" />';
+ $content .= $this->strperms[$permname] . '<span class="note">' . $this->stradvmessage . '</span>';
}
- echo '</td>';
+ $content .= '</td>';
+ return $content;
}
}
}
// One cell for each possible permission.
+ $content = '';
foreach ($this->displaypermissions as $perm => $permname) {
$strperm = $this->strperms[$permname];
$extraclass = '';
if ($this->permissions[$capability->name] == $perm) {
$checked = 'checked="checked" ';
}
- echo '<td class="' . $permname . $extraclass . '">';
- echo '<label><input type="radio" name="' . $capability->name .
+ $content .= '<td class="' . $permname . $extraclass . '">';
+ $content .= '<label><input type="radio" name="' . $capability->name .
'" value="' . $perm . '" ' . $checked . $disabled . '/> ';
if ($perm == CAP_INHERIT) {
$inherited = $this->parentpermissions[$capability->name];
}
$strperm .= ' (' . $inherited . ')';
}
- echo '<span class="note">' . $strperm . '</span>';
- echo '</label></td>';
+ $content .= '<span class="note">' . $strperm . '</span>';
+ $content .= '</label></td>';
}
+ return $content;
}
}
protected function add_row_cells($capability) {
global $OUTPUT, $PAGE;
+ $renderer = $PAGE->get_renderer('core');
+ $adminurl = new moodle_url("/admin/");
$context = $this->context;
$contextid = $this->context->id;
$overridableroles = $this->overridableroles;
$roles = $this->roles;
-
list($needed, $forbidden) = get_roles_with_cap_in_context($context, $capability->name);
$neededroles = array();
$forbiddenroles = array();
foreach ($roles as $id => $name) {
if (isset($needed[$id])) {
- $neededroles[$id] = $roles[$id];
+ $templatecontext = array("rolename" => $name, "roleid" => $id, "a