Moodle release 4.3rc1
[moodle.git] / payment / classes / form / account.php
blob0333e116878308798e90400fc74333920ba339d2
1 <?php
2 // This file is part of Moodle - http://moodle.org/
3 //
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
17 /**
18 * Class account
20 * @package core_payment
21 * @copyright 2020 Marina Glancy
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25 namespace core_payment\form;
27 use core\form\persistent;
29 /**
30 * Class account
32 * @package core_payment
33 * @copyright 2020 Marina Glancy
34 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
36 class account extends persistent {
38 /** @var string The persistent class. */
39 protected static $persistentclass = 'core_payment\account';
41 /**
42 * Define the form - called by parent constructor
44 public function definition() {
45 $mform = $this->_form;
47 $mform->addElement('hidden', 'id');
48 $mform->addElement('hidden', 'contextid');
50 $mform->addElement('text', 'name', get_string('accountname', 'payment'), 'maxlength="255"');
51 $mform->addHelpButton('name', 'accountname', 'payment');
52 $mform->setType('name', PARAM_TEXT);
53 $mform->addRule('name', get_string('required'), 'required', null, 'client');
54 $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'server');
56 $mform->addElement('text', 'idnumber', get_string('accountidnumber', 'payment'), 'maxlength="100"');
57 $mform->addHelpButton('idnumber', 'accountidnumber', 'payment');
58 $mform->setType('idnumber', PARAM_RAW_TRIMMED);
59 $mform->addRule('idnumber', get_string('maximumchars', '', 100), 'maxlength', 100, 'server');
61 $mform->addElement('static', 'staticinfo', '', get_string('accountconfignote', 'payment'));
63 $mform->addElement('advcheckbox', 'enabled', get_string('enable'));
64 $this->add_action_buttons();