-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathformEnvia.php
63 lines (40 loc) · 1.7 KB
/
formEnvia.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
59
60
61
62
63
<?php
require_once("$CFG->libdir/formslib.php");
class formEnvia extends moodleform {
function definition() {
global $CFG, $DB;
$mform =& $this->_form;
$id = $this->_customdata['id'];
$mform->addElement('header', 'dataform','Envio de Emails');
$cursous = $DB->get_records("course",array('visible'=>1));
$arrayCursos = array();
foreach($cursous as $curso){
if($curso->id ==1){
continue;
}
$arrayCursos[$curso->id] = $curso->fullname;
}
$mform->addElement('select', 'course', 'Curso:', $arrayCursos);
$mform->setType('course', PARAM_INT);
$roles = $DB->get_records_sql("SELECT id,name,shortname from {role} where id in (SELECT roleid from {role_assignments})");
$arrayRole = array();
foreach($roles as $role){
$arrayRole[$role->id] = $role->name."({$role->shortname})";
}
$mform->addElement('select', 'role', 'Papel:', $arrayRole);
$mform->setType('role', PARAM_INT);
$accounts = $DB->get_records("custonsmtp_accounts");
$arrayAccount = array();
foreach($accounts as $account){
$arrayAccount[$account->id] = $account->name;
}
$mform->addElement('select', 'account', 'Conta para envio:', $arrayAccount);
$mform->setType('account', PARAM_INT);
$mform->addElement('text', 'title', 'Titulo:',array('maxlength'=>255));
$mform->setType('host', PARAM_TEXT);
$mform->addElement('editor', 'body', 'Menagem:');
$mform->setType('username', PARAM_RAW);
$this->add_action_buttons(true, 'Enviar', null);
}
}
?>