Beispiel #1
0
 public function getForm()
 {
     Yii::import('zii.widgets.jui.CJuiDatePicker');
     Yii::app()->controller->widget('ext.tinymce.TinymceWidget');
     return array('showErrorSummary' => true, 'attributes' => array('enctype' => 'multipart/form-data', 'class' => 'form-horizontal', 'id' => __CLASS__), 'elements' => array('content' => array('type' => 'form', 'title' => $this->t('TAB_GENERAL'), 'elements' => array('name' => array('type' => 'text', 'id' => 'title', 'visible' => Yii::app()->settings->get('shop', 'auto_gen_url') ? false : true), 'seo_alias' => array('type' => 'text', 'id' => 'alias', 'visible' => Yii::app()->settings->get('shop', 'auto_gen_url') || Yii::app()->settings->get('core', 'translate_object_url') ? false : true), 'sku' => array('type' => 'text', 'afterField' => '<span class="fieldIcon icon-barcode "></span>'), 'price' => array('type' => $this->use_configurations ? 'hidden' : 'text', 'afterField' => '<span class="fieldIcon icon-coin"></span>'), 'price_purchase' => array('type' => 'text', 'afterField' => '<span class="fieldIcon icon-coin"></span>'), 'pcs' => array('type' => 'text', 'visible' => Yii::app()->settings->get('shop', 'wholesale') ? true : false), 'label' => array('type' => 'dropdownlist', 'items' => self::getProductLabels(), 'empty' => Yii::t('core', 'EMPTY_DROPDOWNLIST', 1)), 'currency_id' => array('type' => 'dropdownlist', 'items' => Html::listData(ShopCurrency::model()->findAll(array('condition' => '`t`.`default`=:int', 'params' => array(':int' => 0))), 'id', 'name'), 'empty' => '&mdash; Не привязывать &mdash;', 'visible' => Yii::app()->controller->module->accept_currency), 'main_category_id' => array('type' => 'dropdownlist', 'items' => ShopCategory::flatTree(), 'empty' => '---'), 'switch' => array('type' => 'dropdownlist', 'items' => array(1 => Yii::t('app', 'YES'), 0 => Yii::t('app', 'NO')), 'hint' => $this->t('HINT_SWITCH')), 'date_create' => array('type' => 'CJuiDatePicker', 'options' => array('dateFormat' => 'yy-mm-dd ' . date('H:i:s')), 'afterField' => '<span class="fieldIcon icon-calendar-2"></span>'), 'manufacturer_id' => array('type' => 'dropdownlist', 'items' => Html::listData(ShopManufacturer::model()->findAll(), 'id', 'name'), 'empty' => $this->t('EMPTY_MANUFACTURER')), 'supplier_id' => array('type' => 'dropdownlist', 'items' => Html::listData(ShopSuppliers::model()->findAll(), 'id', 'name'), 'empty' => $this->t('EMPTY_SUPPLIERS'), 'visible' => Yii::app()->controller->module->supplier), 'short_description' => array('type' => 'textarea', 'class' => 'editor', 'hint' => Yii::app()->settings->get('shop', 'auto_fill_short_desc') ? Yii::t('ShopModule.admin', 'MODE_ENABLE', array('{mode}' => Yii::t('ShopModule.SettingsShopForm', 'AUTO_FILL_SHORT_DESC'))) : null), 'full_description' => array('type' => 'textarea', 'class' => 'editor'))), 'warehouse' => array('type' => 'form', 'title' => $this->t('TAB_WAREHOUSE'), 'elements' => array('quantity' => array('type' => 'text'), 'discount' => array('type' => 'text', 'hint' => $this->t('HINT_DISCOUNT')), 'auto_decrease_quantity' => array('type' => 'dropdownlist', 'items' => array(0 => Yii::t('app', 'NO'), 1 => Yii::t('app', 'YES')), 'hint' => $this->t('HINT_AUTO_DECREASE_QUANTITY')), 'availability' => array('type' => 'dropdownlist', 'items' => $this->getAvailabilityList()))), 'seo' => array('type' => 'form', 'title' => $this->t('TAB_SEO'), 'elements' => array('seo_title' => array('type' => 'text'), 'seo_keywords' => array('type' => 'textarea'), 'seo_description' => array('type' => 'textarea')))), 'buttons' => array('submit' => array('type' => 'submit', 'class' => 'btn btn-success', 'label' => $this->isNewRecord ? Yii::t('app', 'CREATE', 0) : Yii::t('app', 'SAVE'))));
 }
 public function getForm()
 {
     Yii::app()->controller->widget('ext.tinymce.TinymceWidget');
     $tab = new TabForm(array('attributes' => array('id' => __CLASS__, 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal'), 'showErrorSummary' => true, 'elements' => array('content' => array('type' => 'form', 'title' => $this->t('TAB_GENERAL_INFO'), 'elements' => array('name' => array('type' => 'text', 'id' => 'title'), 'seo_alias' => array('type' => 'text', 'id' => 'alias', 'visible' => Yii::app()->settings->get('core', 'translate_object_url') ? false : true), 'image' => array('type' => 'file', 'hint' => $this->getImageView()), 'cat_id' => array('type' => 'dropdownlist', 'items' => ShopCategory::flatTree(), 'empty' => '---'), 'description' => array('type' => 'textarea', 'class' => 'editor'))), 'seo' => array('type' => 'form', 'title' => $this->t('TAB_META'), 'elements' => array('seo_title' => array('type' => 'text'), 'seo_keywords' => array('type' => 'textarea'), 'seo_description' => array('type' => 'textarea')))), 'buttons' => array('submit' => array('type' => 'submit', 'class' => 'btn btn-success', 'label' => $this->isNewRecord ? Yii::t('app', 'CREATE', 0) : Yii::t('app', 'SAVE')))), $this);
     return $tab;
 }