/** * EditAction for Contactresources * * @return void */ public function editAction() { $this->view->title = "Edit Contactresources"; $form = new Production_Form_Contactresource(); if ($this->getRequest()->isPost()) { if ($form->isValid($this->getRequest()->getPost())) { $model = new Production_Model_Contactresource(); $id = $this->getRequest()->getPost('id'); $model->update($form->getValues(), 'id = ' . (int) $id); return $this->_helper->_redirector->gotoSimple('consult', 'productionsuppliers', 'production'); } else { $form->populate($this->getRequest()->getPost()); } } else { $id = $this->_getParam('id', 0); if ($id > 0) { $model = new Production_Model_Contactresource(); $form->populate($model->fetchEntry($id)); } } $this->view->form = $form; }
public function consultAction() { $this->supplier = new Zend_Session_Namespace('supplier'); if ($this->supplier->id == null) { return $this->_helper->_redirector->gotoSimple('consult', 'production', 'production'); } //get the contacs of the supplier $page = $this->_getParam('page', 1); $models = new Production_Model_Contactresource(); $paginator = Zend_Paginator::factory($models->fetchSupplier($this->supplier->id)); $contact = Zend_Registry::get('supplier'); $paginator->setItemCountPerPage($contact->paginator); $paginator->setCurrentPageNumber($page); $paginator->setPageRange($contact->paginator); $this->view->paginator = $paginator; $model = new Production_Model_Resource(); $data_resource = $model->fetchEntriesSupplier(); //data resource of supplier if ($data_resource) { $paginator_resource = Zend_Paginator::factory($data_resource); $supplier = Zend_Registry::get('supplier'); $paginator_resource->setItemCountPerPage($supplier->paginator); $paginator_resource->setCurrentPageNumber($page); $paginator_resource->setPageRange($supplier->paginator); $this->view->paginator_resource = $paginator_resource; } else { $this->view->paginator_resource = null; } //send information to the view $this->view->title = "Resources list"; //get the dates for the table $model = new Production_Model_Productionsuppliers(); $select_supplier = $model->fetchEntry($_SESSION["supplier"]["id"]); //Zend_Debug::dump($select_supplier); $this->view->select_supplier = $select_supplier; //send information to the view $this->view->title = "Supplier Consult"; }