Esempio n. 1
0
 public static $arrOptions = array(1 => 'With photos only', 2 => 'With Floor plan');
 public static $arrListOn = array('empty' => '-', 1 => 'Within 3 days', 2 => 'Within 1 week', 3 => 'Within 2 weeks', 4 => 'Within 1 month');
 public static function getListingNameDetail($model)
 {
     $huyen = $model->rPropertyType ? $model->rPropertyType->name : "";
     $name = MyFunctionCustom::showTitlePropertyOrBuilding($model->property_name_or_address);
     $type = $model->listing_type == 1 ? "For Rent" : "For Sale";
     $location = $model->location_id;
     if ($location < 10) {
         $location = 'D0' . $location;
     } else {
         $location = 'D' . $location;
     }
     //		return $huyen." ".$type." - ".$name." (".$location.")";
     /*
     * DTOAN 
     * DUNG DE HIEN THI TITLE KHI NGUOI DUNG TU DIEN VAO
     */
Esempio n. 2
0
 /**
  * Jun 07, 2014 - ANH DUNG
  * To do: save file 
  * @param: $model is model ProGlobalEnquiry
  * @param: $fieldName file_name
  * @return: name of image upload/global_enquiry
  */
 public static function saveFile($model, $fieldName)
 {
     if (is_null($model->{$fieldName})) {
         return '';
     }
     $aDate = explode('-', $model->date_only);
     $pathUpload = ProGlobalEnquiry::$folderUpload . "/{$aDate['0']}/{$aDate['1']}/{$aDate['2']}";
     $ext = $model->{$fieldName}->getExtensionName();
     $file_name_slug = strtolower(MyFunctionCustom::slugify($model->{$fieldName}->getName()));
     $file_name_slug = str_replace(strtolower($ext), '', $file_name_slug);
     $model->file_name_slug = $file_name_slug;
     $fileName = date('Y-m-d');
     $fileName = time() . '-' . ActiveRecord::randString() . '.' . $ext;
     $imageProcessing = new ImageProcessing();
     $imageProcessing->createDirectoryByPath($pathUpload);
     $model->{$fieldName}->saveAs($pathUpload . '/' . $fileName);
     $model->{$fieldName} = $fileName;
     return $fileName;
 }
Esempio n. 3
0
             //if($model->validate() && $model->login())
             if ($model->validate()) {
                 if (!empty($returnUrl)) {
                     $this->redirect($returnUrl);
                 }
                 /* Change at yii 1.1.13:
                  * we not use: if (strpos(Yii::app()->user->returnUrl,'/index.php')===false) to check returnUrl
                  */
                 if (strtolower(Yii::app()->user->returnUrl) !== strtolower(Yii::app()->baseUrl . '/')) {
                     $this->redirect(Yii::app()->user->returnUrl);
                 }
                 $this->redirect(Yii::app()->createAbsoluteUrl('member/member_profile/myprofile'));
             }
         }
         // display the login form
         $this->render('user_login/login', array('model' => $model));
     } catch (Exception $exc) {
         throw new CHttpException(404, 'Invalid request. Please do not repeat this request again.');
     }
 }
 /**
  * <Jason>
  * <*****@*****.**>
  * Logs out the current user and redirect to homepage.
  */
 public function actionLogout()
 {
     $role_id = Yii::app()->user->role_id;
Esempio n. 4
0
 public function getSqft()
 {
     // copy from listing_detail.php
     if ($this->property_type_2 == 42) {
         //property type land
         $sqft = MyFunctionCustom::convertData($this->land_area, 'sqm');
         $sqftcontent = $sqft != 0 && $sqft != '' ? "{$sqft} sqft" : '';
     } else {
         $sqft = $this->floor_area;
         $sqm = $this->floor_area;
         if ($this->floor_area_unit == Listing::FLOOR_UNIT_SQM) {
             $sqft = MyFunctionCustom::convertData($this->floor_area, 'sqm');
         }
         if ($this->floor_area_unit == Listing::FLOOR_UNIT_SQFT) {
             $sqm = MyFunctionCustom::convertData($this->floor_area, 'sqft');
         }
         $tmp = array();
         if ($sqft != 0 && $sqft != '') {
             $tmp[] = "{$sqft} sqft";
         }
         if ($sqm != 0 && $sqm != '') {
             $tmp[] = "{$sqm} sqm (built-up)";
         }
         $sqftcontent = implode(' / ', $tmp);
     }
     $s = Listing::showSqft($sqftcontent, Listing::GetFormatLandArea($this));
     $arr = explode('/', $s);
     return trim(str_replace('sqft', '', $arr[0]));
 }
Esempio n. 5
0
 /**
  * Jun 07, 2014 - ANH DUNG
  * To do: save file 
  * @param: $model is model ProGlobalEnquiry
  * @param: $fieldName file_name
  * @return: name of image upload/global_enquiry
  */
 public static function saveFile($model, $fieldName)
 {
     if (is_null($model->{$fieldName})) {
         return '';
     }
     $pathUpload = ProInventoryPhoto::$folderUpload;
     $ext = $model->{$fieldName}->getExtensionName();
     $file_name_slug = strtolower(MyFunctionCustom::slugify($model->{$fieldName}->getName()));
     $file_name_slug = str_replace(strtolower($ext), '', $file_name_slug);
     $model->file_name_slug = $file_name_slug;
     $fileName = date('Y-m-d');
     $uid = isset(Yii::app()->user->id) ? Yii::app()->user->id : 999999;
     $fileName = $uid . '-' . time() . '-' . ActiveRecord::randString() . '.' . $ext;
     $imageProcessing = new ImageProcessing();
     $imageProcessing->createDirectoryByPath($pathUpload);
     $model->{$fieldName}->saveAs($pathUpload . '/' . $fileName);
     $model->{$fieldName} = $fileName;
     return $fileName;
 }
Esempio n. 6
0
        <div class="row">
            <div class="col-sm-6">
                <?php 
if ($model->property_type_2 == 42) {
    //property type land
    $sqft = MyFunctionCustom::convertData($model->land_area, 'sqm');
    $sqftcontent = $sqft != 0 && $sqft != '' ? "{$sqft} sqft" : '';
} else {
    $sqft = $model->floor_area;
    $sqm = $model->floor_area;
    if ($model->floor_area_unit == Listing::FLOOR_UNIT_SQM) {
        $sqft = MyFunctionCustom::convertData($model->floor_area, 'sqm');
    }
    if ($model->floor_area_unit == Listing::FLOOR_UNIT_SQFT) {
        $sqm = MyFunctionCustom::convertData($model->floor_area, 'sqft');
    }
    $tmp = array();
    if ($sqft != 0 && $sqft != '') {
        $tmp[] = "{$sqft} sqft";
    }
    if ($sqm != 0 && $sqm != '') {
        $tmp[] = "{$sqm} sqm (built-up)";
    }
    $sqftcontent = implode(' / ', $tmp);
}
$sqf = $model->search_psf;
?>
    
                <div class="primary-info">
                    <p>
 /**
  * Apr 01, 2014 - ANH DUNG
  * To do: save file 
  * @param: $model transactions
  * @param: $nameField ex: file_name
  * @param: $pathUpload ex: 'upload/transactions/property_document';  
  * @param: $nameBase name to show if need (option)
  * public static $folderUpload='upload/products/';
  * @return: name of image
  */
 public static function saveFile($model, $nameField, $pathUpload, $count)
 {
     if (is_null($model->{$nameField})) {
         return '';
     }
     $ext = $model->{$nameField}->getExtensionName();
     //        $nameBase = $model->$nameField->getName();
     //        $nameBase = str_replace(strtolower($ext), '', $nameBase);
     //        $nameBase = str_replace(strtoupper($ext), '', $nameBase);
     //        $nameBase = trim($nameBase, '.');
     $fileName = MyFunctionCustom::slugify($model->{$nameField}->getName());
     $fileName = str_replace(strtolower($ext), '', $fileName);
     $fileName = trim($fileName, '-');
     $fileName = trim($fileName);
     //        $fileName = time().'_'.$fileName.'.'.$ext;
     $fileName = $fileName . '-' . time() . $count . '.' . $ext;
     //        $fileName = $fileName.'.'.$ext;
     $imageProcessing = new ImageProcessing();
     $imageProcessing->createDirectoryByPath($pathUpload . '/' . $model->transactions_id);
     $model->{$nameField}->saveAs($pathUpload . '/' . $model->transactions_id . '/' . $fileName);
     return $fileName;
 }
Esempio n. 8
0
     $url = Yii::app()->createAbsoluteUrl('site/tenantlogin');
     if ($mUser->role_id == ROLE_LANDLORD) {
         $url = Yii::app()->createAbsoluteUrl('site/landlordlogin');
     }
     $link = '<a target="_blank" href="' . $url . '">' . $url . '</a>';
     $aBody = array('{FULL_NAME}' => $cmsFormater->formatFullNameRegisteredUsers($mUser), '{EMAIL}' => $mUser->email_not_login, '{NRIC}' => $mUser->nric_passportno_roc, '{PASSWORD}' => $mUser->temp_password, '{LINK_LOGIN}' => $link);
     $aSubject = array('{FULL_NAME}' => $cmsFormater->formatFullNameRegisteredUsers($mUser));
     CmsEmail::sendmail(MAIL_LANDLORD_TENANT_LOGIN, $aSubject, $aBody, $mUser->email_not_login);
 }
 /**
  * @Author: ANH DUNG Apr 25, 2014
  * @Todo: send mail to landlord and tenant, just notify 
  * @Param: $mUser model user
  * @Param: $mTransactions
Esempio n. 9
0
 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     try {
         $model = Pages::model()->findbyPk($id);
         $model->scenario = 'update';
         // Uncomment the following line if AJAX validation is needed
         // $this->performAjaxValidation($model);
         $old_image = $model->featured_image;
         $old_home_page = $model->thumb_image;
         if (isset($_POST['Pages'])) {
             $oldImg = $model->banner;
             $model->attributes = $_POST['Pages'];
             $uploadFile = CUploadedFile::getInstance($model, 'banner');
             $model->parent_id = $_POST['Pages']['parent_id'];
             //                $model->show_footer = $_POST['Pages']['show_footer'];
             //                $model->show_home_page = $_POST['Pages']['show_home_page'];
             //                $model->short_content = $_POST['Pages']['short_content'];
             //                $model->order = $_POST['Pages']['order'];
             if (isset($_POST['ck'])) {
                 $model->show_desc = 1;
             } else {
                 $model->show_desc = 0;
             }
             $isEmptyFileInput = empty($_FILES["Pages"]["name"]["imageFile"]);
             $new_banner = '';
             if (!$isEmptyFileInput) {
                 //has file input
                 $model->imageFile = CUploadedFile::getInstance($model, 'imageFile');
             }
             $isEmptyHomePageInput = empty($_FILES["Pages"]["name"]["thumbFile"]);
             $new_home_page = '';
             if (!$isEmptyHomePageInput) {
                 //has file input
                 $model->thumbFile = CUploadedFile::getInstance($model, 'thumbFile');
             }
             if ($model->validate()) {
                 if ($uploadFile) {
                     // remove old image and save new image to disk
                     $model->removeBanner($oldImg);
                     $model->saveBanner($uploadFile);
                 } else {
                     $model->banner = $oldImg;
                     // keep old image
                 }
                 if (!$isEmptyFileInput) {
                     //has file input
                     $errorBanner = false;
                     if (MyFunctionCustom::bannerIsSmall($model->imageFile->getTempName(), Pages::$aSizeBanner['960x252']['width'], Pages::$aSizeBanner['960x252']['height'])) {
                         $errorBanner = true;
                     }
                     //Checked size of banner
                     if ($errorBanner) {
                         $model->addError('imageFile', 'Banner file size need larger than 960x252.');
                     } else {
                         $ext_banner = $model->imageFile->getExtensionName();
                         $timestamp_banner = time();
                         $new_banner = $timestamp_banner . '.' . $ext_banner;
                     }
                 }
                 if (!$isEmptyHomePageInput) {
                     //has file input
                     //Checked size of banner
                     $errorBanner = false;
                     if (MyFunctionCustom::bannerEqual($model->thumbFile->getTempName(), Pages::$aSizeHomePage['204x94']['width'], Pages::$aSizeHomePage['204x94']['height'])) {
                         $errorBanner = true;
                     }
                     //Checked size of banner
                     if ($errorBanner) {
                         $model->addError('thumbFile', 'Thumb file size must be equal 204x94.');
                     } else {
                         $ext_home_page = $model->thumbFile->getExtensionName();
                         $timestamp_home_page = time();
                         $model->thumb_image = $timestamp_home_page . '.' . $ext_home_page;
                     }
                 }
                 if (!$model->hasErrors()) {
                     if (isset($_POST['delete_current_image']) && $_POST['delete_current_image'] == 'on') {
                         Pages::deleteImage($model);
                         $model->featured_image = NULL;
                         if (!$isEmptyFileInput) {
                             $ImageProcessing = new ImageProcessing();
                             $ImageProcessing->delete('upload/admin/' . Pages::$folderUpload . '/' . $model->id . '/' . $old_image);
                             $ImageProcessing->createDirectoryByPath('upload/admin/' . Pages::$folderUpload . '/' . $model->id);
                             $model->imageFile->saveAs(YII_UPLOAD_DIR . '/admin/' . Pages::$folderUpload . '/' . $model->id . '/' . $new_banner);
                             $model->featured_image = $new_banner;
                             $model->resizeBanner();
                         }
                         $model->update();
                     } else {
                         if ($new_banner != NULL) {
                             $model->featured_image = $new_banner;
                         }
                         if ($model->update()) {
                             if (!$isEmptyFileInput) {
                                 $ImageProcessing = new ImageProcessing();
                                 $ImageProcessing->delete('upload/admin/' . Pages::$folderUpload . '/' . $model->id . '/' . $old_image);
                                 $ImageProcessing->createDirectoryByPath('upload/admin/' . Pages::$folderUpload . '/' . $model->id);
                                 $model->imageFile->saveAs(YII_UPLOAD_DIR . '/admin/' . Pages::$folderUpload . '/' . $model->id . '/' . $model->featured_image);
                                 $model->resizeBanner();
                             }
                         }
                     }
                     //For home page
                     if (isset($_POST['delete_current_image_home_page']) && $_POST['delete_current_image_home_page'] == 'on') {
                         Pages::deleteImage($model, true);
                         $model->thumb_image = NULL;
                         if (!$isEmptyHomePageInput) {
                             $ImageProcessing = new ImageProcessing();
                             $ImageProcessing->delete('upload/admin/' . Pages::$folderUpload . '/' . $model->id . '/' . $old_home_page);
                             $ImageProcessing->createDirectoryByPath('upload/admin/' . Pages::$folderUpload . '/' . $model->id);
                             $model->thumbFile->saveAs(YII_UPLOAD_DIR . '/admin/' . Pages::$folderUpload . '/' . $model->id . '/' . $new_home_page);
                             $model->thumb_image = $new_home_page;
                             $model->resizeHomePages();
                         }
                         $model->update();
                     } else {
                         if ($new_home_page != NULL) {
                             $model->thumb_image = $new_home_page;
                         }
                         if ($model->update()) {
                             if (!$isEmptyHomePageInput) {
                                 $ImageProcessing = new ImageProcessing();
                                 $ImageProcessing->delete('upload/admin/' . Pages::$folderUpload . '/' . $model->id . '/' . $old_home_page);
                                 $ImageProcessing->createDirectoryByPath('upload/admin/' . Pages::$folderUpload . '/' . $model->id);
                                 $model->thumbFile->saveAs(YII_UPLOAD_DIR . '/admin/' . Pages::$folderUpload . '/' . $model->id . '/' . $model->thumb_image);
                                 $model->resizeHomePages();
                             }
                         }
                     }
                     $this->redirect(array('view', 'id' => $model->id));
                 }
             }
         }
         $this->render('update', array('model' => $model, 'actions' => $this->listActionsCanAccess));
     } catch (exception $e) {
         Yii::log("Exception " . print_r($e, true), 'error');
         throw new CHttpException("Exception " . print_r($e, true));
     }
 }
Esempio n. 10
0
 /**
  * @param $model
  * @return bool
  * <Jason>
  * <*****@*****.**>
  */
 public static function saveUserRegister($model)
 {
     if (isset($_POST['Users'])) {
         $model->attributes = $_POST['Users'];
         $model->validate(array('email', 'title', 'first_name', 'last_name', 'phone', 'area_code_id', 'password_hash', 'password_confirm'));
         //            $model->validate();
         // if ok validate then do something
         if (!$model->hasErrors()) {
             $model->email = ActiveRecord::clearHtml($model->email);
             //$model->email_temp = ActiveRecord::clearHtml($model->email);
             $model->title = ActiveRecord::clearHtml($model->title);
             $arr_email = explode('@', $model->email);
             $model->username = $arr_email[0];
             $model->first_name = ActiveRecord::clearHtml($model->first_name);
             $model->last_name = ActiveRecord::clearHtml($model->last_name);
             $model->phone = ActiveRecord::clearHtml($model->phone);
             $model->area_code_id = ActiveRecord::clearHtml($model->area_code_id);
             //                if(MyFunctionCustom::checkCountryFilter()) {
             //                    $model->status=STATUS_PENDING_USER;
             //                } else {
             //                    $model->status=STATUS_BLOCK_IP;
             //                }
             $model->created_date = date('Y-m-d H:i:s');
             $model->last_logged_in = date('Y-m-d H:i:s');
             $model->role_id = ROLE_REGISTER_MEMBER;
             $model->application_id = FE;
             $model->login_attemp = 0;
             //$model->verify_code = ActiveRecord::generateVerifyCode();
             $model->temp_password = $_POST['Users']['password_hash'];
             $model->scenario = NULL;
             $model->save();
             $model->password_hash = md5($_POST['Users']['password_hash']);
             $model->verify_code = sha1(mt_rand(10000, 99999) . time() . $model->email);
             $model->update(array('password_hash', 'verify_code'));
             MyFunctionCustom::sendMailAfterRegister($model);
             if ($model->is_subscriber) {
                 Subscriber::saveSubscriberUser($model->id);
             }
             //Added subcriber
             return true;
         }
     }
     return false;
 }
Esempio n. 11
0
</p>
            <!-- <p><?php 
/*echo $cmsFormater->formatPrice($data->office_bkank_valuation);*/
?>
</p> -->
            <?php 
if ($data->property_type_2 == 42) {
    //property type land
    $sqft = MyFunctionCustom::convertData($data->land_area, 'sqm');
    $sqftcontent = "{$sqft} sqft";
} else {
    $sqft = MyFunctionCustom::convertData($data->floor_area, 'sqm');
    $sqm = MyFunctionCustom::convertData($data->floor_area, 'sqft');
    $sqftcontent = "{$sqft} sqft / {$sqm} sqm (built-up) ";
}
$sqf = MyFunctionCustom::convertData($data->price, 'sqf', $sqft);
?>
            
            <p><?php 
echo $sqftcontent;
?>
</p>
            <p><?php 
echo "{$sqf} psf (built-up)";
?>
</p>

            <div class="ico-group clearfix">
                <p class="btn-4"><span class="ico-bed"><?php 
echo $data->of_bedroom;
?>