public function actionIndex() { $model = new \app\modelsActiveRecords\DinamicModel(); $model->setTableName('backend__pages'); $this->headerPage = "Список типовых страниц"; $dataProvider = new ActiveDataProvider(["query" => $model->find(), "pagination" => ["pageSize" => 10]]); return $this->render('index', ["data" => $dataProvider]); }
public function actionIndex() { $this->headerPage = "Каталог ротаций"; $model = new DinamicModel(); $model->setTableName($this->GetModel()["table"]); $dataProvider = new ActiveDataProvider(['query' => $model->find(), 'pagination' => ['pageSize' => 15]]); return $this->render('index', ['dataProvider' => $dataProvider]); }
public function actionIndex() { $model = new \app\modelsActiveRecords\DinamicModel(); $model->setTableName('users'); $this->headerPage = "Список учётных записей"; $dataProvider = new ActiveDataProvider(['query' => $model->find(), 'pagination' => ['pageSize' => 10]]); return $this->render('index', ['dataProvider' => $dataProvider]); }
public function actionIndex($id) { $model = new \app\modelsActiveRecords\DinamicModel(); $model->setTableName('content'); $this->headerPage = "Список элементов"; $dataProvider = new ActiveDataProvider(["query" => $model->find()->where(["parent_id" => $id, "isdirectory" => 0]), "pagination" => ["pageSize" => 10]]); return $this->render('index', ["data" => $dataProvider, "id" => $id]); }
/** * Индексная страница * @return string */ public function actionIndex() { $model = new \app\modelsActiveRecords\DinamicModel(); $model->setTableName('models'); $this->titlePage = "Страница моделей"; $this->headerPage = "Модeли"; $activeProvider = new ActiveDataProvider(["query" => $model->find()->orderBy(["name" => "ASC"]), "pagination" => ["pageSize" => 15]]); return $this->render('index', ["data" => $activeProvider]); }
public function actionIndex($id) { $model = new app\modelsActiveRecords\DinamicModel(); $model->setTableName('content'); Url::remember(Url::toRoute(['/article/list/?id=' . $id]), 'safe_url'); $item = $this->GetModel()->GetItem($id); $dataProvider = new ActiveDataProvider(["query" => $model->find()->where(["parent_id" => $id, "isdirectory" => 0]), "pagination" => ["pageSize" => 10]]); $items = $dataProvider->getModels(); $this->headerPage = "Список элементов - {$item["name"]} (" . count($items) . ")"; return $this->render('index', ["data" => $dataProvider]); }
public function actionIndex($id) { Url::remember(yii::$app->request->url, 'safe_url'); $model = new app\modelsActiveRecords\DinamicModel(); $model->setTableName('content'); $item = $this->GetModel()->GetItem($id); $dataProvider = new ActiveDataProvider(["query" => $model->find()->where(["parent_id" => $id, "isdirectory" => 0]), "pagination" => ["pageSize" => 10]]); $items = $dataProvider->getModels(); $countItems = count($items); $this->headerPage = "Список элементов - {$item["name"]}({$countItems})"; return $this->render('index', ["data" => $dataProvider]); }
public function run() { $model = new DinamicModel(); $model->setTableName('module'); $ListObject = $model->find()->select(['id', 'title', 'name'])->where(['visible' => 1])->All(); $List = yii\helpers\ArrayHelper::toArray($ListObject); if (!empty(yii::$app->request->pathInfo)) { list($module, $action) = explode("/", yii::$app->request->pathInfo); } else { $module = "index"; } return $this->render('index', ["navigation" => $List, "active" => $module]); }
public function RemoveItems($data_id = []) { $res = self::findAll($data_id); $url = new \app\modelsActiveRecords\DinamicModel(); $url->setTableName('url'); if ($res) { foreach ($res as $index => $val) { self::deleteAll(['id' => $val->id]); $url::deleteAll(['page_id' => $val->id]); } } return true; }
public function GetActions($page_type = 0, $id = 0) { $model = new \app\modelsActiveRecords\DinamicModel(); $model->setTableName('backend__actions'); $data = $model->find()->where(["page_id" => $page_type])->asArray()->all(); $makeData = []; if (!empty($data)) { foreach ($data as $index => $value) { $url = str_replace("{id}", $id, Url::toRoute([$value["value"]])); $makeData[$index]["name"] = $value["name"]; $makeData[$index]["href"] = $url; } } return $makeData; }
/** * Формирование Полей * @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); }
/** * Формирование ссылки * * @param array $rowParams * @param string $value * @return string */ public function Url($rowParams = [], $value = "", $item = []) { $params = $this->MakeRowParams($rowParams["params"]); list($module_name) = explode("/", yii::$app->request->pathInfo); $url = new \app\modelsActiveRecords\DinamicModel(); $url->setTableName('module'); $module = $url->find()->select("id")->where(["name" => $module_name])->asArray()->one(); $module_id = $module["id"]; $url->setTableName('url'); $tag = Html::label($rowParams["label"], $rowParams["name"]); $getUrl = $url->find()->where(["page_id" => $value])->asArray()->one(); $model_admin = new \app\base\ModelAdmin(); $id = !empty($value) ? $value : $model_admin->GetLastInsertId($rowParams["model_id"]); if (yii::$app->request->post()) { $urlField = yii::$app->request->post($rowParams["name"]); $actionField = yii::$app->request->post('action'); $findUrl = $url->find()->where(["page_id" => $id])->one(); if ($findUrl) { $findUrl->page_id = $id; $findUrl->url = $urlField; $findUrl->module = $module_id; $findUrl->action = !empty($actionField) ? $actionField : "index"; $findUrl->save(); } else { $url->page_id = $id; $url->url = $urlField; $url->module = $module_id; $url->action = !empty($actionField) ? $actionField : "index"; $url->save(); } } $tag .= Html::textInput($this->ReturnGroup($rowParams), $getUrl["url"], $params); $tag .= Html::a('', 'javascript:void(0)', ['class' => 'fa fa-link', 'style' => 'text-decoration:none; margin-left:5px;', 'onclick' => 'TranslyteEn_ru("#name")']); return $tag; }
/** * Создание действия для страницы */ public function __ModelCreateActionsForPage($rowParams = [], $value = "", $item = []) { $params = $this->MakeRowParams($rowParams["params"]); $model = new \app\modelsActiveRecords\DinamicModel(); $model->setTableName($params["table"]); $id = !empty(yii::$app->request->get('id')) ? yii::$app->request->get('id') : 0; if (yii::$app->request->isPost) { $model_admin = new \app\base\ModelAdmin(); $id = !empty($id) ? $id : $model_admin->GetLastInsertId($rowParams["model_id"]); $data = yii::$app->request->post($rowParams['name']); $model = new \app\modelsActiveRecords\Actions(); $model->Add($id, $data); } $tag = Html::a(Html::tag('i', "", ["class" => "fa fa-plus"]) . 'Добавить действие', 'javascript:void(0)', ["onclick" => "addAction(this, '{$rowParams['name']}')"]); $tag .= Html::beginTag('table', ["style" => "width:440px"]); $data = $model->find()->where(["page_id" => $id])->asArray()->all(); if ($data) { foreach ($data as $index => $value) { $tag .= Html::beginTag('tr'); $tag .= Html::tag('td', Html::textInput("{$rowParams['name']}[{$index}][name]", $value["name"])); $tag .= Html::tag('td', Html::textInput("{$rowParams['name']}[{$index}][value]", $value["value"])); $tag .= Html::tag('td', html::a('Удалить', 'javascript:void(0)', ['onclick' => 'removeRow(this)'])); $tag .= Html::endTag('tr'); } } $tag .= Html::endTag('table'); return $tag; }