mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 13:38:32 +01:00
MDL-37414 blocks: re-added the ability to add some blocks to the My Moodle
This commit is contained in:
parent
a5ec499521
commit
d448625682
@ -11,10 +11,6 @@ class block_glossary_random extends block_base {
|
||||
$this->title = get_string('pluginname','block_glossary_random');
|
||||
}
|
||||
|
||||
function applicable_formats() {
|
||||
return array('all' => true, 'mod' => false, 'tag' => false, 'my' => false);
|
||||
}
|
||||
|
||||
function specialization() {
|
||||
global $CFG, $DB;
|
||||
|
||||
|
@ -26,6 +26,16 @@ defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$capabilities = array(
|
||||
|
||||
'block/glossary_random:myaddinstance' => array(
|
||||
'captype' => 'write',
|
||||
'contextlevel' => CONTEXT_SYSTEM,
|
||||
'archetypes' => array(
|
||||
'user' => CAP_ALLOW
|
||||
),
|
||||
|
||||
'clonepermissionsfrom' => 'moodle/my:manageblocks'
|
||||
),
|
||||
|
||||
'block/glossary_random:addinstance' => array(
|
||||
'riskbitmask' => RISK_SPAM | RISK_XSS,
|
||||
|
||||
|
@ -1,69 +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/>.
|
||||
|
||||
/**
|
||||
* This file keeps track of upgrades to the glossary random 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 installation 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.
|
||||
*
|
||||
* @since 2.0
|
||||
* @package blocks
|
||||
* @copyright 2012 Mark Nelson <markn@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
/**
|
||||
* Handles upgrading instances of this block.
|
||||
*
|
||||
* @param int $oldversion
|
||||
* @param object $block
|
||||
*/
|
||||
function xmldb_block_glossary_random_upgrade($oldversion, $block) {
|
||||
global $DB;
|
||||
|
||||
// Moodle v2.4.0 release upgrade line
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2012112901) {
|
||||
// Get the instances of this block.
|
||||
if ($blocks = $DB->get_records('block_instances', array('blockname' => 'glossary_random', 'pagetypepattern' => 'my-index'))) {
|
||||
// Loop through and remove them from the My Moodle page.
|
||||
foreach ($blocks as $block) {
|
||||
blocks_delete_instance($block);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Savepoint reached.
|
||||
upgrade_block_savepoint(true, 2012112901, 'glossary_random');
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
@ -28,6 +28,7 @@ $string['askaddentry'] = 'When users can add entries to the glossary, show a lin
|
||||
$string['askinvisible'] = 'When users cannot edit or view the glossary, show this text (without link)';
|
||||
$string['askviewglossary'] = 'When users can view the glossary but not add entries, show a link with this text';
|
||||
$string['glossary_random:addinstance'] = 'Add a new random glossary entry block';
|
||||
$string['glossary_random:myaddinstance'] = 'Add a new random glossary entry block to the My Moodle page';
|
||||
$string['intro'] = 'Make sure you have at least one glossary with at least one entry added to this course. Then you can adjust the following settings';
|
||||
$string['invisible'] = '(to be continued)';
|
||||
$string['lastmodified'] = 'Last modified entry';
|
||||
|
@ -25,6 +25,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2012112901; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->version = 2012112902; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2012112900; // Requires this Moodle version
|
||||
$plugin->component = 'block_glossary_random'; // Full name of the plugin (used for diagnostics)
|
||||
|
@ -7,7 +7,7 @@ class block_mentees extends block_base {
|
||||
}
|
||||
|
||||
function applicable_formats() {
|
||||
return array('all' => true, 'tag' => false, 'my' => false);
|
||||
return array('all' => true, 'tag' => false);
|
||||
}
|
||||
|
||||
function specialization() {
|
||||
|
@ -26,6 +26,16 @@ defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$capabilities = array(
|
||||
|
||||
'block/mentees:myaddinstance' => array(
|
||||
'captype' => 'write',
|
||||
'contextlevel' => CONTEXT_SYSTEM,
|
||||
'archetypes' => array(
|
||||
'user' => CAP_ALLOW
|
||||
),
|
||||
|
||||
'clonepermissionsfrom' => 'moodle/my:manageblocks'
|
||||
),
|
||||
|
||||
'block/mentees:addinstance' => array(
|
||||
'riskbitmask' => RISK_SPAM | RISK_XSS,
|
||||
|
||||
|
@ -1,69 +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/>.
|
||||
|
||||
/**
|
||||
* This file keeps track of upgrades to the mentees 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 installation 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.
|
||||
*
|
||||
* @since 2.0
|
||||
* @package blocks
|
||||
* @copyright 2012 Mark Nelson <markn@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
/**
|
||||
* Handles upgrading instances of this block.
|
||||
*
|
||||
* @param int $oldversion
|
||||
* @param object $block
|
||||
*/
|
||||
function xmldb_block_mentees_upgrade($oldversion, $block) {
|
||||
global $DB;
|
||||
|
||||
// Moodle v2.4.0 release upgrade line
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2012112901) {
|
||||
// Get the instances of this block.
|
||||
if ($blocks = $DB->get_records('block_instances', array('blockname' => 'mentees', 'pagetypepattern' => 'my-index'))) {
|
||||
// Loop through and remove them from the My Moodle page.
|
||||
foreach ($blocks as $block) {
|
||||
blocks_delete_instance($block);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Savepoint reached.
|
||||
upgrade_block_savepoint(true, 2012112901, 'mentees');
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
@ -27,5 +27,6 @@ $string['configtitle'] = 'Block title';
|
||||
$string['configtitleblankhides'] = 'Block title (no title if blank)';
|
||||
$string['leaveblanktohide'] = 'leave blank to hide the title';
|
||||
$string['mentees:addinstance'] = 'Add a new mentees block';
|
||||
$string['mentees:myaddinstance'] = 'Add a new mentees block to the My Moodle page';
|
||||
$string['newmenteesblock'] = '(new Mentees block)';
|
||||
$string['pluginname'] = 'Mentees';
|
||||
|
@ -25,6 +25,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2012112901; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->version = 2012112902; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2012112900; // Requires this Moodle version
|
||||
$plugin->component = 'block_mentees'; // Full name of the plugin (used for diagnostics)
|
||||
|
@ -5,10 +5,6 @@ class block_news_items extends block_base {
|
||||
$this->title = get_string('pluginname', 'block_news_items');
|
||||
}
|
||||
|
||||
function applicable_formats() {
|
||||
return array('all' => true, 'mod' => false, 'tag' => false, 'my' => false);
|
||||
}
|
||||
|
||||
function get_content() {
|
||||
global $CFG, $USER;
|
||||
|
||||
|
@ -26,6 +26,16 @@ defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$capabilities = array(
|
||||
|
||||
'block/news_items:myaddinstance' => array(
|
||||
'captype' => 'write',
|
||||
'contextlevel' => CONTEXT_SYSTEM,
|
||||
'archetypes' => array(
|
||||
'user' => CAP_ALLOW
|
||||
),
|
||||
|
||||
'clonepermissionsfrom' => 'moodle/my:manageblocks'
|
||||
),
|
||||
|
||||
'block/news_items:addinstance' => array(
|
||||
'riskbitmask' => RISK_SPAM | RISK_XSS,
|
||||
|
||||
|
@ -1,69 +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/>.
|
||||
|
||||
/**
|
||||
* This file keeps track of upgrades to the latest news 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 installation 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.
|
||||
*
|
||||
* @since 2.0
|
||||
* @package blocks
|
||||
* @copyright 2012 Mark Nelson <markn@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
/**
|
||||
* Handles upgrading instances of this block.
|
||||
*
|
||||
* @param int $oldversion
|
||||
* @param object $block
|
||||
*/
|
||||
function xmldb_block_news_items_upgrade($oldversion, $block) {
|
||||
global $DB;
|
||||
|
||||
// Moodle v2.4.0 release upgrade line
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2012112901) {
|
||||
// Get the instances of this block.
|
||||
if ($blocks = $DB->get_records('block_instances', array('blockname' => 'news_items', 'pagetypepattern' => 'my-index'))) {
|
||||
// Loop through and remove them from the My Moodle page.
|
||||
foreach ($blocks as $block) {
|
||||
blocks_delete_instance($block);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Savepoint reached.
|
||||
upgrade_block_savepoint(true, 2012112901, 'news_items');
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
@ -24,4 +24,5 @@
|
||||
*/
|
||||
|
||||
$string['news_items:addinstance'] = 'Add a new latest news block';
|
||||
$string['news_items:myaddinstance'] = 'Add a new latest news block to the My Moodle page';
|
||||
$string['pluginname'] = 'Latest news';
|
||||
|
@ -25,6 +25,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2012112901; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->version = 2012112902; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2012112900; // Requires this Moodle version
|
||||
$plugin->component = 'block_news_items'; // Full name of the plugin (used for diagnostics)
|
||||
|
@ -10,10 +10,6 @@ class block_online_users extends block_base {
|
||||
$this->title = get_string('pluginname','block_online_users');
|
||||
}
|
||||
|
||||
function applicable_formats() {
|
||||
return array('all' => true, 'mod' => false, 'tag' => false, 'my' => false);
|
||||
}
|
||||
|
||||
function has_config() {
|
||||
return true;
|
||||
}
|
||||
|
@ -26,6 +26,16 @@ defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$capabilities = array(
|
||||
|
||||
'block/online_users:myaddinstance' => array(
|
||||
'captype' => 'write',
|
||||
'contextlevel' => CONTEXT_SYSTEM,
|
||||
'archetypes' => array(
|
||||
'user' => CAP_ALLOW
|
||||
),
|
||||
|
||||
'clonepermissionsfrom' => 'moodle/my:manageblocks'
|
||||
),
|
||||
|
||||
'block/online_users:addinstance' => array(
|
||||
'riskbitmask' => RISK_SPAM | RISK_XSS,
|
||||
|
||||
|
@ -1,69 +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/>.
|
||||
|
||||
/**
|
||||
* This file keeps track of upgrades to the online users 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 installation 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.
|
||||
*
|
||||
* @since 2.0
|
||||
* @package blocks
|
||||
* @copyright 2012 Mark Nelson <markn@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
/**
|
||||
* Handles upgrading instances of this block.
|
||||
*
|
||||
* @param int $oldversion
|
||||
* @param object $block
|
||||
*/
|
||||
function xmldb_block_online_users_upgrade($oldversion, $block) {
|
||||
global $DB;
|
||||
|
||||
// Moodle v2.4.0 release upgrade line
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2012112901) {
|
||||
// Get the instances of this block.
|
||||
if ($blocks = $DB->get_records('block_instances', array('blockname' => 'online_users', 'pagetypepattern' => 'my-index'))) {
|
||||
// Loop through and remove them from the My Moodle page.
|
||||
foreach ($blocks as $block) {
|
||||
blocks_delete_instance($block);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Savepoint reached.
|
||||
upgrade_block_savepoint(true, 2012112901, 'online_users');
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
@ -25,6 +25,7 @@
|
||||
|
||||
$string['configtimetosee'] = 'Number of minutes determining the period of inactivity after which a user is no longer considered to be online.';
|
||||
$string['online_users:addinstance'] = 'Add a new online users block';
|
||||
$string['online_users:myaddinstance'] = 'Add a new online users block to the My Moodle page';
|
||||
$string['online_users:viewlist'] = 'View list of online users';
|
||||
$string['periodnminutes'] = 'last {$a} minutes';
|
||||
$string['pluginname'] = 'Online users';
|
||||
|
@ -25,6 +25,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2012112901; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->version = 2012112902; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2012112900; // Requires this Moodle version
|
||||
$plugin->component = 'block_online_users'; // Full name of the plugin (used for diagnostics)
|
||||
|
Loading…
x
Reference in New Issue
Block a user