public function afterSave() { // Добавляем ответы на вопросы foreach ($this->answers as $answer) { $answer->result_id = $this->id; $answer->save(); } return parent::afterSave(); }
/** * */ public function afterSave() { Yii::app()->eventManager->fire(NewsEvents::NEWS_AFTER_SAVE, new Event($this)); return parent::afterSave(); }
/** * Событие, которое вызывается после сохранения модели: * * @return parent::afterSave() **/ public function afterSave() { if ($cache = Yii::app()->getCache()) { $cache->delete("Comment{$this->model}{$this->model_id}"); } if ($this->isNewRecord) { $module = Yii::app()->getModule('comment'); $notifierComponent = $module->notifier; if ($this->level != 1 && $module->notify && ($notifier = new $notifierComponent()) !== false && $notifier instanceof application\modules\comment\components\INotifier) { $this->onNewComment = array($notifier, 'newComment'); $this->newComment(); } } return parent::afterSave(); }
/** * Метод после сохранения: * * @return void */ public function afterSave() { /* $params = array('user' => $this); if(Yii::app()->user->checkAccess('changeRole', $params) && $this->_oldRole != $this->role) { $auth = Yii::app()->authManager; // предварительно удаляем старую связь $auth->revoke($this->_oldRole, $this->id); // связываем пользователя с ролью $auth->assign($this->role, $this->id); //$auth->save(); } * */ $params = array('user' => $this); if (!Yii::app()->user->checkAccess('changeRole', $params)) { $this->role = $this->_oldRole; } return parent::afterSave(); }
public function afterSave() { parent::afterSave(); $this->clearPaymentMethods(); foreach ((array) $this->payment_methods as $payment_id) { if ($payment_id) { $deliveryPayment = new DeliveryPayment(); $deliveryPayment->delivery_id = $this->id; $deliveryPayment->payment_id = $payment_id; $deliveryPayment->save(); } } }
protected function afterSave() { parent::afterSave(); if ($this->isNewRecord) { $this->position->group_id = $this->id; $this->position->code = $this->code; $this->position->update(); $time = explode(',', $this->time); $tCount = count($time); $j = 0; $k = 0; for ($i = 0; $i < $this->number; $i++) { if ($j == $tCount) { $j = 0; $k++; } $schedule = new Schedule(); $schedule->group_id = $this->id; $schedule->number = $i + 1; $schedule->teacher_id = $this->teacher_id; $schedule->start_time = str_replace(" ", "T", date('Y-m-d H:i:s', strtotime("+" . $k . "week", strtotime($time[$j])))); if ($this->hui == "on") { $pizda = 30; } else { $pizda = 0; } $schedule->end_time = str_replace(" ", "T", date('Y-m-d H:i:s', strtotime("+" . $k . "week 1 hours " . $pizda . " minutes", strtotime($time[$j])))); //die(var_dump($this->branch_id)); $schedule->room_id = $this->findRoom($schedule->start_time, $this->branch_id, count($this->positions)); if (!$schedule->save()) { die(var_dump($schedule->getErrors())); } $j++; } } }
protected function afterSave() { Yii::app()->getCache()->clear($this->menu->code); return parent::afterSave(); }
/** * Метод выполняемый после сохранением: */ public function afterSave() { // При активации подписки админом, оплачиваем ее if ($this->type == self::TYPE_FULL && $this->_isActivateByAdmin()) { $this->_pay(); } return parent::afterSave(); }
/** * Метод выполняемый после сохранения: * * @return void */ public function afterSave() { // Обновляем список категорий $this->refreshCategories(); return parent::afterSave(); }
protected function afterSave() { $this->refreshEavAttributes(); parent::afterSave(); }
public function afterSave() { // Данные if (count($this->data) > 0) { // Удаляем старые данные AnalyzerResultData::model()->deleteAllByAttributes(array('result_id' => $this->id)); // Вставляем новые данные $resultDataArr = array(); foreach ($this->data as $variable => $row) { $resultData = new AnalyzerResultData(); $resultData->result_id = $this->id; $resultData->operation = $row['operation']; $resultData->parent_variable = $row['parent_variable']; $resultData->variable = $variable; $resultData->place = $row['place']; $resultData->attribute = isset($row['attribute']['code']) ? $row['attribute']['code'] : ''; $resultDataArr[] = $resultData; if (key_exists('subconditions', $row) && is_array($row['subconditions']) && !empty($row['subconditions'])) { // Вспомогательные условия foreach ($row['subconditions'] as $subVariable => $subRow) { $resultData = new AnalyzerResultData(); $resultData->result_id = $this->id; $resultData->operation = $subRow['operation']; $resultData->parent_variable = $subRow['parent_variable']; $resultData->variable = $subVariable; $resultData->place = $subRow['place']; $resultData->attribute = isset($subRow['attribute']['code']) ? $subRow['attribute']['code'] : ''; $resultDataArr[] = $resultData; } } } foreach ($resultDataArr as $resultData) { $resultData->save(); } } return parent::afterSave(); }
/** * Метод выполняемый после сохранения: * * @return void */ public function afterSave() { $this->getImageUrl(260, 195); $this->getImageUrl(485, 360); $this->getImageUrl(50, 50); return parent::afterSave(); }
protected function afterSave() { $this->refreshCategories(); $this->refreshReasons(); $this->refreshProducts(); parent::afterSave(); }
/** * Метод после сохранения: * * @return void */ public function afterSave() { if (Yii::app()->user->isSuperUser() && $this->_oldRole != $this->role) { Yii::app()->authManager->revoke($this->_oldRole, $this->id); if (!in_array($this->role, Yii::app()->authManager->defaultRoles)) { Yii::app()->authManager->assign($this->role, $this->id); } } return parent::afterSave(); }
/** * */ public function afterSave() { $this->updateOrderProducts($this->_orderProducts); parent::afterSave(); }
/** * Событие, которое вызывается после сохранения модели: * * @return parent::afterSave() **/ public function afterSave() { if ($cache = Yii::app()->getCache()) { $cache->delete("Comment{$this->model}{$this->model_id}"); } return parent::afterSave(); }
protected function afterSave() { $this->refreshRelatedStones(); parent::afterSave(); }
/** * Событие, которое вызывается после сохранения модели: * * @return parent::afterSave() **/ public function afterSave() { Yii::app()->eventManager->fire(CommentEvents::AFTER_SAVE_COMMENT, new CommentEvent($this, Yii::app()->getUser(), Yii::app()->getModule('comment'))); return parent::afterSave(); }
public function afterSave() { Yii::app()->cache->delete("Blog::Blog::members::{$this->user_id}"); return parent::afterSave(); }
/** * Метод выполняемый после сохранения: * * @return void */ public function afterSave() { if ($this->birth_date !== null) { $this->birth_date = date('d.m.Y', strtotime($this->birth_date)); } return parent::afterSave(); }
protected function afterSave() { parent::afterSave(); if ('CWebApplication' == get_class(Yii::app()) && $this->id == Yii::app()->user->id) { Yii::app()->session->add('timezone', $this->timezone); } }
protected function afterSave() { parent::afterSave(); if ($this->isNewRecord && $this->is_test == 0) { //Формирование расписания пользователя if ($this->isNewRecord && $this->group == "on") { $group = new Group(); $group->code = $this->listner->branch->group_counter + 1; $group->name = $group->name = $group->code . ' | ' . date('Y-m-d', strtotime("+2 week")); $group->time = $this->time; $group->lvl = $this->lvl; $group->note = $this->note; $group->teacher_id = $this->teacher_id; $group->number = $this->form->number; $group->hui = $this->hui; $group->branch_id = $this->listner->branch_id; $group->subject_id = $this->subject_id; $group->parent_id = $this->id; if ($this->parent_group) { $group->parent_group = $this->parent_group; if ($group->prev->first_parent_group) { $group->first_parent_group = $group->prev->first_parent_group; } else { $group->first_parent_group = $group->prev->id; } } $group->is_active = 1; $group->save(); if ($this->form->type->id == 4) { $this->listner->branch->individual_counter += 1; } else { $this->listner->branch->group_counter += 1; } $this->listner->branch->save(); } if ($this->form->type->id == 3) { $time = explode(',', $this->time); $tCount = count($time); $j = 0; $k = 0; for ($i = 0; $i < $this->form->number; $i++) { if ($j == $tCount) { $j = 0; $k++; } $schedule = new Schedule(); //if($this->form->type->id == 3 || $this->form->type->id == 4) //$schedule->position_id = $this->id; // else{ // $schedule->position_id = $this->id; $schedule->position_id = $this->id; $schedule->number = $i + 1; $schedule->teacher_id = $this->teacher_id; $schedule->start_time = str_replace(" ", "T", date('Y-m-d H:i:s', strtotime("+" . $k . "week", strtotime($time[$j])))); if ($this->hui == "on") { $pizda = 30; } else { $pizda = 0; } $schedule->end_time = str_replace(" ", "T", date('Y-m-d H:i:s', strtotime("+" . $k . "week 1 hours " . $pizda . " minutes", strtotime($time[$j])))); $schedule->room_id = $this->findRoom($schedule->start_time, $this->listner->branch_id, 1); $schedule->save(); $j++; } if ($this->form->type->id == 3) { $this->listner->branch->individual_counter += 1; $this->listner->branch->save(); } } //Формирование прихода $inflow = new Inflow(); $inflow->subject_id = $this->subject_id; $inflow->receiver = $this->teacher->user->fullName; $inflow->form_id = $this->form_id; if ($this->is_old == "on") { $inflow->price = $this->form->old_price; } else { $inflow->price = $this->form->price; } $inflow->based = $this->code; $inflow->comment = $this->note; $inflow->date = $this->start_date; $inflow->branch_id = $this->listner->branch_id; $inflow->save(); //Изменение статуса if ($this->listner->status != 1) { $this->listner->status = 1; $this->listner->save(); } } }