本文整理汇总了PHP中Projects::getErrors方法的典型用法代码示例。如果您正苦于以下问题:PHP Projects::getErrors方法的具体用法?PHP Projects::getErrors怎么用?PHP Projects::getErrors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Projects
的用法示例。
在下文中一共展示了Projects::getErrors方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionSaveproject
public function actionSaveproject()
{
header('Access-Control-Allow-Origin: *');
$rows = array();
if (Homeowners::model()->countByAttributes(array('email' => $_POST['email'])) == 0) {
if (Homeowners::model()->countByAttributes(array('username' => $_POST['username'])) == 0) {
$password = Yii::app()->Ini->generate_password();
$huser = new Homeowners();
$huser->firstname = $_POST['firstname'];
$huser->lastname = $_POST['lastname'];
$huser->email = $_POST['email'];
$huser->phone_number = $_POST['phone_number'];
$huser->username = $_POST['username'];
$huser->password = $password;
if ($huser->save()) {
Yii::app()->Ini->savetovnoc($_POST['email']);
$owner_id = Yii::app()->db->getLastInsertId();
Yii::app()->Ini->savetoaffiliate($owner_id, 'homeowner');
$this->SendMailAfterSignUp($owner_id);
$proj = new Projects();
$proj->project_type_id = $_POST['projecttype'];
$proj->description = $_POST['projectdesc'];
$proj->start_date = $_POST['projectstart'];
$proj->status_for_project = $_POST['projectstatus'];
$proj->time_frame = $_POST['projecttimeframe'];
$proj->owned_property = $_POST['won_pro'];
$proj->address = $_POST['projectaddress'];
$proj->state_id = $_POST['projectstate'];
$proj->city = $_POST['city'];
$proj->zipcode = $_POST['zip_code'];
$proj->budget = $_POST['projectbudget'];
$proj->homeowner_id = $owner_id;
if ($proj->save()) {
$proj_id = Yii::app()->db->getLastInsertId();
$this->SendMailAfterProject($proj_id);
Yii::app()->Ini->renovationapi($proj_id);
$this->renderRequest(array('success' => true));
} else {
$this->renderRequest(false, $proj->getErrors());
}
} else {
$this->renderRequest(false, $huser->getErrors());
}
} else {
$this->renderRequest(false, 'Username already exists');
}
} else {
$this->renderRequest(false, 'Email already exists');
}
}
示例2: saveproject
public function saveproject($post)
{
$indicator = $post['indicator'];
$status = true;
$return['indicator'] = $indicator;
if ($indicator == 2) {
if (Homeowners::model()->countByAttributes(array('email' => $post['homeown_email'])) == 0) {
if (Homeowners::model()->countByAttributes(array('username' => $post['howeown_pname'])) == 0) {
$password = Yii::app()->Ini->generate_password();
$huser = new Homeowners();
$huser->firstname = $post['homeown_fname'];
$huser->lastname = $post['homeown_lname'];
$huser->email = $post['homeown_email'];
$huser->phone_number = $post['homeown_phone'];
$huser->username = $post['howeown_pname'];
$huser->password = $password;
if ($huser->save()) {
Yii::app()->Ini->savetovnoc($post['homeown_email']);
$owner_id = Yii::app()->db->getLastInsertId();
Yii::app()->Ini->savetoaffiliate($owner_id, 'homeowner');
Yii::app()->Ini->savetocampaign($huser->email, $huser->firstname . ' ' . $huser->lastname);
$this->SendMailAfterSignUp($owner_id);
$refer_id = $post['refer_id'];
if ($refer_id != '') {
$ref = new Referral();
$ref->userid = $owner_id;
$ref->user_type = 'homeowner';
$ref->referred_by = $refer_id;
$ref->referred_by_type = 'contractor';
$ref->save();
}
} else {
$status = false;
$return['message'] = $huser->getErrors();
}
} else {
$status = false;
$return['message'] = "Username already exists.";
}
} else {
$status = false;
$return['message'] = "Email already exists.";
}
} elseif ($indicator == 3) {
$status = true;
$owner_id = Yii::app()->user->getId();
} else {
$identity = new UserIdentity($post['home_loginEmail'], $post['home_loginPassword'], 'homeowner');
if ($identity->authenticate()) {
Yii::app()->user->login($identity);
$owner_id = Yii::app()->user->getId();
} else {
$status = false;
$return['message'] = $identity->errorMessage;
}
}
if ($status) {
//saving to project
$proj = new Projects();
$proj->project_type_id = $post['projecttype'];
$proj->description = $post['projectdesc'];
$proj->start_date = $post['projectstart'];
$proj->status_for_project = $post['projectstatus'];
$proj->time_frame = $post['projecttimeframe'];
$proj->owned_property = $post['won_pro'];
$proj->address = $post['projectaddress'];
$proj->state_id = $post['projectstate'];
$proj->city = $post['city'];
$proj->zipcode = $post['zip_code'];
$proj->budget = $post['projectbudget'];
$proj->homeowner_id = $owner_id;
if ($proj->save()) {
$proj_id = Yii::app()->db->getLastInsertId();
$this->SendMailAfterProject($proj_id);
Yii::app()->Ini->renovationapi($proj_id);
if ($indicator == 3) {
$return['message'] = $this->renderPartial('successpost', array(), true);
} else {
if ($indicator == 2) {
//echo $password;
//echo $post['homeown_email'];
//$return['message'] = $this->renderPartial('success', array(), true);
$return['projectid'] = $proj_id;
$identity = new UserIdentity($post['homeown_email'], $password, 'homeowner');
if ($identity->authenticate()) {
Yii::app()->user->login($identity);
$owner_id = Yii::app()->user->getId();
$return['message'] = $this->renderPartial('success', array(), true);
} else {
$status = false;
$return['message'] = $identity->errorMessage;
}
} else {
$return['message'] = $this->renderPartial('success', array(), true);
}
}
} else {
$status = false;
$return['message'] = $proj->getErrors();
}
//.........这里部分代码省略.........