/** * Init function * @defaultParam sort = 500 */ public function init() { if (empty($this->sort)) { $this->sort = 500; } parent::init(); }
public function init() { $this->created_at = time(); $this->is_blocked = false; $this->parent_id = NULL; return parent::init(); }
public function init() { parent::init(); $this->typeList = [self::PAY_IN => 'Пополнение счета', self::PAY_OUT => 'Выплата']; $this->statusList = [self::STATUS_PENDING => 'На рассмотрении магазина', self::STATUS_FAIL => 'Не оплачен', self::STATUS_SUCCESS => 'Оплачен']; $this->status = self::STATUS_SUCCESS; }
public function init() { parent::init(); if (isset(Yii::$app->user) && Yii::$app->user instanceof WebUser && !Yii::$app->user->getIsGuest() && static::ADMIN == Yii::$app->user->identity->status) { $this->scenario = 'admin'; } }
/** * @inheritdoc */ public function init() { parent::init(); $this->active = true; $this->height = 300; $this->imageCount = 0; }
/** * @inheritdoc */ public function init() { parent::init(); $this->on(self::EVENT_BEFORE_INSERT, function (\yii\base\ModelEvent $Event) { $Event->sender->date_create = new \yii\db\Expression('NOW()'); }); }
public function init() { // if (!is_dir($this->previewUploadPath())){ // FileHelper::createDirectory($this->previewUploadPath(),0777); // } parent::init(); }
/** @inheritdoc */ public function init() { $this->finder = \Yii::$container->get(Finder::className()); $this->mailer = \Yii::$container->get(Mailer::className()); $this->module = \Yii::$app->getModule('user'); parent::init(); }
/** * @inheritdoc */ public function init() { parent::init(); if (!$this->type) { $this->type = static::TYPE; } }
public function init() { parent::init(); $this->_modelFields = array_keys(self::getAttributes()); self::getConfig(); XiiHeader::run(self::$_whoAmI); }
public function init() { if (!$this->userClass) { $this->userClass = Yii::$app->modules[Module::MODULE_ID]->userClass; } return parent::init(); }
public function init() { if ($this->hasAttribute('sort_num')) { $this->sort_num = Constants::getSortNum(); } parent::init(); }
/** * @inheritdoc */ public function init() { if (null === $this->uid) { $this->uid = self::generateUID(); } parent::init(); }
public function init() { // create weights $key = 0; foreach ($this->getRuleAllIdName() as $id => $name) { $this->weights[$key] = $key; $key++; } $this->weights[$key] = $key; $modelRuleCondition = new RuleCondition(); /*echo('<pre>'); print_r($modelRuleCondition->conditions); print_r($modelRuleCondition->weights); echo('</pre>'); exit();*/ $this->RuleCondition_conditions = $modelRuleCondition->conditions; $this->RuleCondition_equations = $modelRuleCondition->equations; $this->RuleCondition_weights = $modelRuleCondition->weights; $this->RuleCondition_name = []; $this->RuleCondition_condition = []; $this->RuleCondition_equation = []; $this->RuleCondition_value = []; $this->RuleCondition_weight = []; parent::init(); }
public function init() { parent::init(); $this->on(self::EVENT_AFTER_FIND, [$this, 'decodeTransactionConfig']); $this->on(self::EVENT_BEFORE_INSERT, [$this, 'encodeTransactionConfig']); $this->on(self::EVENT_BEFORE_UPDATE, [$this, 'encodeTransactionConfig']); }
public function init() { // actions // translate foreach ($this->actions as $actions => $name) { $this->actions[$actions] = Yii::t('app', $name); } // actions values $this->actions_values['taskdefined'] = TaskDefined::getAllIdName(); $this->actions_values['setting'] = Setting::getAllIdName(); $this->actions_values['rule'] = Rule::getAllIdName(); $this->actions_values['rulevalue'] = RuleValue::getAllIdName(); $this->actions_values['ruleextra'] = RuleExtra::getAllIdName(); $this->actions_values['ruledate'] = RuleDate::getAllIdName(); // values // translate foreach ($this->values as $values => $name) { $this->values[$values] = Yii::t('app', $name); } // values_values $this->values_values['taskdefined'] = TaskDefined::getAllIdName(); $this->values_values['setting'] = Setting::getAllIdName(); $this->values_values['rule'] = Rule::getAllIdName(); $this->values_values['rulevalue'] = RuleValue::getAllIdName(); $this->values_values['ruleextra'] = RuleExtra::getAllIdName(); $this->values_values['ruledate'] = RuleDate::getAllIdName(); //$this->values = array_merge($modelRule->values, $modelRule->actions); //$this->values_values = $modelRule->values; // create weights from 0 to 5 for ($weight = 0; $weight <= 4; $weight++) { $this->weights[$weight] = $weight; } parent::init(); }
public function init() { parent::init(); // These guys are the linker $glbUser = new GlbUser(); $user = $glbUser->getUser(); $this->company_id = $user->company_id; Yii::$app->session->set('company_id', $this->company_id); // These guys are the linker- END $this->data_location = $user->region; $companyData = Company::find()->all(); if (!empty($companyData)) { $companyData = $companyData[0]; $this->company_name = $companyData->name; $this->address = $companyData->address; $this->city = $companyData->city; $this->state = $companyData->state; $this->postal_code = $companyData->postal_code; $this->country = $companyData->country; $this->phone = $companyData->phone; $this->fax = $companyData->fax; $this->email = $companyData->email; $this->website = $companyData->website; } }
public function init() { parent::init(); if ($this->module === null) { $this->module = Yii::$app->getModule('user'); } //$this->module = Yii::$app->controller->module; }
public function init() { parent::init(); foreach (Category::find()->all() as $category) { $this->_catagories[$category->parent_id][] = $category; } //print_r($this->_catagories);die; }
public function init() { parent::init(); $this->on(self::EVENT_BEFORE_INSERT, [$this, 'eventBeforeInsert']); $this->on(self::EVENT_AFTER_INSERT, [$this, 'reindex']); $this->on(self::EVENT_AFTER_UPDATE, [$this, 'reindex']); $this->on(self::EVENT_AFTER_DELETE, [$this, 'reindex']); }
public function init() { parent::init(); $pageSize = Settings::findOne(['type' => 'main', 'key' => 'page_size']); if ($pageSize !== null) { self::$defaultPageSize = $pageSize->value; } }
/** * @inheritdoc */ public function init() { parent::init(); $this->on(self::EVENT_BEFORE_INSERT, function (\yii\base\ModelEvent $Event) { $Event->sender->code = empty($Event->sender->code) ? \Yii::$app->getSecurity()->generateRandomString() : $Event->sender->code; $Event->sender->date_create = new \yii\db\Expression('NOW()'); }); }
public function init() { $this->sender_name = 'Tixty'; $this->sender_email = \Yii::$app->params['adminEmail']; $this->status = Email::EMAIL_UNSENT; $this->created = date("Y-m-d H:i:s"); parent::init(); }
public function init() { if ($this->isNewRecord) { $this->npp = 0; $this->textMaxLength = 100; } parent::init(); }
/** * @inheritdoc */ public function init() { // Make sure there's a request token. if (null === $this->request_token) { $this->request_token = Yii::$app->security->generateRandomString(); } parent::init(); }
public function init() { parent::init(); $this->on(self::EVENT_BEFORE_INSERT, [$this, 'eventBeforeInsert']); $this->on(self::EVENT_AFTER_INSERT, [$this, 'eventAfterInsert']); $this->on(self::EVENT_AFTER_UPDATE, [$this, 'eventAfterUpdate']); $this->on(self::EVENT_BEFORE_UPDATE, [$this, 'eventBeforeUpdate']); }
public function init() { parent::init(); $this->on(ActiveRecord::EVENT_BEFORE_VALIDATE, function ($event) { if ($this->api_key == '') { $this->api_key = self::generateNewApiKey(); } }); }
public function init() { parent::init(); if ($this->item instanceof Tag) { $this->id = $this->item->id; $this->setAttributes($this->item->getAttributes()); $this->setIsNewRecord($this->item->getIsNewRecord()); } }
public function init() { $this->upload_dir = Yii::$app->getModule('fp')->upload_dir; $this->root_path = Yii::$app->getModule('fp')->root_path; $this->root_url = Yii::$app->getModule('fp')->root_url; $this->unlink_files = Yii::$app->getModule('fp')->unlink_files; $this->image_driver = Yii::$app->getModule('fp')->image_driver; parent::init(); }
/** * @inheritdoc */ public function init() { parent::init(); $this->on(self::EVENT_BEFORE_DELETE, [$this, 'eventBeforeDelete']); $this->on(self::EVENT_AFTER_INSERT, [$this, 'eventAfterInsert']); $this->on(self::EVENT_AFTER_UPDATE, [$this, 'eventAfterUpdate']); $this->on(self::EVENT_AFTER_DELETE, [$this, 'eventAfterDelete']); $this->on(self::EVENT_AFTER_VALIDATE, [$this, 'ensureInputValues']); }