public function actionPrepare() { $this->list_sort = $this->getTitleField(); $result = parent::actionPrepare(); if ($result instanceof \Core\Response) { return $result; } // Страница if (!empty($this->request->get_params['page'])) { $this->paginaion_current_page = intval($this->request->get_params['page']); } // Количество записей на страницу if (!empty($this->request->get_params['items']) && is_numeric($this->request->get_params['items']) && in_array(intval($this->request->get_params['items']), array(20, 50, 100, 300, 500))) { $this->pagination_items_per_page = intval($this->request->get_params['items']); } // Сортировка по полю if (!empty($this->request->get_params['sort'])) { $field_name = $this->request->get_params['sort']; if (in_array($field_name, $this->getVisibleFields())) { $this->list_sort = $field_name; } } // Направление сортировки if (!empty($this->request->get_params['sort_side']) && in_array($this->request->get_params['sort_side'], array('asc', 'desc'))) { $this->list_sort_side = $this->request->get_params['sort_side']; } // Первая буква названия if (!empty($this->request->get_params['letter']) && in_array(mb_strtolower($this->request->get_params['letter']), $this->letters)) { $this->first_letter = mb_strtolower($this->request->get_params['letter']); } }
public function actionPrepare() { $result = parent::actionPrepare(); if ($result instanceof \Core\Response) { return $result; } $id = intval($this->route->found_variables[\Core\ORM_Record::FIELD_ID]); $record = $this->factory_orm->getByID($id); if (null !== $record) { $this->record = $record; } else { return $this->response->setRedirect($this->factory_orm->factory->factoryPages->router->route_client->route_error_404->makeUrl()); } return null; }