public function executePermalink(sfWebRequest $request) { //Asignaciones $this->vipSlug = 'club-magic'; $this->level = $request->getParameter('level'); $slug = $request->getParameter('slug'); $this->currentPage = Doctrine::getTable('Page')->findOneBySlug($slug); $user = $this->getUser(); //usuarios de paginas vip if ($user->isAuthenticated()) { $this->isVip = $user->getGuardUser()->hasPermission('Vip'); } else { $this->isVip = false; } $class = sfConfig::get('app_sf_guard_plugin_signin_form', 'sfMooDooFormSignin'); $this->form = new $class(); //si es pagina vip y no es vip redirecciona if ($this->currentPage->getParent()->getSlug() == $this->vipSlug and !$this->isVip) { return $this->redirect('@page_child_slug?parentslug=' . $request->getParameter('parentslug') . '&slug=' . $request->getParameter('slug') . '&level=1'); } else { // paginas hijas if ($this->level == 1 || $this->level == 2) { // VIP estando logueado como vip if ($request->getParameter('slug') == $this->vipSlug) { if ($request->isMethod('post')) { $this->form->bind($request->getParameter('signin')); if ($this->form->isValid()) { $values = $this->form->getValues(); $this->getUser()->signin($values['user'], array_key_exists('remember', $values) ? $values['remember'] : false); return $this->redirect('@page_child_slug?parentslug=' . $request->getParameter('parentslug') . '&slug=' . $request->getParameter('slug') . '&level=1'); } } } // end login in page Vip if ($this->level == 1 || $this->level == 2) { $this->childPage = Doctrine::getTable('Page')->findOneBySlug($slug); } $this->page = $this->childPage->getParent(); $this->grandParent = $this->page->getParent(); if ($this->grandParent == '' || $this->grandParent == NULL) { $this->grandParent = false; } // Paginas hijas de show if ($this->page->get('slug') == 'espectaculos') { $this->catSlug = $slug; $catId = Doctrine::getTable('category')->findOneBySlug($this->catSlug)->getId(); $this->mainShow = EventTable::retrieveMainShow($catId); $this->shows = EventTable::retrieveShows($catId); $this->setTemplate('shows'); } } else { $this->page = Doctrine::getTable('Page')->findOneBySlug($slug); $this->childPage = false; $this->grandParent = false; } // pagina de show if ($slug == 'espectaculos') { $this->catSlug = $slug; $this->mainShow = EventTable::retrieveMainShow(); $this->shows = EventTable::retrieveShows(); $this->setTemplate('shows'); } } }