示例#1
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $statusLabels = User::statusLabels();
     // set items
     $this->setItems([$this->model->first_name, $this->model->last_name, $this->model->email, isset($this->model->languageI18ns[0]) ? $this->model->languageI18ns[0]->title : '', isset($this->model->user) ? $statusLabels[$this->model->user->status] : '']);
 }
示例#2
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     // models
     $models = $this->getModels();
     // language
     $language = $this->getLanguage();
     // get drop down list methods
     $dropDownList = $this->getDropDownList();
     // upload config
     $uploadConfig['main'] = $this->uploadConfig[(new \ReflectionClass($models['main']))->getName()];
     // set items
     $items = [];
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'third_id', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'third.id']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($models['main']->third_id) ? Third::findOne(['id' => $models['main']->third_id])->id : '']]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'first_name', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('first_name')]]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'last_name', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('last_name')]]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'email', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('email')]]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'default_language', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'language_i18n.title']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($models['main']->default_language) ? LanguageI18n::findOne(['language_id' => $models['main']->default_language, 'i18n_id' => $language])->title : '']]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'user_id', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'user.username']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($models['main']->user_id) ? User::findOne(['id' => $models['main']->user_id])->username : '']]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'gender_id', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'person_gender_i18n.title']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($models['main']->gender_id) ? PersonGenderI18n::findOne(['gender_id' => $models['main']->gender_id, 'i18n_id' => $language])->title : '']]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'phone_1', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('phone_1')]]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'phone_2', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('phone_2')]]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'fax', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('fax')]]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'website', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('website')]]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'birthday', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm date-picker date-range', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('birthday')]]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'skype', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('skype')]]);
     $items[] = new SimpleValueField(['model' => $models['main'], 'attribute' => 'created_at', 'value' => Yii::$app->formatter->asDatetime($models['main']->created_at, I18N::getDateFormat())]);
     $items[] = new SimpleValueField(['model' => $models['main'], 'attribute' => 'updated_at', 'value' => Yii::$app->formatter->asDatetime($models['main']->updated_at, I18N::getDateFormat())]);
     $this->setItems($items);
 }
示例#3
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     // get model
     $model = $this->getModel();
     // language
     $language = $this->getLanguage();
     // get drop down list methods
     $dropDownList = $this->getDropDownList();
     // set titles
     $this->setTitle(Yii::t('kalibao', 'list_title'));
     // set head attributes
     $this->setGridHeadAttributes(['third_id' => true, 'first_name' => true, 'last_name' => true, 'email' => true, 'language_i18n_title' => true, 'user_username' => true, 'person_gender_i18n_title' => true, 'phone_1' => true, 'phone_2' => true, 'fax' => true, 'website' => true, 'birthday' => true, 'skype' => true, 'created_at' => true, 'updated_at' => true]);
     // set head filters
     $this->setGridHeadFilters([new InputField(['model' => $model, 'attribute' => 'third_id', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'third.id']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($model->third_id) ? Third::findOne(['id' => $model->third_id])->id : '']]), new InputField(['model' => $model, 'attribute' => 'first_name', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'last_name', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'email', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'default_language', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'language_i18n.title']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($model->default_language) ? LanguageI18n::findOne(['language_id' => $model->default_language, 'i18n_id' => $language])->title : '']]), new InputField(['model' => $model, 'attribute' => 'user_id', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'user.username']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($model->user_id) ? User::findOne(['id' => $model->user_id])->username : '']]), new InputField(['model' => $model, 'attribute' => 'gender_id', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'person_gender_i18n.title']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($model->gender_id) ? PersonGenderI18n::findOne(['gender_id' => $model->gender_id, 'i18n_id' => $language])->title : '']]), new InputField(['model' => $model, 'attribute' => 'phone_1', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'phone_2', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'fax', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'website', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'birthday', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm date-picker date-range', 'maxlength' => true, 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'skype', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new DateRangeField(['model' => $model, 'attribute' => 'created_at', 'start' => new InputField(['model' => $model, 'attribute' => 'created_at_start', 'type' => 'activeTextInput', 'options' => ['placeholder' => Yii::t('kalibao', 'input_search'), 'maxlength' => true, 'class' => 'form-control input-sm date-picker date-range']]), 'end' => new InputField(['model' => $model, 'attribute' => 'created_at_end', 'type' => 'activeTextInput', 'options' => ['placeholder' => Yii::t('kalibao', 'input_search'), 'maxlength' => true, 'class' => 'form-control input-sm date-picker date-range']])]), new DateRangeField(['model' => $model, 'attribute' => 'updated_at', 'start' => new InputField(['model' => $model, 'attribute' => 'updated_at_start', 'type' => 'activeTextInput', 'options' => ['placeholder' => Yii::t('kalibao', 'input_search'), 'maxlength' => true, 'class' => 'form-control input-sm date-picker date-range']]), 'end' => new InputField(['model' => $model, 'attribute' => 'updated_at_end', 'type' => 'activeTextInput', 'options' => ['placeholder' => Yii::t('kalibao', 'input_search'), 'maxlength' => true, 'class' => 'form-control input-sm date-picker date-range']])])]);
     // set advanced filters
     $this->setAdvancedFilters([new InputField(['model' => $model, 'attribute' => 'third_id', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'third.id']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($model->third_id) ? Third::findOne(['id' => $model->third_id])->id : '']]), new InputField(['model' => $model, 'attribute' => 'first_name', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'last_name', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'email', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'default_language', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'language_i18n.title']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($model->default_language) ? LanguageI18n::findOne(['language_id' => $model->default_language, 'i18n_id' => $language])->title : '']]), new InputField(['model' => $model, 'attribute' => 'user_id', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'user.username']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($model->user_id) ? User::findOne(['id' => $model->user_id])->username : '']]), new InputField(['model' => $model, 'attribute' => 'gender_id', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'person_gender_i18n.title']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($model->gender_id) ? PersonGenderI18n::findOne(['gender_id' => $model->gender_id, 'i18n_id' => $language])->title : '']]), new InputField(['model' => $model, 'attribute' => 'phone_1', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'phone_2', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'fax', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'website', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'birthday', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm date-picker date-range', 'maxlength' => true, 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'skype', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new DateRangeField(['model' => $model, 'attribute' => 'created_at', 'start' => new InputField(['model' => $model, 'attribute' => 'created_at_start', 'type' => 'activeTextInput', 'options' => ['placeholder' => Yii::t('kalibao', 'input_search'), 'maxlength' => true, 'class' => 'form-control input-sm date-picker date-range']]), 'end' => new InputField(['model' => $model, 'attribute' => 'created_at_end', 'type' => 'activeTextInput', 'options' => ['placeholder' => Yii::t('kalibao', 'input_search'), 'maxlength' => true, 'class' => 'form-control input-sm date-picker date-range']])]), new DateRangeField(['model' => $model, 'attribute' => 'updated_at', 'start' => new InputField(['model' => $model, 'attribute' => 'updated_at_start', 'type' => 'activeTextInput', 'options' => ['placeholder' => Yii::t('kalibao', 'input_search'), 'maxlength' => true, 'class' => 'form-control input-sm date-picker date-range']]), 'end' => new InputField(['model' => $model, 'attribute' => 'updated_at_end', 'type' => 'activeTextInput', 'options' => ['placeholder' => Yii::t('kalibao', 'input_search'), 'maxlength' => true, 'class' => 'form-control input-sm date-picker date-range']])])]);
 }
 /**
  * @inheritdoc
  */
 protected function getDropDownList($id)
 {
     if (!isset($this->dropDownLists[$id])) {
         switch ($id) {
             case 'checkbox-drop-down-list':
                 $this->dropDownLists[$id] = Html::checkboxInputFilterDropDownList();
                 break;
             case 'user.status':
                 $statusLabel = User::statusLabels();
                 $this->dropDownLists[$id] = ['' => Yii::t('kalibao', 'input_select'), User::STATUS_ENABLED => $statusLabel[User::STATUS_ENABLED], User::STATUS_DISABLED => $statusLabel[User::STATUS_DISABLED]];
                 break;
             case 'user.status:required':
                 $statusLabel = User::statusLabels();
                 $this->dropDownLists[$id] = [User::STATUS_ENABLED => $statusLabel[User::STATUS_ENABLED], User::STATUS_DISABLED => $statusLabel[User::STATUS_DISABLED]];
                 break;
             default:
                 return [];
                 break;
         }
     }
     return $this->dropDownLists[$id];
 }
示例#5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getUser()
 {
     return $this->hasOne(User::className(), ['id' => 'user_id']);
 }
示例#6
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $this->statusLabels = User::statusLabels();
     $this->setHeader(['#', 'first_name' => true, 'last_name' => true, 'email' => true, 'language_i18n_title' => true, 'user_status' => true, 'user_active_password_reset' => true, 'created_at' => true, 'updated_at' => true]);
 }