Exemplo n.º 1
0
 public function indexAction()
 {
     $objCompany = new Default_Model_Company();
     $company = $objCompany->listCompanyJson();
     $this->addYosonVar('company', Zend_Json_Encoder::encode($company), false);
     $objUbigeo = new Default_Model_Ubigeo();
     $ubigeo = $objUbigeo->listStateJson();
     $this->addYosonVar('ubigeo', Zend_Json_Encoder::encode($ubigeo), false);
 }
 public function saveCompanyAction()
 {
     $post = $this->getRequest()->getPost();
     $contact = new Default_Model_ContactPerson();
     $company = new Default_Model_Company();
     $company->setCompanyId($post['company_id']);
     $company->setCompanyName($post['company_name']);
     $company->setBusinesType($post['busines_type']);
     $company->setTel($post['tel']);
     $company->setEmail($post['email']);
     $company->setAddress($post['address']);
     $company->setWebsite($post['website']);
     $company->setInformation($post['information']);
     $company->setAssignCons($post['assign_cons']);
     $company->setCreatedDate(date('Y-m-d'));
     $company->setUpdatedDate(date('Y-m-d'));
     $companyMapper = new Default_Model_CompanyMapper();
     $companyId = $companyMapper->save($company);
     if ($companyId) {
         $contactperson = new Default_Model_ContactPerson();
         $contactperson->setContactPersonId($post['contact_person_id']);
         $contactperson->setCompanyId($companyId);
         $contactperson->setTitle($post['title']);
         $contactperson->setFullName($post['full_name']);
         $contactperson->setJobTitle($post['job_title']);
         $contactperson->setMobile($post['ct_mobile']);
         $contactperson->setEmail($post['ct_email']);
         $contactPersonMapper = new Default_Model_ContactPersonMapper();
         $contactPersonMapper->save($contactperson);
     }
     $this->_redirect('/company');
 }
 public function fetchAll($where = null, $orderby = null)
 {
     $resultSet = $this->getDbTable()->fetchAll($where, $orderby);
     $entries = array();
     $entry = new Default_Model_Company();
     foreach ($resultSet as $row) {
         $entry->getContactPersonId($row['contact_person_id']);
         $entry->getCompanyId($row['company_id']);
         $entry->setTitle($row['title']);
         $entry->setFullName($row['full_name']);
         $entry->setJobTitle($row['job_title']);
         $entry->setMobile($row['mobile']);
         $entry->setEmail($row['email']);
         $entries[] = $entry;
     }
     return $entries;
 }
Exemplo n.º 4
0
 public function indexAction()
 {
     $id = (int) $this->_getParam('id', 0);
     if (empty($id)) {
         $this->_redirect('/company');
     }
     $dataCompany = Default_Model_Company::getRow($id);
     if (!$dataCompany) {
         $this->_redirect('/company');
     }
     $this->view->name = $dataCompany['name'];
     $this->addYosonVar("idCompany", $id);
     $objUbigeo = new Default_Model_Ubigeo();
     $ubigeo = $objUbigeo->listStateJson();
     $this->addYosonVar('ubigeo', Zend_Json_Encoder::encode($ubigeo), false);
 }
Exemplo n.º 5
0
 public function fetchAll($where = null, $orderby = null)
 {
     $resultSet = $this->getDbTable()->fetchAll($where, $orderby);
     $entries = array();
     $entry = new Default_Model_Company();
     foreach ($resultSet as $row) {
         $entry->setCompanyId($row->company_id);
         $entry->setCompanyName($row->company_name);
         $entry->setBusinesType($row->busines_type);
         $entry->setTel($row->tel);
         $entry->setEmail($row->email);
         $entry->setAddress($row->address);
         $entry->setWebsite($row->website);
         $entry->setInformation($row->information);
         $entry->setAssignCons($row->assign_cons);
         $entry->setCreatedDate($row->created_date);
         $entry->setUpdatedDate($row->updated_date);
         $entries[] = $entry;
     }
     return $entries;
 }