当前位置: 首页>>代码示例>>PHP>>正文


PHP Member::validate方法代码示例

本文整理汇总了PHP中Member::validate方法的典型用法代码示例。如果您正苦于以下问题:PHP Member::validate方法的具体用法?PHP Member::validate怎么用?PHP Member::validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Member的用法示例。


在下文中一共展示了Member::validate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create

 /**
  * Create member account from data array.
  * Data must contain unique identifier.
  *
  * @throws ValidationException
  * @param $data - map of member data
  * @return Member|boolean - new member (not saved to db), or false if there is an error.
  */
 public function create($data)
 {
     $result = new ValidationResult();
     if (!Checkout::member_creation_enabled()) {
         $result->error(_t("Checkout.MEMBERSHIPSNOTALLOWED", "Creating new memberships is not allowed"));
         throw new ValidationException($result);
     }
     $idfield = Config::inst()->get('Member', 'unique_identifier_field');
     if (!isset($data[$idfield]) || empty($data[$idfield])) {
         $result->error(sprintf(_t("Checkout.IDFIELDNOTFOUND", "Required field not found: %s"), $idfield));
         throw new ValidationException($result);
     }
     if (!isset($data['Password']) || empty($data['Password'])) {
         $result->error(_t("Checkout.PASSWORDREQUIRED", "A password is required"));
         throw new ValidationException($result);
     }
     $idval = $data[$idfield];
     if (ShopMember::get_by_identifier($idval)) {
         $result->error(sprintf(_t("Checkout.MEMBEREXISTS", "A member already exists with the %s %s"), _t("Member." . $idfield, $idfield), $idval));
         throw new ValidationException($result);
     }
     $member = new Member(Convert::raw2sql($data));
     $validation = $member->validate();
     if (!$validation->valid()) {
         //TODO need to handle i18n here?
         $result->error($validation->message());
     }
     if (!$result->valid()) {
         throw new ValidationException($result);
     }
     return $member;
 }
开发者ID:renskorswagen,项目名称:silverstripe-shop,代码行数:40,代码来源:ShopMemberFactory.php

示例2: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $user = new User();
     $member = new Member();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['User'], $_POST['Member'])) {
         $user->attributes = $_POST['User'];
         $user->repeat_password = $_POST['User']['repeat_password'];
         $member->attributes = $_POST['Member'];
         $member->type_account = $_POST['Member']['type_account'];
         $user->scenario = 'register';
         $member->scenario = 'register';
         $user->level = 3;
         $valid = $user->validate();
         $valid = $member->validate() && $valid;
         if ($valid) {
             $email = explode("@", $user->username);
             $member->name = $email[0];
             $member->email = $user->username;
             $member->date_register = new CDbExpression('NOW()');
             $member->code = strtoupper(substr(md5(uniqid(rand(), true)), 0, 5));
             $getToken = rand(0, 99999);
             $getTime = date("H:i:s");
             $user->token = md5($getToken . $getTime);
             $user->save();
             $member->save();
             MemberController::SendMail($member->email, $member->name, $member->code, $user->token);
             echo CJSON::encode(array('reg' => 'success', 'redirect' => $this->createUrl(array('land/userme')), 'email' => $member->email));
         } else {
             echo CJSON::encode(array('reg' => 'failed', 'email' => str_replace('Username', 'Email', CHtml::error($user, 'username')), 'username' => str_replace('Name', 'Username', CHtml::error($member, 'name')), 'password' => CHtml::error($user, 'password'), 'repeat_password' => CHtml::error($user, 'repeat_password'), 'all' => Chtml::errorSummary(array($user, $member))));
         }
     }
 }
开发者ID:Dvionst,项目名称:vvfy,代码行数:38,代码来源:UserController.php

示例3: doValidate

 /**
  * This function performs the validation work for complex object models.
  *
  * In addition to checking the current object, all related objects will
  * also be validated.  If all pass then <code>true</code> is returned; otherwise
  * an aggreagated array of ValidationFailed objects will be returned.
  *
  * @param      array $columns Array of column names to validate.
  * @return     mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
  */
 protected function doValidate($columns = null)
 {
     if (!$this->alreadyInValidation) {
         $this->alreadyInValidation = true;
         $retval = null;
         $failureMap = array();
         // We call the validate method on the following object(s) if they
         // were passed to this object by their coresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aMember !== null) {
             if (!$this->aMember->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aMember->getValidationFailures());
             }
         }
         if ($this->aWingJob !== null) {
             if (!$this->aWingJob->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aWingJob->getValidationFailures());
             }
         }
         if (($retval = MemberWingJobPeer::doValidate($this, $columns)) !== true) {
             $failureMap = array_merge($failureMap, $retval);
         }
         $this->alreadyInValidation = false;
     }
     return !empty($failureMap) ? $failureMap : true;
 }
开发者ID:yasirgit,项目名称:afids,代码行数:37,代码来源:BaseMemberWingJob.php

示例4: actionRegister

 public function actionRegister()
 {
     $model = new Member();
     if (isset($_POST['Member'])) {
         $model->attributes = $_POST['Member'];
         if ($model->validate()) {
             $model->repass = md5($model->repass);
             $model->password = md5($model->password);
             if ($model->save()) {
                 $this->redirect(array(Yii::app()->getBaseUrl()));
             }
         }
     }
     $this->render('register', array('model' => $model));
 }
开发者ID:nctruong,项目名称:inputen,代码行数:15,代码来源:MemberController.php

示例5: doValidate

 /**
  * This function performs the validation work for complex object models.
  *
  * In addition to checking the current object, all related objects will
  * also be validated.  If all pass then <code>true</code> is returned; otherwise
  * an aggreagated array of ValidationFailed objects will be returned.
  *
  * @param      array $columns Array of column names to validate.
  * @return     mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
  */
 protected function doValidate($columns = null)
 {
     if (!$this->alreadyInValidation) {
         $this->alreadyInValidation = true;
         $retval = null;
         $failureMap = array();
         // We call the validate method on the following object(s) if they
         // were passed to this object by their coresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aMember !== null) {
             if (!$this->aMember->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aMember->getValidationFailures());
             }
         }
         if ($this->aCoordinatorRelatedByLeadId !== null) {
             if (!$this->aCoordinatorRelatedByLeadId->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aCoordinatorRelatedByLeadId->getValidationFailures());
             }
         }
         if (($retval = CoordinatorPeer::doValidate($this, $columns)) !== true) {
             $failureMap = array_merge($failureMap, $retval);
         }
         if ($this->collCoordinatorsRelatedByLeadId !== null) {
             foreach ($this->collCoordinatorsRelatedByLeadId as $referrerFK) {
                 if (!$referrerFK->validate($columns)) {
                     $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                 }
             }
         }
         if ($this->collMissions !== null) {
             foreach ($this->collMissions as $referrerFK) {
                 if (!$referrerFK->validate($columns)) {
                     $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                 }
             }
         }
         if ($this->collMissionLegs !== null) {
             foreach ($this->collMissionLegs as $referrerFK) {
                 if (!$referrerFK->validate($columns)) {
                     $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                 }
             }
         }
         $this->alreadyInValidation = false;
     }
     return !empty($failureMap) ? $failureMap : true;
 }
开发者ID:yasirgit,项目名称:afids,代码行数:58,代码来源:BaseCoordinator.php

示例6: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Member();
     if (isset($_GET['returnurl'])) {
         $returnurl = $_GET['returnurl'];
         $model->returnurl = $returnurl;
     }
     //$model->invitekey = $key;
     //$result = $model->checksignupemail($key);
     $isval = true;
     $result = true;
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Member'])) {
         $model->attributes = $_POST['Member'];
         $model->formpassword = $model->password;
         $model->active = 1;
         //$model->sendinvitekey = sha1($model->email.'sendivite');
         if (isset($_GET['returnurl'])) {
             $returnurl = $_GET['returnurl'];
         } else {
             $returnurl = '';
         }
         // no longer using invites so commenting out
         //$status = $this->getInviteStatus($model,$_POST['Member']['email'],$_POST['Member']['invitekey']);
         if ($model->validate()) {
             if ($model->saveData()) {
                 $identity = new UserIdentity($model->membername, $_POST['Member']['password']);
                 $identity->authenticate();
                 if ($identity->errorCode === UserIdentity::ERROR_NONE) {
                     Yii::app()->user->login($identity);
                     Member::model()->updateLastLoginTime($identity->id);
                     if (empty($returnurl)) {
                         $this->redirect(array('member/manage'));
                     } else {
                         $this->redirect($returnurl);
                     }
                 }
             }
             // end model savedata
         }
         // end if model validate
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:rgummadi,项目名称:ScriptOverflow,代码行数:49,代码来源:MemberController.php

示例7: actionIndex

 public function actionIndex()
 {
     MemberNetwork::model()->updateNetwork(11, 10);
     $this->pageTitle = Lang::t('Register');
     //member model
     $member_model = new Member();
     $member_model_class_name = $member_model->getClassName();
     //user model
     $user_model = new Users(Users::SCENARIO_SIGNUP);
     $user_model->activation_code = Common::generateHash(microtime());
     $user_model->user_level = UserLevels::LEVEL_MEMBER;
     $user_model->timezone = SettingsTimezone::DEFAULT_TIME_ZONE;
     $user_model_class_name = $user_model->getClassName();
     //person model
     $person_model = new Person();
     $person_model_class_name = $person_model->getClassName();
     if (Yii::app()->request->isPostRequest) {
         if (isset($_POST[$member_model_class_name])) {
             $member_model->attributes = $_POST[$member_model_class_name];
             $member_model->validate();
         }
         if (isset($_POST[$user_model_class_name])) {
             $user_model->validatorList->add(CValidator::createValidator('CaptchaExtendedValidator', $user_model, 'verifyCode', array('allowEmpty' => !CCaptcha::checkRequirements())));
             $user_model->attributes = $_POST[$user_model_class_name];
             $user_model->validate();
         }
         if (isset($_POST[$person_model_class_name])) {
             $person_model->attributes = $_POST[$person_model_class_name];
             $person_model->validate();
         }
         if (!$member_model->hasErrors() && !$user_model->hasErrors() && !$person_model->hasErrors()) {
             if ($user_model->save(FALSE)) {
                 $person_model->id = $user_model->id;
                 $person_model->save(FALSE);
                 $member_model->id = $user_model->id;
                 $member_model->save(FALSE);
                 Yii::app()->user->setFlash('success', Lang::t('Check your email for account activation email.'));
                 $this->refresh();
             }
         }
     }
     $this->render('index', array('member_model' => $member_model, 'user_model' => $user_model, 'person_model' => $person_model));
 }
开发者ID:jacjimus,项目名称:furahia_mis,代码行数:43,代码来源:RegisterController.php

示例8: createUser

 /**
  * Creates a user in the database
  * @param {stdClass} $data Data passed from ActionScript
  * @return {array} Returns a standard response array
  */
 public function createUser($data)
 {
     $response = CodeBank_ClientAPI::responseBase();
     try {
         if (Member::get()->filter('Email', Convert::raw2sql($data->username))->count() > 0) {
             $response['status'] = 'EROR';
             $response['message'] = _t('CodeBankAPI.EMAIL_EXISTS', '_An account with that email already exists');
             return $response;
         }
         //Create and write member
         $member = new Member();
         $member->FirstName = !empty($data->firstname) ? $data->firstname : $data->username;
         $member->Surname = !empty($data->surname) ? $data->surname : null;
         $member->Email = $data->username;
         $member->Password = $data->Password;
         $member->UseHeartbeat = 0;
         if (!$member->validate()) {
             $response['status'] = 'EROR';
             $response['message'] = _t('CodeBankAPI.PASSWORD_NOT_VALID', '_Password is not valid');
             return $response;
         }
         $member->write();
         $response['status'] = 'HELO';
         $response['message'] = "User added successfully";
     } catch (Exception $e) {
         $response['status'] = 'EROR';
         $response['message'] = _t('CodeBankAPI.SERVER_ERROR', '_Server error has occured, please try again later');
     }
     return $response;
 }
开发者ID:helpfulrobot,项目名称:undefinedoffset-silverstripe-codebank,代码行数:35,代码来源:CodeBankAdministration.php

示例9: actMemberInfo

 public function actMemberInfo($memberdata, $userinfo, $userdata, $fluser, $from, $returnurl)
 {
     $member = new Member();
     if ($memberdata === false) {
         if ($from === 'facebook') {
             $member->oauthid = $fluser['id'];
             $member->oauthprovider = 'facebook';
             $member->membername = substr($fluser['first_name'], 0, 1) . $fluser['last_name'];
             $member->realname = $fluser['first_name'] . '' . $fluser['last_name'];
             $member->email = $fluser['email'];
             $member->password = 'test123';
             $result = $member->saveData();
             $member->membername = $member->membername . $member->memberid;
         } elseif ($from === 'linkedin') {
             $member->oauthid = strval($fluser->id);
             $member->oauthprovider = 'linkedin';
             $member->membername = substr(strval($fluser->{"first-name"}), 0, 1) . strval($fluser->{"last-name"});
             $member->realname = strval($fluser->{"first-name"}) . '' . strval($fluser->{"last-name"});
             $member->email = strval($fluser->{"email-address"});
             $member->password = 'test123';
             $result = $member->saveData();
             $member->membername = $member->membername . $member->memberid;
         } elseif ($from === 'openid') {
             $member->oauthid = $userinfo['id'];
             $member->oauthprovider = $userinfo['provider'];
             if ($member->oauthprovider !== "yahoo") {
                 $firstname = empty($userdata['namePerson/first']) ? '' : $userdata['namePerson/first'];
                 $lastname = empty($userdata['namePerson/last']) ? '' : $userdata['namePerson/last'];
                 $member->realname = $firstname . " " . $lastname;
             }
             if ($member->oauthprovider === "yahoo") {
                 $member->membername = $userdata['namePerson/friendly'];
             } else {
                 $member->membername = substr($firstname, 0, 1) . $lastname;
             }
             $member->email = $userdata['contact/email'];
             $member->password = 'test123';
             $result = $member->saveData();
             $member->membername = $member->membername . $member->memberid;
         }
         $this->render('create', array('model' => $member, 'oauthprovider' => $member->oauthprovider));
     } else {
         if (isset($_POST['Member'])) {
             $member->attributes = $_POST['Member'];
             $member->memberid = $memberdata['memberid'];
             $member->oauthprovider = $memberdata['oauthprovider'];
             if (empty($member->realname)) {
                 $member->realname = $memberdata['realname'];
             }
             if (empty($member->email)) {
                 $member->email = $memberdata['email'];
             }
             $member->password = $memberdata['password'];
             if ($_POST['submit'] == 'Cancel') {
                 $member->removeMember($member->memberid);
                 $this->redirect(array('site/index'));
             } else {
                 if ($_POST['submit'] == 'Create') {
                     if ($member->validate()) {
                         if ($member->updateOpenidData('membername')) {
                             $this->goLoginMember($member, $returnurl);
                         }
                         // end save
                     } else {
                         $this->render('create', array('model' => $member, 'oauthprovider' => $memberdata['oauthprovider']));
                     }
                 }
             }
             // end if post = update
         } else {
             if ($memberdata["active"] == 1) {
                 $member->membername = $memberdata["membername"];
                 $member->memberid = $memberdata["memberid"];
                 $this->goLoginMember($member, $returnurl);
             } else {
                 if ($memberdata["active"] == 0) {
                     $member->memberid = $memberdata["memberid"];
                     $member->membername = $memberdata["membername"];
                     $member->oauthprovider = $memberdata["oauthprovider"];
                     $this->render('create', array('model' => $member, 'oauthprovider' => $member->oauthprovider));
                 }
             }
         }
     }
     // end member present
 }
开发者ID:rgummadi,项目名称:ScriptOverflow,代码行数:86,代码来源:LoginController.php

示例10: doValidate

 /**
  * This function performs the validation work for complex object models.
  *
  * In addition to checking the current object, all related objects will
  * also be validated.  If all pass then <code>true</code> is returned; otherwise
  * an aggreagated array of ValidationFailed objects will be returned.
  *
  * @param      array $columns Array of column names to validate.
  * @return     mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
  */
 protected function doValidate($columns = null)
 {
     if (!$this->alreadyInValidation) {
         $this->alreadyInValidation = true;
         $retval = null;
         $failureMap = array();
         // We call the validate method on the following object(s) if they
         // were passed to this object by their coresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aMember !== null) {
             if (!$this->aMember->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aMember->getValidationFailures());
             }
         }
         if ($this->aAirport !== null) {
             if (!$this->aAirport->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aAirport->getValidationFailures());
             }
         }
         if ($this->aPilotRelatedByOrientedMemberId !== null) {
             if (!$this->aPilotRelatedByOrientedMemberId->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aPilotRelatedByOrientedMemberId->getValidationFailures());
             }
         }
         if ($this->aPilotRelatedByMopOrientedMemberId !== null) {
             if (!$this->aPilotRelatedByMopOrientedMemberId->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aPilotRelatedByMopOrientedMemberId->getValidationFailures());
             }
         }
         if (($retval = PilotPeer::doValidate($this, $columns)) !== true) {
             $failureMap = array_merge($failureMap, $retval);
         }
         if ($this->collMissionLegsRelatedByPilotId !== null) {
             foreach ($this->collMissionLegsRelatedByPilotId as $referrerFK) {
                 if (!$referrerFK->validate($columns)) {
                     $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                 }
             }
         }
         if ($this->collMissionLegsRelatedByBackupPilotId !== null) {
             foreach ($this->collMissionLegsRelatedByBackupPilotId as $referrerFK) {
                 if (!$referrerFK->validate($columns)) {
                     $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                 }
             }
         }
         if ($this->collMissionLegChanges !== null) {
             foreach ($this->collMissionLegChanges as $referrerFK) {
                 if (!$referrerFK->validate($columns)) {
                     $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                 }
             }
         }
         if ($this->collPersonalFlights !== null) {
             foreach ($this->collPersonalFlights as $referrerFK) {
                 if (!$referrerFK->validate($columns)) {
                     $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                 }
             }
         }
         if ($this->collPilotsRelatedByOrientedMemberId !== null) {
             foreach ($this->collPilotsRelatedByOrientedMemberId as $referrerFK) {
                 if (!$referrerFK->validate($columns)) {
                     $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                 }
             }
         }
         if ($this->collPilotsRelatedByMopOrientedMemberId !== null) {
             foreach ($this->collPilotsRelatedByMopOrientedMemberId as $referrerFK) {
                 if (!$referrerFK->validate($columns)) {
                     $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                 }
             }
         }
         $this->alreadyInValidation = false;
     }
     return !empty($failureMap) ? $failureMap : true;
 }
开发者ID:yasirgit,项目名称:afids,代码行数:89,代码来源:BasePilot.php

示例11: doValidate

 /**
  * This function performs the validation work for complex object models.
  *
  * In addition to checking the current object, all related objects will
  * also be validated.  If all pass then <code>true</code> is returned; otherwise
  * an aggreagated array of ValidationFailed objects will be returned.
  *
  * @param      array $columns Array of column names to validate.
  * @return     mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
  */
 protected function doValidate($columns = null)
 {
     if (!$this->alreadyInValidation) {
         $this->alreadyInValidation = true;
         $retval = null;
         $failureMap = array();
         // We call the validate method on the following object(s) if they
         // were passed to this object by their coresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aPerson !== null) {
             if (!$this->aPerson->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aPerson->getValidationFailures());
             }
         }
         if ($this->aWing !== null) {
             if (!$this->aWing->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aWing->getValidationFailures());
             }
         }
         if ($this->aMemberClass !== null) {
             if (!$this->aMemberClass->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aMemberClass->getValidationFailures());
             }
         }
         if ($this->aMemberRelatedByMasterMemberId !== null) {
             if (!$this->aMemberRelatedByMasterMemberId->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aMemberRelatedByMasterMemberId->getValidationFailures());
             }
         }
         if (($retval = MemberPeer::doValidate($this, $columns)) !== true) {
             $failureMap = array_merge($failureMap, $retval);
         }
         if ($this->collApplications !== null) {
             foreach ($this->collApplications as $referrerFK) {
                 if (!$referrerFK->validate($columns)) {
                     $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                 }
             }
         }
         if ($this->collAvailabilitys !== null) {
             foreach ($this->collAvailabilitys as $referrerFK) {
                 if (!$referrerFK->validate($columns)) {
                     $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                 }
             }
         }
         if ($this->collCoordinators !== null) {
             foreach ($this->collCoordinators as $referrerFK) {
                 if (!$referrerFK->validate($columns)) {
                     $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                 }
             }
         }
         if ($this->collMembersRelatedByMasterMemberId !== null) {
             foreach ($this->collMembersRelatedByMasterMemberId as $referrerFK) {
                 if (!$referrerFK->validate($columns)) {
                     $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                 }
             }
         }
         if ($this->collMemberWingJobs !== null) {
             foreach ($this->collMemberWingJobs as $referrerFK) {
                 if (!$referrerFK->validate($columns)) {
                     $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                 }
             }
         }
         if ($this->collMissionLegsRelatedByCopilotId !== null) {
             foreach ($this->collMissionLegsRelatedByCopilotId as $referrerFK) {
                 if (!$referrerFK->validate($columns)) {
                     $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                 }
             }
         }
         if ($this->collMissionLegsRelatedByBackupCopilotId !== null) {
             foreach ($this->collMissionLegsRelatedByBackupCopilotId as $referrerFK) {
                 if (!$referrerFK->validate($columns)) {
                     $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                 }
             }
         }
         if ($this->collPilots !== null) {
             foreach ($this->collPilots as $referrerFK) {
                 if (!$referrerFK->validate($columns)) {
                     $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                 }
             }
         }
         if ($this->collPilotAircrafts !== null) {
//.........这里部分代码省略.........
开发者ID:yasirgit,项目名称:afids,代码行数:101,代码来源:BaseMember.php

示例12: doValidate

 /**
  * This function performs the validation work for complex object models.
  *
  * In addition to checking the current object, all related objects will
  * also be validated.  If all pass then <code>true</code> is returned; otherwise
  * an aggreagated array of ValidationFailed objects will be returned.
  *
  * @param      array $columns Array of column names to validate.
  * @return     mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
  */
 protected function doValidate($columns = null)
 {
     if (!$this->alreadyInValidation) {
         $this->alreadyInValidation = true;
         $retval = null;
         $failureMap = array();
         // We call the validate method on the following object(s) if they
         // were passed to this object by their coresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aMission !== null) {
             if (!$this->aMission->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aMission->getValidationFailures());
             }
         }
         if ($this->aAirportRelatedByFromAirportId !== null) {
             if (!$this->aAirportRelatedByFromAirportId->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aAirportRelatedByFromAirportId->getValidationFailures());
             }
         }
         if ($this->aAirportRelatedByToAirportId !== null) {
             if (!$this->aAirportRelatedByToAirportId->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aAirportRelatedByToAirportId->getValidationFailures());
             }
         }
         if ($this->aCoordinator !== null) {
             if (!$this->aCoordinator->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aCoordinator->getValidationFailures());
             }
         }
         if ($this->aPilotRelatedByPilotId !== null) {
             if (!$this->aPilotRelatedByPilotId->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aPilotRelatedByPilotId->getValidationFailures());
             }
         }
         if ($this->aMemberRelatedByCopilotId !== null) {
             if (!$this->aMemberRelatedByCopilotId->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aMemberRelatedByCopilotId->getValidationFailures());
             }
         }
         if ($this->aPilotRelatedByBackupPilotId !== null) {
             if (!$this->aPilotRelatedByBackupPilotId->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aPilotRelatedByBackupPilotId->getValidationFailures());
             }
         }
         if ($this->aMemberRelatedByBackupCopilotId !== null) {
             if (!$this->aMemberRelatedByBackupCopilotId->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aMemberRelatedByBackupCopilotId->getValidationFailures());
             }
         }
         if ($this->aMissionReport !== null) {
             if (!$this->aMissionReport->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aMissionReport->getValidationFailures());
             }
         }
         if ($this->aPilotAircraft !== null) {
             if (!$this->aPilotAircraft->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aPilotAircraft->getValidationFailures());
             }
         }
         if ($this->aFbo !== null) {
             if (!$this->aFbo->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aFbo->getValidationFailures());
             }
         }
         if (($retval = MissionLegPeer::doValidate($this, $columns)) !== true) {
             $failureMap = array_merge($failureMap, $retval);
         }
         if ($this->singleAfaLeg !== null) {
             if (!$this->singleAfaLeg->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->singleAfaLeg->getValidationFailures());
             }
         }
         if ($this->collMissionPhotos !== null) {
             foreach ($this->collMissionPhotos as $referrerFK) {
                 if (!$referrerFK->validate($columns)) {
                     $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                 }
             }
         }
         if ($this->collPilotRequests !== null) {
             foreach ($this->collPilotRequests as $referrerFK) {
                 if (!$referrerFK->validate($columns)) {
                     $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                 }
             }
         }
         $this->alreadyInValidation = false;
     }
     return !empty($failureMap) ? $failureMap : true;
//.........这里部分代码省略.........
开发者ID:yasirgit,项目名称:afids,代码行数:101,代码来源:BaseMissionLeg.php

示例13: actionSaveMember

 public function actionSaveMember()
 {
     if (!Yii::app()->request->isPostRequest) {
         echo json_encode(array('status' => 0, 'message' => 'Only Post request are allowed.'));
         die;
     }
     if (Yii::app()->user->isGuest) {
         echo json_encode(array('status' => 0, 'message' => 'Only authorize user can allow this.'));
         die;
     }
     $member = new Member();
     $member->setAttributes($_POST);
     $member->validate();
     if (!UserAccessTable::checkUser2PropertyAccess(Yii::app()->user->getState('id'), $member->propertyId, UserAccessTable::FULL_ACCESS)) {
         echo json_encode(array('status' => 0, 'message' => 'You can not do this action.'));
         die;
     }
     $errors = $member->getErrors();
     if (count($errors) > 0) {
         echo json_encode(array('status' => 0, 'errors' => $errors));
         die;
     }
     //get property
     $property = Properties::model()->findByPk($member->propertyId);
     //check new user in database
     $user = User::model()->findByAttributes(array('email' => $member->email));
     if ($user != null) {
         //system already contains user with some email
         $eu2p = User2property::model()->with('user')->findByAttributes(array('userId' => $user->getAttribute('id'), 'propertyId' => $member->propertyId));
         if ($eu2p != null) {
             echo json_encode(array('status' => 0, 'message' => 'User already exist.'));
             die;
         }
         $u2p = new User2property();
         $u2p->setAttribute('userId', $user->getAttribute('id'));
         $u2p->setAttribute('bookingName', $member->bookname);
         $u2p->setAttributes($member->attributes);
         $u2p->save();
         $this->layout = "emailmaster";
         $emailBody = $this->render('../emails/emailInviteMember', array('userFullName' => $user->getAttribute('firstname') . ' ' . $user->getAttribute('lastname'), 'senderFullName' => Yii::app()->user->getState('firstname') . ' ' . Yii::app()->user->getState('lastname'), 'propertyName' => $property->getAttribute('property_name'), 'access' => UserAccessTable::accessLevelToString($member->access)), true);
         MailHelper::send($emailBody, "SharedKey.com - New Property Added to Your Account", array($user->getAttribute('email')));
         $temp = User2property::model()->with('user')->findByPk($u2p->getAttribute('id'));
         echo json_encode(array('status' => 1, 'member' => $this->createViewItem($temp)));
         die;
     }
     $newUser = new User();
     $newUser->setAttributes($member->attributes);
     $password = PasswordGenerator::generatePassword();
     $newUser->setAttribute('password', $password);
     $newUser->setAttribute('property_id', $member->propertyId);
     $tutorialModel = new TutorialModel();
     $tutorialModel->setAttributes(array('gallery' => 1, 'guest_book' => 1, 'house_rules' => 1, 'key_contacts' => 1, 'mapdirections' => 1, 'notice_board' => 1, 'tourist_info' => 1));
     $tutorialModel->save();
     $newUser->setAttribute('tutorial_id', $tutorialModel->id);
     $newUser->setAttribute('status', 1);
     $newUser->setAttribute('createdDate', new CDbExpression('NOW()'));
     $newUser->save();
     $u2p = new User2property();
     $u2p->setAttribute('userId', $newUser->getAttribute('id'));
     $u2p->setAttribute('bookingName', $member->bookname);
     $u2p->setAttributes($member->attributes);
     $u2p->save();
     $this->layout = "emailmaster";
     $emailBody = $this->render('../emails/emailInviteNewMember', array('userFullName' => $newUser->getAttribute('firstname') . ' ' . $newUser->getAttribute('lastname'), 'senderFullName' => Yii::app()->user->getState('firstname') . ' ' . Yii::app()->user->getState('lastname'), 'propertyName' => $property->getAttribute('property_name'), 'email' => $newUser->getAttribute('email'), 'access' => UserAccessTable::accessLevelToString($member->access), 'password' => $password), true);
     MailHelper::send($emailBody, "Sharedkey.com - Invitation to " . $property->getAttribute('property_name'), array($newUser->getAttribute('email')));
     $temp = User2property::model()->with('user')->findByPk($u2p->getAttribute('id'));
     echo json_encode(array('status' => 1, 'member' => $this->createViewItem($temp)));
     die;
 }
开发者ID:salem-dev-acc,项目名称:yiiapp,代码行数:69,代码来源:MemberController.php

示例14: actionAjaxReg

	public function actionAjaxReg()
	{
		if(isset($_POST['Member']))
		{
			$registerModel = new Member;
			$registerModel->attributes = $_POST['Member'];
			if($registerModel->validate())
			{
				$registerModel->password = md5($registerModel->password);
				if($registerModel->save(false)){
					$arr = array(
						'status'=>'200',
						'msg'=>'注册成功!',
					);
				}else{
					$arr = array(
						'status'=>'302',
						'msg'=>'注册失败!',
					);
				}
				
			 //注册成功,再自动登录
				$loginModel = new LoginForm;
				$loginModel->username = $registerModel->name;
				$loginModel->password = $_POST['Member']['password'];//$registerModel->password;
				//$loginModel->attributes = $arr['LoginForm'];
				if($loginModel->login()){
					$arr = array(
							'status'=>'200',
							'msg'=>'登录成功',
					);
				}else{
					$arr = array(
							'status'=>'302',
							'msg'=>$loginModel->getError(),
					);
				}
				
			}else{
				$arr = array(
						'status'=>'302',
						'msg'=>'表单不能为空!',
				);
			}
			echo json_encode($arr);
			exit;
		}else{
			$arr = array(
					'status'=>'302',
					'msg'=>'没有发送POST!',
			);
			//$this->redirect('/login');
			exit;
		}
	}
开发者ID:noikiy,项目名称:letstravel,代码行数:55,代码来源:LoginController.php

示例15: actionRegister

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionRegister()
 {
     $model = new Member();
     $model2 = new User();
     $model2->scenario = "register";
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     // echo "masuk";
     if (isset($_REQUEST['Member'])) {
         // echo "ini".$_REQUEST['Member']['name'];
         // echo "<pre>";
         // print_r($_REQUEST['Member']);
         // echo "</pre>";
         // exit;
         $model->attributes = $_REQUEST['Member'];
         $model2->username = $_REQUEST['Member']['email'];
         $model2->password = $_REQUEST['Member']['password'];
         $model2->level = 3;
         // $model->email_confirm=0;
         $model->date_register = date('Y-m-d H:i:s');
         $model->code = strtoupper(substr(md5(uniqid(rand(), true)), 0, 5));
         $getToken = rand(0, 99999);
         $getTime = date("H:i:s");
         $model2->token = md5($getToken . $getTime);
         if ($model->validate() && $model2->validate()) {
             if ($model->save()) {
                 if ($model2->save()) {
                     if ($this->sendmail($_REQUEST['Member']['email'], $_REQUEST['Member']['name'], $model->code, $model2->token)) {
                         $this->redirect(array('member/notification'));
                     } else {
                         print_r($model2->getErrors());
                     }
                     // $this->redirect(array('site/index'));
                 } else {
                     echo "masuk";
                     print_r($model2->getErrors());
                 }
             } else {
                 print_r($model->getErrors());
             }
         } else {
             echo CHtml::errorSummary($model2);
             echo CHtml::errorSummary($model, " ", " ", array('style' => ' '));
         }
         // $this->renderPartia('create',array(
         // 'model'=>$model,
         // ));
     } else {
         echo "not isset";
     }
 }
开发者ID:Dvionst,项目名称:vvfy,代码行数:55,代码来源:MemberController.php


注:本文中的Member::validate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。