Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-37414 blocks: re-added the ability to add some blocks to the My M…

…oodle
  • Loading branch information...
commit 528b5b7dac58cc30138c4294f3c9b35f6fb76992 1 parent 7def533
@markn86 markn86 authored
View
4 blocks/glossary_random/block_glossary_random.php
@@ -10,10 +10,6 @@ function init() {
$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;
View
10 blocks/glossary_random/db/access.php
@@ -26,6 +26,16 @@
$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,
View
69 blocks/glossary_random/db/upgrade.php
@@ -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;
-}
View
1  blocks/glossary_random/lang/en/block_glossary_random.php
@@ -28,6 +28,7 @@
$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';
View
2  blocks/glossary_random/version.php
@@ -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)
View
2  blocks/mentees/block_mentees.php
@@ -7,7 +7,7 @@ function init() {
}
function applicable_formats() {
- return array('all' => true, 'tag' => false, 'my' => false);
+ return array('all' => true, 'tag' => false);
}
function specialization() {
View
10 blocks/mentees/db/access.php
@@ -26,6 +26,16 @@
$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,
View
69 blocks/mentees/db/upgrade.php
@@ -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;
-}
View
1  blocks/mentees/lang/en/block_mentees.php
@@ -27,5 +27,6 @@
$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';
View
2  blocks/mentees/version.php
@@ -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)
View
4 blocks/news_items/block_news_items.php
@@ -5,10 +5,6 @@ function init() {
$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;
View
10 blocks/news_items/db/access.php
@@ -26,6 +26,16 @@
$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,
View
69 blocks/news_items/db/upgrade.php
@@ -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;
-}
View
1  blocks/news_items/lang/en/block_news_items.php
@@ -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';
View
2  blocks/news_items/version.php
@@ -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)
View
4 blocks/online_users/block_online_users.php
@@ -10,10 +10,6 @@ function init() {
$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;
}
View
10 blocks/online_users/db/access.php
@@ -26,6 +26,16 @@
$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,
View
69 blocks/online_users/db/upgrade.php
@@ -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;
-}
View
1  blocks/online_users/lang/en/block_online_users.php
@@ -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';
View
2  blocks/online_users/version.php
@@ -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)
Please sign in to comment.
Something went wrong with that request. Please try again.