public function consultAction()
 {
     $this->supplier = new Zend_Session_Namespace('supplier');
     if ($this->supplier->id == null) {
         return $this->_helper->_redirector->gotoSimple('consult', 'supplier', 'supplier');
     }
     //get the contacs of the supplier
     $page = $this->_getParam('page', 1);
     $models = new Supplier_Model_Contact();
     $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 Supplier_Model_Resource();
     $data_resource = $model->fetchEntries();
     //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 Supplier_Model_Supplier();
     $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";
 }
 /**
  * EditAction for Resources
  *
  * @return void
  */
 public function editresourcesupplierAction()
 {
     $this->view->title = "Edit Resources";
     $form = new Production_Form_Resourcesupplier();
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($this->getRequest()->getPost())) {
             $model = new Supplier_Model_Resource();
             $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 Supplier_Model_Resource();
             $form->populate($model->fetchEntry($id));
         }
     }
     $this->view->form = $form;
 }
 public function outlitterAction()
 {
     if ($this->getRequest()->isPost()) {
         $del = $this->getRequest()->getPost('del');
         if ($del == 'Yes') {
             $id = $this->getRequest()->getPost('id');
             $model = new Supplier_Model_Resource();
             $model->outLitter($id);
         }
         return $this->_helper->_redirector->gotoSimple('consult', 'supplier', 'supplier');
     } else {
         $id = $this->_getParam('id', 0);
         if ($id > 0) {
             $model = new Supplier_Model_Resource();
             $this->view->contact = $model->fetchEntry($id);
         }
     }
 }