Changed the class names so that they match the directory structure
This commit is contained in:
parent
fa5d45eef3
commit
7500bfda26
22 changed files with 72 additions and 72 deletions
|
@ -25,4 +25,4 @@
|
|||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$subplugins = array('customcertelement' => 'mod/customcert/elements');
|
||||
$subplugins = array('customcertelements' => 'mod/customcert/elements');
|
||||
|
|
|
@ -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');
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Strings for component 'customcertelement_code', language 'en'.
|
||||
* Strings for component 'customcertelements_code', language 'en'.
|
||||
*
|
||||
* @package customcertelement_code
|
||||
* @package customcertelements_code
|
||||
* @copyright Mark Nelson <markn@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
|
@ -18,7 +18,7 @@
|
|||
/**
|
||||
* The code elements core interaction API.
|
||||
*
|
||||
* @package customcertelement_code
|
||||
* @package customcertelements_code
|
||||
* @copyright Mark Nelson <markn@moodle.com>
|
||||
* @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.
|
||||
|
|
|
@ -18,13 +18,13 @@
|
|||
/**
|
||||
* This file contains the version information for the code plugin.
|
||||
*
|
||||
* @package customcertelement_code
|
||||
* @package customcertelements_code
|
||||
* @copyright Mark Nelson <markn@moodle.com>
|
||||
* @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';
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Strings for component 'customcertelement_date', language 'en'.
|
||||
* Strings for component 'customcertelements_date', language 'en'.
|
||||
*
|
||||
* @package customcertelement_date
|
||||
* @package customcertelements_date
|
||||
* @copyright Mark Nelson <markn@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
|
@ -18,7 +18,7 @@
|
|||
/**
|
||||
* The date elements core interaction API.
|
||||
*
|
||||
* @package customcertelement_date
|
||||
* @package customcertelements_date
|
||||
* @copyright Mark Nelson <markn@moodle.com>
|
||||
* @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);
|
||||
}
|
||||
|
|
|
@ -18,13 +18,13 @@
|
|||
/**
|
||||
* This file contains the version information for the date plugin.
|
||||
*
|
||||
* @package customcertelement_date
|
||||
* @package customcertelements_date
|
||||
* @copyright Mark Nelson <markn@moodle.com>
|
||||
* @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';
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Strings for component 'customcertelement_grade', language 'en'.
|
||||
* Strings for component 'customcertelements_grade', language 'en'.
|
||||
*
|
||||
* @package customcertelement_grade
|
||||
* @package customcertelements_grade
|
||||
* @copyright Mark Nelson <markn@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
|
@ -18,7 +18,7 @@
|
|||
/**
|
||||
* The grade elements core interaction API.
|
||||
*
|
||||
* @package customcertelement_grade
|
||||
* @package customcertelements_grade
|
||||
* @copyright Mark Nelson <markn@moodle.com>
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,13 +18,13 @@
|
|||
/**
|
||||
* This file contains the version information for the grade plugin.
|
||||
*
|
||||
* @package customcertelement_grade
|
||||
* @package customcertelements_grade
|
||||
* @copyright Mark Nelson <markn@moodle.com>
|
||||
* @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';
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Strings for component 'customcertelement_image', language 'en'.
|
||||
* Strings for component 'customcertelements_image', language 'en'.
|
||||
*
|
||||
* @package customcertelement_image
|
||||
* @package customcertelements_image
|
||||
* @copyright Mark Nelson <markn@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
|
@ -18,7 +18,7 @@
|
|||
/**
|
||||
* The image elements core interaction API.
|
||||
*
|
||||
* @package customcertelement_image
|
||||
* @package customcertelements_image
|
||||
* @copyright Mark Nelson <markn@moodle.com>
|
||||
* @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.
|
||||
|
|
|
@ -18,13 +18,13 @@
|
|||
/**
|
||||
* This file contains the version information for the image plugin.
|
||||
*
|
||||
* @package customcertelement_image
|
||||
* @package customcertelements_image
|
||||
* @copyright Mark Nelson <markn@moodle.com>
|
||||
* @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';
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Strings for component 'customcertelement_studentname', language 'en'.
|
||||
* Strings for component 'customcertelements_studentname', language 'en'.
|
||||
*
|
||||
* @package customcertelement_studentname
|
||||
* @package customcertelements_studentname
|
||||
* @copyright Mark Nelson <markn@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
|
@ -18,7 +18,7 @@
|
|||
/**
|
||||
* The studentname elements core interaction API.
|
||||
*
|
||||
* @package customcertelement_studentname
|
||||
* @package customcertelements_studentname
|
||||
* @copyright Mark Nelson <markn@moodle.com>
|
||||
* @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.
|
||||
|
|
|
@ -18,13 +18,13 @@
|
|||
/**
|
||||
* This file contains the version information for the studentname plugin.
|
||||
*
|
||||
* @package customcertelement_studentname
|
||||
* @package customcertelements_studentname
|
||||
* @copyright Mark Nelson <markn@moodle.com>
|
||||
* @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';
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Strings for component 'customcertelement_text', language 'en'.
|
||||
* Strings for component 'customcertelements_text', language 'en'.
|
||||
*
|
||||
* @package customcertelement_text
|
||||
* @package customcertelements_text
|
||||
* @copyright Mark Nelson <markn@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
|
@ -18,7 +18,7 @@
|
|||
/**
|
||||
* The text elements core interaction API.
|
||||
*
|
||||
* @package customcertelement_text
|
||||
* @package customcertelements_text
|
||||
* @copyright Mark Nelson <markn@moodle.com>
|
||||
* @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);
|
||||
}
|
||||
|
|
|
@ -18,13 +18,13 @@
|
|||
/**
|
||||
* This file contains the version information for the text plugin.
|
||||
*
|
||||
* @package customcertelement_text
|
||||
* @package customcertelements_text
|
||||
* @copyright Mark Nelson <markn@moodle.com>
|
||||
* @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';
|
||||
|
|
4
lib.php
4
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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue