public function routing() { $live = Live::getInstance(); // Getting arguments if (!empty($live->_request[2])) { for ($i = 2; $i < count($live->_request); $i++) { $live->_args[] = $live->_request[$i]; } } // Finding modules actions if (!empty($live->_request[0])) { $controller_name = $live->_request[0]; $controller_name[0] = strtoupper($controller_name[0]); $action_name = !empty($live->_request[1]) ? $live->_request[1] : 'index'; $module = new \Modules\Module($controller_name, true); if ($module->checkActionExists($action_name . 'Action')) { $live->_controllers[] = $controller_name; $live->_actions[] = $action_name; } } // Finding routes $router = new \Router\Router(); $findRoute = $router->findByRequest($live->_request); if ($findRoute) { $live->_controllers[] = $findRoute->controller; $live->_actions[] = $findRoute->action; } // Finding pages $page = new \Pages\Page(); $findPage = $page->findByRequest($live->_request); if ($findPage) { $live->_controllers[] = 'Pages'; $live->_actions[] = 'index'; } }
public function get_index($url) { return Pages\Page::make($url, $this->data)->render(); }
public function reorderAction($id) { $id = intval($id); if (empty($id)) { return false; } $values = explode($this->conf->ac_sep, $_POST['values']); $parent = intval($values[0]); $position = intval($values[1]); $page_model = new \Pages\Page(); $page_model->save(array('parent' => 100500), $id); $pages = $this->repPage->findBy(array('parent' => $parent), array('weight' => 'ASC')); $weight = $position > 0 && isset($pages[$position - 1]) ? $pages[$position - 1]->weight + 1 : 1; $page = $this->repPage->findOneBy(array('weight' => $weight)); if (!empty($page)) { foreach ($pages as $page) { if ($page->weight >= $weight) { $page->weight += 1; $this->em->persist($page); $this->em->flush(); } } } $data = array('parent' => $parent, 'weight' => $weight); $page_model = new \Pages\Page(); $page_model->save($data, $id); }