public function opportunityAction() { // action body $id = $this->_getParam('id', 0); $code = $this->_getParam('code', ''); $opportunities = new Application_Model_Opportunities(); if ($id > 0) { $this->_helper->json($opportunities->createJson($id)); } if ($code != '') { $code = trim($code); $where = "Code__c='" . $code . "'"; $info = $opportunities->fetchAll('Id', $where); if (isset($info['opportunities'][0]['Id'])) { $id = $info['opportunities'][0]['Id']; $result = $opportunities->createJson($id); $this->_helper->json($result); } else { $this->_helper->json(''); } } else { $this->_helper->json(''); } }
public function indexAction() { // Affiche de la liste des produits $opportunities = new Application_Model_Opportunities(); $this->view->entries = $opportunities->fetchAll(); }