From 7500bfda26bb7ded2414013d3f0f9e82f67f185f Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Wed, 12 Jun 2013 16:23:08 +0800 Subject: [PATCH] Changed the class names so that they match the directory structure --- db/subplugins.php | 2 +- edit_element_form.php | 2 +- ...t_code.php => customcertelements_code.php} | 4 +-- elements/code/lib.php | 4 +-- elements/code/version.php | 6 ++--- ...t_date.php => customcertelements_date.php} | 4 +-- elements/date/lib.php | 14 +++++----- elements/date/version.php | 6 ++--- elements/element.class.php | 2 +- ...grade.php => customcertelements_grade.php} | 4 +-- elements/grade/lib.php | 26 +++++++++---------- elements/grade/version.php | 6 ++--- ...image.php => customcertelements_image.php} | 4 +-- elements/image/lib.php | 18 ++++++------- elements/image/version.php | 6 ++--- ...php => customcertelements_studentname.php} | 4 +-- elements/studentname/lib.php | 4 +-- elements/studentname/version.php | 6 ++--- ...t_text.php => customcertelements_text.php} | 4 +-- elements/text/lib.php | 8 +++--- elements/text/version.php | 6 ++--- lib.php | 4 +-- 22 files changed, 72 insertions(+), 72 deletions(-) rename elements/code/lang/en/{customcertelement_code.php => customcertelements_code.php} (89%) rename elements/date/lang/en/{customcertelement_date.php => customcertelements_date.php} (91%) rename elements/grade/lang/en/{customcertelement_grade.php => customcertelements_grade.php} (92%) rename elements/image/lang/en/{customcertelement_image.php => customcertelements_image.php} (92%) rename elements/studentname/lang/en/{customcertelement_studentname.php => customcertelements_studentname.php} (88%) rename elements/text/lang/en/{customcertelement_text.php => customcertelements_text.php} (90%) diff --git a/db/subplugins.php b/db/subplugins.php index 2cf91a9..6365fae 100644 --- a/db/subplugins.php +++ b/db/subplugins.php @@ -25,4 +25,4 @@ defined('MOODLE_INTERNAL') || die(); -$subplugins = array('customcertelement' => 'mod/customcert/elements'); +$subplugins = array('customcertelements' => 'mod/customcert/elements'); diff --git a/edit_element_form.php b/edit_element_form.php index f2046de..b489296 100644 --- a/edit_element_form.php +++ b/edit_element_form.php @@ -48,7 +48,7 @@ class mod_customcert_edit_element_form extends moodleform { // Add the field for the name of the variable, this is required for all elements. $mform->addElement('text', 'name', get_string('elementname', 'customcert')); $mform->setType('name', PARAM_TEXT); - $mform->setDefault('name', get_string('pluginname', 'customcertelement_' . $element->element)); + $mform->setDefault('name', get_string('pluginname', 'customcertelements_' . $element->element)); $mform->addRule('name', get_string('required'), 'required', null, 'client'); $mform->addHelpButton('name', 'elementname', 'customcert'); diff --git a/elements/code/lang/en/customcertelement_code.php b/elements/code/lang/en/customcertelements_code.php similarity index 89% rename from elements/code/lang/en/customcertelement_code.php rename to elements/code/lang/en/customcertelements_code.php index 6d57fb7..3848f7b 100644 --- a/elements/code/lang/en/customcertelement_code.php +++ b/elements/code/lang/en/customcertelements_code.php @@ -16,9 +16,9 @@ // along with Moodle. If not, see . /** - * Strings for component 'customcertelement_code', language 'en'. + * Strings for component 'customcertelements_code', language 'en'. * - * @package customcertelement_code + * @package customcertelements_code * @copyright Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/elements/code/lib.php b/elements/code/lib.php index 15c4b1c..3f21dfb 100644 --- a/elements/code/lib.php +++ b/elements/code/lib.php @@ -18,7 +18,7 @@ /** * The code elements core interaction API. * - * @package customcertelement_code + * @package customcertelements_code * @copyright Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -27,7 +27,7 @@ defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); require_once($CFG->dirroot . '/mod/customcert/elements/element.class.php'); -class customcert_element_code extends customcert_element_base { +class customcert_elements_code extends customcert_elements_base { /** * Handles rendering the element on the pdf. diff --git a/elements/code/version.php b/elements/code/version.php index b197104..5612e28 100644 --- a/elements/code/version.php +++ b/elements/code/version.php @@ -18,13 +18,13 @@ /** * This file contains the version information for the code plugin. * - * @package customcertelement_code + * @package customcertelements_code * @copyright Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); -$plugin->version = 2013060600; +$plugin->version = 2013061200; $plugin->requires = 2013040500; // Requires this Moodle version. -$plugin->component = 'customcertelement_code'; +$plugin->component = 'customcertelements_code'; diff --git a/elements/date/lang/en/customcertelement_date.php b/elements/date/lang/en/customcertelements_date.php similarity index 91% rename from elements/date/lang/en/customcertelement_date.php rename to elements/date/lang/en/customcertelements_date.php index 58c4427..dfcbdae 100644 --- a/elements/date/lang/en/customcertelement_date.php +++ b/elements/date/lang/en/customcertelements_date.php @@ -16,9 +16,9 @@ // along with Moodle. If not, see . /** - * Strings for component 'customcertelement_date', language 'en'. + * Strings for component 'customcertelements_date', language 'en'. * - * @package customcertelement_date + * @package customcertelements_date * @copyright Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/elements/date/lib.php b/elements/date/lib.php index 03fc90a..9fc5c26 100644 --- a/elements/date/lib.php +++ b/elements/date/lib.php @@ -18,7 +18,7 @@ /** * The date elements core interaction API. * - * @package customcertelement_date + * @package customcertelements_date * @copyright Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -28,7 +28,7 @@ defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); require_once($CFG->dirroot . '/mod/customcert/elements/element.class.php'); require_once($CFG->dirroot . '/mod/customcert/elements/grade/lib.php'); -class customcert_element_date extends customcert_element_base { +class customcert_elements_date extends customcert_elements_base { /** * Constructor. @@ -62,13 +62,13 @@ class customcert_element_date extends customcert_element_base { $dateoptions = array(); $dateoptions['1'] = get_string('issueddate', 'certificate'); $dateoptions['2'] = get_string('completiondate', 'certificate'); - $dateoptions = $dateoptions + customcert_element_grade::get_grade_items(); + $dateoptions = $dateoptions + customcert_elements_grade::get_grade_items(); - $mform->addElement('select', 'dateitem', get_string('dateitem', 'customcertelement_date'), $dateoptions); - $mform->addHelpButton('dateitem', 'dateitem', 'customcertelement_date'); + $mform->addElement('select', 'dateitem', get_string('dateitem', 'customcertelements_date'), $dateoptions); + $mform->addHelpButton('dateitem', 'dateitem', 'customcertelements_date'); - $mform->addElement('select', 'dateformat', get_string('dateformat', 'customcertelement_date'), $this->get_date_formats()); - $mform->addHelpButton('dateformat', 'dateformat', 'customcertelement_date'); + $mform->addElement('select', 'dateformat', get_string('dateformat', 'customcertelements_date'), self::get_date_formats()); + $mform->addHelpButton('dateformat', 'dateformat', 'customcertelements_date'); parent::render_form_elements($mform); } diff --git a/elements/date/version.php b/elements/date/version.php index 458498c..632b025 100644 --- a/elements/date/version.php +++ b/elements/date/version.php @@ -18,13 +18,13 @@ /** * This file contains the version information for the date plugin. * - * @package customcertelement_date + * @package customcertelements_date * @copyright Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); -$plugin->version = 2013060700; +$plugin->version = 2013061200; $plugin->requires = 2013040500; // Requires this Moodle version. -$plugin->component = 'customcertelement_date'; +$plugin->component = 'customcertelements_date'; diff --git a/elements/element.class.php b/elements/element.class.php index d65f4bf..6a67689 100644 --- a/elements/element.class.php +++ b/elements/element.class.php @@ -27,7 +27,7 @@ require_once($CFG->dirroot . '/mod/customcert/includes/tcpdf_colors.php'); defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); -class customcert_element_base { +class customcert_elements_base { /** * The data for the element we are adding. diff --git a/elements/grade/lang/en/customcertelement_grade.php b/elements/grade/lang/en/customcertelements_grade.php similarity index 92% rename from elements/grade/lang/en/customcertelement_grade.php rename to elements/grade/lang/en/customcertelements_grade.php index e099cdc..619574b 100644 --- a/elements/grade/lang/en/customcertelement_grade.php +++ b/elements/grade/lang/en/customcertelements_grade.php @@ -16,9 +16,9 @@ // along with Moodle. If not, see . /** - * Strings for component 'customcertelement_grade', language 'en'. + * Strings for component 'customcertelements_grade', language 'en'. * - * @package customcertelement_grade + * @package customcertelements_grade * @copyright Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/elements/grade/lib.php b/elements/grade/lib.php index 1676d03..1e0520d 100644 --- a/elements/grade/lib.php +++ b/elements/grade/lib.php @@ -18,7 +18,7 @@ /** * The grade elements core interaction API. * - * @package customcertelement_grade + * @package customcertelements_grade * @copyright Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -35,7 +35,7 @@ require_once($CFG->dirroot . '/grade/querylib.php'); */ define('CUSTOMCERT_GRADE_COURSE', '0'); -class customcert_element_grade extends customcert_element_base { +class customcert_elements_grade extends customcert_elements_base { /** * Constructor. @@ -67,18 +67,18 @@ class customcert_element_grade extends customcert_element_base { public function render_form_elements($mform) { // Get the grade items we can display. $gradeitems = array(); - $gradeitems[CUSTOMCERT_GRADE_COURSE] = get_string('coursegrade', 'customcertelement_grade'); - $gradeitems = $gradeitems + $this->get_grade_items(); + $gradeitems[CUSTOMCERT_GRADE_COURSE] = get_string('coursegrade', 'customcertelements_grade'); + $gradeitems = $gradeitems + self::get_grade_items(); // The grade items. - $mform->addElement('select', 'gradeitem', get_string('gradeitem', 'customcertelement_grade'), $gradeitems); + $mform->addElement('select', 'gradeitem', get_string('gradeitem', 'customcertelements_grade'), $gradeitems); $mform->setType('gradeitem', PARAM_INT); - $mform->addHelpButton('gradeitem', 'gradeitem', 'customcertelement_grade'); + $mform->addHelpButton('gradeitem', 'gradeitem', 'customcertelements_grade'); // The grade format. - $mform->addElement('select', 'gradeformat', get_string('gradeformat', 'customcertelement_grade'), $this->get_grade_format_options()); + $mform->addElement('select', 'gradeformat', get_string('gradeformat', 'customcertelements_grade'), self::get_grade_format_options()); $mform->setType('gradeformat', PARAM_INT); - $mform->addHelpButton('gradeformat', 'gradeformat', 'customcertelement_grade'); + $mform->addHelpButton('gradeformat', 'gradeformat', 'customcertelements_grade'); parent::render_form_elements($mform); } @@ -119,7 +119,7 @@ class customcert_element_grade extends customcert_element_base { $gradeinfo = json_decode($this->element->data); // Get the grade for the grade item. - $grade = $this->get_grade($gradeinfo, $USER->id); + $grade = self::get_grade($gradeinfo, $USER->id); parent::render_content($pdf, $grade); } @@ -191,9 +191,9 @@ class customcert_element_grade extends customcert_element_base { */ public static function get_grade_format_options() { $gradeformat = array(); - $gradeformat[GRADE_DISPLAY_TYPE_REAL] = get_string('gradepoints', 'customcertelement_grade'); - $gradeformat[GRADE_DISPLAY_TYPE_PERCENTAGE] = get_string('gradepercent', 'customcertelement_grade'); - $gradeformat[GRADE_DISPLAY_TYPE_LETTER] = get_string('gradeletter', 'customcertelement_grade'); + $gradeformat[GRADE_DISPLAY_TYPE_REAL] = get_string('gradepoints', 'customcertelements_grade'); + $gradeformat[GRADE_DISPLAY_TYPE_PERCENTAGE] = get_string('gradepercent', 'customcertelements_grade'); + $gradeformat[GRADE_DISPLAY_TYPE_LETTER] = get_string('gradeletter', 'customcertelements_grade'); return $gradeformat; } @@ -222,7 +222,7 @@ class customcert_element_grade extends customcert_element_base { return get_string('coursegrade', 'certificate') . ': ' . $coursegrade; } } else { // Get the module grade. - if ($modinfo = customcert_element_grade::get_mod_grade($gradeitem, $gradeformat, $userid)) { + if ($modinfo = self::get_mod_grade($gradeitem, $gradeformat, $userid)) { return get_string('grade', 'certificate') . ': ' . $modinfo->gradetodisplay; } } diff --git a/elements/grade/version.php b/elements/grade/version.php index 4b1349e..5face0e 100644 --- a/elements/grade/version.php +++ b/elements/grade/version.php @@ -18,13 +18,13 @@ /** * This file contains the version information for the grade plugin. * - * @package customcertelement_grade + * @package customcertelements_grade * @copyright Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); -$plugin->version = 2013060700; +$plugin->version = 2013061200; $plugin->requires = 2013040500; // Requires this Moodle version. -$plugin->component = 'customcertelement_grade'; +$plugin->component = 'customcertelements_grade'; diff --git a/elements/image/lang/en/customcertelement_image.php b/elements/image/lang/en/customcertelements_image.php similarity index 92% rename from elements/image/lang/en/customcertelement_image.php rename to elements/image/lang/en/customcertelements_image.php index 3072026..1d6def0 100644 --- a/elements/image/lang/en/customcertelement_image.php +++ b/elements/image/lang/en/customcertelements_image.php @@ -16,9 +16,9 @@ // along with Moodle. If not, see . /** - * Strings for component 'customcertelement_image', language 'en'. + * Strings for component 'customcertelements_image', language 'en'. * - * @package customcertelement_image + * @package customcertelements_image * @copyright Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/elements/image/lib.php b/elements/image/lib.php index 0ed29bc..8051761 100644 --- a/elements/image/lib.php +++ b/elements/image/lib.php @@ -18,7 +18,7 @@ /** * The image elements core interaction API. * - * @package customcertelement_image + * @package customcertelements_image * @copyright Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -27,7 +27,7 @@ defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); require_once($CFG->dirroot . '/mod/customcert/elements/element.class.php'); -class customcert_element_image extends customcert_element_base { +class customcert_elements_image extends customcert_elements_base { /** * Constructor. @@ -61,15 +61,15 @@ class customcert_element_image extends customcert_element_base { * @param stdClass $mform the edit_form instance. */ public function render_form_elements($mform) { - $mform->addElement('select', 'image', get_string('image', 'customcertelement_image'), self::get_images()); + $mform->addElement('select', 'image', get_string('image', 'customcertelements_image'), self::get_images()); - $mform->addElement('text', 'width', get_string('width', 'customcertelement_image'), array('size' => 10)); + $mform->addElement('text', 'width', get_string('width', 'customcertelements_image'), array('size' => 10)); $mform->setType('width', PARAM_INT); - $mform->addHelpButton('width', 'width', 'customcertelement_image'); + $mform->addHelpButton('width', 'width', 'customcertelements_image'); - $mform->addElement('text', 'height', get_string('height', 'customcertelement_image'), array('size' => 10)); + $mform->addElement('text', 'height', get_string('height', 'customcertelements_image'), array('size' => 10)); $mform->setType('height', PARAM_INT); - $mform->addHelpButton('height', 'height', 'customcertelement_image'); + $mform->addHelpButton('height', 'height', 'customcertelements_image'); parent::render_form_elements_position($mform); } @@ -87,12 +87,12 @@ class customcert_element_image extends customcert_element_base { // Check if width is not set, or not numeric or less than 0. if ((!isset($data['width'])) || (!is_numeric($data['width'])) || ($data['width'] < 0)) { - $errors['width'] = get_string('invalidwidth', 'customcertelement_image'); + $errors['width'] = get_string('invalidwidth', 'customcertelements_image'); } // Check if height is not set, or not numeric or less than 0. if ((!isset($data['height'])) || (!is_numeric($data['height'])) || ($data['height'] < 0)) { - $errors['height'] = get_string('invalidheight', 'customcertelement_image'); + $errors['height'] = get_string('invalidheight', 'customcertelements_image'); } // Validate the position. diff --git a/elements/image/version.php b/elements/image/version.php index 55f4a94..0d1bf88 100644 --- a/elements/image/version.php +++ b/elements/image/version.php @@ -18,13 +18,13 @@ /** * This file contains the version information for the image plugin. * - * @package customcertelement_image + * @package customcertelements_image * @copyright Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); -$plugin->version = 2013060600; +$plugin->version = 2013061200; $plugin->requires = 2013040500; // Requires this Moodle version. -$plugin->component = 'customcertelement_image'; +$plugin->component = 'customcertelements_image'; diff --git a/elements/studentname/lang/en/customcertelement_studentname.php b/elements/studentname/lang/en/customcertelements_studentname.php similarity index 88% rename from elements/studentname/lang/en/customcertelement_studentname.php rename to elements/studentname/lang/en/customcertelements_studentname.php index 539dafb..dae62fb 100644 --- a/elements/studentname/lang/en/customcertelement_studentname.php +++ b/elements/studentname/lang/en/customcertelements_studentname.php @@ -16,9 +16,9 @@ // along with Moodle. If not, see . /** - * Strings for component 'customcertelement_studentname', language 'en'. + * Strings for component 'customcertelements_studentname', language 'en'. * - * @package customcertelement_studentname + * @package customcertelements_studentname * @copyright Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/elements/studentname/lib.php b/elements/studentname/lib.php index 7564b28..e65ae1f 100644 --- a/elements/studentname/lib.php +++ b/elements/studentname/lib.php @@ -18,7 +18,7 @@ /** * The studentname elements core interaction API. * - * @package customcertelement_studentname + * @package customcertelements_studentname * @copyright Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -27,7 +27,7 @@ defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); require_once($CFG->dirroot . '/mod/customcert/elements/element.class.php'); -class customcert_element_studentname extends customcert_element_base { +class customcert_elements_studentname extends customcert_elements_base { /** * Handles rendering the element on the pdf. diff --git a/elements/studentname/version.php b/elements/studentname/version.php index c2a13c4..c94a945 100644 --- a/elements/studentname/version.php +++ b/elements/studentname/version.php @@ -18,13 +18,13 @@ /** * This file contains the version information for the studentname plugin. * - * @package customcertelement_studentname + * @package customcertelements_studentname * @copyright Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); -$plugin->version = 2013060600; +$plugin->version = 2013061200; $plugin->requires = 2013040500; // Requires this Moodle version. -$plugin->component = 'customcertelement_studentname'; +$plugin->component = 'customcertelements_studentname'; diff --git a/elements/text/lang/en/customcertelement_text.php b/elements/text/lang/en/customcertelements_text.php similarity index 90% rename from elements/text/lang/en/customcertelement_text.php rename to elements/text/lang/en/customcertelements_text.php index 355e7d1..ed1c3ff 100644 --- a/elements/text/lang/en/customcertelement_text.php +++ b/elements/text/lang/en/customcertelements_text.php @@ -16,9 +16,9 @@ // along with Moodle. If not, see . /** - * Strings for component 'customcertelement_text', language 'en'. + * Strings for component 'customcertelements_text', language 'en'. * - * @package customcertelement_text + * @package customcertelements_text * @copyright Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/elements/text/lib.php b/elements/text/lib.php index 703dcb7..5113171 100644 --- a/elements/text/lib.php +++ b/elements/text/lib.php @@ -18,7 +18,7 @@ /** * The text elements core interaction API. * - * @package customcertelement_text + * @package customcertelements_text * @copyright Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -27,7 +27,7 @@ defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); require_once($CFG->dirroot . '/mod/customcert/elements/element.class.php'); -class customcert_element_text extends customcert_element_base { +class customcert_elements_text extends customcert_elements_base { /** * Constructor. @@ -46,9 +46,9 @@ class customcert_element_text extends customcert_element_base { * @param stdClass $mform the edit_form instance. */ public function render_form_elements($mform) { - $mform->addElement('textarea', 'text', get_string('text', 'customcertelement_text')); + $mform->addElement('textarea', 'text', get_string('text', 'customcertelements_text')); $mform->setType('text', PARAM_RAW); - $mform->addHelpButton('text', 'text', 'customcertelement_text'); + $mform->addHelpButton('text', 'text', 'customcertelements_text'); parent::render_form_elements($mform); } diff --git a/elements/text/version.php b/elements/text/version.php index d0e6b92..88c6df2 100644 --- a/elements/text/version.php +++ b/elements/text/version.php @@ -18,13 +18,13 @@ /** * This file contains the version information for the text plugin. * - * @package customcertelement_text + * @package customcertelements_text * @copyright Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); -$plugin->version = 2013060700; +$plugin->version = 2013061200; $plugin->requires = 2013040500; // Requires this Moodle version. -$plugin->component = 'customcertelement_text'; +$plugin->component = 'customcertelements_text'; diff --git a/lib.php b/lib.php index a890bc6..d64dc21 100644 --- a/lib.php +++ b/lib.php @@ -392,7 +392,7 @@ function customcert_get_elements() { if (file_exists($classfile)) { // Need to require this file in case if we choose to add this element. require_once($classfile); - $component = "customcertelement_{$foldername}"; + $component = "customcertelements_{$foldername}"; $options[$foldername] = get_string('pluginname', $component); } } @@ -514,7 +514,7 @@ function customcert_get_element_instance($element) { // Ensure this necessary file exists. if (file_exists($classfile)) { require_once($classfile); - $classname = "customcert_element_{$element->element}"; + $classname = "customcert_elements_{$element->element}"; return new $classname($element); }