Author:
Inheritance: extends ApiController
 public function chuanciquery()
 {
     if (IS_POST) {
         //注册用户
         /* 检测验证码 */
         if (!check_verify($verify)) {
             $this->error('验证码输入错误!');
         }
         /* 检测密码 */
         if ($password != $repassword) {
             $this->error('密码和重复密码不一致!');
         }
         /* 调用注册接口注册用户 */
         $User = new UserApi();
         $uid = $User->register($username, $password, $email);
         if (0 < $uid) {
             //注册成功
             //TODO: 发送验证邮件
             $this->success('注册成功!', U('login'));
         } else {
             //注册失败,显示错误信息
             $this->error($this->showRegError($uid));
         }
     } else {
         //显示注册表单
         $this->display();
     }
 }
 /**
  * 后台用户登录
  * @author xxx <*****@*****.**>
  */
 public function login($username = null, $password = null, $verify = null)
 {
     if (IS_POST) {
         /* 检测验证码 TODO: */
         if (!check_verify($verify)) {
             $this->error('验证码输入错误!');
         }
         /* 调用UC登录接口登录 */
         $User = new UserApi();
         $uid = $User->login($username, $password);
         if (0 < $uid) {
             //UC登录成功
             /* 登录用户 */
             $Member = D('Member');
             if ($Member->login($uid)) {
                 //登录用户
                 //TODO:跳转到登录前页面
                 $this->success('登录成功!', U('Index/index'));
             } else {
                 $this->error($Member->getError());
             }
         } else {
             //登录失败
             switch ($uid) {
                 case -1:
                     $error = '用户不存在或被禁用!';
                     break;
                     //系统级别禁用
                 //系统级别禁用
                 case -2:
                     $error = '密码错误!';
                     break;
                 default:
                     $error = '未知错误!';
                     break;
                     // 0-接口参数错误(调试阶段使用)
             }
             $this->error($error);
         }
     } else {
         if (is_login()) {
             $this->redirect('Index/index');
         } else {
             /* 读取数据库中的配置 */
             $config = S('DB_CONFIG_DATA');
             if (!$config) {
                 $config = D('Config')->lists();
                 S('DB_CONFIG_DATA', $config);
             }
             C($config);
             //添加配置
             $this->display();
         }
     }
 }
 public function order()
 {
     if (IS_POST) {
         if (!check_verify(I('verify'))) {
             $this->error('验证码输入错误');
         }
         $Order = D('Order');
         $order_id = 'NS' . date('YmdHis') . mt_rand(1000, 9999);
         $uid = is_login();
         $site_id = I('site_id', 0, 'intval');
         if ($uid) {
             $result = $Order->inputVisa($order_id, $uid, $site_id);
             $mobile = get_userinfo($uid, 3);
         } else {
             $mobile = I('mobile', '', 'trim');
             /* 调用注册接口注册用户 */
             $User = new UserApi();
             $res = $User->checkMobile($mobile);
             if ($res == 1) {
                 $password = mt_rand(100000, 999999);
                 $uid = $User->register('', $password, '', $mobile);
                 if (0 < $uid) {
                     //注册成功
                     send_sms($mobile, array('mobile' => $mobile, 'password' => $password), 'password');
                     $result = $Order->inputVisa($order_id, $uid, $site_id);
                 }
             } else {
                 $user_info = $User->getinfo($mobile, 3);
                 $result = $Order->inputVisa($order_id, $user_info[0], $site_id);
             }
         }
         if ($result) {
             send_sms($mobile, array('orderid' => $order_id), 'onOrder');
             $this->redirect('checkOrder', array('order_id' => $order_id));
         } else {
             $this->error('订单提交失败');
         }
     } else {
         $visa_id = I('visa_id', 0, 'intval');
         if (empty($visa_id)) {
             $this->error('无效参数');
         }
         // 线路信息
         $map = array('visa_id' => $visa_id);
         $visa_info = M('Visa')->where($map)->find();
         if (empty($visa_info)) {
             $this->error('不存在');
         }
         $this->assign('visa_info', $visa_info);
         $this->display();
     }
 }
Exemple #4
0
 public function actionReply($userId)
 {
     Yii::beginProfile('messageReply');
     $pmbMessage = new PmbMessages();
     $user = UserApi::getUser($userId);
     if (!$user) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     $pmbMessage->to_user_id = $userId;
     $pmbMessage->from_user_id = Yii::app()->user->id;
     $userName = UserApi::getNameByUserId($userId);
     if (isset($_POST['submit'])) {
         $pmbMessage->attributes = $_POST['PmbMessages'];
         if ($pmbMessage->save()) {
             $data = array();
             $user = UserApi::getUserById($pmbMessage->to_user_id);
             $user ? $data["user"] = $user->id : null;
             $data["message"] = $pmbMessage->id;
             EmailApi::sendEmail($user->email_id, "ACTIVITY.MESSAGE.NEW", $data);
             $this->redirect('/messages/sent');
         }
     }
     $this->render('reply', array('pmbMessage' => $pmbMessage, 'user' => $user, 'userName' => $userName));
     Yii::endProfile('messageReply');
 }
Exemple #5
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $credentialsModel = new UserCredentials('register');
     $profilesModel = new UserProfiles();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['UserCredentials']) && isset($_POST['UserProfiles'])) {
         $data = $_POST;
         $credentialsModel->attributes = $_POST['UserCredentials'];
         $profilesModel->attributes = $_POST['UserProfiles'];
         $data['UserCredentials']['verified_by'] = Yii::app()->user->id;
         $id = UserApi::createUser($credentialsModel, $profilesModel);
         if ($id) {
             $data["temp_password"] = $credentialsModel->password;
             EmailApi::sendEmail($credentialsModel->email_id, "REGISTRATION.SUCCESS", $data);
             $this->redirect(array('view', 'id' => $id['credential']->id));
         } else {
             $credentialsModel->attributes = $data['UserCredentials'];
             $credentialsModel->validate(array('email_id', 'password', 'password2', 'status'));
             $profilesModel->attributes = $data['UserProfiles'];
             $profilesModel->validate(array('first_name', 'last_name'));
         }
     }
     $this->render('create', array('credentialsModel' => $credentialsModel, 'profilesModel' => $profilesModel));
 }
Exemple #6
0
 public static function sendEmail($scenario, $userId = "", $messageId = "", $tempPassword = "", $cc = "", $bcc = "")
 {
     $model = EmailTemplateApi::getTemplateByScenario($scenario);
     if ($userId) {
         $user = UserApi::getUser($userId);
     }
     if ($user) {
         $data["verification_link"] = SecurityUtils::getVerificationLink($user["activation_code"]);
         $data["email_id"] = $user["email_id"];
         $data["name"] = UserApi::getNameByUserId($userId);
     }
     if ($tempPassword) {
         $data["temp_password"] = $tempPassword;
     }
     if ($messageId) {
         $message = PmbApi::loadMessage($messageId);
     }
     if ($message) {
         $data["message_subject"] = $message->subject;
         $data["message_content"] = $message->content;
         $data["message_from"] = UserApi::getNameByUserId($message->from_user_id);
     }
     if ($model) {
         $htmlEmail = self::changeTemplate($data, $model->body_html);
         $plainEmail = self::changeTemplate($data, $model->body_plain);
         $emailData["from_email"] = $model->from_email;
         $emailData["from_name"] = $model->from_name;
         $emailData["subject"] = $model->subject;
         $emailData["body_html"] = $htmlEmail;
         $emailData["body_plain"] = $plainEmail;
         return EmailQueueApi::addToQueue($user["email_id"], $cc, $bcc, "", $emailData);
     }
     return false;
 }
 public function actionSimilar($id)
 {
     Yii::beginProfile('requirements_view');
     $session = Yii::app()->session;
     $requirement = RequirementApi::getRequirementById($id);
     if (!$requirement) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     $userDetails = UserApi::getUserProfileDetails($requirement->user_id);
     $data['i_want_to'] = $requirement->i_want_to;
     $data['min_price'] = $requirement->min_price;
     $data['max_price'] = $requirement->max_price;
     $propertytypes = RequirementPropertyTypesApi::getPropertyTypesByRequirementId($requirement->id);
     $propertytypeids = null;
     if ($propertytypes) {
         foreach ($propertytypes as $propertytype) {
             $propertytypeids[] = $propertytype->property_type_id;
         }
     }
     $data['property_type_id'] = $propertytypeids;
     $amenity_ids = RequirementAmenitiesApi::getAmenitiesByRequirementId($requirement->id);
     $amenityids = null;
     if ($amenity_ids) {
         foreach ($amenity_ids as $amenity_id) {
             $amenityids[] = $amenity_id->amenity_id;
         }
     }
     $data['PropertyAmenities'] = $amenityids;
     $cityids = RequirementCitiesApi::getCitiesByRequirementId($requirement->id);
     $city = null;
     if ($cityids) {
         foreach ($cityids as $cityid) {
             $city[] = $cityid->city_id;
         }
     }
     $data['city_id'] = $city;
     $bedrooms = RequirementBedroomsApi::getBedroomsByRequirementId($requirement->id);
     $beds = null;
     if ($bedrooms) {
         foreach ($bedrooms as $bedroom) {
             $beds[] = $bedroom->bedrooms;
         }
     }
     $data['bedrooms'] = $beds;
     $criteria = PropertyApi::getCriteriaObjectForRequirement($data);
     $count = Property::model()->count($criteria);
     $pages = new CPagination($count);
     $pages->pageSize = Yii::app()->params['resultsPerPage'];
     $pages->applyLimit($criteria);
     $properties = PropertyApi::searchMyPropertyWithCriteria($criteria);
     $this->render('similar', array('requirement' => $requirement, 'userDetails' => $userDetails, 'properties' => $properties, 'pages' => $pages, 'propertiesCount' => $count));
     Yii::endProfile('requirements_view');
 }
 public function updateInfo()
 {
     if (IS_POST) {
         $arr = I('post.');
         $password = $arr['password'];
         if (!$password) {
             $this->apiError(0, '参数错误');
         }
         $user = new UserApi();
         unset($arr['password']);
         $data = $arr;
         if (empty($data)) {
             $this->apiError(0, '非法请求');
         }
         $res = $user->updateInfo($this->uid, $password, $data);
         if ($res['status']) {
             S('userinfo_' . $this->uid, null);
             $this->apiSuccess('success');
         } else {
             $this->apiError(0, '修改失败');
         }
     }
 }
Exemple #9
0
 /**
  * Before action.
  *
  * @param mixed $action Action.
  *
  * @return mixed
  */
 public function beforeAction($action)
 {
     $input = file_get_contents("php://input");
     if ($this->action->id != 'auth') {
         $token = Yii::app()->request->getParam(Api::KEY_TOKEN);
         if ($token && ($userId = UserApi::model()->apiGetUserId($token))) {
             $this->_userId = $userId;
             $this->_data = $input ? CJSON::decode($input) : array();
         } else {
             $this->_response(false, Api::MESSAGE_TOKEN);
             Yii::app()->end();
         }
     }
     return parent::beforeAction($action);
 }
Exemple #10
0
 /**
  * This method returns the owner of a particular project.
  * Returns model if successfully found.
  * Returns the false if not found.
  *
  * @param string $projectId
  * @return model || false
  */
 public static function getOwner($projectId)
 {
     $criteria = new CDbCriteria();
     $criteria->select = 'user_id';
     $criteria->condition = 'id=:projectId';
     $criteria->params = array(':projectId' => $projectId);
     $project = Projects::model()->find($criteria);
     if ($userId) {
         $criteria = new CDbCriteria();
         $criteria->condition = 'user_id=:userId';
         $criteria->params = array(':userId' => $project->user_id);
         $userprofile = UserProfiles::model()->find($criteria);
         $usercredentials = UserApi::getUserDetails($project->user_id);
         $userdetails = ArrayUtils::mergeArray($usercredentials->getAttributes(), $userprofile->getAttributes());
         return $userdetails;
     } else {
         return false;
     }
 }
Exemple #11
0
 public function actionStarRatingAjax($userId, $agentId)
 {
     $ratingAjax = isset($_POST['rate']) ? $_POST['rate'] : 0;
     AgentRatingApi::addRating($agentId, $userId, $ratingAjax);
     $data = array();
     $userId = AgentProfileApi::getAgentProfileById($agentId)->user_id;
     $user = UserApi::getUserById($userId);
     $user ? $data["user"] = $user->id : null;
     $data["agent"] = $agentId;
     EmailApi::sendEmail($user->email_id, "ACTIVITY.AGENT.RATING", $data);
     echo 'Your Rating is ' . $ratingAjax;
 }
 public function actionView($id)
 {
     Yii::beginProfile('project_view');
     $session = Yii::app()->session;
     $project = ProjectApi::getProjectById($id);
     if (!$project) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     $recentlyViewed = UserApi::getUserProfileDetails($project->recently_viewed);
     $projectAgentInfo = AgentProfileApi::getAgentDetails($project->user_id);
     $projectUser = "";
     $projectAgent = "";
     $projectBuilder = "";
     $projectBuilderInfo = "";
     $projectSpecialist = "";
     $projectSpecialistInfo = "";
     $projectRating = '';
     if ($projectAgentInfo) {
         $projectAgent = UserApi::getUserProfileDetails($projectAgentInfo->user_id);
     } else {
         $projectBuilderInfo = BuilderProfileApi::getBuilderDetails($project->user_id);
         if ($projectBuilderInfo) {
             $projectBuilder = UserApi::getUserProfileDetails($projectBuilderInfo->user_id);
         } else {
             $projectSpecialistInfo = SpecialistProfileApi::getSpecialistDetails($project->user_id);
             if ($projectSpecialistInfo) {
                 $projectSpecialist = UserApi::getUserProfileDetails($projectSpecialistInfo->user_id);
             } else {
                 $projectUser = UserApi::getUser($project->user_id);
             }
         }
     }
     $projectSimilar = ProjectApi::getSimilarProjects($project, 3);
     $projectSimilarAddress = "";
     $projectSimilarUser = "";
     if ($projectSimilar) {
         foreach ($projectSimilar as $similar) {
             $projectSimilarAddress[$similar->id] = ProjectApi::getLocation($similar->id);
             $projectSimilarUser[$similar->id] = UserApi::getUserProfileDetails($similar->user_id);
         }
     }
     $recentlyViewedIds = $session['projects'];
     $project_ids = $recentlyViewedIds;
     $project_ids[] = $id;
     $session['projects'] = array_unique($project_ids);
     $projectRecentlyViewed = "";
     $projectRecentlyViewedAddress = "";
     $projectRecentlyViewedUser = "";
     if ($recentlyViewedIds) {
         foreach ($recentlyViewedIds as $recent) {
             $modelProject = ProjectApi::getProjectById($recent);
             $projectRecentlyViewed[] = $modelProject;
             $projectRecentlyViewedAddress[] = ProjectApi::getLocation($recent);
             $projectRecentlyViewedUser[] = UserApi::getUserProfileDetails($modelProject->user_id);
         }
     }
     $projectImages = ProjectImagesApi::getAllImages($project->id);
     $projectType = ProjectTypesApi::getProjectTypeById($project->project_type_id);
     $ownershipType = OwnershipTypesApi::getOwnershipTypeById($project->ownership_type_id);
     $projectAmenities = ProjectAmenitiesApi::getAmenitiesForProject($project->id);
     $projectAddress = ProjectApi::getLocation($project->id);
     $projectProperties = ProjectPropertiesApi::getPropertiesModel($project->id);
     $projectWishlist = ProjectWishlistApi::getWishlistUserOnProject($project->id, Yii::app()->user->id);
     $projectRating = ProjectRatingApi::getRating($project->id);
     $projectViews = ProjectApi::getViews($project->id);
     ProjectApi::setViews($project->id);
     $this->render('view', array('project' => $project, 'recentlyViewed' => $recentlyViewed, 'projectAgentInfo' => $projectAgentInfo, 'projectBuilderInfo' => $projectBuilderInfo, 'projectSpecialistInfo' => $projectSpecialistInfo, 'projectUser' => $projectUser, 'projectAgent' => $projectAgent, 'projectBuilder' => $projectBuilder, 'projectSpecialist' => $projectSpecialist, 'projectSimilar' => $projectSimilar, 'projectSimilarAddress' => $projectSimilarAddress, 'projectSimilarUser' => $projectSimilarUser, 'projectRecentlyViewed' => $projectRecentlyViewed, 'projectRecentlyViewedAddress' => $projectRecentlyViewedAddress, 'projectRecentlyViewedUser' => $projectRecentlyViewedUser, 'projectImages' => $projectImages, 'projectType' => $projectType, 'projectAddress' => $projectAddress, 'ownershipType' => $ownershipType, 'projectAmenities' => $projectAmenities, 'projectProperties' => $projectProperties, 'projectRating' => $projectRating, 'projectWishlist' => $projectWishlist, 'projectViews' => $projectViews));
     Yii::endProfile('project_view');
 }
Exemple #13
0
<div class="view">

	
	<b><?php 
echo CHtml::encode($data->getAttributeLabel('user_id'));
?>
:</b>
	<?php 
echo CHtml::link(CHtml::encode(UserApi::getNameByUserId($data->user_id)), array('/store/user/view', 'id' => $data->user_id));
?>
	
	<br />

	<b><?php 
echo CHtml::encode($data->getAttributeLabel('question'));
?>
:</b>
	<?php 
echo CHtml::encode($data->question);
?>
	<br />

	<b><?php 
echo CHtml::encode($data->getAttributeLabel('description'));
?>
:</b>
	<?php 
echo CHtml::encode($data->description);
?>
	<br />
 public function actionStarRatingAjax($userId, $specialistId)
 {
     $ratingAjax = isset($_POST['rate']) ? $_POST['rate'] : 0;
     SpecialistRatingApi::addRating($userId, $specialistId, $ratingAjax);
     $data = array();
     $userId = SpecialistProfileApi::getSpecialistProfileById($specialistId)->user_id;
     $user = UserApi::getUserById($userId);
     $user ? $data["user"] = $user->id : null;
     $data["specialist"] = $specialistId;
     EmailApi::sendEmail($user->email_id, "ACTIVITY.SPECIALIST.RATING", $data);
     echo 'Your Rating is ' . $ratingAjax;
 }
Exemple #15
0
 /**
  * Check user.
  *
  * @param $phone
  * @param $password
  *
  * @return mixed
  */
 public function apiAuth($phone, $password)
 {
     $data = null;
     $user = $this->findByAttributes(array('phone' => $phone, 'password' => md5($password)));
     if ($user && ($token = UserApi::model()->apiAdd($user->id))) {
         $data = array('user_id' => $user->id, 'token' => $token);
     }
     return $data;
 }
 public function actionRegister()
 {
     if (!Yii::app()->user->isGuest) {
         $this->redirect('/home');
     }
     $credentialsModel = UserApi::populateCredentialsModel(null, 'register');
     $profilesModel = UserApi::populateProfilesModel(null, 'register');
     /*require_once(Yii::app()->params["rootDir"].'/library/facebook/src/facebook.php');
     	 $facebook = new Facebook(array(
     	 'appId'  => Yii::app()->params["fbAppId"],
     	 'secret' => Yii::app()->params["fbSecret"],
     	 ));*/
     $this->performAjaxValidation(array($credentialsModel, $profilesModel));
     //$this->performAjaxValidation($profilesModel);
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'register-form') {
         echo CActiveForm::validate(array($credentialsModel, $profilesModel));
         //echo CActiveForm::validate($profilesModel);
         Yii::app()->end();
     }
     /*
      * Check if the user has reached this page through a widget.
      */
     if (isset($_POST['UserCredentials']) && !isset($_POST['UserProfiles'])) {
         $credentialsModel = UserApi::populateCredentialsModel($_POST['UserCredentials'], 'register');
         $credentialsModel->validate(array('email_id', 'password', 'password_confirm'));
         $profilesModel = UserApi::populateProfilesModel(null, 'register');
         //	$this->render('account',array('credentialsModel'=>$credentialsModel,'profilesModel'=>$profilesModel,'login'=>$loginModel));
     } else {
         if (isset($_POST['UserCredentials']) && isset($_POST['UserProfiles'])) {
             // save here
             $credentialsModel = UserApi::populateCredentialsModel($_POST['UserCredentials'], 'register');
             $credResult = $credentialsModel->validate(array('email_id', 'password', 'password_confirm'));
             $profilesModel = UserApi::populateProfilesModel($_POST['UserProfiles'], 'register');
             $profResult = $profilesModel->validate(array('first_name', 'last_name', 'gender', 'address_line1', 'address_line2', 'country_id', 'state_id', 'city_id', 'zip', 'mobile', 'telephone', 'agree, verifyCode'));
             if ($credResult && $profResult) {
                 $result = true;
                 $models = UserApi::createUser($credentialsModel, $profilesModel);
                 // Redirect to thanks page.
                 // @todo link to success page.
                 if ($models) {
                     $data = array();
                     $data["user"] = $models['credential']->id;
                     EmailApi::sendEmail($credentialsModel->email_id, "REGISTRATION.ACTIVATION", $data);
                     $session = new CHttpSession();
                     $session->open();
                     $session['registration-success'] = 'true';
                     $resendUrl = Yii::app()->createUrl('/account/resendEmail');
                     Yii::app()->user->setFlash('success', "Thanks for registering. We have sent you an email with activation information.\n\t\t\t\t\t\t<br/> Please add " . Yii::app()->params['adminEmail'] . " to your whitelist. \n\t\t\t\t\t\tIf you have not received the email click here to <a href='{$resendUrl}'>resend</a>.");
                     $this->redirect('/home');
                 }
                 //	else
                 //		$this->render('account',array('credentialsModel'=>$credentialsModel,'profilesModel'=>$profilesModel,'login'=>$loginModel));
                 // save())
             }
         }
     }
     // else
     $this->render('register', array('credentialsModel' => $credentialsModel, 'profilesModel' => $profilesModel));
 }
Exemple #17
0
<div class="view">

	
	<b><?php 
echo CHtml::encode($data->getAttributeLabel('user_id'));
?>
:</b>
	<?php 
echo UserApi::getNameByUserId($data->user_id);
?>
	<br />

	<b><?php 
echo CHtml::encode($data->getAttributeLabel('i_want_to'));
?>
:</b>
	<?php 
echo CHtml::encode($data->i_want_to);
?>
	<br />

	<b><?php 
echo CHtml::encode($data->getAttributeLabel('description'));
?>
:</b>
	<?php 
echo CHtml::encode($data->description);
?>
	<br />

	<b><?php 
 public function actionStarRatingAjax($userId, $builderId)
 {
     $ratingAjax = isset($_POST['rate']) ? $_POST['rate'] : 0;
     BuilderRatingApi::addRating($builderId, $userId, $ratingAjax);
     $data = array();
     $userId = BuilderProfileApi::getBuilderProfileById($builderId)->user_id;
     $user = UserApi::getUserById($userId);
     $user ? $data["user"] = $user->id : null;
     $data["builder"] = $builderId;
     EmailApi::sendEmail($user->email_id, "ACTIVITY.BUILDER.RATING", $data);
     echo 'Your Rating is ' . $ratingAjax;
 }
Exemple #19
0
<?php

$this->breadcrumbs = array('User Builder Profiles' => array('index'), $model->id);
$this->menu = array(array('label' => 'List UserBuilderProfile', 'url' => array('index')), array('label' => 'Create UserBuilderProfile', 'url' => array('create')), array('label' => 'Update UserBuilderProfile', 'url' => array('update', 'id' => $model->id)), array('label' => 'Delete UserBuilderProfile', 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => 'Are you sure you want to delete this item?')), array('label' => 'Manage UserBuilderProfile', 'url' => array('admin')));
?>

<h1>View UserBuilderProfile #<?php 
echo $model->id;
?>
</h1>

<?php 
$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('id', array('name' => 'user_id', 'value' => UserApi::getNameByUserId($model->user_id)), 'company_name', 'company_description', 'address_line1', 'address_line2', 'country_id', 'state_id', 'city_id', 'mobile', 'telephone', 'email', 'image')));
<?php

require_once "Swagger.php";
require_once "UserApi.php";
require_once "models/User.php";
$apiServer = "http://localhost:8080";
$apiKey = "";
$apiClient = new APIClient("http://localhost:8080", "");
$userApi = new UserApi($apiClient);
$user = $userApi->getUser(1);
var_dump($user);
$searchApi = new SearchApi($apiClient);
$users = $searchApi->searchUsers("T");
var_dump($users);
Exemple #21
0
<?php

$this->breadcrumbs = array('Properties' => array('index'), 'View');
$this->menu = array(array('label' => 'List Property', 'url' => array('index')), array('label' => 'Create Property', 'url' => array('create')), array('label' => 'Update Property', 'url' => array('update', 'id' => $model->id)), array('label' => 'Delete Property', 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => 'Are you sure you want to delete this item?')), array('label' => 'Manage Property', 'url' => array('admin')));
if ($model->projectProperties) {
    $this->menu[] = array('label' => 'Back to Project', 'url' => Yii::app()->request->urlReferrer);
}
?>

<h1>View Property</h1> 

<?php 
$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('id', array('label' => 'User Name', 'type' => 'raw', 'value' => CHtml::link(CHtml::encode(UserApi::getNameByUserId($model->user_id)), array('/store/user/view', 'id' => $model->user_id))), 'i_want_to', 'property_name', 'description', 'features', 'featured', 'jackpot_investment', 'instant_home', 'propertyType.property_type', 'transactionType.transaction_type', 'locality.locality', 'address', 'bathrooms', 'bedrooms', 'furnished', 'age_of_construction', 'ownershipType.ownership_type', 'covered_area', 'land_area', 'total_price', 'per_unit_price', 'area_type', 'display_price', 'price_negotiable', 'available_from', 'available_units', 'facing', 'floor_number', 'total_floors', 'landmarks', 'tax_fees', 'terms_and_conditions')));
$images = PropertyImagesApi::getAllImages($model->id);
$propertyAmenities = $model->propertyAmenities;
$amenities = null;
foreach ($propertyAmenities as $i => $propertyAmenity) {
    if ($i != 0) {
        $amenities .= ", ";
    }
    $amenities .= $propertyAmenity->amenity->amenity;
}
?>
<table id="yw0" class="detail-view">
	<tbody>
		<tr class="even">
			<th>Average Rating</th>
			<td><?php 
echo PropertyRatingApi::getRating($model->id);
?>
</td>
Exemple #22
0
<?php

//Check if referrer is Clickatell
//if($_SERVER['REMOTE_ADDR'] == '196.5.254.33')
//{
//Bootstrap!
require '../includes/master.inc.php';
//check for all required CLICKATELL vars
if (!empty($_REQUEST['api_id']) && !empty($_REQUEST['apiMsgId']) && !empty($_REQUEST['timestamp']) && !empty($_REQUEST['to']) && !empty($_REQUEST['status']) && !empty($_REQUEST['charge'])) {
    //first check the api_id
    $ua = new UserApi();
    if ($aUserApi = $ua->checkApi($_REQUEST['api_id'])) {
        //Fire up tracker
        $t = new Tracker2();
        //first look for existing msg_id
        if ($_REQUEST['status'] !== 4 && ($tid = $t->checkMsg($_REQUEST['apiMsgId']))) {
            //just update status (should check for existing status?)
            $t->select($tid);
            $t->timestamp = $_REQUEST['timestamp'];
            $t->status = $_REQUEST['status'];
            $t->internal_timestamp = time();
            $t->update();
        } else {
            //Store tracker
            $t = new Tracker2();
            $t->api_id = $_REQUEST['api_id'];
            $t->user_id = 1;
            $t->msg_id = $_REQUEST['apiMsgId'];
            $t->user_msg_id = !empty($_REQUEST['cliMsgId']) ? $_REQUEST['cliMsgId'] : '';
            $t->charge = $_REQUEST['charge'];
            $t->to = $_REQUEST['to'];
 public function actionView($id)
 {
     Yii::beginProfile('property_view');
     $session = Yii::app()->session;
     $property = PropertyApi::getPropertyById($id);
     if (!$property) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     if (!$property->furnished) {
         $property->furnished = '-';
     }
     if (!$property->floor_number) {
         $property->floor_number = '-';
     }
     if (!$property->total_floors) {
         $property->total_floors = '-';
     }
     if (!$property->facing) {
         $property->facing = '-';
     }
     $recentlyViewed = UserApi::getUserProfileDetails($property->recently_viewed);
     $propertyAgentInfo = AgentProfileApi::getAgentDetails($property->user_id);
     $propertyUser = "";
     $propertyAgent = "";
     $propertyBuilder = "";
     $propertyBuilderInfo = "";
     $propertySpecialist = "";
     $propertySpecialistInfo = "";
     $propertyRating = "";
     $propertyRating = PropertyRatingApi::getRating($id);
     if ($propertyAgentInfo) {
         $propertyAgent = UserApi::getUserProfileDetails($propertyAgentInfo->user_id);
     } else {
         $propertyBuilderInfo = BuilderProfileApi::getBuilderDetails($property->user_id);
         if ($propertyBuilderInfo) {
             $propertyBuilder = UserApi::getUserProfileDetails($propertyBuilderInfo->user_id);
         } else {
             $propertySpecialistInfo = SpecialistProfileApi::getSpecialistDetails($property->user_id);
             if ($propertySpecialistInfo) {
                 $propertySpecialist = UserApi::getUserProfileDetails($propertySpecialistInfo->user_id);
             } else {
                 $propertyUser = UserApi::getUser($property->user_id);
             }
         }
     }
     $propertySimilar = PropertyApi::getSimilarProperties($property, 3, $id);
     $propertySimilarAddress = "";
     $propertySimilarUser = "";
     if ($propertySimilar) {
         foreach ($propertySimilar as $similar) {
             $propertySimilarAddress[$similar->id] = PropertyApi::getLocation($similar->id);
             $propertySimilarUser[$similar->id] = UserApi::getUserProfileDetails($similar->user_id);
         }
     }
     $recentlyViewedIds[] = '';
     $recentlyViewedIds_total = $session['properties'];
     if ($recentlyViewedIds_total) {
         $re_array = array_reverse($recentlyViewedIds_total);
         $i = 0;
         foreach ($re_array as $re) {
             $recentlyViewedIds = $re;
             $i++;
             if ($i > 2) {
                 break;
             }
         }
     }
     $property_ids[] = $recentlyViewedIds;
     $property_ids[] = $id;
     $session['properties'] = array_unique($property_ids);
     $propertyRecentlyViewed = "";
     $propertyRecentlyViewedAddress = "";
     $propertyRecentlyViewedUser = "";
     if ($recentlyViewedIds) {
         foreach ($recentlyViewedIds as $recent) {
             $modelProperty = PropertyApi::getPropertyById($recent);
             if ($modelProperty) {
                 $propertyRecentlyViewed[] = $modelProperty;
                 $propertyRecentlyViewedAddress[] = PropertyApi::getLocation($recent);
                 $propertyRecentlyViewedUser[] = UserApi::getUserProfileDetails($modelProperty->user_id);
             }
         }
     }
     $propertyImages = PropertyImagesApi::getAllImages($property->id);
     $propertyType = PropertyTypesApi::getPropertyTypeById($property->property_type_id);
     $transactionType = PropertyTransactionTypesApi::getTransactionTypeById($property->transaction_type_id);
     $ownershipType = OwnershipTypesApi::getOwnershipTypeById($property->ownership_type_id);
     $propertyAge = PropertyAgeOfConstructionApi::getpropertyAgeById($property->age_of_construction);
     $propertyAmenities = PropertyAmenitiesApi::getAmenitiesForProperty($property->id);
     $propertyAddress = PropertyApi::getLocation($property->id);
     $propertyRating = PropertyRatingApi::getRating($property->id);
     $propertyWishlist = PropertyWishlistApi::getWishlistUserOnProperty($property->id, Yii::app()->user->id);
     $this->render('view', array('property' => $property, 'recentlyViewed' => $recentlyViewed, 'propertyAgentInfo' => $propertyAgentInfo, 'propertyBuilderInfo' => $propertyBuilderInfo, 'propertySpecialistInfo' => $propertySpecialistInfo, 'propertyUser' => $propertyUser, 'propertyAgent' => $propertyAgent, 'propertyBuilder' => $propertyBuilder, 'propertySpecialist' => $propertySpecialist, 'propertySimilar' => $propertySimilar, 'propertySimilarAddress' => $propertySimilarAddress, 'propertySimilarUser' => $propertySimilarUser, 'propertyRecentlyViewed' => $propertyRecentlyViewed, 'propertyRecentlyViewedAddress' => $propertyRecentlyViewedAddress, 'propertyRecentlyViewedUser' => $propertyRecentlyViewedUser, 'propertyImages' => $propertyImages, 'propertyType' => $propertyType, 'propertyAddress' => $propertyAddress, 'transactionType' => $transactionType, 'ownershipType' => $ownershipType, 'propertyAge' => $propertyAge, 'propertyAmenities' => $propertyAmenities, 'propertyRating' => $propertyRating, 'propertyWishlist' => $propertyWishlist));
     Yii::endProfile('property_view');
 }
Exemple #24
0
        <?php 
echo $form->textField($profilesModel, 'last_name', array('size' => 20, 'maxlength' => 20));
?>
        <?php 
echo $form->error($profilesModel, 'last_name');
?>
    </div>

   
   
    <div class="row">
        <?php 
echo $form->labelEx($profilesModel, 'gender');
?>
        <?php 
echo $form->dropDownList($profilesModel, 'gender', UserApi::getAllgender(), array('empty' => 'Select a gender'));
?>
        <?php 
echo $form->error($profilesModel, 'gender');
?>
    </div>

    
    <div class="row">
        <?php 
echo $form->labelEx($profilesModel, 'address_line1');
?>
        <?php 
echo $form->textArea($profilesModel, 'address_line1', array('rows' => 6, 'cols' => 50));
?>
        <?php 
Exemple #25
0
 /**
 * @param $code string Auth code returned by qq
 * @return array if success return access_token, expire_in and refresh_token
 *               if failed return error code and description
 *
     'access_token' => string '313F00C54AC512A7ED1C664EE198B615' (length=32)
     'expires_in' => string '7776000' (length=7)
     'refresh_token' => string 'A5D30D009A349AA8197C86DECEC77BD8' (length=32)
     'code' => int 0
 */
 public function getAccessToken($code = "")
 {
     if (empty($code) && empty($this->refreshToken)) {
         Logger::ERROR("Try to get access token, but neither code nor refresh token was empty.", "", "", "qq_sdk_err");
         return ['code' => -1, 'desc' => "neither code nor refresh token was empty."];
     }
     $url = "https://graph.qq.com/oauth2.0/token";
     $isRefresh = !empty($this->refreshToken);
     $params = ['grant_type' => $isRefresh ? 'refresh_token' : 'authorization_code', 'client_id' => $this->appId, 'client_secret' => $this->appKey, 'redirect_uri' => $this->callback];
     if ($isRefresh) {
         $params['refresh_token'] = $this->refreshToken;
     } else {
         $params['code'] = $code;
     }
     $response = @file_get_contents($url . "?" . http_build_query($params));
     $result = [];
     if (strpos($response, "callback") !== false) {
         $lpos = strpos($response, "(");
         $rpos = strrpos($response, ")");
         $response = substr($response, $lpos + 1, $rpos - $lpos - 1);
         $msg = json_decode($response);
         if (isset($msg->error)) {
             $result['code'] = $msg->error;
             $result['desc'] = $msg->error_description;
             return $result;
         }
     }
     parse_str($response, $result);
     $result['code'] = 0;
     $this->accessToken = $result['access_token'];
     $this->refreshToken = $result['refresh_token'];
     $result['expires_in'] += time();
     $user = self::getSelfInfo();
     if (!$user['openid']) {
         return $user;
     }
     $result['uid'] = $user['openid'];
     UserApi::saveAccessToken($result);
     return $result;
 }
Exemple #26
0
?>
<br />

<?php 
if ($projectViews) {
    ?>
<span>Views :</span><?php 
    echo $projectViews->views;
    ?>
<br /><?php 
}
if ($project->recently_viewed) {
    ?>
<span>Recently Viewed By :</span>
<?php 
    $name = UserApi::getUserProfileDetails($projectViews->recently_viewed);
    echo $name->first_name, " ", $name->last_name;
    ?>
<br /><?php 
}
?>
</div>
<?php 
if ($projectAgentInfo) {
    ?>
<div class="white_wrap">
<h2>Agent Information</h2>
<div style="padding: 10px;">
<p><b><?php 
    echo $projectAgentInfo->company_name;
    ?>
Exemple #27
0
<?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'user-specialist-projects-form', 'enableAjaxValidation' => false));
?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php 
echo $form->errorSummary($model);
?>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'user_id');
?>
		<?php 
echo $form->dropDownList($model, 'user_id', UserApi::getUserList(), array('empty' => 'Select'));
?>
		<?php 
echo $form->error($model, 'user_id');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'specialist_type_id');
?>
		<?php 
echo $form->dropDownList($model, 'specialist_type_id', CHtml::listData(Specializations::model()->findAll(), 'id', 'specialist'), array('empty' => 'Select'));
?>
		<?php 
echo $form->error($model, 'specialist_type_id');
Exemple #28
0
                            <span class="block_box">  <input type="submit" value="UnBlock" class="btn" name="<?php 
        echo $userProfile->id;
        ?>
">
                            
                             </span>
                            <p class="blockusers_info">
                            <span class="user-thumbnail">
                            </span> <!-- .user-thumbnail END --> </p>                           
                            <span class="user_name"><?php 
        echo $userProfile->first_name . " " . $userProfile->last_name;
        ?>
 </span>
                            <br/><br/>
                            <span class="coll_name">   <?php 
        echo UserApi::getAge($userProfile->dob) . " " . "Years" . "," . ucwords(strtolower($userProfile->gender));
        ?>
 </span>                            
                            <hr class="privacy_divider"/> 
                            
                            
                            <?php 
    }
}
?>
                             
                            
                            
                            
                                      
                            
Exemple #29
0
<?php

$this->breadcrumbs = array('User Specialist Projects' => array('index'), 'View');
$this->menu = array(array('label' => 'List UserSpecialistProjects', 'url' => array('index')), array('label' => 'Create UserSpecialistProjects', 'url' => array('create')), array('label' => 'Update UserSpecialistProjects', 'url' => array('update', 'id' => $model->id)), array('label' => 'Delete UserSpecialistProjects', 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => 'Are you sure you want to delete this item?')), array('label' => 'Manage UserSpecialistProjects', 'url' => array('admin')));
?>

<h1>View UserSpecialistProjects</h1>

<?php 
$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('id', array('name' => 'user_id', 'value' => UserApi::getNameByUserId($model->user_id)), array('name' => 'specialist_type_id', 'value' => SpecializationsApi::getSpecializationById($model->specialist_type_id)), 'project_name', 'description', 'image', 'duration', 'updated_time', 'updated_by', 'created_time', 'created_by')));
Exemple #30
0
<?php

$this->breadcrumbs = array('Jukebox Questions' => array('index'), 'View');
$this->menu = array(array('label' => 'List JukeboxQuestions', 'url' => array('index')), array('label' => 'Create JukeboxQuestions', 'url' => array('create')), array('label' => 'Update JukeboxQuestions', 'url' => array('update', 'id' => $model->id)), array('label' => 'Delete JukeboxQuestions', 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => 'Are you sure you want to delete this item?')), array('label' => 'Manage JukeboxQuestions', 'url' => array('admin')));
?>

<h1>View JukeboxQuestions</h1>

<?php 
$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('id', array('label' => 'User Name', 'type' => 'raw', 'value' => CHtml::link(CHtml::encode(UserApi::getNameByUserId($model->user_id)), array('/store/user/view', 'id' => $model->user_id))), 'question', 'description', 'category.category')));