示例#1
0
文件: Edit.php 项目: kalibao/magesko
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     // set titles
     $this->setCreateTitle(Yii::t('kalibao', 'create_title'));
     $this->setUpdateTitle(Yii::t('kalibao', 'update_title'));
     // 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 = [];
     if (!$models['main']->isNewRecord) {
         $items[] = new SimpleValueField(['model' => $models['main'], 'attribute' => 'id', 'value' => $models['main']->id]);
     }
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'sheet_type_id', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'sheet_type_i18n.label']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($models['main']->sheet_type_id) ? SheetTypeI18n::findOne(['sheet_type_id' => $models['main']->sheet_type_id, 'i18n_id' => $language])->label : '']]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'branch_id', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'branch_i18n.label']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($models['main']->branch_id) ? BranchI18n::findOne(['branch_id' => $models['main']->branch_id, 'i18n_id' => $language])->label : '']]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'primary_key', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('primary_key')]]);
     if (!$models['main']->isNewRecord) {
         $items[] = new SimpleValueField(['model' => $models['main'], 'attribute' => 'created_at', 'value' => Yii::$app->formatter->asDatetime($models['main']->created_at, I18N::getDateFormat())]);
     }
     if (!$models['main']->isNewRecord) {
         $items[] = new SimpleValueField(['model' => $models['main'], 'attribute' => 'updated_at', 'value' => Yii::$app->formatter->asDatetime($models['main']->updated_at, I18N::getDateFormat())]);
     }
     $this->setItems($items);
 }
示例#2
0
文件: Edit.php 项目: kalibao/magesko
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     // set titles
     $this->setCreateTitle(Yii::t('kalibao', 'create_title'));
     $this->setUpdateTitle(Yii::t('kalibao', 'update_title'));
     // 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 = [];
     if (!$models['main']->isNewRecord) {
         $items[] = new SimpleValueField(['model' => $models['main'], 'attribute' => 'id', 'value' => $models['main']->id]);
     }
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'branch_type_id', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'branch_type_i18n.label']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($models['main']->branch_type_id) ? BranchTypeI18n::findOne(['branch_type_id' => $models['main']->branch_type_id, 'i18n_id' => $language])->label : '']]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'tree_id', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'tree_i18n.label']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($models['main']->tree_id) ? TreeI18n::findOne(['tree_id' => $models['main']->tree_id, 'i18n_id' => $language])->label : '']]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'parent', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'branch_i18n.label']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($models['main']->parent) ? BranchI18n::findOne(['branch_id' => $models['main']->parent, 'i18n_id' => $language])->label : '']]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'order', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('order')]]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'media_id', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'media_i18n.title']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($models['main']->media_id) ? MediaI18n::findOne(['media_id' => $models['main']->media_id, 'i18n_id' => $language])->title : '']]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'visible', 'type' => 'activeCheckbox', 'options' => ['class' => '', 'label' => '']]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'background', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('background')]]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'presentation_type', 'type' => 'activeCheckbox', 'options' => ['class' => '', 'label' => '']]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'offset', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('offset')]]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'display_brands_types', 'type' => 'activeCheckbox', 'options' => ['class' => '', 'label' => '']]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'big_menu_only_first_level', 'type' => 'activeCheckbox', 'options' => ['class' => '', 'label' => '']]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'unfold', 'type' => 'activeCheckbox', 'options' => ['class' => '', 'label' => '']]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'google_shopping_category_id', 'type' => 'activeDropDownList', 'data' => $dropDownList('google_shopping_category.id'), 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('google_shopping_category_id')]]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'google_shopping', 'type' => 'activeCheckbox', 'options' => ['class' => '', 'label' => '']]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'affiliation_category_id', 'type' => 'activeDropDownList', 'data' => $dropDownList('affiliation_category.id'), 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('affiliation_category_id')]]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'affiliation', 'type' => 'activeCheckbox', 'options' => ['class' => '', 'label' => '']]);
     $items[] = new InputField(['model' => $models['i18n'], 'attribute' => 'label', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['i18n']->getAttributeLabel('label')]]);
     $items[] = new InputField(['model' => $models['i18n'], 'attribute' => 'description', 'type' => 'activeTextarea', 'options' => ['class' => 'form-control input-sm wysiwyg-textarea', 'data-ckeditor-language' => $language]]);
     $items[] = new InputField(['model' => $models['i18n'], 'attribute' => 'url', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['i18n']->getAttributeLabel('url')]]);
     $items[] = new InputField(['model' => $models['i18n'], 'attribute' => 'meta_title', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['i18n']->getAttributeLabel('meta_title')]]);
     $items[] = new InputField(['model' => $models['i18n'], 'attribute' => 'meta_description', 'type' => 'activeTextarea', 'options' => ['class' => 'form-control input-sm', 'placeholder' => $models['i18n']->getAttributeLabel('meta_description')]]);
     $items[] = new InputField(['model' => $models['i18n'], 'attribute' => 'meta_keywords', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['i18n']->getAttributeLabel('meta_keywords')]]);
     $items[] = new InputField(['model' => $models['i18n'], 'attribute' => 'h1_tag', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['i18n']->getAttributeLabel('h1_tag')]]);
     if (!$models['main']->isNewRecord) {
         $items[] = new SimpleValueField(['model' => $models['main'], 'attribute' => 'created_at', 'value' => Yii::$app->formatter->asDatetime($models['main']->created_at, I18N::getDateFormat())]);
     }
     if (!$models['main']->isNewRecord) {
         $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(['id' => true, 'branch_type_i18n_label' => true, 'tree_i18n_label' => true, 'branch_i18n_label' => true, 'order' => true, 'media_i18n_title' => true, 'visible' => true, 'background' => true, 'presentation_type' => true, 'offset' => true, 'display_brands_types' => true, 'big_menu_only_first_level' => true, 'unfold' => true, 'google_shopping_category_id' => true, 'google_shopping' => true, 'affiliation_category_id' => true, 'affiliation' => true, 'branch_i18n_label' => true, 'branch_i18n_description' => true, 'branch_i18n_url' => true, 'branch_i18n_meta_title' => true, 'branch_i18n_meta_description' => true, 'branch_i18n_meta_keywords' => true, 'branch_i18n_h1_tag' => true, 'created_at' => true, 'updated_at' => true]);
     // set head filters
     $this->setGridHeadFilters([new InputField(['model' => $model, 'attribute' => 'id', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'branch_type_id', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'branch_type_i18n.label']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($model->branch_type_id) ? BranchTypeI18n::findOne(['branch_type_id' => $model->branch_type_id, 'i18n_id' => $language])->label : '']]), new InputField(['model' => $model, 'attribute' => 'tree_id', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'tree_i18n.label']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($model->tree_id) ? TreeI18n::findOne(['tree_id' => $model->tree_id, 'i18n_id' => $language])->label : '']]), new InputField(['model' => $model, 'attribute' => 'parent', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'branch_i18n.label']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($model->parent) ? BranchI18n::findOne(['branch_id' => $model->parent, 'i18n_id' => $language])->label : '']]), new InputField(['model' => $model, 'attribute' => 'order', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'media_id', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'media_i18n.title']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($model->media_id) ? MediaI18n::findOne(['media_id' => $model->media_id, 'i18n_id' => $language])->title : '']]), new InputField(['model' => $model, 'attribute' => 'visible', 'type' => 'activeDropDownList', 'data' => $dropDownList('checkbox-drop-down-list'), 'options' => ['class' => 'form-control input-sm']]), new InputField(['model' => $model, 'attribute' => 'background', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'presentation_type', 'type' => 'activeDropDownList', 'data' => $dropDownList('checkbox-drop-down-list'), 'options' => ['class' => 'form-control input-sm']]), new InputField(['model' => $model, 'attribute' => 'offset', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'display_brands_types', 'type' => 'activeDropDownList', 'data' => $dropDownList('checkbox-drop-down-list'), 'options' => ['class' => 'form-control input-sm']]), new InputField(['model' => $model, 'attribute' => 'big_menu_only_first_level', 'type' => 'activeDropDownList', 'data' => $dropDownList('checkbox-drop-down-list'), 'options' => ['class' => 'form-control input-sm']]), new InputField(['model' => $model, 'attribute' => 'unfold', 'type' => 'activeDropDownList', 'data' => $dropDownList('checkbox-drop-down-list'), 'options' => ['class' => 'form-control input-sm']]), new InputField(['model' => $model, 'attribute' => 'google_shopping_category_id', 'type' => 'activeDropDownList', 'data' => $dropDownList('google_shopping_category.id'), 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'google_shopping', 'type' => 'activeDropDownList', 'data' => $dropDownList('checkbox-drop-down-list'), 'options' => ['class' => 'form-control input-sm']]), new InputField(['model' => $model, 'attribute' => 'affiliation_category_id', 'type' => 'activeDropDownList', 'data' => $dropDownList('affiliation_category.id'), 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'affiliation', 'type' => 'activeDropDownList', 'data' => $dropDownList('checkbox-drop-down-list'), 'options' => ['class' => 'form-control input-sm']]), new InputField(['model' => $model, 'attribute' => 'branch_i18n_label', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'branch_i18n_description', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'branch_i18n_url', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'branch_i18n_meta_title', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'branch_i18n_meta_description', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'branch_i18n_meta_keywords', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'branch_i18n_h1_tag', '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' => 'id', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'branch_type_id', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'branch_type_i18n.label']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($model->branch_type_id) ? BranchTypeI18n::findOne(['branch_type_id' => $model->branch_type_id, 'i18n_id' => $language])->label : '']]), new InputField(['model' => $model, 'attribute' => 'tree_id', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'tree_i18n.label']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($model->tree_id) ? TreeI18n::findOne(['tree_id' => $model->tree_id, 'i18n_id' => $language])->label : '']]), new InputField(['model' => $model, 'attribute' => 'parent', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'branch_i18n.label']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($model->parent) ? BranchI18n::findOne(['branch_id' => $model->parent, 'i18n_id' => $language])->label : '']]), new InputField(['model' => $model, 'attribute' => 'order', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'media_id', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'media_i18n.title']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($model->media_id) ? MediaI18n::findOne(['media_id' => $model->media_id, 'i18n_id' => $language])->title : '']]), new InputField(['model' => $model, 'attribute' => 'visible', 'type' => 'activeDropDownList', 'data' => $dropDownList('checkbox-drop-down-list'), 'options' => ['placeholder' => Yii::t('kalibao', 'input_search'), 'class' => 'form-control input-sm']]), new InputField(['model' => $model, 'attribute' => 'background', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'presentation_type', 'type' => 'activeDropDownList', 'data' => $dropDownList('checkbox-drop-down-list'), 'options' => ['placeholder' => Yii::t('kalibao', 'input_search'), 'class' => 'form-control input-sm']]), new InputField(['model' => $model, 'attribute' => 'offset', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'display_brands_types', 'type' => 'activeDropDownList', 'data' => $dropDownList('checkbox-drop-down-list'), 'options' => ['placeholder' => Yii::t('kalibao', 'input_search'), 'class' => 'form-control input-sm']]), new InputField(['model' => $model, 'attribute' => 'big_menu_only_first_level', 'type' => 'activeDropDownList', 'data' => $dropDownList('checkbox-drop-down-list'), 'options' => ['placeholder' => Yii::t('kalibao', 'input_search'), 'class' => 'form-control input-sm']]), new InputField(['model' => $model, 'attribute' => 'unfold', 'type' => 'activeDropDownList', 'data' => $dropDownList('checkbox-drop-down-list'), 'options' => ['placeholder' => Yii::t('kalibao', 'input_search'), 'class' => 'form-control input-sm']]), new InputField(['model' => $model, 'attribute' => 'google_shopping_category_id', 'type' => 'activeDropDownList', 'data' => $dropDownList('google_shopping_category.id'), 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'google_shopping', 'type' => 'activeDropDownList', 'data' => $dropDownList('checkbox-drop-down-list'), 'options' => ['placeholder' => Yii::t('kalibao', 'input_search'), 'class' => 'form-control input-sm']]), new InputField(['model' => $model, 'attribute' => 'affiliation_category_id', 'type' => 'activeDropDownList', 'data' => $dropDownList('affiliation_category.id'), 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'affiliation', 'type' => 'activeDropDownList', 'data' => $dropDownList('checkbox-drop-down-list'), 'options' => ['placeholder' => Yii::t('kalibao', 'input_search'), 'class' => 'form-control input-sm']]), new InputField(['model' => $model, 'attribute' => 'branch_i18n_label', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'branch_i18n_description', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'branch_i18n_url', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'branch_i18n_meta_title', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'branch_i18n_meta_description', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'branch_i18n_meta_keywords', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'branch_i18n_h1_tag', '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']])])]);
 }
示例#4
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(['id' => true, 'sheet_type_i18n_label' => true, 'branch_i18n_label' => true, 'primary_key' => true, 'created_at' => true, 'updated_at' => true]);
     // set head filters
     $this->setGridHeadFilters([new InputField(['model' => $model, 'attribute' => 'id', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'sheet_type_id', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'sheet_type_i18n.label']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($model->sheet_type_id) ? SheetTypeI18n::findOne(['sheet_type_id' => $model->sheet_type_id, 'i18n_id' => $language])->label : '']]), new InputField(['model' => $model, 'attribute' => 'branch_id', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'branch_i18n.label']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($model->branch_id) ? BranchI18n::findOne(['branch_id' => $model->branch_id, 'i18n_id' => $language])->label : '']]), new InputField(['model' => $model, 'attribute' => 'primary_key', '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' => 'id', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'sheet_type_id', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'sheet_type_i18n.label']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($model->sheet_type_id) ? SheetTypeI18n::findOne(['sheet_type_id' => $model->sheet_type_id, 'i18n_id' => $language])->label : '']]), new InputField(['model' => $model, 'attribute' => 'branch_id', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'branch_i18n.label']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($model->branch_id) ? BranchI18n::findOne(['branch_id' => $model->branch_id, 'i18n_id' => $language])->label : '']]), new InputField(['model' => $model, 'attribute' => 'primary_key', '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']])])]);
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getBranchI18ns()
 {
     return $this->hasMany(BranchI18n::className(), ['branch_id' => 'branch_id']);
 }