本文整理汇总了PHP中ActiveRecord::getDefaultAreaCode方法的典型用法代码示例。如果您正苦于以下问题:PHP ActiveRecord::getDefaultAreaCode方法的具体用法?PHP ActiveRecord::getDefaultAreaCode怎么用?PHP ActiveRecord::getDefaultAreaCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActiveRecord
的用法示例。
在下文中一共展示了ActiveRecord::getDefaultAreaCode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$model = new ProGlobalEnquiry('create');
$model->country_id = ActiveRecord::getDefaultAreaCode();
if (isset(Yii::app()->user->id)) {
$model->name = Yii::app()->user->title . ' ' . Yii::app()->user->first_name . ' ' . Yii::app()->user->last_name;
$model->email = Yii::app()->user->email;
if (Yii::app()->user->role_id != ROLE_REGISTER_MEMBER) {
$model->email = Yii::app()->user->email_not_login;
}
$model->phone = Yii::app()->user->phone;
$model->country_id = Yii::app()->user->country;
}
if (isset(Yii::app()->user->id)) {
$cmsFormater = new CmsFormatter();
$mUser = Users::model()->findByPk(Yii::app()->user->id);
$model->name = $cmsFormater->formatFullNameRegisteredUsers($mUser);
$model->email = $mUser->email;
$model->nric = $mUser->nric_passportno_roc;
$model->phone = $mUser->phone;
if (Yii::app()->user->role_id == ROLE_LANDLORD || Yii::app()->user->role_id == ROLE_TENANT) {
$model->phone = $mUser->contact_no;
$model->email = $mUser->email_not_login;
}
if (Yii::app()->user->role_id == ROLE_AGENT) {
$model->email = $mUser->email_not_login;
}
}
// $model->type_selling= 'Tenancy';
$box = Pages::getPageById(PAGE_ENGAGE_US_BOX);
$this->render("global_enquiry", array('model' => $model, 'box' => $box));
}
示例2: run
public function run()
{
$box = Pages::getPageById(PAGE_PROPERTY_BOX);
$model = new ProEnquiryProperty();
$mListing = Listing::model()->findByPk($this->property_id);
// echo $mListing->property_name_or_address;die;
Listing::ReplaceContentCmsPage($box, $mListing);
$model->country_id = ActiveRecord::getDefaultAreaCode();
if (isset(Yii::app()->user->id)) {
$model->name = Yii::app()->user->title . ' ' . Yii::app()->user->first_name . ' ' . Yii::app()->user->last_name;
$model->email = Yii::app()->user->email;
if (Yii::app()->user->role_id != ROLE_REGISTER_MEMBER) {
$model->email = Yii::app()->user->email_not_login;
}
$model->phone = Yii::app()->user->phone;
$model->country_id = Yii::app()->user->country;
}
$this->dir = Yii::getPathOfAlias('application.components.views') . '/_agent_detail.php';
$model->description = trim(strip_tags($box->content));
if ($this->position == "bottom") {
$this->render("enquiry_bottom", array('model' => $model, 'box' => $box, 'property_id' => $this->property_id, 'agent_id' => $this->agent_id, 'dir' => $this->dir, 'position' => 'bottom'));
} else {
$this->render("enquiry_right", array('model' => $model, 'box' => $box, 'property_id' => $this->property_id, 'agent_id' => $this->agent_id, 'dir' => $this->dir, 'position' => 'right'));
}
}
示例3: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
try {
$model = new Users('create_agent');
$model->area_code_id = ActiveRecord::getDefaultAreaCode();
$model->country_id = ActiveRecord::getDefaultAreaCode();
$model->license = Yii::app()->params['company_license'];
$model->agent_company_name = Yii::app()->params['company_name'];
$this->ajaxGetFirstTier($model);
if (isset($_POST['Users'])) {
$model->attributes = $_POST['Users'];
$model->role_id = ROLE_AGENT;
$model->temp_password = $_POST['Users']['password_hash'];
$model->application_id = FE;
$model->avatar = CUploadedFile::getInstance($model, 'avatar');
$model->agent_company_logo = CUploadedFile::getInstance($model, 'agent_company_logo');
$model->validate();
if (!$model->hasErrors()) {
$model->save();
$model->password_hash = md5($_POST['Users']['password_hash']);
$model->scenario = NULL;
$model->update(array('password_hash'));
$model->save();
if (!is_null($model->avatar)) {
$model->avatar = Users::saveImage($model, 'avatar');
Users::resizeImage($model, 'avatar', Users::$aSize);
$model->update(array('avatar'));
}
if (!is_null($model->agent_company_logo)) {
$model->agent_company_logo = Users::saveImage($model, 'agent_company_logo');
Users::resizeImage($model, 'agent_company_logo', Users::$aSizeLogo);
$model->update(array('agent_company_logo'));
}
ProAgentTierManager::saveAgentTier($model, isset($_POST['tier_id']) ? $_POST['tier_id'] : array());
ProAgentDistrict::saveAgentDistict($model, $model->ProAgentDistrict);
$this->redirect(array('view', 'id' => $model->id));
}
}
$this->render('create', 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));
}
}