Permalink
Browse files

MDL-36455 blocks: removed ability to add blocks to the My Moodle page…

… that did not make sense in that context
  • Loading branch information...
1 parent 322af44 commit a8f85379659089e2c0d6b140dc649a0120322099 @markn86 markn86 committed with Sam Hemelryk Nov 29, 2012
Showing with 521 additions and 88 deletions.
  1. +4 −0 blocks/completionstatus/block_completionstatus.php
  2. +0 −10 blocks/completionstatus/db/access.php
  3. +69 −0 blocks/completionstatus/db/upgrade.php
  4. +0 −1 blocks/completionstatus/lang/en/block_completionstatus.php
  5. +2 −2 blocks/completionstatus/version.php
  6. +4 −0 blocks/course_summary/block_course_summary.php
  7. +0 −10 blocks/course_summary/db/access.php
  8. +69 −0 blocks/course_summary/db/upgrade.php
  9. +0 −1 blocks/course_summary/lang/en/block_course_summary.php
  10. +1 −1 blocks/course_summary/version.php
  11. +5 −0 blocks/glossary_random/block_glossary_random.php
  12. +0 −10 blocks/glossary_random/db/access.php
  13. +69 −0 blocks/glossary_random/db/upgrade.php
  14. +0 −1 blocks/glossary_random/lang/en/block_glossary_random.php
  15. +1 −1 blocks/glossary_random/version.php
  16. +1 −1 blocks/mentees/block_mentees.php
  17. +0 −10 blocks/mentees/db/access.php
  18. +69 −0 blocks/mentees/db/upgrade.php
  19. +0 −1 blocks/mentees/lang/en/block_mentees.php
  20. +1 −1 blocks/mentees/version.php
  21. +4 −0 blocks/news_items/block_news_items.php
  22. +0 −10 blocks/news_items/db/access.php
  23. +69 −0 blocks/news_items/db/upgrade.php
  24. +0 −1 blocks/news_items/lang/en/block_news_items.php
  25. +1 −1 blocks/news_items/version.php
  26. +7 −1 blocks/online_users/block_online_users.php
  27. +0 −10 blocks/online_users/db/access.php
  28. +69 −0 blocks/online_users/db/upgrade.php
  29. +0 −1 blocks/online_users/lang/en/block_online_users.php
  30. +1 −1 blocks/online_users/version.php
  31. +5 −1 blocks/selfcompletion/block_selfcompletion.php
  32. +0 −10 blocks/selfcompletion/db/access.php
  33. +69 −0 blocks/selfcompletion/db/upgrade.php
  34. +0 −1 blocks/selfcompletion/lang/en/block_selfcompletion.php
  35. +1 −1 blocks/selfcompletion/version.php
View
4 blocks/completionstatus/block_completionstatus.php
@@ -38,6 +38,10 @@ public function init() {
$this->title = get_string('pluginname', 'block_completionstatus');
}
+ function applicable_formats() {
+ return array('all' => true, 'mod' => false, 'tag' => false, 'my' => false);
+ }
+
public function get_content() {
global $USER;
View
10 blocks/completionstatus/db/access.php
@@ -26,16 +26,6 @@
$capabilities = array(
- 'block/completionstatus:myaddinstance' => array(
- 'captype' => 'write',
- 'contextlevel' => CONTEXT_SYSTEM,
- 'archetypes' => array(
- 'user' => CAP_ALLOW
- ),
-
- 'clonepermissionsfrom' => 'moodle/my:manageblocks'
- ),
-
'block/completionstatus:addinstance' => array(
'riskbitmask' => RISK_SPAM | RISK_XSS,
View
69 blocks/completionstatus/db/upgrade.php
@@ -0,0 +1,69 @@
+<?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 completion status 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_completionstatus_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' => 'completionstatus', '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, 'completionstatus');
+ }
+
+
+ return true;
+}
View
1 blocks/completionstatus/lang/en/block_completionstatus.php
@@ -25,7 +25,6 @@
$string['completionprogressdetails'] = 'Completion progress details';
$string['completionstatus:addinstance'] = 'Add a new course completion status block';
-$string['completionstatus:myaddinstance'] = 'Add a new course completion status block to the My Moodle page';
$string['criteriagroup'] = 'Criteria group';
$string['firstofsecond'] = '{$a->first} of {$a->second}';
$string['pluginname'] = 'Course completion status';
View
4 blocks/completionstatus/version.php
@@ -26,7 +26,7 @@
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2012112900; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->version = 2012112901; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2012112900; // Requires this Moodle version
$plugin->component = 'block_completionstatus';
-$plugin->dependencies = array('report_completion' => 2012112900);
+$plugin->dependencies = array('report_completion' => 2012112900);
View
4 blocks/course_summary/block_course_summary.php
@@ -5,6 +5,10 @@ function init() {
$this->title = get_string('pluginname', 'block_course_summary');
}
+ function applicable_formats() {
+ return array('all' => true, 'mod' => false, 'tag' => false, 'my' => false);
+ }
+
function specialization() {
if($this->page->pagetype == PAGE_COURSE_VIEW && $this->page->course->id != SITEID) {
$this->title = get_string('coursesummary', 'block_course_summary');
View
10 blocks/course_summary/db/access.php
@@ -26,16 +26,6 @@
$capabilities = array(
- 'block/course_summary:myaddinstance' => array(
- 'captype' => 'write',
- 'contextlevel' => CONTEXT_SYSTEM,
- 'archetypes' => array(
- 'user' => CAP_ALLOW
- ),
-
- 'clonepermissionsfrom' => 'moodle/my:manageblocks'
- ),
-
'block/course_summary:addinstance' => array(
'riskbitmask' => RISK_SPAM | RISK_XSS,
View
69 blocks/course_summary/db/upgrade.php
@@ -0,0 +1,69 @@
+<?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 course summary 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_course_summary_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' => 'course_summary', '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, 'course_summary');
+ }
+
+
+ return true;
+}
View
1 blocks/course_summary/lang/en/block_course_summary.php
@@ -25,5 +25,4 @@
$string['coursesummary'] = 'Course summary';
$string['course_summary:addinstance'] = 'Add a new course/site description block';
-$string['course_summary:myaddinstance'] = 'Add a new course/site description block to the My Moodle page';
$string['pluginname'] = 'Course/Site description';
View
2 blocks/course_summary/version.php
@@ -25,6 +25,6 @@
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2012112900; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->version = 2012112901; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2012112900; // Requires this Moodle version
$plugin->component = 'block_course_summary'; // Full name of the plugin (used for diagnostics)
View
5 blocks/glossary_random/block_glossary_random.php
@@ -5,10 +5,15 @@
define('BGR_NEXTONE', '2');
class block_glossary_random extends block_base {
+
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,16 +26,6 @@
$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
@@ -0,0 +1,69 @@
+<?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,7 +28,6 @@
$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 = 2012112900; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->version = 2012112901; // 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);
+ return array('all' => true, 'tag' => false, 'my' => false);
}
function specialization() {
View
10 blocks/mentees/db/access.php
@@ -26,16 +26,6 @@
$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
@@ -0,0 +1,69 @@
+<?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,6 +27,5 @@
$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 = 2012112900; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->version = 2012112901; // 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,6 +5,10 @@ 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,16 +26,6 @@
$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
@@ -0,0 +1,69 @@
+<?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,5 +24,4 @@
*/
$string['news_items:addinstance'] = 'Add a new latest news block';
-$string['news_items:myaddinstance'] = 'Add a new navigation 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 = 2012112900; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->version = 2012112901; // 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
8 blocks/online_users/block_online_users.php
@@ -10,7 +10,13 @@ function init() {
$this->title = get_string('pluginname','block_online_users');
}
- function has_config() {return true;}
+ function applicable_formats() {
+ return array('all' => true, 'mod' => false, 'tag' => false, 'my' => false);
+ }
+
+ function has_config() {
+ return true;
+ }
function get_content() {
global $USER, $CFG, $DB, $OUTPUT;
View
10 blocks/online_users/db/access.php
@@ -26,16 +26,6 @@
$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
@@ -0,0 +1,69 @@
+<?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,7 +25,6 @@
$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 = 2012112900; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->version = 2012112901; // 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)
View
6 blocks/selfcompletion/block_selfcompletion.php
@@ -36,7 +36,11 @@
class block_selfcompletion extends block_base {
public function init() {
- $this->title = get_string('pluginname', 'block_selfcompletion');
+ $this->title = get_string('pluginname', 'block_selfcompletion');
+ }
+
+ function applicable_formats() {
+ return array('all' => true, 'mod' => false, 'tag' => false, 'my' => false);
}
public function get_content() {
View
10 blocks/selfcompletion/db/access.php
@@ -26,16 +26,6 @@
$capabilities = array(
- 'block/selfcompletion:myaddinstance' => array(
- 'captype' => 'write',
- 'contextlevel' => CONTEXT_SYSTEM,
- 'archetypes' => array(
- 'user' => CAP_ALLOW
- ),
-
- 'clonepermissionsfrom' => 'moodle/my:manageblocks'
- ),
-
'block/selfcompletion:addinstance' => array(
'riskbitmask' => RISK_SPAM | RISK_XSS,
View
69 blocks/selfcompletion/db/upgrade.php
@@ -0,0 +1,69 @@
+<?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 self completion 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_selfcompletion_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' => 'selfcompletion', '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, 'selfcompletion');
+ }
+
+
+ return true;
+}
View
1 blocks/selfcompletion/lang/en/block_selfcompletion.php
@@ -28,4 +28,3 @@
$string['pluginname'] = 'Self completion';
$string['selfcompletionnotenabled'] = 'The self completion criteria has not been enabled for this course';
$string['selfcompletion:addinstance'] = 'Add a new self completion block';
-$string['selfcompletion:myaddinstance'] = 'Add a new self completion block to the My Moodle page';
View
2 blocks/selfcompletion/version.php
@@ -25,6 +25,6 @@
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2012112900; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->version = 2012112901; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2012112900; // Requires this Moodle version
$plugin->component = 'block_selfcompletion'; // Full name of the plugin (used for diagnostics)

0 comments on commit a8f8537

Please sign in to comment.