public function thingAction() { $mapper = new Application_Model_ThingsMapper(); if ($this->getRequest()->getParam('itemid')) { if (Zend_Auth::getInstance()->hasIdentity()) { $this->view->thing = $mapper->selectThing($this->getRequest()->getParam('itemid'), new Application_Model_Things()); $this->view->images = $mapper->findimage($this->getRequest()->getParam('itemid')); $this->view->mythings = $mapper->fetchAll(Zend_Auth::getInstance()->getStorage()->read()->id); } else { $this->view->thing = $mapper->selectThing($this->getRequest()->getParam('itemid'), new Application_Model_Things()); $this->view->images = $mapper->findimage($this->getRequest()->getParam('itemid')); } } }
public function editthingAction() { $form = new Application_Form_ThingsForm(); $this->view->form = $form; if ($this->getRequest()->isPost()) { if ($form->isValid($this->getRequest()->getPost())) { $userInfo = Zend_Auth::getInstance()->getStorage()->read(); $mything = new Application_Model_Things($form->getValues()); $newmapper = new Application_Model_ThingsMapper(); $newmapper->editThing($mything, $this->_getParam('id')); return; } } if ($this->_getParam('id')) { $thing = new Application_Model_Things(); $mapper = new Application_Model_ThingsMapper(); $this->view->form = $form; $mapper = new Application_Model_ThingsMapper(); $result = $mapper->find($this->_getParam('id'), $thing); $form->populate($result); $this->view->images = $mapper->findimage($this->_getParam('id')); } else { $this->view->form = $form; } }