/** * @inheritdoc */ public function __construct($config = []) { parent::__construct($config); if (is_null($this->columns)) { $this->columns = [new Column()]; } }
public function __construct($config = []) { if ($this->getUserSecurityQusetions() != null) { $this->setAttributes(['question_one' => $this->getUserSecurityQusetions()->security_question_one_id, 'question_one_answer' => $this->getUserSecurityQusetions()->security_question_one_answer, 'question_two' => $this->getUserSecurityQusetions()->security_question_two_id, 'question_two_answer' => $this->getUserSecurityQusetions()->security_question_two_answer], false); } parent::__construct($config); }
/** * CategoryForm constructor * @param integer|null $item_id */ public function __construct($item_id = null) { parent::__construct(); if ($item_id) { /** @var $category Category*/ $category = Category::findOne($item_id); $this->item_id = $category->id; $this->language_id = $category->language_id; $this->title = $category->title; $this->description = $category->description; $this->category_type = $category->category_type; if ($category->main) { $this->boxes[] = self::PROPERTY_MAIN; } if ($category->public) { $this->boxes[] = self::PROPERTY_PUBLIC; } if ($category->active) { $this->boxes[] = self::PROPERTY_ACTIVE; } } else { $session = Yii::$app->session; if (!$session['language_id']) { $session['language_id'] = LanguageRecord::getMainLanguageId(); } $this->language_id = $session['language_id']; $this->boxes[] = self::PROPERTY_PUBLIC; $this->boxes[] = self::PROPERTY_ACTIVE; } }
public function __construct($user, $config = []) { parent::__construct($config); $this->_user = $user; $this->username = $user->username; $this->email = $user->email; }
/** * Find profession categories with professions links * @param array $config */ public function __construct($config = []) { $this->categorias = Categorias::find()->with(['articulos' => function ($query) { $query->andWhere(['in', 'estado', [Articulos::NUEVO, Articulos::USADO, Articulos::OFERTA, Articulos::RESERVADO]])->orderBy(['idarticulo' => SORT_DESC]); }])->activas()->all(); parent::__construct($config); }
/** * @param Mailer $mailer * @param Finder $finder * @param array $config */ public function __construct(Mailer $mailer, Finder $finder, $config = []) { $this->module = \Yii::$app->getModule('user'); $this->mailer = $mailer; $this->finder = $finder; parent::__construct($config); }
/** * @param integer|null $item_id */ public function __construct($item_id = null) { parent::__construct(); if ($item_id) { /** @var $poll PollRecord */ $poll = PollRecord::findOne($item_id); $this->item_id = $poll->id; $this->language_id = $poll->language_id; $this->question = $poll->question; $this->end_date = $poll->end_date ? Yii::$app->formatter->asDate($poll->end_date, 'dd.MM.y') : null; if ($poll->active) { $this->boxes[] = self::PROPERTY_ACTIVE; } if ($poll->main) { $this->boxes[] = self::PROPERTY_MAIN; } foreach ($poll->answers as $pollAnswer) { $this->answers[] = $pollAnswer->answer; } $voices = PollAnswerRecord::find()->where(['poll_id' => $poll->id])->andWhere('voices>0')->count(); $this->isAnswersEditable = !$voices; } else { $session = Yii::$app->session; if (!$session['language_id']) { $session['language_id'] = LanguageRecord::getMainLanguageId(); } $this->language_id = $session['language_id']; $this->boxes[] = self::PROPERTY_ACTIVE; $this->answers[1] = $this->answers[0] = ''; $this->isAnswersEditable = true; } }
/** * @param array $config * @param bool $item */ public function __construct($config = [], $item = false) { parent::__construct($config); if ($item) { $this->attributes = $item; } }
/** @inheritdoc */ public function __construct(Mailer $mailer, $config = []) { $this->mailer = $mailer; $this->module = \Yii::$app->getModule('user'); $this->setAttributes(['username' => $this->user->username, 'email' => $this->user->email, 'tagline' => $this->user->tagline, 'display_name' => $this->user->display_name], false); parent::__construct($config); }
/** @inheritdoc */ public function __construct(Mailer $mailer, $config = []) { $this->mailer = $mailer; $this->module = Yii::$app->getModule('user'); $this->setAttributes(['username' => $this->user->username, 'email' => $this->user->unconfirmed_email ?: $this->user->email], false); parent::__construct($config); }
/** * Creates a form model given a token. * * @param int $id The user ID. * @param array $config name-value pairs that will be used to initialize the object properties * @throws \yii\base\InvalidParamException if token is empty or not valid */ public function __construct($id, $config = []) { // Volunteer can be new or have an existing entry. $this->_volunteer = Volunteer::findOne($id); if (!$this->_volunteer) { $this->_volunteer = new Volunteer(); $this->_volunteer->accountID = $id; } else { // Initialise form values. foreach ($this::$interestBits as $key => $value) { if ($key & $this->_volunteer->interests) { $this->interests[] = $key; } } foreach ($this::$availabilityBits as $key => $value) { if ($key & $this->_volunteer->availability) { $this->availability[] = $key; } if ($key & $this->_volunteer->experience) { $this->experience[] = $key; } } $this->daysAvailable = $this->_volunteer->daysAvailable; $this->skills = $this->_volunteer->skills; $this->mobile = User::findOne($id)->details->mobile; } parent::__construct($config); }
/** * @inheritdoc */ public function __construct(Posts $postModel, $config = []) { $this->postModel = $postModel; $this->setAttributes($this->postModel->getAttributes(['title', 'description', 'file', 'category_id', 'author_id', 'create_date'])); $this->tags = ArrayHelper::map($postModel->tagPost, 'name', 'name'); parent::__construct($config); }
/** * PageForm constructor * @param integer|null $item_id */ public function __construct($item_id = null) { parent::__construct(); if ($item_id) { /** @var $page Page */ $page = Page::findOne($item_id); $this->item_id = $page->id; $this->language_id = $page->language_id; if ($page->image) { $this->imageFilename = $page->image->filename; } $this->perex = $page->perex; $this->title = $page->title; $this->description = $page->description; if ($page->active) { $this->boxes[] = self::PROPERTY_ACTIVE; } if ($page->public) { $this->boxes[] = self::PROPERTY_PUBLIC; } $this->tagValues = $page->tagValues; } else { $session = Yii::$app->session; if (!$session['language_id']) { $session['language_id'] = LanguageRecord::getMainLanguageId(); } $this->language_id = $session['language_id']; $this->boxes[] = self::PROPERTY_ACTIVE; $this->boxes[] = self::PROPERTY_PUBLIC; } }
public function __construct(ActionsRecord $model, $config = []) { $this->_model = $model; if ($this->objects !== false && isset($config['objects']) && is_string($config['objects'])) { $config['objects'] = preg_split('/,\\s*/', $config['objects']); } parent::__construct($config); }
/** * Creates a form model given a token. * * @param array $config name-value pairs that will be used to initialize the object properties * @throws \yii\base\InvalidParamException if token is empty or not valid */ public function __construct($config = []) { $this->_user = User::thisUser(); if (!$this->_user) { throw new InvalidParamException('Wrong password reset token.'); } parent::__construct($config); }
/** * @param Wiki $wiki * @param array $config */ public function __construct(Wiki $wiki, $config = array()) { $this->_wiki = $wiki; $this->title = $wiki->title; $this->slug = $wiki->slug; $this->content = $this->getHistoryContent(); parent::__construct($config); }
public function __construct($config = array()) { if (YII_DEBUG) { error_log("[ProfileForm::__construct]"); } parent::__construct($config); $this->loadData(); }
/** * Creates a form model given an order id. * * @param string $id * @param array $config name-value pairs that will be used to initialize the object properties * @throws \yii\base\InvalidParamException if order id is not valid */ public function __construct($id, $config = []) { $this->_order = Order::find()->where(['and', ['id' => $id], ['user_id' => Yii::$app->user->id], ['<>', 'status', Order::STATUS_DELETED]])->one(); if (!$this->_order) { throw new InvalidParamException('您没有该订单!'); } parent::__construct($config); }
public function __construct($config = []) { if (Yii::$app->user->isGuest) { throw new Exception('Method not allowed to guest users.'); } $this->_user = User::findIdentity(Yii::$app->user->id); parent::__construct($config); }
public function __construct(Studio $Studio, $config = []) { $this->Studio = $Studio; if (!$this->Studio->type) { throw new InvalidParamException('Не указан тип студии'); } parent::__construct($config = []); }
/** * * @param mixed $userId The id of user use for assign * @param array $config */ public function __construct($usuarioId, $config = array()) { parent::__construct($config); $this->usuarioId = $usuarioId; foreach ($this->getIdUnidadesEjecutoras($usuarioId) as $unidades) { $this->unidadesEjecutoras[] = $unidades->unidad_ejecutora; } }
/** * @param User $user * @param array $config * @throws \yii\base\InvalidParamException */ public function __construct(User $user, $config = []) { if (empty($user)) { throw new InvalidParamException('User is empty.'); } $this->_user = $user; parent::__construct($config); }
/** * Creates a form model given a token. * * @param string $token * @param array $config name-value pairs that will be used to initialize the object properties * @throws \yii\base\InvalidParamException if token is empty or not valid */ public function __construct($uid, $config = []) { $this->_user = User::findOne($uid); if (!$this->_user) { throw new InvalidParamException('找不到该用户.'); } parent::__construct($config); }
public function __construct($user, $tournament, array $config = []) { $this->getForecast($user, $tournament); $this->first = $this->_models[1]->id_participant_team; $this->second = $this->_models[2]->id_participant_team; $this->third = $this->_models[3]->id_participant_team; parent::__construct($config); }
public function __construct($id, $config = []) { // if (empty($user)) { // throw new InvalidParamException('User is empty.'); // } $user = User::findOne($id); $this->_user = $user; parent::__construct($config); }
public function __construct($item = NULL, $config = []) { $this->_item = $item; if ($this->_item != NULL) { $this->route = $item->name; $this->description = $item->description; } parent::__construct($config); }
/** * Creates a form model given a token. * * @param string $token * @param array $config name-value pairs that will be used to initialize the object properties * @throws \yii\base\InvalidParamException if token is empty or not valid */ public function __construct($id, $config = []) { $this->_user = Admin::findIdentity($id); if (!$this->_user) { throw new InvalidParamException('Unable to find admin!'); } $this->id = $this->_user->id; parent::__construct($config); }
/** * @param Finder $finder * @param array $config */ public function __construct(Finder $finder, $config = []) { // Override the singleton instance for the Finder that is set in // the DI container of the Boostrap class of this module so that our custom Finder is used \Yii::$container->setSingleton(Finder::className(), ['userQuery' => \Yii::$container->get('UserQuery'), 'profileQuery' => \Yii::$container->get('ProfileQuery'), 'tokenQuery' => \Yii::$container->get('TokenQuery'), 'accountQuery' => \Yii::$container->get('AccountQuery')]); $this->finder = \Yii::$container->get(Finder::className()); $this->module = \Yii::$app->getModule('user'); Model::__construct($config); }
/** * * @param mixed $userId The id of user use for assign * @param array $config */ public function __construct($userId, $config = array()) { parent::__construct($config); $this->userId = $userId; $this->authManager = Yii::$app->authManager; foreach ($this->authManager->getRolesByUser($userId) as $role) { $this->roles[] = $role->name; } }
/** * Initilaize object * @param \yii\rbac\Rule $item * @param array $config */ public function __construct($item, $config = []) { $this->_item = $item; if ($item !== null) { $this->name = $item->name; $this->className = get_class($item); } parent::__construct($config); }