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

contact_form.php

Blame
  • contact_form.php 5.14 KiB
    <?php
    
    /**
     * User: wernerpe
     * Date: 19.01.2015
     * Time: 10:43
     */
    require_once(dirname(__FILE__) . '/../../config.php');
    require_once($CFG->libdir . '/formslib.php');
    
    class contact_form extends moodleform {
    
        function definition() {
    
            global $CFG, $DB, $USER;
            $mform = & $this->_form;
    
            $mform->addElement('header', 'personaldetails', get_string('personaldetails', 'local_contactform'));
    
            $mform->addElement('text', 'firstname', get_string('firstname', 'local_contactform'), 'maxlength="254" size="34"');
            $mform->addRule('firstname', get_string('firstname_mis', 'local_contactform'), 'required', null, 'client');
            $mform->setType('firstname', PARAM_TEXT);
    
            $mform->addElement('text', 'lastname', get_string('lastname', 'local_contactform'), 'maxlength="254" size="34"');
            $mform->addRule('lastname', get_string('lastname_mis', 'local_contactform'), 'required', null, 'client');
            $mform->setType('lastname', PARAM_TEXT);
    
            $mform->addElement('text', 'email', get_string('email', 'local_contactform'), 'maxlength="254" size="34"');
            $mform->addRule('email', get_string('email_mis', 'local_contactform'), 'required', null, 'client');
            $mform->addRule('email', get_string('email_mis', 'local_contactform'), 'email', null, 'client');
            $mform->setType('email', PARAM_EMAIL);
    
            $mform->addElement('text', 'telephone', get_string('telephone', 'local_contactform'), 'maxlength="254" size="34"');
    
            $mform->setType('telephone', PARAM_TEXT);
    
            $mform->addElement('header', 'messageheader', get_string('message', 'local_contactform'));
    
            $contactto = array();
            //  $contactto[] = get_string('pleasechoose', 'local_contactform');
            $contactto[] = get_string('contacttomoodle', 'local_contactform');
            $contactto[] = get_string('contacttoelc', 'local_contactform');
    
            $mform->addElement('select', 'contacttoselect', get_string('contactto', 'local_contactform'), $contactto, ' style="width: 20em;"');
            $mform->addRule('contacttoselect', get_string('contactto_mis', 'local_contactform'), 'required', null, 'client');
            $values = array(get_string('improvement', 'local_contactform') => get_string('improvement', 'local_contactform'),
                get_string('technical', 'local_contactform') => get_string('technical', 'local_contactform'),
                get_string('usercreate', 'local_contactform') => get_string('usercreate', 'local_contactform'),
    <<<<<<< HEAD
    =======
                get_string('userdelete', 'local_contactform') => get_string('userdelete', 'local_contactform'),
                get_string('coursedelete', 'local_contactform') => get_string('coursedelete', 'local_contactform'),
    >>>>>>> hsh/develop
                get_string('loginprob', 'local_contactform') => get_string('loginprob', 'local_contactform'),
                get_string('dataloss', 'local_contactform') => get_string('dataloss', 'local_contactform'));
            sort($values);
            array_unshift($values, get_string('pleasechoose', 'local_contactform'));
            $values[get_string('other', 'local_contactform')] = get_string('other', 'local_contactform');
            $mform->addElement('select', 'subject', get_string('subject', 'local_contactform'), $values, ' style="width: 20em;"');
    
            $mform->addElement('textarea', 'message', get_string('message', 'local_contactform'), 'style="width: 20em;height: 20em"');
            $mform->addRule('message', get_string('message_mis', 'local_contactform'), 'required', null, 'client');
    
            if (isloggedin()) {
                $mform->setDefault('firstname', $USER->firstname);
                $mform->setDefault('lastname', $USER->lastname);
                $mform->setDefault('email', $USER->email);
                $mform->setDefault('telephone', $USER->phone1);
            }
            if (!empty($CFG->recaptchapublickey) && !empty($CFG->recaptchaprivatekey)) {