コード例 #1
0
 /**
  * @inheritdoc
  */
 protected function view()
 {
     $view = parent::view();
     if (is_array($this->model->{$this->attr})) {
         $view["value"] = $this->renderFilesView($this->model->{$this->attr});
         $view["format"] = "html";
     }
     return $view;
 }
コード例 #2
0
ファイル: ListField.php プロジェクト: frostiks25/rzwebsys7
 /**
  * @inheritdoc
  */
 public function rules()
 {
     $rules = parent::rules();
     if ($this->numeric) {
         $rules[] = [$this->attr, 'integer', 'except' => [ActiveRecord::SCENARIO_SEARCH]];
     }
     if ($this->numeric and $this->defaultValue === null) {
         $rules[] = [$this->attr, 'default', 'value' => 0, 'except' => [ActiveRecord::SCENARIO_SEARCH]];
     }
     return $rules;
 }
コード例 #3
0
ファイル: TextField.php プロジェクト: frostiks25/rzwebsys7
 /**
  * @inheritdoc
  */
 public function rules()
 {
     $rules = parent::rules();
     $rules[] = [$this->attr, 'filter', 'filter' => 'trim'];
     return $rules;
 }
コード例 #4
0
ファイル: BaseInput.php プロジェクト: frostiks25/rzwebsys7
 /**
  * @inheritdoc
  * @throws InvalidConfigException
  */
 public function init()
 {
     if (empty($this->modelField) or !$this->modelField instanceof Field) {
         throw new InvalidConfigException("Property 'modelField' must be instance of " . Field::className());
     }
 }
コード例 #5
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     $rules = parent::rules();
     $rules[] = [$this->attr, 'default', 'value' => 0, 'except' => ActiveRecord::SCENARIO_SEARCH];
     return $rules;
 }
コード例 #6
0
ファイル: OrderMeta.php プロジェクト: frostiks25/rzwebsys7
 /**
  * @inheritdoc
  */
 protected function config()
 {
     return ['created_at' => ['definition' => ["showInGrid" => true]], "status_id" => ["definition" => ["class" => \common\db\fields\HasOneField::className(), "title" => Yii::t('shop/app', 'Status'), "isRequired" => true, "showInGrid" => true, "editInGrid" => true, "data" => [$this, "getStatusList"]], "params" => [$this->owner, "status_id", "status"]], "name" => ["definition" => ["class" => \common\db\fields\TextField::className(), "title" => Yii::t('shop/app', 'Name'), "isRequired" => true, "editInGrid" => true], "params" => [$this->owner, "name"]], "email" => ["definition" => ["class" => \common\db\fields\EmailField::className(), "title" => Yii::t('shop/app', 'Email'), "isRequired" => true, "editInGrid" => true], "params" => [$this->owner, "email"]], "phone" => ["definition" => ["class" => \common\db\fields\TextField::className(), "title" => Yii::t('shop/app', 'Phone'), "editInGrid" => true], "params" => [$this->owner, "phone"]], "city" => ["definition" => ["class" => \common\db\fields\TextField::className(), "title" => Yii::t('shop/app', 'City'), "isRequired" => true, "showInGrid" => false], "params" => [$this->owner, "city"]], "index" => ["definition" => ["class" => \common\db\fields\TextField::className(), "title" => Yii::t('shop/app', 'Index'), "showInGrid" => false], "params" => [$this->owner, "index"]], "address" => ["definition" => ["class" => \common\db\fields\TextField::className(), "title" => Yii::t('shop/app', 'Address'), "isRequired" => true, "showInGrid" => false], "params" => [$this->owner, "address"]], "comment" => ["definition" => ["class" => \common\db\fields\TextAreaField::className(), "title" => Yii::t('shop/app', 'Comment'), "showInGrid" => false], "params" => [$this->owner, "comment"]], "delivery_id" => ["definition" => ["class" => \common\db\fields\HasOneField::className(), "title" => Yii::t('shop/app', 'Delivery'), "isRequired" => true, "showInGrid" => false, "data" => [$this, "getDeliveryList"]], "params" => [$this->owner, "delivery_id", "delivery"]], "payment_id" => ["definition" => ["class" => \common\db\fields\HasOneField::className(), "title" => Yii::t('shop/app', 'Payment'), "isRequired" => true, "showInGrid" => false, "data" => [$this, "getPaymentList"]], "params" => [$this->owner, "payment_id", "payment"]], "delivery_price" => ["definition" => ["class" => \common\db\fields\NumberField::className(), "title" => Yii::t('shop/app', 'Delivery price'), "showInGrid" => false, "showInForm" => false], "params" => [$this->owner, "delivery_price"]], "totalPrice" => ["definition" => ["class" => \common\db\fields\Field::className(), "title" => Yii::t('shop/app', 'Total price'), "showInGrid" => true, "showInForm" => false, "isSafe" => false, "search" => false, "gridOptions" => ['format' => 'currency']], "params" => [$this->owner, "totalPrice"]]];
 }
コード例 #7
0
ファイル: UserMeta.php プロジェクト: frostiks25/rzwebsys7
 /**
  * @inheritdoc
  */
 public function config()
 {
     return ["role" => ["definition" => ["class" => \common\db\fields\ListField::className(), "title" => Yii::t('main/app', 'Role'), "isRequired" => true, "data" => [$this->owner, "getRolesNames"]], "params" => [$this->owner, "role"]], "username" => ["definition" => ["class" => \common\db\fields\TextField::className(), "title" => Yii::t('main/app', 'Username'), "isRequired" => true], "params" => [$this->owner, "username"]], "password" => ["definition" => ["class" => \common\db\fields\PasswordField::className(), "title" => Yii::t('main/app', 'Password'), "isRequired" => false, "showInGrid" => false, "showInView" => false], "params" => [$this->owner, "password"]], "confirm_password" => ["definition" => ["class" => \common\db\fields\PasswordField::className(), "title" => Yii::t('main/app', 'Confirm password'), "isRequired" => false, "showInGrid" => false, "showInView" => false], "params" => [$this->owner, "confirm_password"]], "email" => ["definition" => ["class" => \common\db\fields\EmailField::className(), "title" => Yii::t('main/app', 'Email'), "isRequired" => true], "params" => [$this->owner, "email"]], "name" => ["definition" => ["class" => \common\db\fields\TextField::className(), "title" => Yii::t('main/app', 'Name'), "isRequired" => false], "params" => [$this->owner, "name"]], "image" => ["definition" => ["class" => \common\db\fields\Html5ImageField::className(), "title" => Yii::t('main/app', 'Image'), "isRequired" => false], "params" => [$this->owner, "image"]], "text" => ["definition" => ["class" => \common\db\fields\TextAreaField::className(), "title" => Yii::t('main/app', 'Text'), "isRequired" => false], "params" => [$this->owner, "text"]], "auth_key" => ["definition" => ["class" => \common\db\fields\Field::className(), "title" => Yii::t('main/app', 'Api key'), "isRequired" => false, "showInForm" => false, "showInGrid" => false, "showInExtendedFilter" => false, "isSafe" => false], "params" => [$this->owner, "auth_key"]]];
 }