public function executeIndex() { $this->setscope(); $this->checkfreshinstall(); if ($this->getRequest()->hasParameter('pageid')) { $this->checkfreshinstall(); //populate form with edit data $this->populateForm($this->getRequest()->getParameter('pageid')); $this->edit = true; return; } $this->generateAddPageForm(); if ($this->getRequest()->isMethod('post')) { //bind values //validate //if valid then add page $values = $this->getRequest()->getParameter('sfbreadnavaddpageform'); $this->form->bind($values); if ($this->form->isValid()) { if ($this->form->getValue('id') == '') { if (!sfBreadNavPeer::addPage($values, $this->scope)) { $this->setTemplate('breadnav'); $this->message = "You need to be logged in to add a page."; return sfView::ERROR; } } else { if (!sfBreadNavPeer::editPage($values)) { $this->setTemplate('breadnav'); $this->message = "You need to be logged in to edit a page."; return sfView::ERROR; } } $this->generateAddPageForm(); } } }