1 |
efrain |
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.
|
|
|
13 |
//
|
|
|
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/>.
|
|
|
16 |
|
|
|
17 |
/**
|
|
|
18 |
* Class account
|
|
|
19 |
*
|
|
|
20 |
* @package core_payment
|
|
|
21 |
* @copyright 2020 Marina Glancy
|
|
|
22 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
23 |
*/
|
|
|
24 |
|
|
|
25 |
namespace core_payment\form;
|
|
|
26 |
|
|
|
27 |
use core\form\persistent;
|
|
|
28 |
|
|
|
29 |
/**
|
|
|
30 |
* Class account
|
|
|
31 |
*
|
|
|
32 |
* @package core_payment
|
|
|
33 |
* @copyright 2020 Marina Glancy
|
|
|
34 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
35 |
*/
|
|
|
36 |
class account extends persistent {
|
|
|
37 |
|
|
|
38 |
/** @var string The persistent class. */
|
|
|
39 |
protected static $persistentclass = 'core_payment\account';
|
|
|
40 |
|
|
|
41 |
/**
|
|
|
42 |
* Define the form - called by parent constructor
|
|
|
43 |
*/
|
|
|
44 |
public function definition() {
|
|
|
45 |
$mform = $this->_form;
|
|
|
46 |
|
|
|
47 |
$mform->addElement('hidden', 'id');
|
|
|
48 |
$mform->addElement('hidden', 'contextid');
|
|
|
49 |
|
|
|
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');
|
|
|
55 |
|
|
|
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');
|
|
|
60 |
|
|
|
61 |
$mform->addElement('static', 'staticinfo', '', get_string('accountconfignote', 'payment'));
|
|
|
62 |
|
|
|
63 |
$mform->addElement('advcheckbox', 'enabled', get_string('enable'));
|
|
|
64 |
$this->add_action_buttons();
|
|
|
65 |
}
|
|
|
66 |
}
|