From 6eb70b82186d1bda672c9f726ba9620999a382d6 Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Thu, 5 Jul 2012 12:42:13 +1200 Subject: [PATCH 1/2] Fix boilerplates, remove old cvs tags, add correct component to version.php --- add_form.php | 17 +++++++++-- ...backup_attforblock_activity_task.class.php | 14 +++++++++ .../backup_attforblock_settingslib.php | 14 +++++++++ .../moodle2/backup_attforblock_stepslib.php | 14 +++++++++ ...estore_attforblock_activity_task.class.php | 14 +++++++++ .../moodle2/restore_attforblock_stepslib.php | 14 +++++++++ db/access.php | 17 +++++++++-- db/install.php | 15 ++++++++++ db/upgrade.php | 20 ++++++++++--- duration_form.php | 17 +++++++++-- export.php | 16 ++++++++-- export_form.php | 18 +++++++++-- index.php | 18 +++++++++-- lang/en/attforblock.php | 20 +++++++++---- lang/en_us/attforblock.php | 22 ++++++++++---- lib.php | 19 +++++++++--- locallib.php | 16 ++++++++-- manage.php | 15 +++++++++- mod_form.php | 15 +++++++++- preferences.php | 16 ++++++++-- renderables.php | 16 ++++++++-- renderer.php | 15 +++++++++- renderhelpers.php | 18 +++++++++-- report.php | 15 +++++++++- sessions.php | 16 ++++++++-- take.php | 18 ++++++++--- update_form.php | 17 +++++++++-- version.php | 30 +++++++++++++++---- view.php | 16 ++++++++-- 29 files changed, 432 insertions(+), 60 deletions(-) diff --git a/add_form.php b/add_form.php index 5a0378f..849b86d 100644 --- a/add_form.php +++ b/add_form.php @@ -1,4 +1,18 @@ -. require_once($CFG->libdir.'/formslib.php'); @@ -125,4 +139,3 @@ class mod_attforblock_add_form extends moodleform { } } -?> diff --git a/backup/moodle2/backup_attforblock_activity_task.class.php b/backup/moodle2/backup_attforblock_activity_task.class.php index d8fcf53..67024f6 100644 --- a/backup/moodle2/backup_attforblock_activity_task.class.php +++ b/backup/moodle2/backup_attforblock_activity_task.class.php @@ -1,4 +1,18 @@ . /** * Class {@link backup_attforblock_activity_task} definition diff --git a/backup/moodle2/backup_attforblock_settingslib.php b/backup/moodle2/backup_attforblock_settingslib.php index f3d3197..323a6b4 100644 --- a/backup/moodle2/backup_attforblock_settingslib.php +++ b/backup/moodle2/backup_attforblock_settingslib.php @@ -1,4 +1,18 @@ . /** * @package mod diff --git a/backup/moodle2/backup_attforblock_stepslib.php b/backup/moodle2/backup_attforblock_stepslib.php index 10a31f3..a978983 100644 --- a/backup/moodle2/backup_attforblock_stepslib.php +++ b/backup/moodle2/backup_attforblock_stepslib.php @@ -1,4 +1,18 @@ . /** * Defines all the backup steps that will be used by {@link backup_attforblock_activity_task} diff --git a/backup/moodle2/restore_attforblock_activity_task.class.php b/backup/moodle2/restore_attforblock_activity_task.class.php index 3e2124b..d235665 100644 --- a/backup/moodle2/restore_attforblock_activity_task.class.php +++ b/backup/moodle2/restore_attforblock_activity_task.class.php @@ -1,4 +1,18 @@ . /** * @package mod diff --git a/backup/moodle2/restore_attforblock_stepslib.php b/backup/moodle2/restore_attforblock_stepslib.php index c2aa2d5..8449074 100644 --- a/backup/moodle2/restore_attforblock_stepslib.php +++ b/backup/moodle2/restore_attforblock_stepslib.php @@ -1,4 +1,18 @@ . /** * @package mod diff --git a/db/access.php b/db/access.php index 1e27a6e..3a058d0 100644 --- a/db/access.php +++ b/db/access.php @@ -1,4 +1,19 @@ . + // // Capability definitions for the assignment module. // @@ -132,5 +147,3 @@ $capabilities = array( ) ) ); - -?> diff --git a/db/install.php b/db/install.php index cdc7d1b..0433ec9 100644 --- a/db/install.php +++ b/db/install.php @@ -1,4 +1,19 @@ . + /** * This file replaces the legacy STATEMENTS section in db/install.xml, diff --git a/db/upgrade.php b/db/upgrade.php index edb4e59..34c51fb 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -1,7 +1,21 @@ -. // This file keeps track of upgrades to -// the forum module +// the attforblock module // // Sometimes, changes between versions involve // alterations to database structures and other @@ -328,5 +342,3 @@ function xmldb_attforblock_upgrade($oldversion=0) { } return $result; } - -?> diff --git a/duration_form.php b/duration_form.php index e0083e5..6b4c810 100644 --- a/duration_form.php +++ b/duration_form.php @@ -1,4 +1,18 @@ -. require_once($CFG->libdir.'/formslib.php'); @@ -45,4 +59,3 @@ class mod_attforblock_duration_form extends moodleform { } } -?> diff --git a/export.php b/export.php index 41e73d4..c5916e0 100644 --- a/export.php +++ b/export.php @@ -1,4 +1,18 @@ . /** * Export attendance sessions @@ -189,5 +203,3 @@ function ExportToCSV($data, $filename) { echo implode("\t", $row)."\n"; } } - -?> diff --git a/export_form.php b/export_form.php index c30df8e..1d61008 100644 --- a/export_form.php +++ b/export_form.php @@ -1,4 +1,18 @@ -. require_once($CFG->libdir.'/formslib.php'); @@ -67,4 +81,4 @@ class mod_attforblock_export_form extends moodleform { // } } -?> + diff --git a/index.php b/index.php index 09dcd09..97b6add 100644 --- a/index.php +++ b/index.php @@ -1,4 +1,18 @@ -. /// This page lists all the instances of attforblock in a particular course /// Replace attforblock with the name of your module @@ -16,5 +30,3 @@ } else { print_error('notfound', 'attforblock'); } - -?> diff --git a/lang/en/attforblock.php b/lang/en/attforblock.php index 99ce54d..af512ee 100644 --- a/lang/en/attforblock.php +++ b/lang/en/attforblock.php @@ -1,6 +1,18 @@ -. $string['Aacronym'] = 'A'; $string['Afull'] = 'Absent'; @@ -178,5 +190,3 @@ $string['viewmode'] = 'View mode'; $string['week'] = 'week(s)'; $string['weeks'] = 'Weeks'; $string['youcantdo'] = 'You can\'t do anything'; - -?> diff --git a/lang/en_us/attforblock.php b/lang/en_us/attforblock.php index 17a6fbf..9759f10 100644 --- a/lang/en_us/attforblock.php +++ b/lang/en_us/attforblock.php @@ -1,10 +1,22 @@ -. + $string['strftimedm'] = '%m.%d'; $string['strftimedmy'] = '%m.%d.%Y'; $string['strftimedmyw'] = '%m.%d.%y (%a)'; -$string['strftimeshortdate'] = '%m.%d.%Y'; - -?> \ No newline at end of file +$string['strftimeshortdate'] = '%m.%d.%Y'; \ No newline at end of file diff --git a/lib.php b/lib.php index e81fe29..3abf9a5 100644 --- a/lib.php +++ b/lib.php @@ -1,4 +1,18 @@ -. /// Library of functions and constants for module attforblock @@ -462,6 +476,3 @@ function attforblock_pluginfile($course, $cm, $context, $filearea, $args, $force ////////////////////////////////////////////////////////////////////////////////////// /// Any other attforblock functions go here. Each of them must have a name that /// starts with attforblock_ - - -?> diff --git a/locallib.php b/locallib.php index d15caf9..7782128 100644 --- a/locallib.php +++ b/locallib.php @@ -1,4 +1,18 @@ . defined('MOODLE_INTERNAL') || die(); @@ -1291,5 +1305,3 @@ function att_log_convert_url(moodle_url $fullurl) { return substr($fullurl->out(), strlen($baseurl)); } - -?> diff --git a/manage.php b/manage.php index 2000471..2687223 100644 --- a/manage.php +++ b/manage.php @@ -1,4 +1,18 @@ . /** * Manage attendance sessions @@ -69,4 +83,3 @@ echo $output->render($sesstable); echo $output->footer(); -?> diff --git a/mod_form.php b/mod_form.php index 11a0c2f..82e7afd 100644 --- a/mod_form.php +++ b/mod_form.php @@ -1,4 +1,18 @@ . if (!defined('MOODLE_INTERNAL')) { die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page @@ -34,4 +48,3 @@ class mod_attforblock_mod_form extends moodleform_mod { } } -?> \ No newline at end of file diff --git a/preferences.php b/preferences.php index 83bf016..c09ed2e 100644 --- a/preferences.php +++ b/preferences.php @@ -1,4 +1,18 @@ . /** * Manage attendance settings @@ -94,5 +108,3 @@ echo $output->render($tabs); echo $output->render($prefdata); echo $output->footer(); - -?> diff --git a/renderables.php b/renderables.php index cf1d1c7..99e9b9d 100644 --- a/renderables.php +++ b/renderables.php @@ -1,4 +1,18 @@ . /** * Attendance module renderable components are defined here @@ -528,5 +542,3 @@ class url_helpers { return $att->url_view($params); } } - -?> \ No newline at end of file diff --git a/renderer.php b/renderer.php index 6a628f9..4c6396a 100644 --- a/renderer.php +++ b/renderer.php @@ -1,4 +1,18 @@ . /** * Attendance module renderering methods @@ -778,4 +792,3 @@ class mod_attforblock_renderer extends plugin_renderer_base { } } -?> diff --git a/renderhelpers.php b/renderhelpers.php index 3616365..f200b2a 100644 --- a/renderhelpers.php +++ b/renderhelpers.php @@ -1,4 +1,19 @@ . + /** * Attendance module renderering helpers * @@ -235,6 +250,3 @@ function construct_full_user_stat_html_table($attforblock, $course, $user) { return construct_user_data_stat($stat, $statuses, $gradeable, $grade, $maxgrade, $decimalpoints); } - - -?> diff --git a/report.php b/report.php index e183e4d..d6e4466 100644 --- a/report.php +++ b/report.php @@ -1,4 +1,18 @@ . /** * Attendance report @@ -58,4 +72,3 @@ echo $output->render($reportdata); echo $output->footer(); -?> diff --git a/sessions.php b/sessions.php index 473734a..679dabb 100644 --- a/sessions.php +++ b/sessions.php @@ -1,4 +1,18 @@ . /** * Adding attendance sessions @@ -237,5 +251,3 @@ function fill_groupid($formdata, &$sessions, $sess) { } } } - -?> diff --git a/take.php b/take.php index 154c5fe..ef945d1 100644 --- a/take.php +++ b/take.php @@ -1,4 +1,18 @@ . require_once(dirname(__FILE__).'/../../config.php'); require_once(dirname(__FILE__).'/locallib.php'); @@ -46,7 +60,3 @@ echo $output->render($tabs); echo $output->render($sesstable); echo $output->footer(); - - - -?> diff --git a/update_form.php b/update_form.php index 88a9410..1ca26d4 100644 --- a/update_form.php +++ b/update_form.php @@ -1,4 +1,18 @@ -. require_once($CFG->libdir.'/formslib.php'); @@ -61,4 +75,3 @@ class mod_attforblock_update_form extends moodleform { // } } -?> diff --git a/version.php b/version.php index 2c05fa8..9869f53 100644 --- a/version.php +++ b/version.php @@ -1,11 +1,29 @@ -. -///////////////////////////////////////////////////////////////////////////////// -/// Code fragment to define the version of attforblock -/// This fragment is called by moodle_needs_upgrading() and /admin/index.php -///////////////////////////////////////////////////////////////////////////////// +/** + * Version information + * + * @package mod + * @subpackage attforblock + * @copyright 2011 Artem Andreev + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ $module->version = 2011071600; // The current module version (Date: YYYYMMDDXX) $module->release = '2.4.0'; $module->cron = 0; // Period for cron to check this module (secs) -?> +$module->component = 'mod_attforblock'; // Full name of the plugin (used for diagnostics) diff --git a/view.php b/view.php index 9862ac1..93c64f6 100644 --- a/view.php +++ b/view.php @@ -1,4 +1,18 @@ . /** * Prints attendance info for particular user @@ -58,5 +72,3 @@ echo $output->header(); echo $output->render($userdata); echo $output->footer(); - -?> From cf110bd09cd25fc698ccdbe285d6a1c16f6fb19a Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Thu, 5 Jul 2012 13:22:51 +1200 Subject: [PATCH 2/2] Add new core addinstance capability (2.3 throws warnings if this doesn't exist) --- db/access.php | 12 ++++++++++++ version.php | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/db/access.php b/db/access.php index 3a058d0..e6bc4e1 100644 --- a/db/access.php +++ b/db/access.php @@ -60,6 +60,18 @@ $capabilities = array( ) ), + 'mod/attforblock:addinstance' => array( + 'riskbitmask' => RISK_XSS, + + 'captype' => 'write', + 'contextlevel' => CONTEXT_COURSE, + 'archetypes' => array( + 'editingteacher' => CAP_ALLOW, + 'manager' => CAP_ALLOW + ), + 'clonepermissionsfrom' => 'moodle/course:manageactivities' + ), + 'mod/attforblock:viewreports' => array( 'riskbitmask' => RISK_PERSONAL, diff --git a/version.php b/version.php index 9869f53..5792216 100644 --- a/version.php +++ b/version.php @@ -23,7 +23,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -$module->version = 2011071600; // The current module version (Date: YYYYMMDDXX) +$module->version = 2011071601; // The current module version (Date: YYYYMMDDXX) $module->release = '2.4.0'; $module->cron = 0; // Period for cron to check this module (secs) $module->component = 'mod_attforblock'; // Full name of the plugin (used for diagnostics)