Skip to content

Commit

Permalink
WIP (#591)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjnelson committed Jan 25, 2024
1 parent 5b0f5d0 commit 783e20e
Show file tree
Hide file tree
Showing 7 changed files with 820 additions and 598 deletions.
105 changes: 105 additions & 0 deletions classes/persistent/element.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<?php
// This file is part of the tool_certificate plugin for 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/>.

/**
* Class represents a customcert element.
*
* @package mod_customcert
* @copyright 2024 Mark Nelson <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace mod_customcert\persistent;

use core\persistent;

/**
* Class represents a customcert element.
*
* @package mod_customcert
* @copyright 2024 Mark Nelson <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class element extends persistent {

/** @var string */
const TABLE = 'tool_certificate_elements';

/**
* Return the definition of the properties of this model.
*
* @return array
*/
protected static function define_properties() {
return [
'pageid' => [
'type' => PARAM_INT,
],
'name' => [
'type' => PARAM_TEXT,
'default' => '',
],
'element' => [
'type' => PARAM_ALPHANUMEXT,
],
'data' => [
'type' => PARAM_RAW,
'null' => NULL_ALLOWED,
'default' => null,
],
'font' => [
'type' => PARAM_NOTAGS,
'null' => NULL_ALLOWED,
'default' => 'freesans',
],
'fontsize' => [
'type' => PARAM_INT,
'null' => NULL_ALLOWED,
'default' => null,
],
'colour' => [
'type' => PARAM_NOTAGS,
'null' => NULL_ALLOWED,
'default' => null,
],
'posx' => [
'type' => PARAM_INT,
'null' => NULL_ALLOWED,
'default' => null,
],
'posy' => [
'type' => PARAM_INT,
'null' => NULL_ALLOWED,
'default' => null,
],
'width' => [
'type' => PARAM_INT,
'null' => NULL_ALLOWED,
'default' => null,
],
'refpoint' => [
'type' => PARAM_INT,
'null' => NULL_ALLOWED,
'default' => null,
],
'sequence' => [
'type' => PARAM_INT,
'null' => NULL_ALLOWED,
'default' => null,
],
];
}
}
77 changes: 77 additions & 0 deletions classes/persistent/page.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?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/>.

/**
* Class represents a customcert page.
*
* @package mod_customcert
* @copyright 2024 Mark Nelson <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace mod_customcert\persistent;

use core\persistent;

/**
* Class represents a customcert page.
*
* @package mod_customcert
* @copyright 2024 Mark Nelson <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class page extends persistent {

/** @var string The table name. */
public const TABLE = 'customcert_pages';

/**
* Return the definition of the properties of this model.
*
* @return array
*/
protected static function define_properties() {
return [
'templateid' => [
'type' => PARAM_INT
],
'width' => [
'type' => PARAM_INT,
'default' => 297
],
'height' => [
'type' => PARAM_INT,
'default' => 210
],
'leftmargin' => [
'type' => PARAM_INT,
'default' => 0
],
'rightmargin' => [
'type' => PARAM_INT,
'default' => 0
],
'sequence' => [
'type' => PARAM_INT
],
];
}

public function after_create()
{
\mod_customcert\event\page_created::create_from_page($this->get('id'), $this)->trigger();
}
}
Loading

0 comments on commit 783e20e

Please sign in to comment.