Example #1
0
 public function search($location, $limit, $offset = 0, $query = null, $cat1 = null, $cat2 = null, $cat3 = null, $cat4 = null, $cat5 = null, $addtionalData = null)
 {
     logfire('restaurant cat2', $cat2);
     if (empty($cat2) || $cat2 == 'Any' || $cat2 == 'ALL') {
         $cat2 = null;
     }
     // temp fix for the router
     $cat1 = $cat3;
     $cat3 = null;
     if (empty($cat1) || $cat1 == 'Any' || $cat1 == 'ALL' || $cat1 == 25) {
         $cat1 = null;
     }
     $select = parent::search($location, $limit, $offset, $query, $cat1, $cat2, $cat3, $cat4, $cat5, $addtionalData);
     if ($cat1 == null) {
         $keys = '';
         foreach ($this->getCat1Array() as $key => $value) {
             if (empty($keys)) {
                 $keys = $key;
             } else {
                 $keys .= ',' . $key;
             }
         }
         $select->where('cat1 in (' . $keys . ')');
     }
     //echo $select;
     return $select;
 }
Example #2
0
 protected function buildExtraElements()
 {
     $pricesTable = new Refprice();
     logfire('$this->_business->getBusinessTypeId()', $this->_business->getBusinessTypeId());
     $prices = $pricesTable->getPriceOptions($this->_business->getBusinessTypeId(), $this->_location->getSearchRules()->currency);
     $min = new Zend_Form_Element_Select('min');
     $min->setLabel('Min');
     $min->setAttrib('class', 'refineformmoneyselect');
     $min->addMultiOptions($prices);
     $this->addElement($min);
     $max = new Zend_Form_Element_Select('max');
     $max->setLabel('Max');
     $max->setAttrib('class', 'refineformmoneyselect');
     $max->addMultiOptions($prices);
     $this->addElement($max);
     $facilifies = array('Any' => 'Any', '-1' => 'NA', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '100' => '6+');
     $bedOptions = array('Any' => 'Any', '-1' => 'NA', '0' => 'Studio', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '100' => '6+');
     $bed = new Zend_Form_Element_Select('bed');
     $bed->setLabel('Bed');
     $bed->setAttrib('class', 'refineformmoneyselect');
     $bed->addMultiOptions($bedOptions);
     $this->addElement($bed);
     $cars = new Zend_Form_Element_Select('cars');
     $cars->setLabel('Cars');
     $cars->setAttrib('class', 'refineformmoneyselect');
     $cars->addMultiOptions($facilifies);
     $this->addElement($cars);
     $bath = new Zend_Form_Element_Select('bath');
     $bath->setLabel('Bath');
     $bath->setAttrib('class', 'refineformmoneyselect');
     $bath->addMultiOptions($facilifies);
     $this->addElement($bath);
     return parent::buildExtraElements();
 }
Example #3
0
 public static function sendMail($toMailAddress, $name, $subject, $body)
 {
     try {
         $config = Zend_Registry::get('CONFIG');
         $sitename = $config->website->host;
         logfire('send email', $toMailAddress);
         $mailer = new Zend_Mail('utf-8');
         $mailer->addTo($toMailAddress, $name);
         $mailer->setFrom('*****@*****.**', 'SydneyHostpot');
         $mailer->setSubject($subject);
         $mailer->setBodyHtml($body, 'utf8');
         $mailer->send();
     } catch (Exception $e) {
         logError('send mail failed', $e->getMessage());
     }
 }
Example #4
0
 protected function buildExtraElements()
 {
     $pricesTable = new Refprice();
     logfire('$this->_business->getBusinessTypeId()', $this->_business->getBusinessTypeId());
     $prices = $pricesTable->getPriceOptions($this->_business->getBusinessTypeId(), $this->_location->getSearchRules()->currency);
     $min = new Zend_Form_Element_Select('min');
     $min->setLabel('Min');
     $min->setAttrib('class', 'refineformmoneyselect');
     $min->addMultiOptions($prices);
     $this->addElement($min);
     $max = new Zend_Form_Element_Select('max');
     $max->setLabel('Max');
     $max->setAttrib('class', 'refineformmoneyselect');
     $max->addMultiOptions($prices);
     $this->addElement($max);
     return parent::buildExtraElements();
 }
Example #5
0
 public function getHeadingById($headingId)
 {
     try {
         $select = $this->select();
         $select->where('id = ?', $headingId);
         logfire('select', $select->__toString());
         $cat = $this->fetchRow($select);
         if (empty($cat)) {
             return null;
         } else {
             return $cat;
         }
     } catch (Exception $e) {
         logError('ref_cat1 failed!', $e);
         throw $e;
     }
 }
Example #6
0
 function searchResults($cat1 = 'ALL', $categoty = '', $loc)
 {
     $retstr = '<div class="searchresult">';
     $retstr .= 'Below shows the <span class="emphasis">lastest</span> postings for ';
     if (empty($cat1)) {
         $findstr = 'ALL ' . $categoty;
     } else {
         $findstr = Jobs::getCat1NameById($cat1) . ' ' . $categoty;
     }
     /*
     if (strtolower($region) == strtolower($city))
     {
     	$location = 'All ' . $city;
     }
     else
     {
     	$location = $region . ' of ' . $city;
     }
     */
     $location = "";
     $searchRule = Location::getSearchRule($coutry);
     logfire('search resutl searchrule', $searchRule);
     if ($searchRule == 1 || $searchRule == 2) {
         if (!empty($city)) {
             $location = $city;
         }
     }
     if (!empty($state)) {
         if (empty($location)) {
             $location = $state;
         } else {
             $location .= ' ' . $state;
         }
     }
     if (!empty($coutry)) {
         if (empty($location)) {
             $location = $coutry;
         } else {
             $location .= ', ' . $coutry;
         }
     }
     $retstr .= '<span class="emphasis">' . $findstr . '</span> ';
     $retstr .= 'in <span class="emphasis">' . $location . '</span>. ';
     $retstr .= '</div>';
     return $retstr;
 }
Example #7
0
 public function changeregionAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     $param1 = $this->_getParam('param1', 0);
     logfire('param1', $param1);
     $location = new Location($param1);
     $suburbs = $location->getSuburbOptionsByRegionId($param1);
     if (!empty($suburbs)) {
         $jsonArray = array();
         foreach ($suburbs as $key => $value) {
             $cityrow = array('id' => $key, 'name' => $value);
             $jsonArray[] = $cityrow;
         }
         $json = Zend_Json::encode($jsonArray);
         echo $json;
         unset($json);
     }
 }
Example #8
0
 function basicCategoryUri($showCategory, $value, $currentCategory)
 {
     logfire('$showCategory', $showCategory);
     logfire('$$currentCategory', $currentCategory);
     if (strtolower($showCategory) == strtolower($currentCategory)) {
         $attributes = 'class="menu_on"';
     } else {
         $attributes = '';
     }
     switch ($showCategory) {
         case 'Car Sale':
             $CategoryForUri = 'Cars';
             break;
         default:
             $CategoryForUri = $showCategory;
     }
     //echo str_replace(' ', '', str_replace('&', 'and', strtolower($showCategory))) . 'basic' . "     ";
     return Tag::link(str_replace(' ', '', str_replace('&', 'and', strtolower($CategoryForUri))) . 'basic', $value, $showCategory, $attributes);
 }
Example #9
0
 public function getFeatures($list, $busTypeId)
 {
     try {
         $list = trim($list);
         $lastPostionOfComma = strripos($list, ',');
         logfire('ref_features $lastPostionOfComma', $lastPostionOfComma);
         logfire('ref_features $sizeof($list)', strlen($list));
         if (strlen($list) == $lastPostionOfComma + 1) {
             $list = substr($list, 0, $lastPostionOfComma);
         }
         $select = $this->select();
         $select->where('postTypeId = ?', $busTypeId);
         $select->where('id in (' . $list . ')');
         logfire('ref_features select', $select->__toString());
         return $this->fetchAll($select);
     } catch (Exception $e) {
         logError('ref_features failed!', $e);
         throw $e;
     }
 }
Example #10
0
 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;
 }
Example #11
0
File: Jobs.php Project: xinghao/shs
 public function search($location, $limit, $offset = 0, $query = null, $cat1 = null, $cat2 = null, $cat3 = null, $cat4 = null, $cat5 = null, $addtionalData = null)
 {
     $orginalCat1 = $cat1;
     if ($cat1 == $this->_cat1All) {
         $cat1 = null;
     }
     $select = parent::search($location, $limit, $offset, $query, $cat1, $cat2, $cat3, $cat4, $cat5, $addtionalData);
     if ($orginalCat1 == $this->_cat1All) {
         logfire('sdfsdfsdfdsfdsfs', sizeof($this->getCat1Array()));
         $keys = '';
         foreach ($this->getCat1Array() as $key => $value) {
             if (empty($keys)) {
                 $keys = $key;
             } else {
                 $keys .= ',' . $key;
             }
         }
         $select->where('cat1 in (' . $keys . ')');
     }
     logfire('job select', $select);
     return $select;
 }
Example #12
0
File: Cars.php Project: xinghao/shs
 public function search($location, $limit, $offset = 0, $query = null, $cat1 = null, $cat2 = null, $cat3 = null, $cat4 = null, $cat5 = null, $addtionalData = null)
 {
     if ($cat1 == 22) {
         $cat1 = null;
     }
     logfire('realstatesearch cat2', $cat2);
     if (empty($cat2) || $cat2 == 'Any' || $cat2 == 'ALL') {
         $cat2 = null;
     }
     if (empty($cat3) || $cat3 == 'Any' || $cat3 == 'ALL') {
         $cat3 = null;
     }
     $select = parent::search($location, $limit, $offset, $query, $cat1, $cat2, $cat3, $cat4, $cat5, $addtionalData);
     // TODO price;
     foreach ($addtionalData as $key => $value) {
         logfire($key, $value);
     }
     if (!empty($addtionalData['min']) && $addtionalData['min'] != 'Any' && $addtionalData['min'] != 'ALL') {
         $select->where('a.priceCalculate >= ?', $addtionalData['min']);
     }
     if (!empty($addtionalData['max']) && $addtionalData['max'] != 'Any' && $addtionalData['max'] != 'ALL') {
         $select->where('a.priceCalculate <= ?', $addtionalData['max']);
     }
     if (empty($cat1)) {
         $keys = '';
         foreach ($this->getCat1Array() as $key => $value) {
             if (empty($keys)) {
                 $keys = $key;
             } else {
                 $keys .= ',' . $key;
             }
         }
         $select->where('cat1 in (' . $keys . ')');
     }
     //echo $select;
     return $select;
 }
Example #13
0
 public function getPriceOptions($priceTab, $currency, $addAny = true)
 {
     try {
         $select = $this->select();
         $select->where('PriceTab = ?', $priceTab);
         $select->where('country = ?', $currency);
         logfire('Price', $select);
         $prices = $this->fetchAll($select);
         if (empty($prices)) {
             throw new Exception('No price for that priceTab (' . $priceTab . ')');
         }
         $retArray = array();
         if ($addAny) {
             $retArray['Any'] = 'Any';
         }
         foreach ($prices as $price) {
             $retArray[$price->PriceDataCalc] = $price->PriceData;
         }
         return $retArray;
     } catch (Exception $e) {
         logError('Refloc failed!', $e);
         throw $e;
     }
 }
Example #14
0
 function listAllCitiesInState($routerName, $value, $loc)
 {
     $retStr = '';
     $currentCity = $value->city;
     $currentState = $value->state;
     $cities = $loc->getLocations();
     $searchRule = $loc->getSearchRule();
     if ($searchRule == 1 || $searchRule == 2) {
         $locid = $loc->getCityId();
     } elseif ($searchRule == 3) {
         $locid = $loc->getStateId();
     }
     foreach ($cities as $city) {
         if ($city["current"]) {
             $attributes = 'class="menu_on"';
         } else {
             $attributes = '';
         }
         if ($searchRule == 1 || $searchRule == 2) {
             $value->city = $city["location"];
         } elseif ($searchRule == 3) {
             $value->city = $value->state = $city["location"];
         }
         $value->locationid = $city['locationid'];
         if ($routerName == "posting") {
             $routerName = BusinessType::getbasicSearchRouter($value->category);
             logfire('posting cities router', $routerName);
         }
         $retStr .= '<li>' . Tag::link($routerName, $value, $city["location"], $attributes) . '</li>' . "\n";
     }
     $value->city = $currentCity;
     $value->state = $currentState;
     //$value->city = strtolower($showRegion);
     $value->locationid = $locid;
     return $retStr;
 }
Example #15
0
 /**
  * check if payment card number is valid number.
  * @see branches/michael-test/library/Zend/Validate/Zend_Validate_NotEmpty#isValid()
  */
 public function isValid($value, $context = null)
 {
     // Filter the card number.
     // If it includes hash we will return empty.
     $value = PaymentCards::CardNUmberFilter($value);
     if (empty($value)) {
         return true;
     }
     $this->_setValue($value);
     $field = $this->_fieldName;
     $expiry = '';
     // Get field of expiry date.
     if (empty($field)) {
         $this->_error(self::MISSINGFIELDNAME);
         return false;
     } elseif (!isset($context[$field])) {
         $this->_error(self::INVALIDFIELDNAME);
         return false;
     } elseif (is_array($context)) {
         $expiry = $context[$field];
     } elseif (is_string($context)) {
         $expiry = $context;
     }
     // Explode to array
     $expiryarray = explode('/', $expiry);
     // Check if expiry is valid.
     if (empty($expiryarray) || !array_key_exists(1, $expiryarray)) {
         $this->_error(self::INVALIDEXPIRYDATE);
         return false;
     }
     $paymentCardsTable = new PaymentCards();
     // Check payment card number valid.
     // If it returns false we also get the error message.
     $validFlag = $paymentCardsTable->isCreditCardValid(trim($value), $expiryarray[0], '20' . $expiryarray[1]);
     logfire('valid:', '[' . trim($value) . '][' . $expiryarray[0] . '][' . '20' . $expiryarray[1] . ']');
     //logError('valid', $paymentCardsTable->getCreditCardValidErrorMsg());
     if ($validFlag) {
         return true;
     } else {
         $this->_errorMsg = $paymentCardsTable->getCreditCardValidErrorMsg();
         $this->_error(self::INVALIDPAYMENTCARDNUMBER);
         return false;
     }
 }
Example #16
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;
     }
 }
Example #17
0
 public function printTabs()
 {
     echo '<div class="tabwrap">';
     echo '<div class="tabs">';
     echo '<ul class="tabs">';
     $icount = 1;
     logfire('pdf exist', $this->attachmentExist());
     $tabArray = array(false, false, false, false, false);
     foreach ($this->_tabCollection as $tab) {
         if ((strtolower($tab) != 'photo' || $this->photoExist()) && (!in_array(strtolower($tab), $this->_attachTabCollect) || $this->attachmentExist())) {
             $tabArray[$icount - 1] = true;
             if (strtolower($tab) == 'photo') {
                 $photoTab = 'tabname = "photo"';
             } else {
                 $photoTab = 'tabname = tab' . $icount;
             }
             logfire('$this->_tabSequence', $this->_tabSequence);
             if ($this->_tabSequence == $icount) {
                 $style = ' class="active" ';
             } else {
                 $style = "";
             }
             echo '<li ' . $photoTab . $style . '><a href="#tab' . $icount . '" >' . $tab . '</a></li>';
         }
         $icount++;
     }
     echo '</ul>';
     echo '<div class="clear"></div>';
     echo '</div>';
     echo '<div class="tab_container">';
     if ($tabArray[0]) {
         $this->getTab1();
     }
     if ($tabArray[1]) {
         $this->getTab2();
     }
     if ($tabArray[2]) {
         $this->getTab3();
     }
     if ($tabArray[3]) {
         $this->getTab4();
     }
     if ($tabArray[4]) {
         $this->getTab5();
     }
     echo '<div class="clear"></div>';
     echo '</div>';
     echo '</div>';
 }
Example #18
0
 /**
  * Render form elements
  *
  * @param  string $content
  * @return string
  */
 public function render($content)
 {
     logfire('dfsfdsf', '--------------------');
     $form = $this->getElement();
     return '<table class="' . '">' . parent::render($content) . '</table>';
 }
Example #19
0
File: Tag.php Project: xinghao/shs
 /**
  * [xinghao]
  *  Common phone number print function
  *  return like: <skype image> (619) 224-3254
  * 	@author	Xinghao Yu <*****@*****.**>
  *  @param $fullPhoneNumber
  *  @return formatted phone number.
  *  @throws none
  */
 public static function phone($fullPhoneNumber)
 {
     logfire('full phone muber', $fullPhoneNumber);
     return '<img src="/images/search/pic_small.png" /></a>' . ' (' . substr($fullPhoneNumber, 0, 3) . ') ' . substr($fullPhoneNumber, 3, 3) . '-' . substr($fullPhoneNumber, 6, 4);
 }
Example #20
0
 protected function buildRefineUri($businessType, $formData)
 {
     try {
         echo str_replace(' ', '', strtolower($businessType)) . 'basicrefine';
         if (array_key_exists('cat1', $formData) && !empty($formData['cat1']) && strtolower($formData['cat1']) != strtolower('ALL') && strtolower($formData['cat1']) != strtolower('Any')) {
             $refcat1 = new Refcat1();
             $formData['cat1name'] = $refcat1->getCatNameById($formData['cat1']);
         }
         /*
         if (strtolower($formData['cat2']) == strtolower('ALL'))
         {
         	$formData['cat2name'] = 'ALL';
         }
         else{
         	$refcat2 = new Refcategory();
         	$formData['cat2name'] = $refcat2->getCatNameById($formData['cat2']);
         }
         
         if (strtolower($formData['cat3']) == strtolower('ALL'))
         {
         	$formData['cat3name'] = 'ALL';
         }
         else{
         	$refcat3 = new Refcategory();
         	$formData['cat3name'] = $refcat3->getCatNameById($formData['cat3']);
         }
         */
         if (array_key_exists('suburbid', $formData) && !empty($formData['suburbid']) && strtolower($formData['suburbid']) != strtolower('ALL')) {
             $locationid = $formData['suburbid'];
         } elseif (array_key_exists('regionid', $formData) && !empty($formData['regionid']) && strtolower($formData['regionid']) != strtolower('ALL')) {
             $locationid = $formData['regionid'];
         } elseif (array_key_exists('cityid', $formData) && !empty($formData['cityid']) && strtolower($formData['cityid']) != strtolower('ALL')) {
             $locationid = $formData['cityid'];
         } elseif (array_key_exists('stateid', $formData) && !empty($formData['stateid']) && strtolower($formData['stateid']) != strtolower('ALL')) {
             $locationid = $formData['stateid'];
         }
         $location = new Location($locationid);
         $formData['country'] = $location->getCountry();
         $formData['city'] = $location->getUriCity();
         $formData['state'] = $location->getUriState();
         $formData['locationid'] = $locationid;
         logfire('city', $formData['city']);
         logfire('state', $formData['state']);
         //logfire('cat3name', $formData['cat3name']);
         echo 'sss' . '1';
         $formData = Common::encodeUriParams($formData);
         return Tag::url(str_replace(' ', '', strtolower($businessType)) . 'basicrefine', Common::arrayToStdClass($formData));
     } catch (Exception $e) {
         echo $e;
     }
 }
Example #21
0
 public static function photoExists($photo)
 {
     logfire("photo test1", $photo);
     if (empty($photo)) {
         return false;
     }
     $photoInt = intval($photo);
     logfire("photo test2", $photoInt);
     if (empty($photoInt)) {
         return false;
     }
     return true;
 }
Example #22
0
 /**
  * Get city, regin, suburb, state, country by it.
  * @param $location_id
  * @return location.
  * @exception if illegal paramter passed in or can not find result.
  */
 public function getLocationById($location_id)
 {
     if (empty($location_id)) {
         throw new Exception('Location id passed in is empty. location_id:[' . $location_id . ']');
     }
     try {
         $select = $this->select();
         $select->from($this->_name, array('country', 'countryid', 'state', 'stateid', 'city', 'cityid', 'region', 'regionid', 'suburb', 'suburbid'))->distinct(true)->orWhere('countryid <> 0 and countryid = ?', $location_id)->orWhere('stateid = ?', $location_id)->orWhere('cityid = ?', $location_id)->orWhere('regionid = ?', $location_id)->orWhere('suburbid <> 0 and suburbid = ?', $location_id);
         logfire('getlocationbyId: ', $select->__toString());
         $location = $this->fetchRow($select);
         if (empty($location)) {
             throw new Exception('Location id does not exist. location_id:[' . $location_id . ']');
         } else {
             return $location;
         }
     } catch (Exception $e) {
         logError('Refloc failed!', $e);
         throw $e;
     }
 }
Example #23
0
 public function search($location, $limit, $offset = 0, $query = null, $cat1 = null, $cat2 = null, $cat3 = null, $cat4 = null, $cat5 = null, $addtionalData = null)
 {
     logfire('realstatesearch cat2', $cat2);
     if (empty($cat2)) {
         $cat2 = 630;
     }
     if ($cat3 == 631 || $cat3 == 639) {
         $cat3 = null;
     }
     $select = parent::search($location, $limit, $offset, $query, $cat1, $cat2, $cat3, $cat4, $cat5, $addtionalData);
     // TODO price;
     foreach ($addtionalData as $key => $value) {
         logfire($key, $value);
     }
     if ($addtionalData['bed'] != '' && $addtionalData['bed'] != 'Any' && $addtionalData['bed'] != 'ALL') {
         if ($addtionalData['bed'] == 100) {
             $select->where('i.rooms >= 6');
         } else {
             $select->where('i.rooms = ?', $addtionalData['bed']);
         }
     }
     if ($addtionalData['cars'] != '' && $addtionalData['cars'] != 'Any' && $addtionalData['cars'] != 'ALL') {
         if ($addtionalData['cars'] == 100) {
             $select->where('i.parking >= 6');
         } else {
             $select->where('i.parking = ?', $addtionalData['cars']);
         }
     }
     if ($addtionalData['bath'] != '' && $addtionalData['bath'] != 'Any' && $addtionalData['bath'] != 'ALL') {
         if ($addtionalData['bath'] == 100) {
             $select->where('i.baths >= 6');
         } else {
             $select->where('i.baths = ?', $addtionalData['bath']);
         }
     }
     if (!empty($addtionalData['min']) && $addtionalData['min'] != 'Any' && $addtionalData['min'] != 'ALL') {
         $select->where('a.priceCalculate >= ?', $addtionalData['min']);
     }
     if (!empty($addtionalData['max']) && $addtionalData['max'] != 'Any' && $addtionalData['max'] != 'ALL') {
         $select->where('a.priceCalculate <= ?', $addtionalData['max']);
     }
     /*
     if ($cat3 == 631||$cat3 == 639)
     {
     	$keys = '';
     	foreach($this->getCat3Array($cat2, false) as $key=>$value)
     	{
     		if (empty($keys))
     		{
     			$keys = $key;
     		}
     		else
     		{
     			$keys .= ','.$key;
     		}
     	}
     	$select->where('cat3 in ('.$keys.')');
     }
     */
     //echo $select;
     return $select;
 }
Example #24
0
 /**
  * Render a captcha image
  * 
  * @param  string $content 
  * @return string
  */
 public function render($content)
 {
     $element = $this->getElement();
     $view = $element->getView();
     if (null === $view) {
         return $content;
     }
     $tag = $this->getTag();
     $placement = $this->getPlacement();
     $separator = $this->getSeparator();
     $namespace = $this->getOption('namespace');
     $captchaId = $this->getOption('captchaId');
     if (!$namespace || !$captchaId) {
         require_once 'Zend/Form/Decorator/Exception.php';
         $exception = new Zend_Form_Decorator_Exception('namespace or captchaId not set');
         throw $exception;
     }
     $image = '<img src="/app/user/captcha/' . $namespace . '/' . $captchaId . '" alt="CAPTCHA challange" />';
     //$red = imagecolorallocate($image, 255, 0,0);
     if (null !== $tag) {
         require_once 'Zend/Form/Decorator/HtmlTag.php';
         $decorator = new Zend_Form_Decorator_HtmlTag();
         $decorator->setOptions(array('tag' => $tag));
         $image = $decorator->render($image);
     } else {
         $image = '<tr><td>&nbsp;</td><td class=forminput valign="middle" align="left" width="65%">' . $image . '</td></tr>' . "\n";
         $image = '<tr><td>&nbsp;</td><td></td></tr><tr><td>&nbsp;</td><td class=forminput valign="middle" align="left" width="65%">Type the characters you see in the picture below.</td></tr>' . "\n" . $image;
     }
     logfire('captcha', $image);
     switch ($placement) {
         case self::PREPEND:
             return $image . $separator . $content;
         case self::APPEND:
         default:
             return $content . $separator . $image;
     }
 }
Example #25
0
 public function getLocations()
 {
     $retArray = array();
     $current = false;
     try {
         $searchRule = $this->getSearchRule();
         logfire('searchrule', $searchRule);
         $currentloc = '';
         switch ($searchRule) {
             case 1:
                 $cities = $this->getAllCityByStateId();
                 $currentloc = $this->getCity();
                 break;
             case 2:
                 $cities = $this->getAllCityBycountryId();
                 $currentloc = $this->getCity();
                 break;
             case 3:
                 $currentloc = $this->getState();
                 $cities = $this->getAllStateBycountryId();
                 break;
             default:
                 throw new Exception("No rule " . $searchRule . " handler exists.");
         }
         if (empty($cities)) {
             throw new Exception("No cities exist");
         }
         logfire('currentloc', $currentloc);
         foreach ($cities as $row) {
             $rowloc = '';
             $rowlocid = '';
             if ($searchRule == 1 || $searchRule == 2) {
                 $rowloc = $row->city;
                 $rowlocid = $row->cityid;
             } elseif ($searchRule == 3) {
                 $rowloc = $row->state;
                 $rowlocid = $row->stateid;
             }
             if (trim($rowloc) == trim($currentloc)) {
                 $current = true;
             } else {
                 $current = false;
             }
             $retArray[] = array('location' => $rowloc, 'locationid' => $rowlocid, 'current' => $current);
         }
     } catch (Exception $e) {
         logError('', $e);
         echo $e;
     }
     foreach ($retArray as $q) {
         logfire($q['location'], $q['current']);
     }
     return $retArray;
 }
Example #26
0
 /**
  * build Listing Form
  * @see library/CrFramework/CrFramework_Form#init()
  */
 public function init()
 {
     logfire('dsfsdf', 'sdfsdfdsfs');
     $this->setMethod('post');
     $this->setName('refineform');
     $this->buildQuickSearchElements();
     $this->buildCat1Element();
     $this->buildCat2Element();
     $this->buildCat3Element();
     $this->buildCat4Element();
     $this->buildCat5Element();
     $this->buildExtraElements();
     $this->buildLocationElements();
     $this->addElement(Common::createHiddenElement('searchtype', ''));
     $this->addElement(Common::createHiddenElement('locationid', $this->_location->getLocationId()));
     $this->setAction('/refine/' . str_replace(' ', '', strtolower($this->_business->getBusinessType())));
     /*
     $cat4 = new Zend_Form_Element_Select('cat4');
     $cat4->setLabel($this->_cat4Name);
     
     $cat3->addMultiOptions($this->_business->getCat3Options($cat1selectArray[0]));
     $this->addElement($cat3);
     
     $cat3 = new Zend_Form_Element_Select('cat5');
     $cat3->setLabel($this->_cat3Name);
     
     $cat1selectArray = explode('|', $this->_business->getFirstCat2Option());
     $cat3->addMultiOptions($this->_business->getCat3Options($cat1selectArray[0]));
     $this->addElement($cat3);
     */
     // Quick search btn
     $submit = new Zend_Form_Element_Image('submit');
     $submit->setImage('/images/sitetemplate/find-2-80.png');
     $submit->setAttribs(array('rows' => 22, 'cols' => 80));
     $submit->setAttrib('onclick', 'return setsearch(2);');
     $submit->setImageValue(true);
     $this->addElement($submit);
     //$this->addAttribs(array('onsubmit'=>'beforeSubmit()'));
     // use view script to render form
     $this->setDecorators(array('FormElements', array('ViewScript', array('viewScript' => 'forms/_refineform.phtml', 'class' => 'hotspotform', 'placement' => false)), 'Form'));
 }