Example #1
0
 public function generallocationoptionsAction()
 {
     // Using homepage template.
     //Hotspot_Plugin_ViewSetup::setUpSiteTemplate(Hotspot_Plugin_ViewSetup::SIMPLEVIEW);
     $this->_helper->viewRenderer->setNoRender();
     try {
         $ref_locTable = new Refloc();
         $cities = $ref_locTable->getAllCityWithCountry();
         if (empty($cities)) {
             echo 'Empty in table!';
         } else {
             //echo '<option value="-1|All|All" selected="selected">All</option>' . "\n";
             echo '<option value="All|All|All" selected="selected">All</option>' . "\n";
             foreach ($cities as $city) {
                 //echo '<option value="' . $city->id . '|' . $city->city . '|' . $city->country .  '">' . $city->city . ' - ' . $city->country . '</option>' . "\n";
                 echo '<option value="' . $city->city . '|' . $city->state . '|' . $city->country . '">' . $city->city . ' - ' . $city->country . '</option>' . "\n";
             }
         }
     } catch (Exception $e) {
         echo $e;
     }
 }
Example #2
0
 public static function getLocationIdByCountryId($country_id)
 {
     $refloc = new Refloc();
     return $refloc->getLocationIdByCountryId($country_id);
 }
Example #3
0
 protected function getSearchSelect($limit, $offset = 0, $countryid, $stateid, $cityid, $regionid, $suburbid, $title = null, $cat1 = null, $cat2 = null, $cat3 = null, $cat4 = null, $cat5 = null, $addtionalData = null)
 {
     try {
         $pstitleTable = new Pstposting();
         $select = $pstitleTable->select()->setIntegrityCheck(false);
         $psttitle = new Psttitle();
         $reflocTable = new Refloc();
         $refcat1Table = new Refcat1();
         $refcategoryTable = new Refcategory();
         $select->from(array('a' => $pstitleTable->getTableName()))->join(array('b' => $psttitle->getTableName()), 'a.id = b.id', array('a.*', 'b.title', 'postingid' => 'b.id'))->join(array('c' => $reflocTable->getTableName()), 'a.locId = c.id')->joinLeft(array('d' => $refcat1Table->getTableName()), 'a.cat1 = d.cat1Id', array('cat1name' => 'catName'))->joinLeft(array('e' => $refcategoryTable->getTableName()), 'a.cat2 = e.id', array('cat2name' => 'name'))->joinLeft(array('f' => $refcategoryTable->getTableName()), 'a.cat3 = f.id', array('cat3name' => 'name'))->joinLeft(array('g' => $refcategoryTable->getTableName()), 'a.cat4 = g.id', array('cat4name' => 'name'))->joinLeft(array('h' => $refcategoryTable->getTableName()), 'a.cat5 = h.id', array('cat5name' => 'name'));
         $select = $this->extraJoin($select);
         $select = $select->where('status = ?', 1)->order('lastUPdateDate Desc');
         if (!empty($title)) {
             //$select->where('match (title) against(?)', $title);
             $title = str_replace(' ', '%', $title);
             $select->where('title like ? or a.id = ?', '%' . $title . '%');
         }
         if (!empty($stateid)) {
             $select->where('stateid = ?', $stateid);
         }
         if (!empty($cityid)) {
             $select->where('cityid = ?', $cityid);
         }
         if (!empty($countryid)) {
             $select->where('countryid = ?', $countryid);
         }
         if (!empty($regionid)) {
             $select->where('regionid = ?', $regionid);
         }
         if (!empty($suburbid)) {
             $select->where('suburbid = ?', $suburbid);
         }
         logfire('cat1', $cat1);
         if (!empty($cat1) && $cat1 != 'ALL' && $cat1 != 'Any') {
             $select->where('cat1 = ?', $cat1);
         }
         if (!empty($cat2) && $cat2 != 'ALL' && $cat2 != 'Any') {
             $select->where('cat2 = ?', $cat2);
         }
         if (!empty($cat3) && $cat3 != 'ALL' && $cat3 != 'Any') {
             $select->where('cat3 = ?', $cat3);
         }
         if (!empty($cat4) && $cat4 != 'ALL' && $cat4 != 'Any') {
             $select->where('cat4 = ?', $cat4);
         }
         if (!empty($cat5) && $cat5 != 'ALL' && $cat5 != 'Any') {
             $select->where('cat5 = ?', $cat5);
         }
         logfire('searchselect', $select->__toString());
         return $select;
         /*
         $postings = $this->fetchAll($select);
         
         if (empty($postings))
         {
         	return null;
         }
         else
         {
         	return $postings;
         }
         */
     } catch (Exception $e) {
         logError('Pst_posting failed!', $e);
         throw $e;
     }
 }