if (!file_exists("$CFG->dirroot/blocks/$blockname/block_$blockname.php")) {
$blockobject = false;
$strblockname = '<span class="notifyproblem">'.$blockname.' ('.get_string('missingfromdisk').')</span>';
+ $plugin = new object();
+ $plugin->version = $block->version;
+
} else {
+ $plugin = new object();
+ $plugin->version = '???';
+ if (file_exists("$CFG->dirroot/blocks/$blockname/version.php")) {
+ include("$CFG->dirroot/blocks/$blockname/version.php");
+ }
+
if (!$blockobject = block_instance($block->name)) {
$incompatible[] = $block;
continue;
$class = ' class="dimmed_text"'; // Leading space required!
}
-
- if ($blockobject) {
- $blockobject->get_version();
+ if ($block->version == $plugin->version) {
+ $version = $block->version;
+ } else {
+ $version = "$block->version ($plugin->version)";
}
+
+
$table->add_data(array(
'<span'.$class.'>'.$strblockname.'</span>',
$blocklist,
- '<span'.$class.'>'.$block->version.'</span>',
+ '<span'.$class.'>'.$version.'</span>',
$visible,
$delete,
$settings
class block_activity_modules extends block_list {
function init() {
$this->title = get_string('pluginname', 'block_activity_modules');
- $this->version = 2007101509;
}
function get_content() {
--- /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/>.
+
+$plugin->version = 2007101509;
function init() {
$this->title = get_string('pluginname', 'block_admin_bookmarks');
- $this->version = 2007101509;
}
function applicable_formats() {
--- /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/>.
+
+$plugin->version = 2007101509;
function init() {
$this->title = get_string('pluginname', 'block_blog_menu');
- $this->version = 2009071700;
}
function instance_allow_multiple() {
}
function get_content() {
-
+
// Check if we've already generated content
if (!empty($this->content)) {
return $this->content;
}
return $this->content;
}
-
+
// Iterate the option types
$menulist = array();
foreach ($options as $types) {
--- /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/>.
+
+$plugin->version = 2009071700;
function init() {
$this->title = get_string('pluginname', 'block_blog_recent');
$this->content_type = BLOCK_TYPE_TEXT;
- $this->version = 2009070900;
}
function applicable_formats() {
--- /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/>.
+
+$plugin->version = 2009070900;
<?php
+//TODO: fix these sloppy constant names or move them elsewhere!
+
define('BLOGDEFAULTTIMEWITHIN', 90);
define('BLOGDEFAULTNUMBEROFTAGS', 20);
define('BLOGDEFAULTSORT', 'name');
class block_blog_tags extends block_base {
function init() {
- $this->version = 2007101509;
$this->title = get_string('pluginname', 'block_blog_tags');
}
--- /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/>.
+
+$plugin->version = 2007101509;
class block_calendar_month extends block_base {
function init() {
$this->title = get_string('pluginname', 'block_calendar_month');
- $this->version = 2007101509;
}
function preferred_width() {
--- /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/>.
+
+$plugin->version = 2007101509;
class block_calendar_upcoming extends block_base {
function init() {
$this->title = get_string('pluginname', 'block_calendar_upcoming');
- $this->version = 2007101509;
}
function get_content() {
--- /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/>.
+
+$plugin->version = 2007101509;
function init() {
$this->title = get_string('pluginname', 'block_comments');
- $this->version = 2009072000;
}
function specialization() {
--- /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/>.
+
+$plugin->version = 2009072000;
class block_community extends block_list {
function init() {
$this->title = get_string('pluginname', 'block_community');
- $this->version = 2010042701;
}
function user_can_addto($page) {
$this->content->icons[] = '';
foreach ($courses as $course) {
//delete link
- $deleteicon = html_writer::empty_tag('img',
- array('src' => $OUTPUT->pix_url('i/cross_red_small'),
+ $deleteicon = html_writer::empty_tag('img',
+ array('src' => $OUTPUT->pix_url('i/cross_red_small'),
'alt' => get_string('removecommunitycourse', 'block_community')));
$deleteurl = new moodle_url($CFG->wwwroot.'/blocks/community/communitycourse.php',
array('remove'=>true, 'communityid'=> $course->id, 'sesskey' => sesskey()));
--- /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/>.
+
+$plugin->version = 2010042701;
public function init() {
$this->title = get_string('completionstatus', 'block_completionstatus');
- $this->version = 2009072800;
}
public function get_content() {
--- /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/>.
+
+$plugin->version = 2009072800;
class block_course_list extends block_list {
function init() {
$this->title = get_string('courses');
- $this->version = 2007101509;
}
function has_config() {
--- /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/>.
+
+$plugin->version = 2007101509;
*/
public function init() {
$this->title = get_string('pluginname', 'block_course_overview');
- $this->version = 2010021100;
}
/**
--- /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/>.
+
+$plugin->version = 2010021100;
class block_course_summary extends block_base {
function init() {
$this->title = get_string('pluginname', 'block_course_summary');
- $this->version = 2007101509;
}
function specialization() {
--- /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/>.
+
+$plugin->version = 2007101509;
function init() {
$this->title = get_string('feedback', 'block_feedback');
- $this->version = 2010050200;
}
-
+
function applicable_formats() {
return array('site' => true, 'course' => true);
}
function get_content() {
global $CFG, $OUTPUT;
-
+
if ($this->content !== NULL) {
return $this->content;
}
-
+
if (!defined('FEEDBACK_BLOCK_LIB_IS_OK')) {
$this->content = new stdClass;
$this->content->text = get_string('missing_feedback_module', 'block_feedback');
$this->content->footer = '';
return $this->content;
}
-
+
$courseid = $this->page->course->id;
if ($courseid <= 0) {
$courseid = SITEID;
}
-
+
$this->content = new stdClass;
$this->content->text = '';
$this->content->footer = '';
-
+
if (empty($this->instance->pageid)) {
$this->instance->pageid = SITEID;
--- /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/>.
+
+$plugin->version = 2010050200;
class block_glossary_random extends block_base {
function init() {
-
$this->title = get_string('pluginname','block_glossary_random');
- $this->version = 2007101509;
-
}
function specialization() {
--- /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/>.
+
+$plugin->version = 2007101509;
function init() {
$this->title = get_string('pluginname', 'block_html');
- $this->version = 2007101509;
}
function applicable_formats() {
--- /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/>.
+
+$plugin->version = 2007101509;
class block_login extends block_base {
function init() {
$this->title = get_string('pluginname', 'block_login');
- $this->version = 2007101509;
}
function applicable_formats() {
--- /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/>.
+
+$plugin->version = 2007101509;
function init() {
$this->title = get_string('pluginname', 'block_mentees');
- $this->version = 2007101509;
}
function applicable_formats() {
--- /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/>.
+
+$plugin->version = 2007101509;
class block_messages extends block_base {
function init() {
$this->title = get_string('pluginname', 'block_messages');
- $this->version = 2007101509;
}
function get_content() {
$link = '/message/discussion.php?id='.$user->id;
$anchortagcontents = '<img class="iconsmall" src="'.$OUTPUT->pix_url('t/message') . '" alt="" /> '.$user->count;
-
+
$action = new popup_action('click', $link, 'message_'.$user->id);
$anchortag = $OUTPUT->action_link($link, $anchortagcontents, $action);
--- /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/>.
+
+$plugin->version = 2007101509;
class block_mnet_hosts extends block_list {
function init() {
$this->title = get_string('pluginname','block_mnet_hosts') ;
- $this->version = 2007101509;
}
function has_config() {
--- /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/>.
+
+$plugin->version = 2007101509;
*/
var $edit_controls = NULL;
- /**
- * The current version that the block type defines.
- * @var string $version
- */
- var $version = NULL;
-
/**
* The initialized instance of this block object.
* @var block $instance
/// Class Functions
- /**
- * The class constructor
- *
- */
- function block_base() {
- $this->init();
- }
-
/**
* Fake constructor to keep PHP5 happy
*
*/
function __construct() {
- $this->block_base();
+ $this->init();
}
/**
return $this->content_type;
}
- /**
- * Returns the class $version var value.
- *
- * Intentionally doesn't check if a version is set.
- * This is already done in {@link _self_test()}
- *
- * @return string $this->version
- */
- function get_version() {
- // Intentionally doesn't check if a version is set. This is already done in _self_test()
- return $this->version;
- }
-
/**
* Returns true or false, depending on whether this block has any content to display
* and whether the user has permission to view the block
$errors[] = 'content_not_set';
$correct = false;
}*/
- if ($this->get_version() === NULL) {
- $errors[] = 'version_not_set';
- $correct = false;
- }
-
$formats = $this->applicable_formats();
if (empty($formats) || array_sum($formats) === 0) {
$errors[] = 'no_formats';
*/
public function init() {
$this->title = get_string('pluginname', 'block_myprofile');
- $this->version = 2009123100;
}
/**
--- /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/>.
+
+$plugin->version = 2009123100;
global $CFG;
$this->blockname = get_class($this);
$this->title = get_string('pluginname', $this->blockname);
- $this->version = 2009082800;
}
/**
--- /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/>.
+
+$plugin->version = 2009082800;
class block_news_items extends block_base {
function init() {
$this->title = get_string('pluginname', 'block_news_items');
- $this->version = 2007101509;
}
function get_content() {
--- /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/>.
+
+$plugin->version = 2007101509;
class block_online_users extends block_base {
function init() {
$this->title = get_string('pluginname','block_online_users');
- $this->version = 2007101510;
}
function has_config() {return true;}
$sql = "SELECT $userfields, MAX(ul.timeaccess) AS lastaccess
FROM {user_lastaccess} ul, {user} u $groupmembers $rafrom
- JOIN ($esqljoin) euj ON euj.id = u.id
+ JOIN ($esqljoin) euj ON euj.id = u.id
WHERE ul.timeaccess > $timefrom
AND u.id = ul.userid
AND ul.courseid = :courseid
--- /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/>.
+
+$plugin->version = 2007101510;
class block_participants extends block_list {
function init() {
$this->title = get_string('pluginname', 'block_participants');
- $this->version = 2007101509;
}
function get_content() {
--- /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/>.
+
+$plugin->version = 2007101509;
function init() {
$this->title = get_string('areauserpersonal', 'repository');
- $this->version = 2010030100;
}
function specialization() {
--- /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/>.
+
+$plugin->version = 2010030100;
class block_quiz_results extends block_base {
function init() {
$this->title = get_string('pluginname', 'block_quiz_results');
- $this->version = 2007101509;
}
function applicable_formats() {
--- /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/>.
+
+$plugin->version = 2007101509;
class block_recent_activity extends block_base {
function init() {
$this->title = get_string('pluginname', 'block_recent_activity');
- $this->version = 2007101509;
}
function get_content() {
--- /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/>.
+
+$plugin->version = 2007101509;
function init() {
$this->title = get_string('feedstitle', 'block_rss_client');
- $this->version = 2009072901;
- $this->cron = 300; /// Set min time between cron executions to 300 secs (5 mins)
}
function preferred_width() {
--- /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/>.
+
+$plugin->version = 2009072901;
+$plugin->cron = 300; /// Set min time between cron executions to 300 secs (5 mins)
function init() {
$this->title = get_string('pluginname', 'block_search');
- $this->cron = 1;
- $this->version = 2008031500;
} //init
// only one instance of this block is required
--- /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/>.
+
+$plugin->version = 2008031500;
+$plugin->cron = 1;
class block_search_forums extends block_base {
function init() {
$this->title = get_string('pluginname', 'block_search_forums');
- $this->version = 2007101509;
}
function get_content() {
--- /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/>.
+
+$plugin->version = 2007101509;
function init() {
$this->title = get_string('pluginname', 'block_section_links');
- $this->version = 2007101511;
}
function instance_config($instance) {
--- /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/>.
+
+$plugin->version = 2007101511;
public function init() {
$this->title = get_string('selfcompletion', 'block_selfcompletion');
- $this->version = 2009072800;
}
public function get_content() {
--- /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/>.
+
+$plugin->version = 2009072800;
function init() {
$this->blockname = get_class($this);
$this->title = get_string('pluginname', $this->blockname);
- $this->version = 2009082800;
}
/**
--- /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/>.
+
+$plugin->version = 2009082800;
class block_site_main_menu extends block_list {
function init() {
$this->title = get_string('pluginname', 'block_site_main_menu');
- $this->version = 2007101509;
}
-
+
function applicable_formats() {
return array('site' => true);
}
--- /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/>.
+
+$plugin->version = 2007101509;
class block_social_activities extends block_list {
function init(){
$this->title = get_string('pluginname', 'block_social_activities');
- $this->version = 2007101509;
}
function applicable_formats() {
--- /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/>.
+
+$plugin->version = 2007101509;
<?php
-require_once($CFG->dirroot.'/tag/lib.php');
-require_once($CFG->libdir . '/filelib.php');
-
define('FLICKR_DEV_KEY', '4fddbdd7ff2376beec54d7f6afad425e');
define('DEFAULT_NUMBER_OF_PHOTOS', 6);
function init() {
$this->title = get_string('pluginname','block_tag_flickr');
- $this->version = 2007101509;
}
function applicable_formats() {
}
function get_content() {
-
global $CFG, $USER;
+ //note: do NOT include files at the top of this file
+ require_once($CFG->dirroot.'/tag/lib.php');
+ require_once($CFG->libdir . '/filelib.php');
+
if ($this->content !== NULL) {
return $this->content;
}
--- /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/>.
+
+$plugin->version = 2007101509;
<?php
-require_once($CFG->dirroot.'/tag/lib.php');
-require_once($CFG->libdir . '/filelib.php');
-
define('DEFAULT_NUMBER_OF_VIDEOS', 5);
class block_tag_youtube extends block_base {
function init() {
$this->title = get_string('pluginname','block_tag_youtube');
- $this->version = 2007101509;
}
function applicable_formats() {
}
function get_content() {
+ global $CFG;
+
+ //note: do NOT include files at the top of this file
+ require_once($CFG->dirroot.'/tag/lib.php');
+ require_once($CFG->libdir . '/filelib.php');
if ($this->content !== NULL) {
return $this->content;
--- /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/>.
+
+$plugin->version = 2007101509;
class block_tags extends block_base {
function init() {
- $this->version = 2008063001;
$this->title = get_string('pluginname', 'block_tags');
// the cron function goes through all users, so only do daily
// (this creates rss feeds for personal course tags)
--- /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/>.
+
+$plugin->version = 2008063001;
old global $THEME is fully replaced by $OUTPUT
* remove '_utf8' from language pack names, use new {$a} syntax in language packs
* use 'pluginname' lang pack identifier instead of 'blockname'
+* move cron and version number into standard version.php
optional - no changes needed in older code:
*
$string['dbsessionhandlerproblem'] = 'Setting up of database session failed.<br /><br />Please notify server administrator.';
$string['dbsessionmysqlpacketsize'] = 'Serious session error detected.<br /><br />Please notify administrator, this problem is most probably caused by small value in max_allowed_packet MySQL setting.';
$string['dbupdatefailed'] = 'Database update failed';
-$string['ddldependencyerror'] = '{$a->targettype} "{$a->targetname}" cannot be modifed. Dependency found with {$a->offendingtype} "{$a->offendingname}"';
+$string['ddldependencyerror'] = '{$a->targettype} "{$a->targetname}" cannot be modified. Dependency found with {$a->offendingtype} "{$a->offendingname}"';
$string['ddlexecuteerror'] = 'DDL sql execution error';
$string['ddlfieldalreadyexists'] = 'Field "{$a}" already exists';
$string['ddlfieldnotexist'] = 'Field "{$a->fieldname}" does not exist in table "{$a->tablename}"';
$string['ddlunknownerror'] = 'Unknown DDL library error';
$string['ddlxmlfileerror'] = 'XML database file errors found';
$string['destinationcmnotexit'] = 'The destination course module does not exist';
-$string['detectedbrokenplugin'] = 'Plugin "{$a}" is defective, can not continue, sorry.';
+$string['detectedbrokenplugin'] = 'Plugin "{$a}" is defective or outdated, can not continue, sorry.';
$string['dmlreadexception'] = 'Error reading from database';
$string['dmltransactionexception'] = 'Database transaction error';
$string['dmlwriteexception'] = 'Error writing to database';
if ($blockname === 'NEWBLOCK') { // Someone has unzipped the template, ignore it
continue;
}
- if (!is_readable($fullblock.'/block_'.$blockname.'.php')) {
+ if (!is_readable($fullblock.'/version.php')) {
continue;
}
- include_once($fullblock.'/block_'.$blockname.'.php');
- $classname = 'block_'.$blockname;
- if (!class_exists($classname)) {
- continue;
- }
- $blockobj = new $classname;
+ $plugin = new object();
+ $plugin->version = NULL;
+ include($fullblock.'/version.php');
if (empty($installed[$blockname])) {
return true;
- } else if ($blockobj->get_version() > $installed[$blockname]->version) {
+ } else if ($plugin->version > $installed[$blockname]->version) {
return true;
}
}
$component = 'block_'.$blockname;
+ if (!is_readable($fullblock.'/version.php')) {
+ throw new plugin_defective_exception('block/'.$blockname, 'Missing version.php file.');
+ }
+ $plugin = new object();
+ $plugin->version = NULL;
+ $plugin->cron = 0;
+ include($fullblock.'/version.php');
+ $block = $plugin;
+
if (!is_readable($fullblock.'/block_'.$blockname.'.php')) {
throw new plugin_defective_exception('block/'.$blockname, 'Missing main block class file.');
}
- require_once($fullblock.'/block_'.$blockname.'.php');
+ include_once($fullblock.'/block_'.$blockname.'.php');
$classname = 'block_'.$blockname;
throw new plugin_defective_exception($component, 'Self test failed.');
}
- $block = new object(); // This may be used to update the db below
$block->name = $blockname; // The name MUST match the directory
- $block->version = $blockobj->get_version();
- $block->cron = !empty($blockobj->cron) ? $blockobj->cron : 0;
$block->multiple = $blockobj->instance_allow_multiple() ? 1 : 0;
if (empty($block->version)) {