return array('captcha' => array('class' => 'CCaptchaAction', 'backColor' => 0xffffff), 'page' => array('class' => 'CViewAction')); } /* * @author Lam Huynh */ public function actionIndex() { if (empty($_GET)) { $this->redirect(Yii::app()->createAbsoluteUrl('site/home')); } // build breadscrumb $searchParams = array('index'); $breadcrumbs = array(); // property type (child) if (isset($_GET['property_type_code'])) { $typeIds = $_GET['property_type_code']; if ($typeIds && ($type = ProPropertyType::model()->findByPk(current($typeIds)))) { $searchParams['property_type_code[]'] = $type->id; $breadcrumbs[$type->name] = $searchParams; } } // district if (isset($_GET['location'])) { $locationIds = $_GET['location']; if ($locationIds && ($location = ProLocation::model()->findByPk(current($locationIds)))) { $searchParams['location[]'] = $location->id; $breadcrumbs[$location->name] = $searchParams; } } // buidling name if (isset($_GET['building']) && ($building = $_GET['building'])) { $searchParams['building'] = $building; $breadcrumbs[$building] = $searchParams; } // listing type: sale/rent if (isset($_GET['listing_for']) && ($listingFor = $_GET['listing_for'])) { $typeText = $listingFor == 'for_rent' ? "For Rent" : "For Sale"; $searchParams['listing_for'] = $listingFor; $breadcrumbs[$typeText] = $searchParams; } $this->breadcrumbs = $breadcrumbs; Yii::app()->theme = 'onehome'; Yii::app()->clientScript->coreScriptPosition = CClientScript::POS_BEGIN;
/** * @Author: ANH DUNG Jun 27, 2014 */ public static function SubCheckOne($property_type_id, $price) { $message = ''; $mProperty = ProPropertyType::model()->findByPk($property_type_id); if ($mProperty) { if (!empty($mProperty->price_min) && !empty($mProperty->price_max) && $mProperty->price_min > 0 && $mProperty->price_max > 0) { if (!Listing::validMinMaxPrice($mProperty, $price)) { $price_min = ProPropertyType::formatPriceMinMax($mProperty, 'price_min'); $price_max = ProPropertyType::formatPriceMinMax($mProperty, 'price_max'); $nameProperty = $mProperty->name; $message = "Sorry! Price outside acceptable range. For {$nameProperty}, must be <br>between {$price_min} and {$price_max}"; } } } return $message; }
public function run() { $property_type = ProPropertyType::model()->findForSearch(); $this->render("property_search", array('property_type' => $property_type)); }
/** use for FE search and Member module * @Author: ANH DUNG Apr 07, 2014 * @Todo: render ra select group cho property type * @Param: $name select * @Param: $id model user * @Param: $value value selected * @Param: $hasEmpty is string for empty value: ex: Select, All property types * @Return: string html select */ public static function getOptionSelectGroupByParent($parent_id, $name, $id, $value = '', $hasEmpty = '', $classSelect = null) { $criteria = new CDbCriteria(); $criteria->compare('t.status', STATUS_ACTIVE); // $criteria->compare('t.parent_id', $parent_id); $criteria->order = 'parent_id ASC, name asc'; $aPropertyType = ProPropertyType::model()->findAll($criteria); $strSelect = '<select class="' . $classSelect . '" name=' . $name . ' id=' . $id . '>'; $mPropertyType = new ProPropertyType(); if (trim($hasEmpty) != '') { $strSelect .= "<option value=''>{$hasEmpty}</option>"; } $mPropertyType->buildSelectGroup($parent_id, $aPropertyType, $value); $strSelect .= $mPropertyType->strOptionGroup; $strSelect .= '</select>'; return $strSelect; }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { try { $model = ProPropertyType::model()->findByPk($id); if ($model === null) { Yii::log("The requested page does not exist."); throw new CHttpException(404, 'The requested page does not exist.'); } return $model; } catch (Exception $e) { Yii::log("Exception " . print_r($e, true), 'error'); throw new CHttpException("Exception " . print_r($e, true)); } }
protected static function parsePropType($value) { $data = CHtml::listData(ProPropertyType::model()->findAll(), 'id', 'name'); return array_search(strtolower($value), array_map('strtolower', $data)); }