示例#1
0
 public function save()
 {
     $model = new ConsultationRequest();
     $model->email = $this->email;
     $model->name = $this->name;
     $model->phone = $this->phone;
     $model->skype = $this->skype;
     $model->text = $this->text;
     if ($model->save(FALSE)) {
         $this->emailSubject = 'Замовлення консультації з сайту РЕЗИДЕНТ';
         $this->receiverEmail = Yii::app()->params['emails']['notificationReceiver'];
         $this->emailViewFile = 'consultation';
         $this->emailParams = array('name' => $model->getName(), 'email' => $model->getEmail(FALSE, TRUE), 'message' => $model->getText(), 'phone' => $this->phone, 'skype' => $this->skype);
         $this->senderEmail = Yii::app()->params['emails']['defaultSender'];
         if ($this->sendEmail()) {
             if (!empty($this->email)) {
                 $this->notificationSubject = 'Повідомлення від сайту http://rezydent.com.ua';
                 $this->notificationViewFile = 'sender-notification';
                 $this->notificationParams = array();
                 $this->notificationReceiver = $this->email;
                 $this->notificationSender = Yii::app()->params['emails']['defaultSender'];
                 $this->sendSenderNotification();
             }
         }
     }
 }
 public function actionView()
 {
     /** @var $messageModel ContactMessage */
     $messageModel = ConsultationRequest::model()->findByPk(getParam('id'));
     $messageModel->is_new = 0;
     $messageModel->save();
     $this->render('view', array('model' => $messageModel));
 }
 function testUnclosed()
 {
     $y = ConsultationRequest::unclosed();
     $this->assertType('array', $y);
     $this->assertEquals(2, count($y));
     $z = array_shift($y);
     $this->assertType('ConsultationRequest', $z);
     $this->assertEquals(2, $z->id);
 }
示例#4
0
 function request()
 {
     return ConsultationRequest::for_consultation($this->id);
 }
示例#5
0
 function consultation_requests()
 {
     return ConsultationRequest::for_teacher($this->id);
 }
示例#6
0
 static function for_consultation($consultation_id)
 {
     return ConsultationRequest::for_query(sprintf("SELECT * FROM consultation_requests WHERE consultation_id=%d ORDER BY id DESC", $teacher_id));
 }
示例#7
0
 function consultation_requests()
 {
     return ConsultationRequest::for_student($this->id);
 }