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); }
function request() { return ConsultationRequest::for_consultation($this->id); }
function consultation_requests() { return ConsultationRequest::for_teacher($this->id); }
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)); }
function consultation_requests() { return ConsultationRequest::for_student($this->id); }