public function getFilterValues() { $field = FFields::findOne($this->id_field); $r = array(); if ($field->typeLink->name == "select") { $r = $this->hasMany(SSelect::className(), ['id_field' => 'id_field']); } return $r; }
public function setQuery($query) { if ($this->search != "") { $search = explode(" ", $this->search); $query = $query->where(['or like', 'r_items.name', $search]); $query = $query->orWhere(['or like', 'r_items.description', $search]); $query = $query->joinWith('fields')->orWhere(['or like', 'r_fields.value', $search]); $s_select = SSelect::find()->where(["or like", "value", $search])->all(); if (count($s_select) > 0) { foreach ($s_select as $select) { $query = $query->orWhere("(`r_fields`.`id_field` = " . $select->id_field . " AND `r_fields`.`value` = " . $select->id . ")"); } } } else { $query = $query->where(["r_items.id" => ""]); } return $query; }
public function getVal() { $type_field = $this->typeField->typeLink->name; switch ($type_field) { case 'integer': $r = $this->value; break; case 'select': $r = SSelect::findOne($this->value); $r = $r->value; break; case 'yandex_map': $r = \Yii::$app->view->renderFile('@app/views/c/map.php', ['field' => $this]); break; default: $r = $this->value; break; } return $r; }
public function getSSelect() { return $this->hasMany(SSelect::className(), ['id_field' => 'id']); }
public function actionDelSelect() { $post = Yii::$app->request->post(); $id_element = $post["id_element"]; $select = SSelect::findOne($id_element); $parent_id = $select->id_field; $select->delete(); $this->redirect(['/cabinet/field', 'id' => $parent_id]); }