コード例 #1
0
ファイル: ListGridRowEdit.php プロジェクト: kalibao/magesko
 /**
  * @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);
 }
コード例 #2
0
ファイル: Edit.php プロジェクト: kalibao/kalibao-framework
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     // set titles
     $this->setCreateTitle(Yii::t('kalibao.backend', 'cms_news_create_title'));
     $this->setUpdateTitle(Yii::t('kalibao.backend', 'cms_news_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['i18n'], 'attribute' => 'title', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('title')]]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'cms_news_group_id', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'cms_news_group_i18n.title']), 'data-add-action' => Url::to('/cms/cms-news-group/create'), 'data-update-action' => Url::to('/cms/cms-news-group/update'), 'data-update-argument' => 'id', 'data-related-field' => '.link_cms_news_group_title', 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($models['main']->cms_news_group_id) ? CmsNewsGroupI18n::findOne(['cms_news_group_id' => $models['main']->cms_news_group_id, 'i18n_id' => $language])->title : '']]);
     $items[] = new InputField(['model' => $models['i18n'], 'attribute' => 'content', 'type' => 'activeTextarea', 'options' => ['class' => 'form-control input-sm wysiwyg-textarea', 'data-ckeditor-filebrowser-browse-url' => Url::to(['cms-image/list', 'mode' => 'explorer']), 'data-ckeditor-language' => $language]]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'activated', 'type' => 'activeCheckbox', 'options' => ['class' => '', 'label' => '']]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'published_at', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm date-picker date-range', 'value' => $models['main']->published_at != '' ? Yii::$app->formatter->asDatetime($models['main']->published_at, 'yyyy-MM-dd') : '', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('published_at')]]);
     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
ファイル: 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 = [];
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'company_id', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'company.name']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($models['main']->company_id) ? Company::findOne(['third_id' => $models['main']->company_id])->name : '']]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'person_id', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'person.last_name']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($models['main']->person_id) ? Person::findOne(['third_id' => $models['main']->person_id])->last_name : '']]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'is_primary', 'type' => 'activeCheckbox', 'options' => ['class' => '', 'label' => '']]);
     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);
 }
コード例 #4
0
ファイル: Edit.php プロジェクト: kalibao/kalibao-framework
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     // set titles
     $this->setCreateTitle(Yii::t('kalibao.backend', 'rbac_permission_create_title'));
     $this->setUpdateTitle(Yii::t('kalibao.backend', 'rbac_permission_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' => 'name', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('name')]]);
     $items[] = new InputField(['model' => $models['i18n'], 'attribute' => 'title', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('title')]]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'rule_path', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('rule_path')]]);
     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);
 }
コード例 #5
0
ファイル: Edit.php プロジェクト: kalibao/kalibao-framework
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     // set titles
     $this->setCreateTitle(Yii::t('kalibao.backend', 'variable_variable_create_title'));
     $this->setUpdateTitle(Yii::t('kalibao.backend', 'variable_variable_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' => 'variable_group_id', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'variable_group_i18n.title']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-add-action' => Url::to('/variable/variable-group/create'), 'data-update-action' => Url::to('/variable/variable-group/update'), 'data-update-argument' => 'id', 'data-related-field' => '.link_variable_group_title', 'data-text' => !empty($models['main']->variable_group_id) ? VariableGroupI18n::findOne(['variable_group_id' => $models['main']->variable_group_id, 'i18n_id' => $language])->title : '']]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'name', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('name')]]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'val', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('val')]]);
     $items[] = new InputField(['model' => $models['i18n'], 'attribute' => 'description', 'type' => 'activeTextarea', 'options' => ['class' => 'form-control input-sm', 'data-ckeditor-language' => $language]]);
     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);
 }
コード例 #6
0
ファイル: ListGridRowEdit.php プロジェクト: kalibao/magesko
 /**
  * @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 SimpleValueField(['model' => $models['main'], 'attribute' => 'id', 'value' => $models['main']->id]);
     /*$items[] = new InputField([
           'model' => $models['i18n'],
           'attribute' => 'gender_id',
           'type' => 'activeTextInput',
           'options' => [
               'class' => 'form-control input-sm',
               'maxlength' => true,
               'placeholder' => $models['i18n']->getAttributeLabel('gender_id'),
           ]
       ]);*/
     $items[] = new InputField(['model' => $models['i18n'], 'attribute' => 'title', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['i18n']->getAttributeLabel('title')]]);
     $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);
 }
コード例 #7
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' => 'file', 'type' => 'activeFileInput', 'options' => ['maxlength' => true, 'class' => 'input-advanced-uploader', 'placeholder' => $models['main']->getAttributeLabel('file'), 'data-type-uploader' => $uploadConfig['main']['file']['type'], 'data-file-url' => $models['main']->file != '' ? $uploadConfig['main']['file']['baseUrl'] . '/' . $models['main']->file : '']]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'media_type_id', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'media_type_i18n.title']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($models['main']->media_type_id) ? MediaTypeI18n::findOne(['media_type_id' => $models['main']->media_type_id, 'i18n_id' => $language])->title : '']]);
     $items[] = new InputField(['model' => $models['i18n'], 'attribute' => 'title', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['i18n']->getAttributeLabel('title')]]);
     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);
 }
コード例 #8
0
ファイル: View.php プロジェクト: kalibao/magesko
 /**
  * @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 = [];
     if (!$models['main']->isNewRecord) {
         $items['id'] = new SimpleValueField(['model' => $models['main'], 'attribute' => 'id', 'value' => $models['main']->id]);
     }
     $items['exclude_discount_code'] = new InputField(['model' => $models['main'], 'attribute' => 'exclude_discount_code', 'type' => 'activeCheckbox', 'options' => ['class' => '', 'label' => '']]);
     $items['force_secure'] = new InputField(['model' => $models['main'], 'attribute' => 'force_secure', 'type' => 'activeCheckbox', 'options' => ['class' => '', 'label' => '']]);
     $items['archived'] = new InputField(['model' => $models['main'], 'attribute' => 'archived', 'type' => 'activeCheckbox', 'options' => ['class' => '', 'label' => '']]);
     $items['top_product'] = new InputField(['model' => $models['main'], 'attribute' => 'top_product', 'type' => 'activeCheckbox', 'options' => ['class' => '', 'label' => '']]);
     $items['exclude_from_google'] = new InputField(['model' => $models['main'], 'attribute' => 'exclude_from_google', 'type' => 'activeCheckbox', 'options' => ['class' => '', 'label' => '']]);
     $items['link_brand_product'] = new InputField(['model' => $models['main'], 'attribute' => 'link_brand_product', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('link_brand_product')]]);
     $items['link_product_test'] = new InputField(['model' => $models['main'], 'attribute' => 'link_product_test', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('link_product_test')]]);
     $items['available'] = new InputField(['model' => $models['main'], 'attribute' => 'available', 'type' => 'activeCheckbox', 'options' => ['class' => '', 'label' => '']]);
     $items['available_date'] = new InputField(['model' => $models['main'], 'attribute' => 'available_date', 'type' => 'activeTextInput', 'required' => true, 'options' => ['class' => 'form-control input-sm date-picker date-range required', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('available_date')]]);
     $items['alternative_product'] = new InputField(['model' => $models['main'], 'attribute' => 'alternative_product', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'product_i18n.name']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($models['main']->alternative_product) ? ProductI18n::findOne(['product_id' => $models['main']->alternative_product, 'i18n_id' => $language])->name : '']]);
     $items['lidoli_category_id'] = new InputField(['model' => $models['main'], 'attribute' => 'lidoli_category_id', 'type' => 'activeTextInput', 'required' => true, 'options' => ['class' => 'form-control input-sm required', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('lidoli_category_id')]]);
     $items['brand_id'] = new InputField(['model' => $models['main'], 'attribute' => 'brand_id', 'type' => 'activeHiddenInput', 'required' => true, 'options' => ['class' => 'form-control input-sm input-ajax-select required', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'brand.name']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($models['main']->brand_id) ? Brand::findOne(['id' => $models['main']->brand_id])->name : '']]);
     $items['supplier_id'] = new InputField(['model' => $models['main'], 'attribute' => 'supplier_id', 'type' => 'activeHiddenInput', 'required' => true, 'options' => ['class' => 'form-control input-sm input-ajax-select required', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'supplier.name']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($models['main']->supplier_id) ? Supplier::findOne(['id' => $models['main']->supplier_id])->name : '']]);
     $items['catalog_category_id'] = new InputField(['model' => $models['main'], 'attribute' => 'catalog_category_id', 'type' => 'activeDropDownList', 'data' => $dropDownList('category_i18n.title'), 'required' => true, 'options' => ['class' => 'form-control input-sm required', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('catalog_category_id')]]);
     $items['google_category_id'] = new InputField(['model' => $models['main'], 'attribute' => 'google_category_id', 'type' => 'activeDropDownList', 'data' => $dropDownList('category_i18n.title'), 'required' => true, 'options' => ['class' => 'form-control input-sm required', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('google_category_id')]]);
     $items['stats_category_id'] = new InputField(['model' => $models['main'], 'attribute' => 'stats_category_id', 'type' => 'activeDropDownList', 'data' => $dropDownList('category_i18n.title'), 'required' => true, 'options' => ['class' => 'form-control input-sm required', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('stats_category_id')]]);
     $items['accountant_category_id'] = new InputField(['model' => $models['main'], 'attribute' => 'accountant_category_id', 'type' => 'activeDropDownList', 'data' => $dropDownList('category_i18n.title'), 'required' => true, 'options' => ['class' => 'form-control input-sm required', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('accountant_category_id')]]);
     $items['base_price'] = new InputField(['model' => $models['main'], 'attribute' => 'base_price', 'type' => 'activeTextInput', 'required' => true, 'options' => ['class' => 'form-control input-sm required', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('base_price'), 'id' => 'base_price']]);
     $items['is_pack'] = new InputField(['model' => $models['main'], 'attribute' => 'is_pack', 'type' => 'activeCheckbox', 'options' => ['class' => '', 'label' => '']]);
     $items['short_description'] = new InputField(['model' => $models['i18n'], 'attribute' => 'short_description', 'type' => 'activeTextarea', 'options' => ['class' => 'form-control input-sm wysiwyg-textarea', 'data-ckeditor-language' => $language]]);
     $items['long_description'] = new InputField(['model' => $models['i18n'], 'attribute' => 'long_description', 'type' => 'activeTextarea', 'options' => ['class' => 'form-control input-sm wysiwyg-textarea', 'data-ckeditor-language' => $language]]);
     $items['comment'] = new InputField(['model' => $models['i18n'], 'attribute' => 'comment', 'type' => 'activeTextarea', 'options' => ['class' => 'form-control input-sm wysiwyg-textarea', 'data-ckeditor-language' => $language]]);
     $items['page_title'] = new InputField(['model' => $models['i18n'], 'attribute' => 'page_title', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['i18n']->getAttributeLabel('page_title')]]);
     $items['name'] = new InputField(['model' => $models['i18n'], 'attribute' => 'name', 'type' => 'activeTextInput', 'required' => true, 'options' => ['class' => 'form-control input-sm required', 'maxlength' => true, 'placeholder' => $models['i18n']->getAttributeLabel('name')]]);
     $items['infos_shipping'] = new InputField(['model' => $models['i18n'], 'attribute' => 'infos_shipping', 'type' => 'activeTextarea', 'options' => ['class' => 'form-control input-sm wysiwyg-textarea', 'data-ckeditor-language' => $language]]);
     $items['meta_description'] = new InputField(['model' => $models['i18n'], 'attribute' => 'meta_description', 'type' => 'activeTextarea', 'options' => ['class' => 'form-control input-sm', 'placeholder' => $models['i18n']->getAttributeLabel('meta_description')]]);
     $items['meta_keywords'] = new InputField(['model' => $models['i18n'], 'attribute' => 'meta_keywords', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['i18n']->getAttributeLabel('meta_keywords')]]);
     if (!$models['main']->isNewRecord) {
         $items['created_at'] = new SimpleValueField(['model' => $models['main'], 'attribute' => 'created_at', 'value' => Yii::$app->formatter->asDatetime($models['main']->created_at, I18N::getDateFormat())]);
     }
     if (!$models['main']->isNewRecord) {
         $items['updated_at'] = new SimpleValueField(['model' => $models['main'], 'attribute' => 'updated_at', 'value' => Yii::$app->formatter->asDatetime($models['main']->updated_at, I18N::getDateFormat())]);
     }
     $this->setItems($items);
 }
コード例 #9
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);
 }
コード例 #10
0
 /**
  * @inheritdoc
  */
 public function run()
 {
     // get app language of current application
     $languages = Yii::$app->appLanguage->getAppLanguages();
     $languageLabels = [];
     foreach ($languages as $languageId) {
         $languageLabels[$languageId] = I18N::label($languageId);
     }
     // build form
     $html = '<form method="post" class="current-language" action="' . Yii::$app->request->url . '">';
     $html .= Html::dropDownList('language', Yii::$app->language, $languageLabels, ['class' => 'language-selector form-control']);
     foreach ($languages as $languageId) {
         $html .= Html::hiddenInput($languageId, Url::to([''] + array_merge(Yii::$app->request->get(), ['language' => $languageId])));
     }
     $html .= '</form>';
     return $html;
 }
コード例 #11
0
ファイル: Edit.php プロジェクト: kalibao/magesko
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     // set titles
     $this->setCreateTitle(Yii::t('kalibao.backend', 'rbac_user_create_title'));
     $this->setUpdateTitle(Yii::t('kalibao.backend', 'rbac_user_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' => 'third_id', 'value' => $models['main']->third_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['user'], 'attribute' => 'password', 'type' => 'activePasswordInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['user']->getAttributeLabel('password')]]);
     $items[] = new InputField(['model' => $models['user'], 'attribute' => 'password_repeat', 'type' => 'activePasswordInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['user']->getAttributeLabel('password_repeat')]]);
     $items[] = new InputField(['model' => $models['user'], 'attribute' => 'status', 'type' => 'activeDropDownList', 'data' => $dropDownList('user.status:required'), 'options' => ['class' => 'form-control input-sm']]);
     $items[] = new InputField(['model' => $models['user'], 'attribute' => 'active_password_reset', 'type' => 'activeCheckbox', 'options' => ['label' => '']]);
     if (!empty($models['rbacRoles'])) {
         $rbacRoles = [];
         foreach ($models['rbacRoles'] as $rbacRole) {
             $rbacRoles[$rbacRole->id] = $rbacRole->rbacRoleI18ns[0]->title;
         }
         $rbacUserRoles = [];
         foreach ($models['rbacUserRoles'] as $rbacUserRole) {
             $rbacUserRoles[] = $rbacUserRole->rbac_role_id;
         }
         $items[] = new SimpleValueField(['label' => Yii::t('kalibao.backend', 'person_user_roles'), 'value' => Html::checkboxList('rbacUserRolesId', $rbacUserRoles, $rbacRoles, ['unselect' => '-1'])]);
     }
     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);
 }
コード例 #12
0
ファイル: ListGridRowEdit.php プロジェクト: kalibao/magesko
 /**
  * @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 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')]]);
     $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);
 }
コード例 #13
0
ファイル: EditAddress.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['address'] = $this->uploadConfig[(new \ReflectionClass($models['address']))->getName()];
     // set items
     $items = [];
     if (!$models['address']->isNewRecord) {
         $items[] = new SimpleValueField(['model' => $models['address'], 'attribute' => 'id', 'value' => $models['address']->id]);
     }
     $items[] = new InputField(['model' => $models['address'], '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['address']->third_id) ? Third::findOne(['id' => $models['address']->third_id])->id : '']]);
     $items[] = new InputField(['model' => $models['address'], 'attribute' => 'address_type_id', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'address_type_i18n.title']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($models['address']->address_type_id) ? AddressTypeI18n::findOne(['address_type_id' => $models['address']->address_type_id, 'i18n_id' => $language])->title : '']]);
     $items[] = new InputField(['model' => $models['address'], 'attribute' => 'label', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['address']->getAttributeLabel('label')]]);
     $items[] = new InputField(['model' => $models['address'], 'attribute' => 'place_1', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['address']->getAttributeLabel('place_1')]]);
     $items[] = new InputField(['model' => $models['address'], 'attribute' => 'place_2', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['address']->getAttributeLabel('place_2')]]);
     $items[] = new InputField(['model' => $models['address'], 'attribute' => 'street_number', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['address']->getAttributeLabel('street_number')]]);
     $items[] = new InputField(['model' => $models['address'], 'attribute' => 'door_code', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['address']->getAttributeLabel('door_code')]]);
     $items[] = new InputField(['model' => $models['address'], 'attribute' => 'zip_code', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['address']->getAttributeLabel('zip_code')]]);
     $items[] = new InputField(['model' => $models['address'], 'attribute' => 'city', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['address']->getAttributeLabel('city')]]);
     $items[] = new InputField(['model' => $models['address'], 'attribute' => 'country', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['address']->getAttributeLabel('country')]]);
     $items[] = new InputField(['model' => $models['address'], 'attribute' => 'is_primary', 'type' => 'activeCheckbox', 'options' => ['class' => '', 'label' => '']]);
     $items[] = new InputField(['model' => $models['address'], 'attribute' => 'note', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['address']->getAttributeLabel('note')]]);
     if (!$models['address']->isNewRecord) {
         $items[] = new SimpleValueField(['model' => $models['address'], 'attribute' => 'created_at', 'value' => Yii::$app->formatter->asDatetime($models['address']->created_at, I18N::getDateFormat())]);
     }
     if (!$models['address']->isNewRecord) {
         $items[] = new SimpleValueField(['model' => $models['address'], 'attribute' => 'updated_at', 'value' => Yii::$app->formatter->asDatetime($models['address']->updated_at, I18N::getDateFormat())]);
     }
     $this->setItems($items);
 }
コード例 #14
0
ファイル: Edit.php プロジェクト: kalibao/kalibao-framework
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     // set titles
     $this->setCreateTitle(Yii::t('kalibao.backend', 'cms_page_create_title'));
     $this->setUpdateTitle(Yii::t('kalibao.backend', 'cms_page_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['id'] = new SimpleValueField(['model' => $models['main'], 'attribute' => 'id', 'value' => $models['main']->id]);
     }
     $items['title'] = new InputField(['model' => $models['i18n'], 'attribute' => 'title', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('title')]]);
     $items['activated'] = new InputField(['model' => $models['main'], 'attribute' => 'activated', 'type' => 'activeCheckbox', 'options' => ['class' => '', 'label' => '']]);
     $items['cache_duration'] = new InputField(['model' => $models['main'], 'attribute' => 'cache_duration', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('cache_duration')]]);
     $items['cms_layout_id'] = new InputField(['model' => $models['main'], 'attribute' => 'cms_layout_id', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select input-ajax-select-layout', 'data-url-page-contents' => Url::to(['load-page-contents']), 'data-page-id' => !$models['main']->isNewRecord ? $models['main']->id : '', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'cms_layout_i18n.name']), 'data-add-action' => Url::to('/cms/cms-layout/create'), 'data-update-action' => Url::to('/cms/cms-layout/update'), 'data-update-argument' => 'id', 'data-related-field' => '.link_cms_layout_name', 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($models['main']->cms_layout_id) ? CmsLayoutI18n::findOne(['cms_layout_id' => $models['main']->cms_layout_id, 'i18n_id' => $language])->name : '']]);
     $items['slug'] = new InputField(['model' => $models['i18n'], 'attribute' => 'slug', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm active-slug', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('slug')]]);
     $items['html_title'] = new InputField(['model' => $models['i18n'], 'attribute' => 'html_title', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('html_title')]]);
     $items['html_description'] = new InputField(['model' => $models['i18n'], 'attribute' => 'html_description', 'type' => 'activeTextarea', 'options' => ['class' => 'form-control input-sm', 'placeholder' => $models['i18n']->getAttributeLabel('html_description')]]);
     $items['html_keywords'] = new InputField(['model' => $models['i18n'], 'attribute' => 'html_keywords', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('html_keywords')]]);
     if (isset($models['pageContents'])) {
         $editPageContents = new EditPageContents(['language' => $this->getLanguage(), 'models' => ['pageContents' => $models['pageContents']]]);
         $items = array_merge($items, $editPageContents->getItems());
     }
     if (!$models['main']->isNewRecord) {
         $items['created_at'] = new SimpleValueField(['model' => $models['main'], 'attribute' => 'created_at', 'value' => Yii::$app->formatter->asDatetime($models['main']->created_at, I18N::getDateFormat())]);
     }
     if (!$models['main']->isNewRecord) {
         $items['updated_at'] = new SimpleValueField(['model' => $models['main'], 'attribute' => 'updated_at', 'value' => Yii::$app->formatter->asDatetime($models['main']->updated_at, I18N::getDateFormat())]);
     }
     $this->setItems($items);
 }
コード例 #15
0
ファイル: ListGridRow.php プロジェクト: kalibao/magesko
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     // set items
     $this->setItems([$this->model->id, isset($this->model->branchTypeI18ns[0]) ? $this->model->branchTypeI18ns[0]->label : '', isset($this->model->treeI18ns[0]) ? $this->model->treeI18ns[0]->label : '', isset($this->model->branchI18ns[0]) ? $this->model->branchI18ns[0]->label : '', $this->model->order, isset($this->model->mediaI18ns[0]) ? $this->model->mediaI18ns[0]->title : '', Html::activeCheckbox($this->model, 'visible', ['disabled' => 'disabled', 'label' => '']), $this->model->background, Html::activeCheckbox($this->model, 'presentation_type', ['disabled' => 'disabled', 'label' => '']), $this->model->offset, Html::activeCheckbox($this->model, 'display_brands_types', ['disabled' => 'disabled', 'label' => '']), Html::activeCheckbox($this->model, 'big_menu_only_first_level', ['disabled' => 'disabled', 'label' => '']), Html::activeCheckbox($this->model, 'unfold', ['disabled' => 'disabled', 'label' => '']), isset($this->model->googleShoppingCategory) ? $this->model->googleShoppingCategory->id : '', Html::activeCheckbox($this->model, 'google_shopping', ['disabled' => 'disabled', 'label' => '']), isset($this->model->affiliationCategory) ? $this->model->affiliationCategory->id : '', Html::activeCheckbox($this->model, 'affiliation', ['disabled' => 'disabled', 'label' => '']), isset($this->model->branchI18ns[0]) ? $this->model->branchI18ns[0]->label : '', isset($this->model->branchI18ns[0]) ? $this->model->branchI18ns[0]->description : '', isset($this->model->branchI18ns[0]) ? $this->model->branchI18ns[0]->url : '', isset($this->model->branchI18ns[0]) ? $this->model->branchI18ns[0]->meta_title : '', isset($this->model->branchI18ns[0]) ? $this->model->branchI18ns[0]->meta_description : '', isset($this->model->branchI18ns[0]) ? $this->model->branchI18ns[0]->meta_keywords : '', isset($this->model->branchI18ns[0]) ? $this->model->branchI18ns[0]->h1_tag : '', Yii::$app->formatter->asDatetime($this->model->created_at, I18N::getDateFormat()), Yii::$app->formatter->asDatetime($this->model->updated_at, I18N::getDateFormat())]);
 }
コード例 #16
0
 /**
  * @inheritdoc
  */
 protected function getRow(ActiveRecord $model)
 {
     return [$model->id, $model->name, isset($model->rbacPermissionI18ns[0]) ? $model->rbacPermissionI18ns[0]->title : '', $model->rule_path, Yii::$app->formatter->asDatetime($model->created_at, I18N::getDateFormat()), Yii::$app->formatter->asDatetime($model->updated_at, I18N::getDateFormat())];
 }
コード例 #17
0
ファイル: ExportCsv.php プロジェクト: kalibao/magesko
 /**
  * @inheritdoc
  */
 protected function getRow(ActiveRecord $model)
 {
     return [isset($model->third) ? $model->third->id : '', isset($model->companyTypeI18ns[0]) ? $model->companyTypeI18ns[0]->title : '', $model->name, $model->tva_number, $model->naf, $model->siren, Yii::$app->formatter->asDatetime($model->created_at, I18N::getDateFormat()), Yii::$app->formatter->asDatetime($model->updated_at, I18N::getDateFormat())];
 }
コード例 #18
0
ファイル: ListGridRow.php プロジェクト: kalibao/magesko
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     // set items
     $this->setItems([$this->model->id, isset($this->model->thirdRoleI18ns[0]) ? $this->model->thirdRoleI18ns[0]->title : '', Yii::$app->formatter->asDatetime($this->model->created_at, I18N::getDateFormat()), Yii::$app->formatter->asDatetime($this->model->updated_at, I18N::getDateFormat())]);
 }
コード例 #19
0
ファイル: ExportCsv.php プロジェクト: kalibao/magesko
 /**
  * @inheritdoc
  */
 protected function getRow(ActiveRecord $model)
 {
     return [$model->id, isset($model->cmsNewsI18ns[0]) ? $model->cmsNewsI18ns[0]->title : '', isset($model->cmsNewsGroupI18ns[0]) ? $model->cmsNewsGroupI18ns[0]->title : '', isset($model->cmsNewsI18ns[0]) ? $model->cmsNewsI18ns[0]->content : '', $model->activated, Yii::$app->formatter->asDatetime($model->published_at, I18N::getDateFormat()), Yii::$app->formatter->asDatetime($model->created_at, I18N::getDateFormat()), Yii::$app->formatter->asDatetime($model->updated_at, I18N::getDateFormat())];
 }
コード例 #20
0
ファイル: Html.php プロジェクト: kalibao/magesko
 /**
  * Get language label from id
  * @param string $language Language ID
  * @param bool $flag Display flag
  * @param bool $text Display text
  * @return string HTML
  */
 public static function labelI18n($language, $flag = true, $text = true)
 {
     return '<span class="label-language">' . ($flag ? '<span class="flag flag-' . $language . '"></span>' : '') . ($text ? '<span class="value">' . I18N::label($language) . '</span>' : '') . '</span>';
 }
コード例 #21
0
ファイル: ExportCsv.php プロジェクト: kalibao/magesko
 /**
  * @inheritdoc
  */
 protected function getRow(ActiveRecord $model)
 {
     return [$model->id, isset($model->sheetTypeI18ns[0]) ? $model->sheetTypeI18ns[0]->label : '', isset($model->branchI18ns[0]) ? $model->branchI18ns[0]->label : '', $model->primary_key, Yii::$app->formatter->asDatetime($model->created_at, I18N::getDateFormat()), Yii::$app->formatter->asDatetime($model->updated_at, I18N::getDateFormat())];
 }
コード例 #22
0
ファイル: _crossSelling.php プロジェクト: kalibao/magesko
][percent_vip]" value="<?php 
        echo $data['discount']->percent_vip;
        ?>
"/></td>
                                <td><input class="form-control input-sm date-picker" type="text" name="discount[<?php 
        echo $data['discount']->id;
        ?>
][start_date_vip]" value="<?php 
        echo Yii::$app->formatter->asDate($data['discount']->start_date_vip, I18N::getDateFormat(I18N::DATE_FORMAT));
        ?>
"/></td>
                                <td><input class="form-control input-sm date-picker" type="text" name="discount[<?php 
        echo $data['discount']->id;
        ?>
][end_date_vip]" value="<?php 
        echo Yii::$app->formatter->asDate($data['discount']->end_date_vip, I18N::getDateFormat(I18N::DATE_FORMAT));
        ?>
"/></td>
                                <td><input class="form-control input-sm discount-final-price" type="text" disabled/></td>
                            </tr>
                        <?php 
    }
    ?>
                        </tbody>
                    </table>
                </div>
            <?php 
}
?>
        </div>
        <div class="row">
コード例 #23
0
ファイル: ExportCsv.php プロジェクト: kalibao/magesko
 /**
  * @inheritdoc
  */
 protected function getRow(ActiveRecord $model)
 {
     return [$model->id, isset($model->cmsSimpleMenuGroupI18ns[0]) ? $model->cmsSimpleMenuGroupI18ns[0]->title : '', Yii::$app->formatter->asDatetime($model->created_at, I18N::getDateFormat()), Yii::$app->formatter->asDatetime($model->updated_at, I18N::getDateFormat())];
 }
コード例 #24
0
ファイル: ListGridRow.php プロジェクト: kalibao/magesko
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     // set items
     $this->setItems([$this->model->id, $this->model->url_pick, $this->model->table, $this->model->url_zoom_front, $this->model->url_zoom_back, isset($this->model->sheetTypeI18ns[0]) ? $this->model->sheetTypeI18ns[0]->label : '', Yii::$app->formatter->asDatetime($this->model->created_at, I18N::getDateFormat()), Yii::$app->formatter->asDatetime($this->model->updated_at, I18N::getDateFormat())]);
 }
コード例 #25
0
ファイル: _discount.php プロジェクト: kalibao/magesko
][percent_vip]" value="<?php 
    echo $variant->discount->percent_vip;
    ?>
"/></td>
                        <td><input class="form-control input-sm date-picker" type="text" name="discount[<?php 
    echo $variant->discount->id;
    ?>
][start_date_vip]" value="<?php 
    echo Yii::$app->formatter->asDate($variant->discount->start_date_vip, I18N::getDateFormat(I18N::DATE_FORMAT));
    ?>
"/></td>
                        <td><input class="form-control input-sm date-picker" type="text" name="discount[<?php 
    echo $variant->discount->id;
    ?>
][end_date_vip]" value="<?php 
    echo Yii::$app->formatter->asDate($variant->discount->end_date_vip, I18N::getDateFormat(I18N::DATE_FORMAT));
    ?>
"/></td>
                        <td><input class="form-control input-sm discount-final-price" type="text" disabled/></td>
                    </tr>
                <?php 
}
?>
                </tbody>
            </table>
        </div>
        <?php 
echo $this->render('../_buttons', ['propagation' => false]);
?>
    </form>
</div>
コード例 #26
0
ファイル: ExportCsv.php プロジェクト: kalibao/magesko
 /**
  * @inheritdoc
  */
 protected function getRow(ActiveRecord $model)
 {
     return [$model->id, isset($model->variableGroupI18ns[0]) ? $model->variableGroupI18ns[0]->title : '', $model->name, $model->val, isset($model->variableI18ns[0]) ? $model->variableI18ns[0]->description : '', Yii::$app->formatter->asDatetime($model->created_at, I18N::getDateFormat()), Yii::$app->formatter->asDatetime($model->updated_at, I18N::getDateFormat())];
 }
コード例 #27
0
ファイル: ExportCsv.php プロジェクト: kalibao/magesko
 /**
  * @inheritdoc
  */
 protected function getRow(ActiveRecord $model)
 {
     return [$model->id, isset($model->mailTemplateGroupI18ns[0]) ? $model->mailTemplateGroupI18ns[0]->title : '', $model->html_mode, $model->sql_request, $model->sql_param, isset($model->mailTemplateI18ns[0]) ? $model->mailTemplateI18ns[0]->object : '', isset($model->mailTemplateI18ns[0]) ? $model->mailTemplateI18ns[0]->message : '', Yii::$app->formatter->asDatetime($model->created_at, I18N::getDateFormat()), Yii::$app->formatter->asDatetime($model->updated_at, I18N::getDateFormat())];
 }
コード例 #28
0
 /**
  * @inheritdoc
  */
 protected function getRow(ActiveRecord $model)
 {
     return [$model->id, isset($model->cmsImageI18ns[0]) ? $model->cmsImageI18ns[0]->title : '', isset($model->cmsImageGroupI18ns[0]) ? $model->cmsImageGroupI18ns[0]->title : '', $model->file_path != '' ? $this->uploadConfig[(new \ReflectionClass($this->model))->getParentClass()->name]['file_path']['baseUrl'] . '/' . $this->model->file_path : '', Yii::$app->formatter->asDatetime($model->created_at, I18N::getDateFormat()), Yii::$app->formatter->asDatetime($model->updated_at, I18N::getDateFormat())];
 }
コード例 #29
0
ファイル: ListGridRow.php プロジェクト: kalibao/magesko
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     // set items
     $this->setItems([isset($this->model->third) ? $this->model->third->id : '', isset($this->model->companyTypeI18ns[0]) ? $this->model->companyTypeI18ns[0]->title : '', $this->model->name, $this->model->tva_number, $this->model->naf, $this->model->siren, Yii::$app->formatter->asDatetime($this->model->created_at, I18N::getDateFormat()), Yii::$app->formatter->asDatetime($this->model->updated_at, I18N::getDateFormat())]);
 }
コード例 #30
0
ファイル: ExportCsv.php プロジェクト: kalibao/magesko
 /**
  * @inheritdoc
  */
 protected function getRow(ActiveRecord $model)
 {
     return [$model->id, $model->stockout, $model->preorder, Yii::$app->formatter->asDatetime($model->delivery_date, I18N::getDateFormat()), $model->real_stock, $model->alert_stock, $model->direct_delivery, isset($model->supplier) ? $model->supplier->name : '', $model->additional_delay, $model->just_in_time, $model->temporary_stockout, isset($model->logisticStrategyI18ns[0]) ? $model->logisticStrategyI18ns[0]->message : ''];
 }