Exemplo n.º 1
0
 /**
  * @Author: ANH DUNG Dec 02, 2014
  * @Todo: get array listing id by property name
  * @Param: $property_name_or_address
  */
 public static function GetArrListingIdByPropertyName($property_name_or_address)
 {
     $criteria = new CDbCriteria();
     Listing::GetConditionSearchListing($criteria, $property_name_or_address);
     $models = Listing::model()->findAll($criteria);
     return CHtml::listData($models, "id", "id");
 }
Exemplo n.º 2
0
  * @Author: ANH DUNG Apr 24, 2014
  * @Todo: search autocomplete landlord and tenant at FE create new transaction
  */
 public function actionSearchLandlordTenant()
 {
     if (!isset($_GET['term']) || !Yii::app()->request->isAjaxRequest) {
         throw new CHttpException(404, "Invalid request");
     }
     $role = ROLE_LANDLORD;
     $aCheck = array(ROLE_LANDLORD, ROLE_TENANT);
     if (isset($_GET['role']) && in_array($_GET['role'], $aCheck)) {
         $role = $_GET['role'];
     }
     $criteria = new CDbCriteria();
     $criteria->compare(" t.role_id", $role);
     $criteria->addSearchCondition('CONCAT(t.first_name, " " ,t.last_name, " " ,t.nric_passportno_roc)', $_GET['term'], true);
     // true ==> LIKE '%...%'
     $criteria->limit = 30;
     $models = Users::model()->findAll($criteria);
     $returnVal = array();
     $cmsFormat = new CmsFormatter();
     foreach ($models as $model) {
         $label = $cmsFormat->formatFullNameRegisteredUsers($model);
         $returnVal[] = array('label' => $label, 'value' => $label, 'id' => $model->id, 'row_class_id' => "row_class_id{$model->id}", 'full_name' => $label, 'email' => $model->email_not_login, 'nric_passportno_roc' => $model->nric_passportno_roc, 'contact_no' => $model->contact_no, 'address' => $model->address, 'postal_code' => $model->postal_code, 'id_type' => $model->id_type, 'pass_expiry_date' => $cmsFormat->formatDatePickerInput($model->pass_expiry_date), 'upload_employment_pass_passport' => $model->upload_employment_pass_passport, 'scanned_passport' => $model->scanned_passport, 'postal_code' => $model->postal_code);
     }
     echo CJSON::encode($returnVal);
     Yii::app()->end();
 }
 /**
  * @Author: ANH DUNG Apr 24, 2014
  * @Todo: search autocomplete landlord and tenant at FE create new transaction