75 lines
1.9 KiB
PHP
75 lines
1.9 KiB
PHP
|
<?php
|
||
|
/**
|
||
|
* Pages Controller
|
||
|
*
|
||
|
* @package baseContent
|
||
|
* @subpacke pages
|
||
|
*/
|
||
|
class pages_controller extends fl_controller {
|
||
|
/* Eigenschaften */
|
||
|
var $defaultAction = 'start';
|
||
|
var $layout = 'common/default';
|
||
|
#
|
||
|
|
||
|
function start() {
|
||
|
$this->data['title'] = 'Willkommen';
|
||
|
}
|
||
|
|
||
|
function contact($action) {
|
||
|
$this->data['title'] = 'Kontakt';
|
||
|
|
||
|
$val = $this->factory->get_helper('validation');
|
||
|
|
||
|
$val->set_rule('name', 'string');
|
||
|
$val->set_msg('name', 'Bitte geben Sie Ihren Namen an.');
|
||
|
|
||
|
$val->set_rule('firma', '', '*');
|
||
|
$val->set_msg('firma', 'Bitte geben Sie den Namen Ihrer Firma an oder lassen Sie das entsprechende Feld frei.');
|
||
|
|
||
|
$val->set_rule('mail', 'email');
|
||
|
$val->set_msg('mail', 'Bitte geben Sie Ihre E-Mail-Adresse an.');
|
||
|
|
||
|
$val->set_rule('telefon', 'number', '*');
|
||
|
$val->set_msg('telefon', 'Bitte geben Sie Ihre Telefonnummer an oder lassen Sie das entsprechende Feld frei.');
|
||
|
|
||
|
$val->set_rule('thema', 'string');
|
||
|
$val->set_msg('thema', 'Bitte wählen Sie ein Thema aus.');
|
||
|
|
||
|
if ( $action == 'send' ) {
|
||
|
$data = ( isset($_POST['fl']) )? $_POST['fl']: $this->goToTarget('pages/contact/');
|
||
|
$errors = $val->validate_form($data);
|
||
|
|
||
|
if ( count($errors) == 0 ) {
|
||
|
$sent = $this->model->send_contact($data);
|
||
|
$msg = ( $sent === TRUE )?
|
||
|
'Danke! Ihre Anfrage wurde an uns abgeschickt.':
|
||
|
'[Systemfehler] e-mail wurde nicht verschickt. <br>' . $sent;
|
||
|
$type = ( $sent === TRUE )?
|
||
|
'okay':
|
||
|
'error';
|
||
|
$this->flash($msg, $type);
|
||
|
#$this->goToTarget('pages/thankyou');
|
||
|
} else {
|
||
|
$this->data += $data;
|
||
|
$msg = implode('<br>', $errors );
|
||
|
$this->flash($msg, 'error');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
$this->data['system']['validator'] = $val;
|
||
|
}
|
||
|
|
||
|
function thankyou() {
|
||
|
$this->data['title'] = 'Vielen Dank!';
|
||
|
}
|
||
|
|
||
|
function impressum() {
|
||
|
$this->data['title'] = 'Impressum';
|
||
|
}
|
||
|
|
||
|
function sitemap() {
|
||
|
$this->data['title'] = 'Sitemap';
|
||
|
}
|
||
|
}
|
||
|
?>
|