Skip to content

Commit

Permalink
MDL-36455 blocks: removed ability to add blocks to the My Moodle page…
Browse files Browse the repository at this point in the history
… that did not make sense in that context
  • Loading branch information
mdjnelson committed Dec 18, 2012
1 parent 2075186 commit bfe2041
Show file tree
Hide file tree
Showing 35 changed files with 521 additions and 88 deletions.
4 changes: 4 additions & 0 deletions blocks/completionstatus/block_completionstatus.php
Expand Up @@ -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;

Expand Down
10 changes: 0 additions & 10 deletions blocks/completionstatus/db/access.php
Expand Up @@ -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,

Expand Down
69 changes: 69 additions & 0 deletions 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;
}
1 change: 0 additions & 1 deletion blocks/completionstatus/lang/en/block_completionstatus.php
Expand Up @@ -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';
Expand Down
4 changes: 2 additions & 2 deletions blocks/completionstatus/version.php
Expand Up @@ -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);
4 changes: 4 additions & 0 deletions blocks/course_summary/block_course_summary.php
Expand Up @@ -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');
Expand Down
10 changes: 0 additions & 10 deletions blocks/course_summary/db/access.php
Expand Up @@ -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,

Expand Down
69 changes: 69 additions & 0 deletions 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;
}
1 change: 0 additions & 1 deletion blocks/course_summary/lang/en/block_course_summary.php
Expand Up @@ -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';
2 changes: 1 addition & 1 deletion blocks/course_summary/version.php
Expand Up @@ -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)
5 changes: 5 additions & 0 deletions blocks/glossary_random/block_glossary_random.php
Expand Up @@ -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;

Expand Down
10 changes: 0 additions & 10 deletions blocks/glossary_random/db/access.php
Expand Up @@ -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,

Expand Down
69 changes: 69 additions & 0 deletions 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;
}
1 change: 0 additions & 1 deletion blocks/glossary_random/lang/en/block_glossary_random.php
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion blocks/glossary_random/version.php
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion blocks/mentees/block_mentees.php
Expand Up @@ -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() {
Expand Down
10 changes: 0 additions & 10 deletions blocks/mentees/db/access.php
Expand Up @@ -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,

Expand Down

0 comments on commit bfe2041

Please sign in to comment.