$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;
$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,
--- /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 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;
+}
\ No newline at end of file
$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';
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);
\ No newline at end of file
+$plugin->dependencies = array('report_completion' => 2012112900);
$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');
$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,
--- /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 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;
+}
\ No newline at end of file
$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';
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)
}, this);
// Add a close icon
// Must set the image src seperatly of we get an error with XML strict headers
- var closeicon = Y.Node.create('<span class="hidepanelicon" tabindex="0"><img alt="" /></span>');
+ var closeicon = Y.Node.create('<span class="hidepanelicon" tabindex="0"><img alt="'+M.str.block.hidepanel+'" title="'+M.str.block.hidedockpanel+'" /></span>');
closeicon.one('img').setAttribute('src', M.util.image_url('t/dockclose', 'moodle'));
closeicon.on('forceclose|click', this.hide, this);
closeicon.on('dock:actionkey',this.hide, this, {actions:{enter:true,toggle:true}});
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;
$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,
--- /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 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;
+}
\ No newline at end of file
$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';
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)
}
function applicable_formats() {
- return array('all' => true, 'tag' => false);
+ return array('all' => true, 'tag' => false, 'my' => false);
}
function specialization() {
$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,
--- /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 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;
+}
\ No newline at end of file
$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';
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)
$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;
$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,
--- /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 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;
+}
\ No newline at end of file
*/
$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';
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)
$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;
$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,
--- /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 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;
+}
\ No newline at end of file
$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';
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)
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() {
$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,
--- /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 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;
+}
\ No newline at end of file
$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';
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)
*/
public function purge() {
$this->flush_store_by_id($this->storeid);
+ $this->store = &self::register_store_id($this->storeid);
}
/**
// Integrate into the admin tree only if the user can edit categories at the top level,
// otherwise the admin block does not appear to this user, and you get an error.
require_once($CFG->libdir . '/adminlib.php');
+ navigation_node::override_active_url(new moodle_url('/course/category.php', array('id' => $id)));
admin_externalpage_setup('coursemgmt', '', $urlparams, $CFG->wwwroot . '/course/category.php');
$PAGE->set_context($context); // Ensure that we are actually showing blocks etc for the cat context
$textcss = '';
}
- // Get on-click attribute value if specified
- $onclick = $mod->get_on_click();
+ // Get on-click attribute value if specified and decode the onclick - it
+ // has already been encoded for display (puke).
+ $onclick = htmlspecialchars_decode($mod->get_on_click(), ENT_QUOTES);
$groupinglabel = '';
if (!empty($mod->groupingid) && has_capability('moodle/course:managegroups', context_course::instance($course->id))) {
$string['defaultweight_help'] = 'The default weight allows you to choose roughly where you want the block to appear in the chosen region, either at the top or the bottom. The final location is calculated from all the blocks in that region (for example, only one block can actually be at the top). This value can be overridden on specific pages if required.';
$string['deletecheck'] = 'Delete {$a} block?';
$string['deleteblockcheck'] = 'Are you sure that you want to delete this block titled {$a}?';
+$string['hidedockpanel'] = 'Hide the dock panel';
+$string['hidepanel'] = 'Hide panel';
$string['moveblockhere'] = 'Move block here';
$string['movingthisblockcancel'] = 'Moving this block ({$a})';
$string['onthispage'] = 'On this page';
+Version 2.0.6.1 (2012-11-16)\r
+ Fixed security issue with google spellchecker.\r
Version 2.0.6 (2011-09-29)\r
Fixed incorrect position of suggestion menu.\r
Fixed handling of mispelled words with no suggestions in PSpellShell engine.\r
}\r
\r
function &_getMatches($lang, $str) {\r
+ $lang = preg_replace('/[^a-z\-]/i', '', $lang); // Sanitize, remove everything but a-z or -\r
+ $str = preg_replace('/[\x00-\x1F\x7F]/', '', $str); // Sanitize, remove all control characters\r
$server = "www.google.com";\r
$port = 443;\r
$path = "/tbproxy/spell?lang=" . $lang . "&hl=en";\r
$propogrationhandler = 'e.halt();';
}
// Decode the onclick - it has already been encoded for display (puke)
- $onclick = htmlspecialchars_decode($activity->onclick);
+ $onclick = htmlspecialchars_decode($activity->onclick, ENT_QUOTES);
// Build the JS function the click event will call
$jscode = "function {$functionname}(e) { $propogrationhandler $onclick }";
$this->page->requires->js_init_code($jscode);
$module = array('name' => 'core_dock',
'fullpath' => '/blocks/dock.js',
'requires' => array('base', 'node', 'event-custom', 'event-mouseenter', 'event-resize'),
- 'strings' => array(array('addtodock', 'block'),array('undockitem', 'block'),array('undockall', 'block'),array('thisdirectionvertical', 'langconfig')));
+ 'strings' => array(array('addtodock', 'block'),array('undockitem', 'block'),array('undockall', 'block'),array('thisdirectionvertical', 'langconfig'),array('hidedockpanel', 'block'),array('hidepanel', 'block')));
break;
case 'core_message':
$module = array('name' => 'core_message',
}
$gradeddate = $gradebookgrade->dategraded;
- $grader = $DB->get_record('user', array('id'=>$gradebookgrade->usermodified));
+ $grader = $DB->get_record('user', array('id'=>$grade->grader));
$feedbackstatus = new assign_feedback_status($gradefordisplay,
$gradeddate,
redirect($CFG->wwwroot . '/mod/wiki/edit.php?pageid='.$newpageid);
break;
case 'new':
- if ((int)$wiki->forceformat == 1 && !empty($title)) {
+ // Go straight to editing if we know the page title and we're in force format mode.
+ if ((int)$wiki->forceformat == 1 && $title != get_string('newpage', 'wiki')) {
$newpageid = $wikipage->create_page($title);
add_to_log($course->id, 'wiki', 'add page', "view.php?pageid=".$newpageid, $newpageid, $cm->id);
redirect($CFG->wwwroot . '/mod/wiki/edit.php?pageid='.$newpageid);
} else {
- // create link from moodle navigation block without pagetitle
$wikipage->print_header();
- // new page without page title
+ // Create a new page.
$wikipage->print_content($title);
}
$wikipage->print_footer();
$data = $this->mform->get_data();
if (isset($data->groupinfo)) {
$groupid = $data->groupinfo;
+ } else if (!empty($this->gid)) {
+ $groupid = $this->gid;
} else {
$groupid = '0';
}