1
0
www.mikescher.com/www/protected/controllers/SiteController.php

60 lines
977 B
PHP
Raw Normal View History

2014-05-13 12:40:42 +02:00
<?php
class SiteController extends Controller
{
2014-05-14 11:15:32 +02:00
public $selectedNav = '';
2014-05-13 12:40:42 +02:00
public function actionIndex()
{
$this->render('index');
}
public function actionError()
{
if($error=Yii::app()->errorHandler->error)
{
if(Yii::app()->request->isAjaxRequest)
echo $error['message'];
else
$this->render('error', $error);
}
}
2014-05-14 11:15:32 +02:00
public function actionAbout()
2014-05-13 12:40:42 +02:00
{
2014-05-14 14:14:45 +02:00
$data = array();
if(isset($_POST['SendMailForm']))
{
$model = new SendMailForm();
$model->attributes=$_POST['SendMailForm'];
if($model->validate()) {
if ($model->send())
{
$data['alerts_success'][] = "Successfully send mail from " . $model->name;
$data['model'] = new SendMailForm();
}
else
{
$data['alerts_error'][] = "Internal error while sending mail";
$data['model'] = $model;
}
}
else
{
$data['model'] = $model;
}
}
else
{
$data['model'] = new SendMailForm();
}
$this->render('about', $data);
2014-05-13 12:40:42 +02:00
}
}