Exemplo n.º 1
0
 public function actionSignup()
 {
     $this->needAuthenticate();
     if (Param::post('employee-registration-form-sign-up', false)->exists()) {
         $name = Param::post('employee-registration-form-name', false)->noEmpty("Запоните поле \"Имя\".")->asString(true, "Недопустимое значение поля \"Имя\".");
         $email = Param::post('employee-registration-form-email', false)->noEmpty("Заполните поле \"Email\"!")->asEmail(true, "Недопустимое значение поля \"Email\".");
         $password = Param::post('employee-registration-form-password', false)->noEmpty("Заполните поле \"Пароль\".")->asString(true, "Недопустимое значение поля \"Пароль\".");
         $passwordRepeat = Param::post('employee-registration-form-password-repeat', false)->noEmpty("Заполните поле \"Повтор пароля\".")->asString(true, "Недопустимое значение поля \"Повтор пароля\".");
         if ($password != $passwordRepeat) {
             SCMSNotificationLog::instance()->pushError("\"Пароль\" и \"Повтор пароля\" должны быть одинаковы.");
         }
         if (SCMSNotificationLog::instance()->hasProblems()) {
             $this->Response->send();
             exit;
         }
         /** @var Employee $oEmployee */
         $oEmployee = DataSource::factory(Employee::cls());
         $oEmployee->name = $name;
         $oEmployee->email = $email;
         $oEmployee->password = $this->EmployeeAuthentication->encodePassword($password, Employee::SALT);
         $oEmployee->active = true;
         $oEmployee->deleted = false;
         $oEmployee->commit();
         SCMSNotificationLog::instance()->pushMessage("Успешно зарегистрирован!");
         $this->Response->send('/admin/modules/employees');
         exit;
     } else {
         SCMSNotificationLog::instance()->pushError("Форма регистрации сотрудника заполнена неверно!");
     }
     $this->Response->send();
 }
Exemplo n.º 2
0
 public function actionIndex()
 {
     $this->needAuthenticate();
     $pageId = Param::post('page-edit-id', false)->asInteger(false);
     $name = Param::post('page-edit-name')->noEmpty('Поле "Наименование" должно быть заполнено.')->asString();
     $description = Param::post('page-edit-description')->asString();
     $content = Param::post('page-edit-content')->asString();
     $active = (bool) Param::post('page-edit-active')->exists();
     if (!SCMSNotificationLog::instance()->hasProblems()) {
         /** @var Page $oPage */
         $oPage = DataSource::factory(Page::cls(), $pageId == 0 ? null : $pageId);
         $oPage->name = $name;
         $oPage->description = $description;
         $oPage->content = $content;
         $oPage->active = $active;
         if (!$oPage->getPrimaryKey()) {
             $oPage->deleted = false;
         }
         $oPage->commit();
         SCMSNotificationLog::instance()->pushMessage("Страница \"{$oPage->name}\" успешно " . ($pageId == 0 ? 'добавлена' : 'отредактирована') . '.');
         $redirect = '';
         if (Param::post('page-edit-accept', false)->exists()) {
             $redirect = '/admin/modules/pages/';
         } elseif ($pageId == 1) {
             $redirect = "/admin/modules/pages/edit/?id={$oPage->getPrimaryKey()}";
         }
         $this->Response->send($redirect);
     } else {
         $this->Response->send();
     }
 }
Exemplo n.º 3
0
 public function actionIndex()
 {
     $this->needAuthenticate();
     $galleryId = Param::get('gallery_id')->asInteger(true, 'Недопустимое значение номера галереи.');
     /** @var Gallery $oGallery */
     $oGallery = DataSource::factory(Gallery::cls(), $galleryId);
     if (!$oGallery) {
         SCMSNotificationLog::instance()->pushError("Запрошенная галерея с номером \"{$galleryId}\" не существует.");
         $this->Frame->render();
         return;
     }
     $pageNumber = Param::get('gallery-item-page', false)->asInteger(false);
     $itemsPerPage = Param::get('gallery-item-items-per-page', false)->asInteger(false);
     $manifest = $this->ModuleInstaller->getManifest($this->ModuleDirectory);
     $dataGridView = new ViewDataGrid();
     $retriever = new GalleryRetriever();
     $dataGrid = new DataGrid('item', '', 'id', $manifest['meta']['alias'], $pageNumber, $itemsPerPage, $manifest['meta']['description']);
     $dataGrid->getMenu()->addElement(new Item('Добавить элемент', "/admin/modules/gallery/item/edit/?gallery_id={$oGallery->id}"));
     $dataGrid->addAction(new Action('id', "/admin/modules/gallery/item/edit/?gallery_id={$oGallery->id}", 'edit', '', [], ['class' => 'glyphicon glyphicon-pencil'], 'Редактировать'))->addAction(new Action('id', '/admin/modules/gallery/item/delete/', 'delete', '', [], ['class' => 'glyphicon glyphicon-trash'], 'Удалить', true));
     $dataGrid->addHeader(new Header('id', '№', null, ['class' => 'text-center', 'style' => 'width: 50px;'], ['class' => 'text-center'], true, Param::get('item-filter-id', false)->asString(false)))->addHeader(new Header('name', 'Название', null, ['class' => 'text-center', 'style' => 'width: 250px;'], [], true, Param::get('item-filter-name', false)->asString(false)))->addHeader(new Header('description', 'Описание', new ViewCutString(20, true, ['class' => 'content-to-modal', 'style' => 'cursor: pointer;'], ['style' => 'display: none;']), ['class' => 'text-center'], ['class' => 'modal-display-field'], true, Param::get('item-filter-description', false)->asString(false)))->addHeader(new Header('path', 'Миниатюра', new ViewCondition(new ViewImageLink(true, ['class' => 'fancybox'], ['class' => 'img-rounded', 'style' => 'height: 20px;']), [['field' => 'path', 'value' => '/public/assets/images/system/no-image.svg', 'view' => new ViewStub('<span class="glyphicon glyphicon-picture"></span>')]]), ['class' => 'text-center', 'style' => 'width: 50px;'], ['class' => 'text-center']))->addHeader(new Header('position', 'Позиция', null, ['class' => 'text-center', 'style' => 'width: 50px;'], ['class' => 'text-center'], true, Param::get('item-filter-position', false)->asString(false)));
     $galleries = $retriever->getGalleryItems($oGallery, $dataGrid->getFilterConditions(), $dataGrid->Pagination->getLimit(), $dataGrid->Pagination->getOffset());
     $dataSet = new ArrayDataSet($galleries);
     $dataGrid->addDataSet($dataSet);
     $dataGridView->dataGrid = $dataGrid;
     // Подготовка хлебных крошек
     $viewBreadcrumbs = new ViewBreadcrumbs();
     $viewBreadcrumbs->Breadcrumbs = [new Breadcrumb('Панель управления', '/admin'), new Breadcrumb('Галереи', '/modules/gallery'), new Breadcrumb("Элементы галереи \"{$oGallery->name}\"", '')];
     $this->Frame->bindView('breadcrumbs', $viewBreadcrumbs);
     $this->Frame->bindView('content', $dataGridView);
     $this->Frame->render();
 }
Exemplo n.º 4
0
 public function actionIndex()
 {
     $this->needAuthenticate();
     $galleryItemId = Param::get('id', false)->asInteger(false);
     $galleryId = Param::get('gallery_id')->asInteger(true, 'Недопустимое значение номера галереи.');
     /** @var GalleryItem $oGalleryItem */
     $oGalleryItem = DataSource::factory(GalleryItem::cls(), $galleryItemId);
     /** @var Gallery $oGallery */
     $oGallery = DataSource::factory(Gallery::cls(), $galleryId);
     if ($oGalleryItem->isNew() && $oGallery->isNew()) {
         SCMSNotificationLog::instance()->pushError('Недопустимое значение параметра!');
         $this->Frame->render();
         return;
     }
     $view = new ViewEditForm();
     $view->GalleryItem = $oGalleryItem;
     $view->Gallery = $oGallery;
     // Подготовка хлебных крошек
     $viewBreadcrumbs = new ViewBreadcrumbs();
     $viewBreadcrumbs->Breadcrumbs = [new Breadcrumb('Панель управления', '/admin'), new Breadcrumb('Галереи', '/modules/gallery'), new Breadcrumb("Галерея \"{$oGallery->name}\"", "/item/?gallery_id={$oGallery->id}")];
     if ($oGalleryItem->id !== null) {
         $viewBreadcrumbs->Breadcrumbs[] = new Breadcrumb("Редактирование \"{$oGalleryItem->name}\"", '');
     } else {
         $viewBreadcrumbs->Breadcrumbs[] = new Breadcrumb('Добавление нового элемента галереи', '');
     }
     $view->backUrl = CoreFunctions::buildUrlByBreadcrumbs($viewBreadcrumbs->Breadcrumbs, 1);
     $this->Frame->bindView('breadcrumbs', $viewBreadcrumbs);
     $this->Frame->bindView('content', $view);
     $this->Frame->render();
 }
Exemplo n.º 5
0
 public function actionIndex()
 {
     if (CoreFunctions::isAJAX()) {
         if (!$this->EmployeeAuthentication->authenticated()) {
             SCMSNotificationLog::instance()->pushError('Нет доступа.');
             $this->Response->send();
             return;
         }
     } else {
         $this->needAuthenticate();
     }
     $siteuserId = Param::get('id')->noEmpty('Параметр обязателен для заполнения.')->asInteger(true, "Неверно задан параметр.");
     /** @var Siteuser $oSiteuser */
     $oSiteuser = DataSource::factory(Siteuser::cls(), $siteuserId);
     if ($oSiteuser->id) {
         $oSiteuser->deleted = true;
         try {
             $oSiteuser->commit();
             SCMSNotificationLog::instance()->pushMessage("Пользователь \"{$oSiteuser->name}\" успешно удалён.");
         } catch (Exception $e) {
             SCMSNotificationLog::instance()->pushError($e->getMessage());
         }
     } else {
         SCMSNotificationLog::instance()->pushError("Пользователь с ID {$siteuserId} не найден");
     }
     $this->Response->send();
 }
Exemplo n.º 6
0
 public function actionIndex()
 {
     $this->needAuthenticate();
     $galleryId = Param::post('gallery-edit-id', false)->asInteger(false);
     $name = Param::post('gallery-edit-name')->noEmpty('Поле "Название" должно быть заполнено.')->asString();
     $description = Param::post('gallery-edit-description')->asString();
     if (!SCMSNotificationLog::instance()->hasProblems()) {
         /** @var Gallery $oGallery */
         $oGallery = DataSource::factory(Gallery::cls(), $galleryId == 0 ? null : $galleryId);
         $oGallery->name = $name;
         $oGallery->description = $description;
         $oGallery->deleted = false;
         $oGallery->commit();
         SCMSNotificationLog::instance()->pushMessage("Галерея \"{$oGallery->name}\" успешно " . ($galleryId == 0 ? 'добавлена' : 'отредактирована') . '.');
         $redirect = '';
         if (Param::post('gallery-edit-accept', false)->exists()) {
             $redirect = '/admin/modules/gallery/';
         } elseif ($galleryId == 0) {
             $redirect = "/admin/modules/gallery/edit/?id={$oGallery->getPrimaryKey()}";
         }
         $this->Response->send($redirect);
     } else {
         $this->Response->send();
     }
 }
Exemplo n.º 7
0
 public function actionIndex()
 {
     $this->needAuthenticate();
     $galleryId = Param::post('gallery-id')->asInteger(true, 'Недопустимое значние номера галереи.');
     $galleryItemId = Param::post('gallery-item-edit-id', false)->asInteger(false);
     $name = Param::post('gallery-item-edit-name')->noEmpty('Поле "Название" должно быть заполнено.')->asString();
     $description = Param::post('gallery-item-edit-description')->asString();
     $path = Param::post('gallery-item-edit-path')->noEmpty('Недопустимое значение пути к изображению.')->asString();
     $position = Param::post('gallery-item-edit-position')->noEmpty('Недопустимое значение позиции элемента.')->asInteger();
     /** @var Gallery $oGallery */
     $oGallery = DataSource::factory(Gallery::cls(), $galleryId);
     if ($oGallery->isNew()) {
         SCMSNotificationLog::instance()->pushError("Попытка добавить элемент в несуществующую галерею.");
     }
     if (!SCMSNotificationLog::instance()->hasProblems()) {
         /** @var GalleryItem $oGalleryItem */
         $oGalleryItem = DataSource::factory(GalleryItem::cls(), $galleryItemId == 0 ? null : $galleryItemId);
         $oGalleryItem->name = $name;
         $oGalleryItem->description = $description;
         $oGalleryItem->path = $path;
         $oGalleryItem->gallery_id = $oGallery->id;
         $oGalleryItem->position = $position;
         $oGalleryItem->commit();
         SCMSNotificationLog::instance()->pushMessage("Элемент \"{$oGalleryItem->name}\" успешно " . ($galleryItemId == 0 ? "добавлен в галерею \"{$oGalleryItem->getGallery()->name}\"" : 'отредактирован') . '.');
         $redirect = '';
         if (Param::post('gallery-item-edit-accept', false)->exists()) {
             $redirect = "/admin/modules/gallery/item/?gallery_id={$oGalleryItem->gallery_id}";
         } elseif ($galleryItemId == 0) {
             $redirect = "/admin/modules/gallery/item/edit/?id={$oGalleryItem->getPrimaryKey()}";
         }
         $this->Response->send($redirect);
     } else {
         $this->Response->send();
     }
 }
Exemplo n.º 8
0
 public function actionIndex()
 {
     $this->needAuthenticate();
     $isCategory = Param::get('is_category')->asInteger(true, "Недопустимое значение параметра.");
     $id = Param::get('id', false)->asInteger(false);
     $parentId = Param::get('parent_pk', false)->asInteger(false);
     /** @var Category $oCategories */
     $oCategories = DataSource::factory(Category::cls());
     $oCategories->builder()->where('deleted=0');
     /** @var Category[] $aCategories */
     $aCategories = $oCategories->findAll();
     if ($isCategory == 1) {
         $viewCatalogueEdit = new ViewCategoryEdit();
         /** @var Category $oCategory */
         $oCategory = DataSource::factory(Category::cls(), $id);
         $viewCatalogueEdit->oCategory = $oCategory;
         $viewCatalogueEdit->aCategories = $aCategories;
         $viewCatalogueEdit->parentId = $oCategory->isNew() ? $parentId : $oCategory->category_id;
     } else {
         $viewCatalogueEdit = new ViewItemEdit();
         /** @var Item $oItem */
         $oItem = DataSource::factory(Item::cls(), $id);
         $viewCatalogueEdit->oItem = $oItem;
         $viewCatalogueEdit->aCategories = $aCategories;
         $viewCatalogueEdit->parentId = $oItem->isNew() ? $parentId : $oItem->category_id;
     }
     // Подготовка хлебных крошек
     $viewBreadcrumbs = new ViewBreadcrumbs();
     $viewBreadcrumbs->Breadcrumbs = [new Breadcrumb('Панель управления', '/admin'), new Breadcrumb('Каталог', '/modules/catalogue')];
     if ($parentId) {
         $breadcrumbsParentPK = $parentId;
     } elseif ($isCategory == 1 && isset($oCategory)) {
         $breadcrumbsParentPK = $oCategory->category_id;
     } elseif (!$isCategory && isset($oItem)) {
         $breadcrumbsParentPK = $oItem->category_id;
     } else {
         $breadcrumbsParentPK = 0;
     }
     $catalogueEditBreadcrumbs = [];
     while ($breadcrumbsParentPK) {
         /** @var Category $oParentCategory */
         $oParentCategory = DataSource::factory(Category::cls(), $breadcrumbsParentPK);
         $catalogueEditBreadcrumbs[] = new Breadcrumb($oParentCategory->name, "?parent_pk={$oParentCategory->getPrimaryKey()}", true);
         $breadcrumbsParentPK = $oParentCategory->category_id;
     }
     $viewBreadcrumbs->Breadcrumbs = array_merge($viewBreadcrumbs->Breadcrumbs, array_reverse($catalogueEditBreadcrumbs));
     if ($id && isset($oCategory)) {
         $viewBreadcrumbs->Breadcrumbs[] = new Breadcrumb("Редактирование \"{$oCategory->name}\"", '');
     } elseif ($id && isset($oItem)) {
         $viewBreadcrumbs->Breadcrumbs[] = new Breadcrumb("Редактирование \"{$oItem->name}\"", '');
     } else {
         $lastBreadcrumb = 'Добавление новой ' . ($isCategory == 1 ? 'категории' : 'позиции');
         $viewBreadcrumbs->Breadcrumbs[] = new Breadcrumb($lastBreadcrumb, '');
     }
     $viewCatalogueEdit->backUrl = CoreFunctions::buildUrlByBreadcrumbs($viewBreadcrumbs->Breadcrumbs, 1);
     $this->Frame->bindView('breadcrumbs', $viewBreadcrumbs);
     $this->Frame->bindView('content', $viewCatalogueEdit);
     $this->Frame->render();
 }
Exemplo n.º 9
0
 public function actionIndex()
 {
     $this->needAuthenticate();
     $structureId = Param::get('id')->asInteger();
     /** @var Structure $oStructure */
     $oStructure = DataSource::factory(Structure::cls(), $structureId);
     $name = $oStructure->name;
     $this->deepDelete($oStructure);
     SCMSNotificationLog::instance()->pushMessage("Структура \"{$name}\" успешно удалена.");
     $this->Response->send();
 }
Exemplo n.º 10
0
 public function actionIndex()
 {
     $this->needAuthenticate();
     $this->Frame->addCss('\\public\\assets\\css\\edit-form.css');
     $this->Frame->addCss('\\public\\assets\\css\\main-menu.css');
     $moduleId = Param::get('pk')->asInteger();
     $view = new ViewModuleShow();
     $module = DataSource::factory(Module::cls(), $moduleId);
     $view->module = $module;
     $this->Frame->bindView('content', $view);
     $this->Frame->render();
 }
Exemplo n.º 11
0
 public function actionIndex()
 {
     $this->needAuthenticate();
     $galleryItemId = Param::get('id')->noEmpty('Не задан обязательный параметр.')->asInteger(true, 'Параметр должен быть числом.');
     /** @var GalleryItem $oGalleryItem */
     $oGalleryItem = DataSource::factory(GalleryItem::cls(), $galleryItemId);
     if (is_null($oGalleryItem) || !$oGalleryItem->getPrimaryKey()) {
         SCMSNotificationLog::instance()->pushError('Элемент галереи не найден.');
     } else {
         SCMSNotificationLog::instance()->pushMessage("Элемент \"{$oGalleryItem->name}\" галереи {$oGalleryItem->getGallery()->name} успешно удален.");
         $oGalleryItem->delete();
     }
     $this->Response->send();
 }
Exemplo n.º 12
0
 public function actionIndex()
 {
     $this->needAuthenticate();
     $employeeId = Param::get('id')->noEmpty('Параметр обязателен для заполнения.')->asInteger(true, "Неверно задан параметр.");
     /** @var Employee $oEmployee */
     $oEmployee = DataSource::factory(Employee::cls(), $employeeId);
     if ($oEmployee->id) {
         SCMSNotificationLog::instance()->pushMessage("Сотрудник \"{$oEmployee->name}\" успешно удалён.");
         $oEmployee->deleted = true;
         $oEmployee->commit();
     } else {
         SCMSNotificationLog::instance()->pushError("Сотрутник с ID {$employeeId} не найден");
     }
     $this->Response->send();
 }
Exemplo n.º 13
0
 public function actionIndex()
 {
     $this->needAuthenticate();
     $pageId = Param::get('id')->noEmpty('Не задан обязательный параметр.')->asInteger(true, 'Параметр должен быть числом.');
     /** @var Page $oPage */
     $oPage = DataSource::factory(Page::cls(), $pageId);
     if (is_null($oPage) || !$oPage->getPrimaryKey()) {
         SCMSNotificationLog::instance()->pushError('Статическая страница не найдена.');
     } else {
         SCMSNotificationLog::instance()->pushMessage("Страница \"{$oPage->name}\" успешно удалена.");
         $oPage->deleted = true;
         $oPage->commit();
     }
     $this->Response->send();
 }
Exemplo n.º 14
0
 public function actionIndex()
 {
     $this->needAuthenticate();
     $pk = Param::get('id', true)->asInteger(true, 'Не указан обязательный параметр.');
     /** @var Employee $oEmployee */
     $oEmployee = DataSource::factory(Employee::cls(), $pk);
     $view = new ViewEmployeeEdit();
     $view->employee = $oEmployee;
     // Подготовка хлебных крошек
     $viewBreadcrumbs = new ViewBreadcrumbs();
     $viewBreadcrumbs->Breadcrumbs = [new Breadcrumb('Панель управления', '/admin'), new Breadcrumb('Сотрудники', '/modules/employees'), new Breadcrumb("Редактирование \"{$oEmployee->email}\"", '')];
     $this->Frame->bindView('breadcrumbs', $viewBreadcrumbs);
     $this->Frame->bindView('content', $view);
     $this->Frame->render();
 }
Exemplo n.º 15
0
 public function actionIndex()
 {
     $this->needAuthenticate();
     $employeeId = Param::post('employee-id')->asInteger(true, 'Не указан обязательный параметр.');
     $name = Param::post('employee-name')->noEmpty('Поле "Имя" должно быть заполнено.')->asString();
     $email = Param::post('employee-email')->noEmpty('Поле "Email" должно быть заполнено.')->asString();
     $currentEmployeePassword = Param::post('employee-current-password')->asString();
     $newPassword = Param::post('employee-new-password')->asString();
     $newPasswordRepeat = Param::post('employee-new-password-repeat')->asString();
     if (!empty($newPassword)) {
         if (!$this->EmployeeAuthentication->verifyPassword($currentEmployeePassword, $this->EmployeeAuthentication->getCurrentUser()->password)) {
             SCMSNotificationLog::instance()->pushError('Вы указали неверный пароль.');
         }
         if ($newPassword != $newPasswordRepeat) {
             SCMSNotificationLog::instance()->pushError('"Новый пароль" и "Повтор нового пароля" должны быть заполены одинаково.');
         }
     }
     /** @var Employee $oEmployee */
     $oEmployee = DataSource::factory(Employee::cls(), $employeeId);
     if (!$oEmployee->getPrimaryKey()) {
         SCMSNotificationLog::instance()->pushError('Редактируемый сотрудник не определён.');
     }
     /** @var Employee $aEmployee */
     $aEmployee = DataSource::factory(Employee::cls());
     $aEmployee->builder()->where("{$aEmployee->getPrimaryKeyName()}<>{$employeeId}")->whereAnd()->where('deleted=0')->whereAnd()->where('active=1')->whereAnd()->where("email='{$email}'")->limit(1);
     $aEmployees = $aEmployee->findAll();
     if (sizeof($aEmployees) > 0) {
         SCMSNotificationLog::instance()->pushError('Данный Email уже используется другим сотрудником.');
     }
     if (!SCMSNotificationLog::instance()->hasProblems()) {
         $oEmployee->name = $name;
         $oEmployee->email = $email;
         $oEmployee->password = $this->EmployeeAuthentication->encodePassword($newPassword, Employee::SALT);
         $oEmployee->commit();
         SCMSNotificationLog::instance()->pushMessage("Сотрудник \"{$oEmployee->email}\" успешно отредактирован");
         $redirect = '';
         if (Param::post('employee-accept', false)->exists()) {
             $redirect = '/admin/modules/employees/';
         } else {
             if ($employeeId == 1) {
                 $redirect = "/admin/modules/employees/edit/?pk={$oEmployee->getPrimaryKey()}";
             }
         }
         $this->Response->send($redirect);
     } else {
         $this->Response->send();
     }
 }
Exemplo n.º 16
0
 public function actionItem()
 {
     if (CoreFunctions::isAJAX() && !$this->EmployeeAuthentication->authenticated()) {
         SCMSNotificationLog::instance()->pushError('Нет доступа!');
         $this->Response->send();
         return;
     }
     $this->needAuthenticate();
     $categoryId = Param::post('catalogue-item-id', false)->asInteger(false);
     $name = Param::post('catalogue-item-name')->noEmpty('Заполните поле "Наименование"')->asString();
     $description = Param::post('catalogue-item-description')->asString();
     $parentCategoryId = Param::post('catalogue-item-parent_id')->asInteger(true, 'Поле "Родительская категория" заполнено неверно.');
     $price = Param::post('catalogue-item-price', true)->asNumber(true, "Поле \"Цена\" заполнено неверно.");
     $count = Param::post('catalogue-item-count', true)->asInteger(true, "Поле \"Количество\" заполнено неверно.");
     $thumbnail = Param::post('catalogue-item-thumbnail', false)->asString();
     $priority = Param::post('catalogue-item-priority', false)->asString();
     $active = (int) Param::post('catalogue-item-active', false)->exists();
     $accept = Param::post('catalogue-item-accept', false);
     if (CoreFunctions::isAJAX() && SCMSNotificationLog::instance()->hasProblems()) {
         $this->Response->send();
         return;
     }
     /** @var Item $oItem */
     $oItem = DataSource::factory(Item::cls(), $categoryId == 0 ? null : $categoryId);
     $oItem->name = $name;
     $oItem->description = $description;
     $oItem->category_id = $parentCategoryId;
     $oItem->price = $price;
     $oItem->count = $count;
     $oItem->thumbnail = $thumbnail;
     $oItem->priority = $priority;
     $oItem->active = $active;
     if ($oItem->isNew()) {
         $oItem->deleted = false;
     }
     $oItem->commit();
     if (!SCMSNotificationLog::instance()->hasProblems()) {
         SCMSNotificationLog::instance()->pushMessage("Позиция \"{$oItem->name}\" успешно " . ($categoryId == 0 ? 'добавлена' : 'отредактирована') . ".");
     }
     $redirect = "/admin/modules/catalogue/edit/?id={$oItem->getPrimaryKey()}";
     if ($accept->exists()) {
         $redirect = '/admin/modules/catalogue/' . ($oItem->category_id == 0 ? '' : "?parent_pk={$oItem->category_id}");
     } elseif ($categoryId != 0) {
         $redirect = '';
     }
     $this->Response->send($redirect);
 }
Exemplo n.º 17
0
 public function actionIndex()
 {
     if (!Param::post('employee-authorization-form-sign-in', false)->exists()) {
         SCMSNotificationLog::instance()->pushError('Форма авторизации заполнена неверно');
         $this->Response->send();
         exit;
     }
     $email = Param::post('employee-authorization-form-email')->noEmpty('Заполните Email.')->asEmail(true, 'Недопустимый Email.');
     $password = Param::post('employee-authorization-form-password')->noEmpty('Заполните пароль.')->asString(true, 'Недопустимый пароль.');
     $redirect = '';
     if ($this->EmployeeAuthentication->signIn($email, $password)) {
         $redirect = '/admin';
     } else {
         SCMSNotificationLog::instance()->pushError('Неверно указан email или пароль.');
     }
     $this->Response->send($redirect);
 }
Exemplo n.º 18
0
 public function actionIndex()
 {
     $this->needAuthenticate();
     $parentCategoryId = Param::get('parent_pk', false);
     if ($parentCategoryId->exists()) {
         $parentCategoryId = $parentCategoryId->asInteger(true, 'Недопустимое значение параметра!');
         /** @var Category $oParentCategoryFact */
         $oParentCategoryFact = DataSource::factory(Category::cls(), $parentCategoryId);
         if ($oParentCategoryFact->isNew()) {
             SCMSNotificationLog::instance()->pushError('Недопустимое значение параметра!');
             $this->Frame->render();
             return;
         }
     } else {
         $parentCategoryId = 0;
     }
     $pageNumber = Param::get('catalogue-page', false)->asInteger(false);
     $itemsPerPage = Param::get('catalogue-items-per-page', false)->asInteger(false);
     $manifest = $this->ModuleInstaller->getManifest($this->ModuleDirectory);
     $dataGridView = new ViewDataGrid();
     $retriever = new CatalogueRetriever();
     $dataGrid = new DataGrid('catalogue', '/admin/modules/catalogue/', 'id', $manifest['meta']['alias'], $pageNumber, $itemsPerPage, $manifest['meta']['description']);
     $dataGrid->addHiddenField('parent_pk', $parentCategoryId);
     $dataGrid->getMenu()->addElement(new DataGrid\Menu\Item('Добавить категорию', '/admin/modules/catalogue/edit/?is_category=1' . ($parentCategoryId ? "&parent_pk={$parentCategoryId}" : '')))->addElement(new DataGrid\Menu\Item('Добавить позицию', '/admin/modules/catalogue/edit/?is_category=0' . ($parentCategoryId ? "&parent_pk={$parentCategoryId}" : '')));
     $dataGrid->addAction(new Action('id', '/admin/modules/catalogue/edit/', 'edit', '', ['is_category'], ['class' => 'glyphicon glyphicon-pencil'], 'Редактировать'))->addAction(new Action('id', '/admin/modules/catalogue/delete/', 'delete', '', ['is_category'], ['class' => 'glyphicon glyphicon-trash'], 'Удалить', true));
     $dataGrid->addHeader(new Header('id', '№', null, ['class' => 'text-center', 'style' => 'width: 50px;'], ['class' => 'text-center'], true, Param::get('catalogue-filter-id', false)->asString(false)))->addHeader(new Header('is_category', 'Тип', new ViewChange('', [[0, '<span class="glyphicon glyphicon-file"></span>'], [1, '<span class="glyphicon glyphicon-folder-open"></span>']]), ['class' => 'text-center', 'style' => 'width: 50px;'], ['class' => 'text-center'], true, Param::get('catalogue-filter-is_category', false)->asString(false)))->addHeader(new Header('name', 'Наименование', new ViewCondition(new ViewDefault(), [['field' => 'is_category', 'value' => 1, 'view' => new ViewLink('/admin/modules/catalogue/?parent_pk={label}', false, 'id')]]), ['class' => 'text-center'], [], true, Param::get('catalogue-filter-name', false)->asString(false)))->addHeader(new Header('description', 'Описание', new ViewCutString(20, true, ['class' => 'content-to-modal', 'style' => 'cursor: pointer;'], ['style' => 'display: none;']), ['class' => 'text-center'], ['class' => 'modal-display-field'], true, Param::get('catalogue-filter-description', false)->asString(false)))->addHeader(new Header('thumbnail', 'Миниатюра', new ViewCondition(new ViewImageLink(true, ['class' => 'fancybox'], ['class' => 'img-rounded', 'style' => 'height: 20px;']), [['field' => 'thumbnail', 'value' => '/public/assets/images/system/no-image.svg', 'view' => new ViewStub('<span class="glyphicon glyphicon-picture"></span>')]]), ['class' => 'text-center', 'style' => 'width: 50px;'], ['class' => 'text-center']))->addHeader(new Header('price', '<span class="glyphicon glyphicon-ruble" title="Цена"></span>', new ViewMoney('<span class="glyphicon glyphicon-ruble"></span>'), ['class' => 'text-center'], ['class' => 'text-center'], true, Param::get('catalogue-filter-price', false)->asString(false)))->addHeader(new Header('count', '<span class="glyphicon glyphicon-inbox" title="Количество"></span>', null, ['class' => 'text-center'], ['class' => 'text-center'], true, Param::get('catalogue-filter-count', false)->asString(false)))->addHeader(new Header('priority', '<span class="glyphicon glyphicon-sort-by-attributes" title="Приоритет"></span>', null, ['class' => 'text-center', 'style' => 'width: 50px;'], ['class' => 'text-center'], true, Param::get('catalogue-filter-priority', false)->asString(false)))->addHeader(new Header('active', '<span class="glyphicon glyphicon-asterisk" title="Активность"></span>', new ViewSwitch(), ['class' => 'text-center', 'style' => 'width: 50px;'], ['class' => 'text-center'], true, Param::get('catalogue-filter-active', false)->asString(false)));
     $categoriesAndItems = $retriever->getCategoriesAndItems($parentCategoryId, $dataGrid->getFilterConditions('childs'), $dataGrid->Pagination->getLimit(), $dataGrid->Pagination->getOffset());
     $dataSet = new ArrayDataSet($categoriesAndItems);
     $dataGrid->addDataSet($dataSet);
     $dataGridView->dataGrid = $dataGrid;
     // Подготовка хлебных крошек
     $viewBreadcrumbs = new ViewBreadcrumbs();
     $viewBreadcrumbs->Breadcrumbs = [new Breadcrumb('Панель управления', '/admin'), new Breadcrumb('Каталог', '/modules/catalogue')];
     $breadcrumbsParentPK = $parentCategoryId;
     $categoryBreadcrumbs = [];
     while ($breadcrumbsParentPK) {
         /** @var Category $oParentCategory */
         $oParentCategory = DataSource::factory(Category::cls(), $breadcrumbsParentPK);
         $categoryBreadcrumbs[] = new Breadcrumb($oParentCategory->name, "?parent_pk={$oParentCategory->getPrimaryKey()}", true);
         $breadcrumbsParentPK = $oParentCategory->category_id;
     }
     $viewBreadcrumbs->Breadcrumbs = array_merge($viewBreadcrumbs->Breadcrumbs, array_reverse($categoryBreadcrumbs));
     $this->Frame->bindView('breadcrumbs', $viewBreadcrumbs);
     $this->Frame->bindView('content', $dataGridView);
     $this->Frame->render();
 }
Exemplo n.º 19
0
 public function actionIndex()
 {
     $this->needAuthenticate();
     $frame = $this->Frame;
     $frame->addCss('/public/assets/js/bower_components/markitup/markitup/skins/markitup/style.css');
     $frame->addCss('/public/assets/js/bower_components/markitup/markitup/sets/default/style.css');
     $frameName = Param::get('name', false)->asString(false);
     $view = new ViewEditForm();
     $view->frameName = $frameName;
     // Подготовка хлебных крошек
     $viewBreadcrumbs = new ViewBreadcrumbs();
     $viewBreadcrumbs->Breadcrumbs = [new Breadcrumb('Панель управления', '/admin'), new Breadcrumb('Фреймы', '/modules/frames'), new Breadcrumb($frameName ? "Редактирование фрейма \"{$frameName}\"" : 'Создание нового фрейма', '')];
     $view->backUrl = CoreFunctions::buildUrlByBreadcrumbs($viewBreadcrumbs->Breadcrumbs, 1);
     $frame->bindView('breadcrumbs', $viewBreadcrumbs);
     $frame->bindView('content', $view);
     $frame->render();
 }
Exemplo n.º 20
0
 public function actionIndex()
 {
     if (CoreFunctions::isAJAX() && !$this->EmployeeAuthentication->authenticated()) {
         SCMSNotificationLog::instance()->pushError('Нет доступа!');
         $this->Response->send();
         return;
     }
     $this->needAuthenticate();
     $frameName = Param::get('name', true)->asString(true, 'Недопустимое имя фрейма!');
     $FrameFile = new File(SFW_MODULES_FRAMES . $frameName);
     if (!$FrameFile->exists()) {
         SCMSNotificationLog::instance()->pushError("Фрейм с именем \"{$frameName}\" не найден!");
     }
     if (SCMSNotificationLog::instance()->hasProblems()) {
         $this->Response->send();
         return;
     }
     $oStructures = DataSource::factory(Structure::cls());
     $oStructures->builder()->where('deleted=0')->whereAnd()->where("frame='{$frameName}'");
     /** @var Structure[] $aStructures */
     $aStructures = $oStructures->findAll();
     if (sizeof($aStructures) > 0) {
         $structureNames = [];
         foreach ($aStructures as $oStructure) {
             $structureNames[] = $oStructure->name;
         }
         SCMSNotificationLog::instance()->pushError("Фрейм \"{$frameName}\" нельзя удалять, пока он используется в структуре сайта. На данный момент фрейм назначен разделам: \"" . implode('", "', $structureNames) . '"');
     }
     if (SCMSNotificationLog::instance()->hasProblems()) {
         $this->Response->send();
         return;
     }
     try {
         $FrameFile->delete();
     } catch (Exception $e) {
         SCMSNotificationLog::instance()->pushError('При удалении фрейма произошла ошибка.');
     }
     if (!SCMSNotificationLog::instance()->hasProblems()) {
         SCMSNotificationLog::instance()->pushMessage("Фрейм \"{$frameName}\" успешно удалён.");
     }
     $this->Response->send();
 }
Exemplo n.º 21
0
 public function actionIndex()
 {
     $this->needAuthenticate();
     $pageId = Param::get('id', false)->asInteger(false);
     /** @var Page $oPage */
     $oPage = is_null($pageId) ? null : DataSource::factory(Page::cls(), $pageId);
     $view = new ViewEditForm();
     $view->page = $oPage;
     // Подготовка хлебных крошек
     $viewBreadcrumbs = new ViewBreadcrumbs();
     $viewBreadcrumbs->Breadcrumbs = [new Breadcrumb('Панель управления', '/admin'), new Breadcrumb('Статичные страницы', '/modules/pages')];
     if ($oPage !== null) {
         $viewBreadcrumbs->Breadcrumbs[] = new Breadcrumb("Редактирование \"{$oPage->name}\"", '');
     } else {
         $viewBreadcrumbs->Breadcrumbs[] = new Breadcrumb('Добавление новой статичной страницы', '');
     }
     $this->Frame->bindView('breadcrumbs', $viewBreadcrumbs);
     $this->Frame->bindView('content', $view);
     $this->Frame->render();
 }
Exemplo n.º 22
0
 public function actionIndex()
 {
     $error = Param::get('error', false)->asInteger(false);
     $frame = Registry::frame('back_clear');
     $view = new ViewAuthorization();
     if (!is_null($error)) {
         switch ($error) {
             case 0:
                 $view->errorText = 'Неверный email или пароль.';
                 break;
             default:
                 $view->errorText = 'Произошла неизвестная ошибка.';
         }
     }
     $frame->bindView('modal-notification', new ViewNotificationsModal());
     $frame->bindView('modal-confirmation', new ViewConfirmationModal());
     $frame->bindView('modal-information', new ViewInformationModal());
     $frame->bindView('content', $view);
     $frame->render();
 }
Exemplo n.º 23
0
 public function actionAjaxModuleConfig()
 {
     $this->needAuthenticate();
     $structureId = Param::get('structure_id')->noEmpty('Пропущен обязательный параметр "structure_id".')->asInteger(true, '"structure_id" должен быть числом.');
     if ($structureId == 0) {
         SCMSNotificationLog::instance()->pushError("Не указана целевая структура.");
         $this->Response->send();
         exit;
     }
     $moduleId = Param::get('module_id')->noEmpty('Пропущен обязательный параметр "module_id".')->asInteger(true, '"structure_id" должен быть числом.');
     /** @var Structure $oStructure */
     $oStructure = DataSource::factory(Structure::cls(), $structureId);
     /** @var Module $oModule */
     $oModule = DataSource::factory(Module::cls(), $moduleId == 0 ? null : $moduleId);
     ob_start();
     $view = $this->getModuleConfigView($oStructure, $oModule);
     $view->render();
     $form = ob_get_clean();
     $this->Response->send('', ['form' => $form]);
 }
Exemplo n.º 24
0
 public function actionIndex()
 {
     $this->needAuthenticate();
     $siteuserId = Param::get('id', false)->asInteger(false);
     /** @var Siteuser $oSiteuser */
     $oSiteuser = is_null($siteuserId) ? null : DataSource::factory(Siteuser::cls(), $siteuserId);
     $view = new ViewSiteuserEditForm();
     $view->oSiteuser = $oSiteuser;
     // Подготовка хлебных крошек
     $viewBreadcrumbs = new ViewBreadcrumbs();
     $viewBreadcrumbs->Breadcrumbs = [new Breadcrumb('Панель управления', '/admin'), new Breadcrumb('Пользователи', '/modules/siteusers')];
     if ($oSiteuser !== null) {
         $viewBreadcrumbs->Breadcrumbs[] = new Breadcrumb("Редактирование \"{$oSiteuser->name}\"", '');
     } else {
         $viewBreadcrumbs->Breadcrumbs[] = new Breadcrumb('Добавление нового пользователя', '');
     }
     $view->backUrl = CoreFunctions::buildUrlByBreadcrumbs($viewBreadcrumbs->Breadcrumbs, 1);
     $this->Frame->bindView('breadcrumbs', $viewBreadcrumbs);
     $this->Frame->bindView('content', $view);
     $this->Frame->render();
 }
Exemplo n.º 25
0
 public function actionIndex()
 {
     if (CoreFunctions::isAJAX() && !$this->EmployeeAuthentication->authenticated()) {
         SCMSNotificationLog::instance()->pushError('Нет доступа!');
         $this->Response->send();
         return;
     }
     $this->needAuthenticate();
     $frameName = Param::post('frame-name')->asString();
     $frameContent = Param::post('frame-content')->asString();
     $FrameFile = new File(SFW_MODULES_FRAMES . $frameName);
     $isNew = !$FrameFile->exists();
     $FrameFile->setContent($frameContent);
     if (Param::post('frame-accept', false)->exists()) {
         $redirect = '/admin/modules/frames/';
     } else {
         $redirect = $isNew ? "/admin/modules/frames/edit/?name={$frameName}" : '';
     }
     SCMSNotificationLog::instance()->pushMessage("Фрейм \"{$frameName}\" успешно " . ($isNew ? 'создан' : 'отредактирован') . '!');
     $this->Response->send($redirect);
 }
Exemplo n.º 26
0
 public function actionIndex()
 {
     $this->needAuthenticate();
     $galleryId = Param::get('id', false)->asInteger(false);
     /** @var Gallery $oGallery */
     $oGallery = DataSource::factory(Gallery::cls(), $galleryId);
     $view = new ViewEditForm();
     $view->gallery = $oGallery;
     // Подготовка хлебных крошек
     $viewBreadcrumbs = new ViewBreadcrumbs();
     $viewBreadcrumbs->Breadcrumbs = [new Breadcrumb('Панель управления', '/admin'), new Breadcrumb('Галереи', '/modules/gallery')];
     if ($oGallery->id !== null) {
         $viewBreadcrumbs->Breadcrumbs[] = new Breadcrumb("Редактирование \"{$oGallery->name}\"", '');
     } else {
         $viewBreadcrumbs->Breadcrumbs[] = new Breadcrumb('Добавление новой галереи', '');
     }
     $view->backUrl = CoreFunctions::buildUrlByBreadcrumbs($viewBreadcrumbs->Breadcrumbs, 1);
     $this->Frame->bindView('breadcrumbs', $viewBreadcrumbs);
     $this->Frame->bindView('content', $view);
     $this->Frame->render();
 }
Exemplo n.º 27
0
 public function actionIndex()
 {
     $this->needAuthenticate();
     $pageNumber = Param::get('frames-page', false)->asInteger(false);
     $itemsPerPage = Param::get('frames-items-per-page', false)->asInteger(false);
     $dataGridView = new ViewDataGrid();
     $retriever = new FramesRetriever();
     $manifest = $this->ModuleInstaller->getManifest($this->ModuleDirectory);
     $dataGrid = new DataGrid('frames', '/admin/modules/frames/', 'name', $manifest['meta']['alias'], $pageNumber, $itemsPerPage, $manifest['meta']['description']);
     $dataGrid->getMenu()->addElement(new Item('Создать новый фрейм', '/admin/modules/frames/edit/'));
     $dataGrid->addAction(new Action('name', '/admin/modules/frames/edit/', 'edit', '', [], ['class' => 'glyphicon glyphicon-pencil'], 'Редактировать'))->addAction(new Action('name', '/admin/modules/frames/delete/', 'delete', '', [], ['class' => 'glyphicon glyphicon-trash'], 'Удалить', true));
     $dataGrid->addHeader(new Header('name', 'Название', null, ['class' => 'text-center'], ['class' => 'text-left'], true, Param::get('frames-filter-id', false)->asString(false)));
     $arrayDataSet = new ArrayDataSet($retriever->getFrames());
     $dataGrid->addDataSet($arrayDataSet);
     $dataGridView->dataGrid = $dataGrid;
     // Подготовка хлебных крошек
     $viewBreadcrumbs = new ViewBreadcrumbs();
     $viewBreadcrumbs->Breadcrumbs = [new Breadcrumb('Панель управления', '/admin'), new Breadcrumb('Фреймы', '/modules/frames')];
     $this->Frame->bindView('breadcrumbs', $viewBreadcrumbs);
     $this->Frame->bindView('content', $dataGridView);
     $this->Frame->render();
 }
Exemplo n.º 28
0
 public function actionIndex()
 {
     $this->needAuthenticate();
     $parentPK = (int) Param::get('parent_pk', false)->asInteger(false);
     $pageNumber = Param::get('structure-page', false)->asInteger(false);
     $itemsPerPage = Param::get('structure-items-per-page', false)->asInteger(false);
     $addItemUrl = '/admin/modules/structures/edit/';
     if ($parentPK != 0) {
         $addItemUrl .= "?parent_pk={$parentPK}";
     }
     $manifest = $this->ModuleInstaller->getManifest($this->ModuleDirectory);
     $dataGridView = new ViewDataGrid();
     $retriever = new StructureRetriever();
     $dataGrid = new DataGrid('structure', '', 'id', $manifest['meta']['alias'], $pageNumber, $itemsPerPage, $manifest['meta']['description']);
     $dataGrid->addHiddenField('parent_pk', $parentPK);
     $dataGrid->getMenu()->addElement(new Item('Добавить элемент структуры', $addItemUrl));
     $dataGrid->addAction(new Action('id', '/admin/modules/structures/edit/', 'edit', '', [], ['class' => 'glyphicon glyphicon-pencil'], 'Редактировать'))->addAction(new Action('id', '/admin/modules/structures/delete/', 'delete', '', [], ['class' => 'glyphicon glyphicon-trash'], 'Удалить', true));
     $dataGrid->addHeader(new Header('id', '№', null, ['class' => 'text-center', 'style' => 'width: 50px;'], ['class' => 'text-center'], true, Param::get('structure-filter-id', false)->asString(false)))->addHeader(new Header('name', 'Наименование', new ViewLink('/admin/modules/structures/?parent_pk={label}', false, 'id'), ['class' => 'text-center', 'style' => 'width: 300px'], [], true, Param::get('structure-filter-name', false)->asString(false)))->addHeader(new Header('parent_structure_name', 'Родитель', null, ['class' => 'text-center', 'style' => 'width: 300px;'], [], true, Param::get('structure-filter-parent_structure_name', false)->asString(false), 'name', 'parent_structure'))->addHeader(new Header('path', 'Путь', null, ['class' => 'text-center', 'style' => 'width: 300px;'], [], true, Param::get('structure-filter-path', false)->asString(false)))->addHeader(new Header('module_alias', 'Модуль', null, ['class' => 'text-center', 'style' => 'width: 300px;'], [], true, Param::get('structure-filter-module_alias', false)->asString(false), 'alias', 'module'))->addHeader(new Header('anchor', 'Фрагмент', new ViewSwitch(), ['class' => 'text-center'], ['class' => 'text-center'], true, Param::get('structure-filter-anchor', false)->asString(false)))->addHeader(new Header('frame', 'Фрейм', new ViewEmpty(), ['class' => 'text-center'], ['class' => 'text-center'], true, Param::get('structure-filter-frame', false)->asString(false)))->addHeader(new Header('seo_title', 'SEO T', new ViewEmpty(), ['class' => 'text-center', 'style' => 'width: 80px;'], ['class' => 'text-center'], true, Param::get('structure-filter-seo_title', false)->asString(false)))->addHeader(new Header('seo_description', 'SEO D', new ViewEmpty(), ['class' => 'text-center', 'style' => 'width: 80px;'], ['class' => 'text-center'], true, Param::get('structure-filter-seo_description', false)->asString(false)))->addHeader(new Header('seo_keywords', 'SED K', new ViewEmpty(), ['class' => 'text-center', 'style' => 'width: 80px;'], ['class' => 'text-center'], true, Param::get('structure-filter-seo_keywords', false)->asString(false)))->addHeader(new Header('is_main', '<span class="glyphicon glyphicon-home" title="Главная"></span>', new ViewSwitch(), ['class' => 'text-center', 'style' => 'width: 50px;'], ['class' => 'text-center'], true, Param::get('structure-filter-is_main', false)->asString(false)))->addHeader(new Header('priority', '<span class="glyphicon glyphicon-sort-by-attributes" title="Приоритет"></span>', new ViewSwitch(), ['class' => 'text-center', 'style' => 'width: 50px;'], ['class' => 'text-center'], true, Param::get('structure-filter-priority', false)->asString(false)))->addHeader(new Header('active', '<span class="glyphicon glyphicon-asterisk" title="Активность"></span>', new ViewSwitch(), ['class' => 'text-center', 'style' => 'width: 50px;'], ['class' => 'text-center'], true, Param::get('structure-filter-active', false)->asString(false)));
     $structures = $retriever->getStructures($parentPK, $dataGrid->getFilterConditions('structure'), $dataGrid->Pagination->getLimit(), $dataGrid->Pagination->getOffset());
     $dataSet = new ArrayDataSet($structures);
     $dataGrid->addDataSet($dataSet);
     $dataGridView->dataGrid = $dataGrid;
     // Подготовка хлебных крошек
     $viewBreadcrumbs = new ViewBreadcrumbs();
     $viewBreadcrumbs->Breadcrumbs = [new Breadcrumb('Панель управления', '/admin'), new Breadcrumb('Структура сайта', '/modules/structures')];
     $breadcrumbsParentPK = $parentPK;
     $structureBreadcrumbs = [];
     while ($breadcrumbsParentPK) {
         /** @var Structure $oParentStructure */
         $oParentStructure = DataSource::factory(Structure::cls(), $breadcrumbsParentPK);
         $structureBreadcrumbs[] = new Breadcrumb($oParentStructure->name, "?parent_pk={$oParentStructure->getPrimaryKey()}", true);
         $breadcrumbsParentPK = $oParentStructure->structure_id;
     }
     $viewBreadcrumbs->Breadcrumbs = array_merge($viewBreadcrumbs->Breadcrumbs, array_reverse($structureBreadcrumbs));
     $this->Frame->bindView('breadcrumbs', $viewBreadcrumbs);
     $this->Frame->bindView('content', $dataGridView);
     $this->Frame->render();
 }
Exemplo n.º 29
0
 public function actionIndex()
 {
     $this->needAuthenticate();
     $pageNumber = Param::get('page-page', false)->asInteger(false);
     $itemsPerPage = Param::get('page-items-per-page', false)->asInteger(false);
     $manifest = $this->ModuleInstaller->getManifest($this->ModuleDirectory);
     $dataGridView = new ViewDataGrid();
     $retriever = new PagesRetriever();
     $dataGrid = new DataGrid('page', '', 'id', $manifest['meta']['alias'], $pageNumber, $itemsPerPage, $manifest['meta']['description']);
     $dataGrid->getMenu()->addElement(new Item('Добавить статическую страницу', '/admin/modules/pages/edit/'));
     $dataGrid->addAction(new Action('id', '/admin/modules/pages/edit/', 'edit', '', [], ['class' => 'glyphicon glyphicon-pencil'], 'Редактировать'))->addAction(new Action('id', '/admin/modules/pages/delete/', 'delete', '', [], ['class' => 'glyphicon glyphicon-trash'], 'Удалить', true));
     $dataGrid->addHeader(new Header('id', '№', null, ['class' => 'text-center', 'style' => 'width: 50px;'], ['class' => 'text-center'], true, Param::get('page-filter-id', false)->asString(false)))->addHeader(new Header('name', 'Наименование', null, ['style' => 'width: 250px;'], [], true, Param::get('page-filter-name', false)->asString(false)))->addHeader(new Header('description', 'Описание', null, [], [], true, Param::get('page-filter-description', false)->asString(false)))->addHeader(new Header('active', '<span class="glyphicon glyphicon-asterisk" title="Активность"></span>', new ViewSwitch(), ['class' => 'text-center', 'style' => 'width: 50px;'], ['class' => 'text-center'], true, Param::get('page-filter-active', false)->asString(false)));
     $structures = $retriever->getPages($dataGrid->getFilterConditions(), $dataGrid->Pagination->getLimit(), $dataGrid->Pagination->getOffset());
     $dataSet = new ArrayDataSet($structures);
     $dataGrid->addDataSet($dataSet);
     $dataGridView->dataGrid = $dataGrid;
     // Подготовка хлебных крошек
     $viewBreadcrumbs = new ViewBreadcrumbs();
     $viewBreadcrumbs->Breadcrumbs = [new Breadcrumb('Панель управления', '/admin'), new Breadcrumb('Статичные страницы', '/modules/pages')];
     $this->Frame->bindView('breadcrumbs', $viewBreadcrumbs);
     $this->Frame->bindView('content', $dataGridView);
     $this->Frame->render();
 }
Exemplo n.º 30
0
 public function actionIndex()
 {
     $this->needAuthenticate();
     $pageNumber = Param::get('gallery-page', false)->asInteger(false);
     $itemsPerPage = Param::get('gallery-items-per-page', false)->asInteger(false);
     $manifest = $this->ModuleInstaller->getManifest($this->ModuleDirectory);
     $dataGridView = new ViewDataGrid();
     $retriever = new GalleryRetriever();
     $dataGrid = new DataGrid('gallery', '', 'id', $manifest['meta']['alias'], $pageNumber, $itemsPerPage, $manifest['meta']['description']);
     $dataGrid->getMenu()->addElement(new Item('Создать новую галерею', '/admin/modules/gallery/edit/'));
     $dataGrid->addAction(new Action('id', '/admin/modules/gallery/edit/', 'edit', '', [], ['class' => 'glyphicon glyphicon-pencil'], 'Редактировать'))->addAction(new Action('id', '/admin/modules/gallery/delete/', 'delete', '', [], ['class' => 'glyphicon glyphicon-trash'], 'Удалить', true));
     $dataGrid->addHeader(new Header('id', '№', null, ['class' => 'text-center', 'style' => 'width: 50px;'], ['class' => 'text-center'], true, Param::get('gallery-filter-id', false)->asString(false)))->addHeader(new Header('name', 'Название', new ViewLink('/admin/modules/gallery/item/?gallery_id={label}', false, 'id'), ['class' => 'text-center', 'style' => 'width: 250px;'], [], true, Param::get('gallery-filter-name', false)->asString(false)))->addHeader(new Header('description', 'Описание', new ViewCutString(20, true, ['class' => 'content-to-modal', 'style' => 'cursor: pointer;'], ['style' => 'display: none;']), ['class' => 'text-center'], ['class' => 'modal-display-field'], true, Param::get('gallery-filter-description', false)->asString(false)));
     $galleries = $retriever->getGalleries($dataGrid->getFilterConditions(), $dataGrid->Pagination->getLimit(), $dataGrid->Pagination->getOffset());
     $dataSet = new ArrayDataSet($galleries);
     $dataGrid->addDataSet($dataSet);
     $dataGridView->dataGrid = $dataGrid;
     // Подготовка хлебных крошек
     $viewBreadcrumbs = new ViewBreadcrumbs();
     $viewBreadcrumbs->Breadcrumbs = [new Breadcrumb('Панель управления', '/admin'), new Breadcrumb('Галереи', '')];
     $this->Frame->bindView('breadcrumbs', $viewBreadcrumbs);
     $this->Frame->bindView('content', $dataGridView);
     $this->Frame->render();
 }