Пример #1
0
 public function getAllCotactUsdeatils($offset, Administrator_Model_ContactUs $contSummary)
 {
     try {
         $limit = 10;
         $table = $this->getDbTable();
         $select = $table->select();
         $select->setIntegrityCheck(false);
         $select->from(array('cont' => 'rd.contactus'), array('id', 'contactname', 'address', 'email', 'phone', 'postedon', 'moreinformation', 'status', 'contacttype', 'city', 'enquiry_status_id', 'company_id', 'ipaddress'))->joinLeft(array('esbd' => 'rd.enquiry_status_bd'), 'esbd.id = cont.enquiry_status_id', array('description'));
         if ($contSummary->getId()) {
             $select->where('cont.id = ?', $contSummary->getId());
         }
         if ($contSummary->getcontactname()) {
             $select->where('cont.contactname Ilike  ?', '%' . trim($contSummary->getcontactname()) . '%');
         }
         if ($contSummary->getStartDate()) {
             $select->where('cont.postedon >=  ?', $contSummary->getStartDate());
         }
         if ($contSummary->getEndDate()) {
             $select->where('cont.postedon <=  ?', $contSummary->getEndDate());
         }
         if ($contSummary->getStatus()) {
             $select->where('cont.enquiry_status_id =  ?', $contSummary->getStatus());
         } else {
             $select->where('cont.enquiry_status_id !=  ?', 6);
         }
         //			else if($contSummary->getStatus() != ""){
         //				$select->where('cont.status =  ?',$contSummary->getStatus());
         //			}
         if ($contSummary->getCompanyId() != 1) {
             $select->where('cont.company_id =  ?', $contSummary->getCompanyId());
         }
         $select->where('contacttype != ?', 'resContact');
         $select->order('cont.id Desc');
         //$rowset = $table->fetchAll($select);
         $resultSet = new Zend_Paginator(new Zend_Paginator_Adapter_DbTableSelect($select));
         $resultSet->setItemCountPerPage($limit);
         $resultSet->setCurrentPageNumber($offset);
         return $resultSet;
     } catch (Exception $ex) {
         throw new Exception($ex->getMessage());
     }
 }