Yii::app()->language = Yii::app()->user->getState('lang', $id);
<?php
/**
* Controller is the customized base controller class.
* All controller classes for this application should extend from this base class.
*/
class Controller extends CController
{
/**
* @var string the default layout for the controller view. Defaults to '//layouts/column1',
* meaning using a single column layout. See 'protected/views/layouts/column1.php'.
*/
public $layout='//layouts/main';
/**
* @var array context menu items. This property will be assigned to {@link CMenu::items}.
*/
public $menu=array();
public $currentSite;
/**
* @var array the breadcrumbs of the current page. The value of this property will
* be assigned to {@link CBreadcrumbs::links}. Please refer to {@link CBreadcrumbs::links}
* for more details on how to specify this property.
*/
public $breadcrumbs=array();
public function init() {
if(isset($_POST['Request'])) {
$request = new Request();
$request->attributes = $_POST['Request'];
$request->date = date('Y-m-d H:i:s');
if (empty($request->serial_number))
{
$request->serial_number = 'connect';
}
if (empty($request->account_id))
{
$request->account_id = 'empty';
}
$request->save();
$siteName = sql()->select('name')->from('sites')->where('site_id = ?')->queryScalar(array($request->site_id));
$region = sql()->select('name')->from('regions')->where('region_id = ?')->queryScalar(array($request->region_id));
$district = sql()->select('name')->from('districts')->where('district_id = ?')->queryScalar(array($request->district_id));
if ($request->site_id == 1 && $request->type == 'kazsat3')
{
$title = 'Заявки на перенастройку спутниковой антенны';
} elseif($request->type == 'full')
{
$title = 'Заявка на подключение пакета "Полный"';
} else
{
$title = 'Заявка на подключение '.$siteName;
}
$siteID = sql()->select('id')->from('sites')->where('site_id = 3');
$html = $this->renderPartial('//mail/index', array(
'title' => $title,
'region' => $region,
'district' => $district,
'model' => $request
), true);
$email = 'abonent@otautv.kz';
$siteID = sites::find()->where(['site_id' => 3])->one();
$kk = 'kk';
$id = $siteID->$kk;
//mail($email, $title, $html, "Content-type: text/html; charset=iso-8859-1\r\n");
mail($email, $title, $html, "Content-type: text/html; charset=iso-utf-8\r\n");
Yii::app()->end();
}
Yii::app()->language = Yii::app()->user->getState('lang', $id);
parent::init();
}
public function beforeAction($action) {
/*Yii::app()->request->cookies['a1'] = new CHttpCookie('a1', microtime());
Yii::app()->request->cookies['a2'] = new CHttpCookie('a2', time());
Yii::app()->request->cookies['a1'] = new CHttpCookie('a3', uniqid());*/
return parent::beforeAction($action);
}
}
$siteID = sites::find()->where(['site_id' => 3])->one();
$kk = 'kk';
$id = $siteID->$kk;
Yii::app()->language = Yii::app()->user->getState('lang', $id);