Skip to content
Snippets Groups Projects
Select Git revision
  • 4xx_dev
  • 33_STABLE
  • excel-export-evaluation
  • master default protected
  • 2022050502
  • 2022050501
  • 2022021501
  • 2022021500
8 results

contact.php

Blame
  • contact.php 1.99 KiB
    <?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/hsh/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_hsh');
    $PAGE->set_title($strtitle);
    $PAGE->set_heading($strtitle);
    
    $formtitle = get_string('formtitle', 'local_hsh');
    $intro_1 = get_string('intro_1', 'local_hsh');
    $intro_2 = get_string('intro_2', 'local_hsh');
    
    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_hsh'), $returnurl);
    }
    
    
    $PAGE->navbar->add($strtitle);
    
    echo $OUTPUT->header();
    echo $OUTPUT->heading($formtitle);
    echo ('<p>' . $intro_1 . '<br />' . $intro_2 . '</p>');
    // Show the request form.
    $requestform->display();
    echo $OUTPUT->footer();