public function __ModelGetAllTables($rowParams = [], $value = "", $item = []) { $rowParams = ArrayHelper::toArray($rowParams); $model = new ModelAdmin(); $model->table = "backend__id_db"; $params = Yii::$app->request->bodyParams; if (!empty($params) && !empty($value)) { $model_tables = new \app\modelsActiveRecords\Tables(); $model_tables->Add($value, ['name' => $params["name"]]); } $params = $this->MakeRowParams($rowParams["params"]); $tables = $model->GetTableList(); $getActiveTable = $model->GetItems(['name'], ['model_id' => $value]); $activeTable = isset($getActiveTable[0]["name"]) ? $getActiveTable[0]["name"] : ""; $tag = Html::label($rowParams["label"], $rowParams["name"]); $tag .= Html::dropDownList($this->ReturnGroup($rowParams), $activeTable, $tables, $params); return $tag; }
/** * Свойства модели * @return string */ public function actionProperty() { $id = yii::$app->request->get('id') ? (int) yii::$app->request->get('id') : 0; if ($id) { $m_tabs = new Tabs(); $m_tables = new Tables(); $m_rows = new Rows(); $item = $this->GetModel()->GetItem($id); $data['rows'] = $m_rows->GetRows($id); $data['tabs'] = $m_tabs->GetItems($id); $table_columns = $m_tables->GetTableForModelId($id); $data['column'] = $this->GetModel()->GetColumnFromTable($table_columns); $this->titlePage = "Модель " . $item["name"]; $this->headerPage = "Свойство модели / " . $item["name"]; if (isset($_POST["saveAction"])) { if (isset(yii::$app->request->bodyParams["row"])) { $fields = yii::$app->request->bodyParams["row"]; foreach ($fields as $id_section => $value) { $m_rows->Add($id_section, $value, $id); } } $this->redirect(Url::to(["/models/catalog/property", "id" => $id])); } return $this->render('property', ["data" => $data, "id" => $id]); } }