コード例 #1
0
ファイル: View.php プロジェクト: frostiks25/rzwebsys7
 /**
  * Регистрирует мета-теги
  * @param \common\db\ActiveRecord $model
  */
 public function registerMetaTags($model)
 {
     if ($model->hasAttribute("metatitle") and !empty($model->metatitle)) {
         $this->title = $model->metatitle;
     } elseif ($model->hasAttribute("title")) {
         $this->title = $model->title;
     }
     if ($model->hasAttribute("keywords")) {
         $this->registerMetaTag(["name" => "keywords", "content" => $model->keywords]);
     }
     if ($model->hasAttribute("description")) {
         $this->registerMetaTag(["name" => "description", "content" => $model->description]);
     }
 }
コード例 #2
0
ファイル: Base.php プロジェクト: frostiks25/rzwebsys7
 /**
  * Проверяет попытку изменения запрещенных атрибутов
  * @param \common\db\ActiveRecord $model
  * @throws \yii\web\ForbiddenHttpException
  */
 protected function checkForbiddenAttrs($model)
 {
     $attrs = Yii::$app->request->post($model->formName(), []);
     $perm = $model->getPermission();
     if ($perm and $perm->hasForbiddenAttrs($attrs)) {
         throw new ForbiddenHttpException('Forbidden');
     }
 }
コード例 #3
0
ファイル: Banner.php プロジェクト: frostiks25/rzwebsys7
 /**
  * @inheritdoc
  */
 public function beforeSave($insert)
 {
     if (parent::beforeSave($insert)) {
         if (empty($this->sort)) {
             $this->sort = self::DEFAULT_SORT;
         }
         return true;
     }
     return false;
 }
コード例 #4
0
ファイル: Review.php プロジェクト: frostiks25/rzwebsys7
 /**
  * @inheritdoc
  */
 public function afterSave($insert, $changedAttributes)
 {
     if ($insert and $this->active == true) {
         $this->recalc();
     }
     if (!$insert and isset($changedAttributes['active'])) {
         $this->recalc();
     }
     parent::afterSave($insert, $changedAttributes);
 }
コード例 #5
0
ファイル: TableInput.php プロジェクト: frostiks25/rzwebsys7
 /**
  * Возвращает строку формы
  * @param \common\db\ActiveRecord $model модель
  * @param int $index номер строки
  * @return string
  */
 protected function renderLine($model, $index)
 {
     $html = Html::beginTag('tr');
     $meta = $model->getMetaFields();
     $fields = $meta->getFields();
     foreach ($fields as $field) {
         if (!$field->showInTableInput) {
             continue;
         }
         $html .= Html::beginTag('td');
         $html .= $field->getForm($this->form, [], $index);
         $html .= Html::endTag('td');
     }
     if ($this->hasRowLinks()) {
         $html .= Html::beginTag('td');
         $html .= $this->renderLinks($index, $model);
         $html .= Html::endTag('td');
     }
     $html .= Html::endTag('tr');
     return $html;
 }
コード例 #6
0
ファイル: Status.php プロジェクト: frostiks25/rzwebsys7
 /**
  * @inheritdoc
  * загружаем шаблон письма
  */
 public function afterFind()
 {
     parent::afterFind();
     Yii::$app->getModule('shop')->orderLetters->loadStatusTpl($this);
 }
コード例 #7
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     $behaviors = parent::behaviors();
     $behaviors["nestedSets"] = ["class" => NestedSet::className(), "depthAttribute" => "level"];
     return $behaviors;
 }
コード例 #8
0
ファイル: Order.php プロジェクト: frostiks25/rzwebsys7
 /**
  * @inheritdoc
  */
 public function scenarios()
 {
     $parent = parent::scenarios();
     $arr = array_diff($parent[self::SCENARIO_CONFIRM], ["allGoods"]);
     $parent[self::SCENARIO_CONFIRM] = array_merge($arr, ["!allGoods"]);
     return $parent;
 }
コード例 #9
0
ファイル: Catalog.php プロジェクト: frostiks25/rzwebsys7
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     $arr = parent::behaviors();
     $arr["manyManySaver"] = ['class' => \common\behaviors\ManyManySaver::className(), 'names' => ['sections']];
     return $arr;
 }
コード例 #10
0
ファイル: Good.php プロジェクト: frostiks25/rzwebsys7
 /**
  * @inheritdoc
  */
 public function beforeSave($insert)
 {
     if ($insert) {
         $this->setClientAttributes();
         $this->setModelAttributes();
     }
     if (parent::beforeSave($insert)) {
         $this->item_key = $this->generateKey();
         return true;
     } else {
         return false;
     }
 }
コード例 #11
0
ファイル: User.php プロジェクト: frostiks25/rzwebsys7
 /**
  * @inheritdoc
  */
 public function fields()
 {
     $arr = parent::fields();
     $disabled = ["auth_key", "password_hash", "password_reset_token"];
     return array_diff($arr, $disabled);
 }
コード例 #12
0
ファイル: Payment.php プロジェクト: frostiks25/rzwebsys7
 /**
  * @inheritdoc
  */
 public function rules()
 {
     $parent = parent::rules();
     $parent[] = ['sort', 'default', 'value' => 500];
     return $parent;
 }
コード例 #13
0
ファイル: IncludeGroup.php プロジェクト: frostiks25/rzwebsys7
 /**
  * @inheritdoc
  */
 public function __get($name)
 {
     $val = parent::__get($name);
     if ($name == "includes" and !empty($val)) {
         $this->sortIncludes($val, $this->id);
     }
     return $val;
 }
コード例 #14
0
ファイル: Template.php プロジェクト: frostiks25/rzwebsys7
 /**
  * @inheritdoc
  */
 public function rules()
 {
     $rules = parent::rules();
     return $rules;
 }