Ejemplo n.º 1
0
 /**
  * Формирование Полей
  * @param unknown $item
  * @param unknown $model
  */
 protected function buildRows($item, $model)
 {
     $module_model = new DinamicModel();
     $module_model->setTableName('module');
     $info_module = $module_model->find()->select(['model'])->where(['name' => $this->ExecModule()])->one();
     $rows_model = new app\modelsActiveRecords\Rows();
     $model_id = $model == 0 ? ArrayHelper::toArray($info_module)["model"] : $model;
     return $this->MakeRows($rows_model->GetRows($model_id), $item);
 }
 /**
  * Свойства модели
  * @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]);
     }
 }