Newer
Older
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
64
65
66
67
68
69
70
71
72
73
<?php
require_once(dirname(__FILE__) . '/../../config.php');
require_once(dirname(__FILE__) . '/contact_form.php');
require_once(dirname(__FILE__) . '/lib.php');
// You will process some page parameters at the top here and get the info about
// what instance of your module and what course you're in etc. Make sure you
// include hidden variable in your forms which have their defaults set in set_data
// which pass these variables from page to page.
global $CFG, $PAGE;
// Setup $PAGE here.
$site = get_site();
$returnurl = new moodle_url('/my');
$url = new moodle_url('/local/contactform/contact.php');
$return = optional_param('return', null, PARAM_ALPHANUMEXT);
$PAGE->set_url($url);
$context = context_system::instance();
$PAGE->set_context($context);
// Set page layout
$PAGE->set_pagelayout('standard');
$requestform = new contact_form($url);
$strtitle = get_string('pluginname','local_contactform');
$PAGE->set_title($strtitle);
$PAGE->set_heading($strtitle);
// Standard form processing if statement.
if ($requestform->is_cancelled()){
redirect($returnurl);
} else if ($data = $requestform->get_data()) {
// we need $_POST for javascript generated entries
$data = $_POST;
$eventdata = new stdClass();
$eventdata->contacttoselect = $_POST["contacttoselect"];
$eventdata->subject = $_POST["subject"];
$eventdata->email = $_POST["email"];
$eventdata->message = $_POST["message"];
$eventdata->lastname = $_POST["lastname"];
$eventdata->firstname = $_POST["firstname"];
$eventdata->telephone = $_POST["telephone"];
contactform::create($eventdata);
//end HsH
// And redirect back to the course listing.
notice(get_string('confirmrequest','local_contactform'), $returnurl);
}
$PAGE->navbar->add($strtitle);
$jsmodule = array(
'name' => 'local_contactform',
'fullpath' => '/local/contactform/module.js',
'requires' => array('base', 'node', 'json', 'io')
);
$jsdata = array(
'instanceid' => $context->id,
'sesskey' => sesskey()
);
$PAGE->requires->js_init_call('M.local_contactform.init',
$jsdata,
false,
$jsmodule);
<<<<<<< HEAD
$PAGE->requires->strings_for_js(array('contacttoelc','recording','clicker','moodle','loncapa','evaexam','eexam','training', 'other','improvement','technical','usercreate','loginprob','pleasechoose','dataloss'),'local_contactform');
=======
$PAGE->requires->strings_for_js(array('contacttoelc','recording','clicker','moodle','loncapa','evaexam','eexam','training', 'other','improvement','technical','usercreate','userdelete','coursedelete','loginprob','pleasechoose','dataloss'),'local_contactform');
>>>>>>> hsh/develop
echo $OUTPUT->header();
echo $OUTPUT->heading($strtitle);
// Show the request form.
$requestform->display();
echo $OUTPUT->footer();