public static function validateId($id) { $pst = new Pstposting(); $posting = $pst->getPosting($id); if (empty($posting)) { return false; } if ($posting->status == 1) { return true; } return false; }
protected function _setRequiredParamsToView($view) { //$this->_helper->viewRenderer->setNoRender(); $view->posting_id = base64_decode($this->_getParam('postingid')); if (!Pstposting::validateId($view->posting_id)) { $this->_redirect('/inactiveposting'); } echo "posting id:" . $view->posting_id; $pstPosing = new Pstposting(); $view->posting = $pstPosing->getPosting($view->posting_id); logfire("posting locId", $view->posting->locId); $view->location = new Location($view->posting->locId); $view->category = BusinessType::getBusinessType($view->posting->typeID); $view->paramsHolder = $view->location->toStdClass(); $view->paramsHolder->category = $view->category; //echo "categoy: " . $view->category; //$this->view->paramsHolder = $this->view->location->mergeToAnotherClass($this->view->paramsHolder); $view->paramsHolder->posting_id = $view->posting_id; $view->router = Common::getRouteName(); return $view; }
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; } }
public function getResultTable($posting, $location = null) { try { echo '<table class="resultheader" id="classifieds" cellspacing=0>'; echo '<tr>'; echo '<th class="cuisine">'; echo 'Category'; echo '</th>'; echo '<th class="location">'; echo 'Suburb'; echo '</th>'; echo '<th class="title">'; echo 'Title'; echo '</th>'; echo '<th class="photo">'; echo 'Photo'; echo '</th>'; echo '<th class="price">'; echo 'Price <br />(' . $location->getCurrencyAndSymbol() . ')'; echo '</th>'; echo '</tr>'; foreach ($posting as $key => $value) { echo '<tr class="postingrow">'; echo $this->getPostingInfoLinkHtml($value->cat2name, $value->postingid); echo $this->getPostingInfoLinkHtml($value->suburb, $value->postingid); echo $this->getPostingInfoLinkHtml($value->title, $value->postingid); if (Pstposting::photoExists($value->photo)) { $tmpBool = "Yes"; } else { $tmpBool = "No"; } echo $this->getPostingInfoLinkHtml($tmpBool, $value->postingid); echo $this->getPostingInfoLinkHtml($value->priceDisplay, $value->postingid); echo '</tr>'; } echo '</table>'; } catch (Exception $e) { logError('get results for classifieds', $e); echo $e; } return parent::getResultTable($posting); }