Exemplo n.º 1
0
    public function init()
    {
        $this->baseUrl = Y::config('baseUrl');
        Yii::app()->language = isset($_GET['lang']) ? $_GET['lang'] : "ru";

        parent::init();
    }
Exemplo n.º 2
0
 public function __construct($config = [])
 {
     // 由于多态 此时 $this 是子类 Application
     Y::$app = $this;
     $this->errorHandler();
     $this->init($config);
     Y::config($this, $config);
 }
	public function actionClose() {
		
		$email = new Email;

		$this->performAjaxValidation($email);
		
		if(isset($_POST['Email'])) {
			$email->attributes = $_POST['Email'];
			$email->to = Y::config('email_to_registraiton');
			$email->send();
			Y::flash('success',Yii::t('interface', "email was sended"));
		}
		
		$this->render('/registration/close', 
			array('model' => $email)
		);
	}
Exemplo n.º 4
0
<div>
<?php echo Yii::t('errors', 'registration close', array('{email}'=>Y::config('email_to_registraiton') ));?>
</div>

<div class="form">
<?php 
if(Y::hasFlash('success')) {
	echo CHtml::tag('div', array('class'=>'success'), Y::flash('success'));
}?>
	
	<?php $form=$this->beginWidget('CActiveForm', array(
	    'id'=>'send-mail',
	    'enableAjaxValidation'=>true
	)); ?>
	<?php echo CHtml::errorSummary($model); ?>
	
    <div class="row">
        <?php echo $form->labelEx($model,'subject'); ?>
        <?php echo $form->textField($model,'subject') ?>
        <?php echo $form->error($model,'subject'); ?>
    </div>
 
    <div class="row">
        <?php echo $form->labelEx($model,'message'); ?>
        <?php echo $form->textArea($model,'message') ?>
        <?php echo $form->error($model,'message'); ?>
    </div>	
 	
	<div class="row submit">
        <?php echo CHtml::submitButton(Yii::t('interface', "send mail")); ?>
    </div>
Exemplo n.º 5
0
	/**
	 * Send mail method
	 */
	public static function sendMail($email,$subject,$message) {
		
		$model = new Email;
		
		$model->email_name = self::t("Your registration");
		$model->subject = $subject;
		$model->message = $message;
		$model->to = $email;
		$model->from = Y::config('email_to_registraiton');
    	return $model->send();
	}