-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathformAcount.php
58 lines (43 loc) · 2.17 KB
/
formAcount.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
require_once("$CFG->libdir/formslib.php");
class formAcount extends moodleform {
function definition() {
global $CFG, $DB;
$mform =& $this->_form;
$id = $this->_customdata['id'];
$mform->addElement('header', 'dataform','Conta SMTP');
$mform->addElement('text', 'name', 'Name:',array('maxlength'=>255));
$mform->setType('name', PARAM_TEXT);
$mform->addElement('text', 'host', 'Host:',array('maxlength'=>255));
$mform->setType('host', PARAM_TEXT);
$mform->addElement('text', 'username', 'Username:',array('maxlength'=>255));
$mform->setType('username', PARAM_TEXT);
$mform->addElement('passwordunmask', 'password', 'Password:',array('maxlength'=>255));
$mform->setType('password', PARAM_TEXT);
$selectSecurity =$mform->addElement('select', 'security', "Segurança:", array(''=>"Nenhuma", 'ssl'=>'SSL', 'tls'=>"TLS"));
$mform->setType('security', PARAM_TEXT);
$mform->addElement('text', 'dialylimit', 'Limite Diario:', array('maxlength'=>4));
$mform->setType('dialylimit', PARAM_INT);
$selectPriority = $mform->addElement('select', 'priority', "Prioridade:", array('1', '2', '3','4'));
$mform->addHelpButton('priority', 'priority', 'local_custonsmtp');
$mform->setType('priority', PARAM_INT);
if($id){
$account =$DB->get_record('custonsmtp_accounts',array('id'=>$id));
$mform->addElement('hidden', 'id', $id);
$mform->setType('id', PARAM_INT);
$mform->hardFreeze('id');
$mform->setDefault('name', $account->name);
$mform->setDefault('host', $account->host);
$mform->setDefault('username', $account->username);
$mform->setDefault('password', $account->password);
$mform->setDefault('dialylimit', $account->dialylimit);
$selectSecurity->setSelected($account->security);
$selectPriority->setSelected($account->priority);
$this->add_action_buttons(true, 'Editar', null);
}
else{
$this->add_action_buttons(true, 'Inserir', null);
}
}
}
?>