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


PHP Invitation::model方法代码示例

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


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

示例1: loadModel

 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Invitation the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Invitation::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:acuba001,项目名称:Collaborative-Platform,代码行数:15,代码来源:InvitationController.php

示例2: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new User();
     $model->username = "";
     $model->password = "";
     $infoModel = new UserInfo();
     $infoModel->user_id = $model->id;
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     $error = '';
     $form = 'user-Register-form';
     //If a new User has been successfully created e.g. the user has created an account from the register.php page
     if (isset($_POST['User']) && isset($_POST['UserInfo'])) {
         /*if ($this->actionVerifyRegistration() != "") {
               $this->render('create', array('model'=>$model));
           }*/
         echo "<script>console.log('New User Registered');</script>";
         // auto-fill biography information
         $model->attributes = $_POST['User'];
         $model->pic_url = '/coplat/images/profileimages/default_pic.jpg';
         $model->biography = "Tell us something about yourself...";
         $model->activation_chain = $this->genRandomString(10);
         $model->activated = 1;
         //$emailCheck=User::model()->find(array(
         //  'select'=>'email',
         //  'condition'=>'email=:email',
         //  'params'=>array(':email'=>$model->email))
         //);
         //$unameCheck=User::model()->find(array(
         //  'select'=>'username',
         //  'condition'=>'username=:username',
         //  'params'=>array(':username'=>$model->username))
         //);
         //if($emailCheck === null or $unameCheck === null){
         //	$error = "username or email taken";
         //	$this->render('create',array(
         //			'model'=>$model,'infoModel'=> $infoModel, 'error' => $error,
         //	));
         //	return;
         //}
         // hash entered password
         $pw = $model->password;
         $hasher = new PasswordHash(8, false);
         $model->password = $hasher->HashPassword($model->password);
         $error1 = $this->verifyRegistration();
         if ($error1 == null) {
             //application management
             $redirectMentorApp = false;
             //
             //$id = $_GET['id'];
             if (isset($_GET['id']) && $_GET['id'] > 0) {
                 $id = $_GET['id'];
                 $invitationInfo = Invitation::model()->findByPk($id);
                 if (isset($invitationInfo)) {
                     $model->isMentee = $invitationInfo->mentee;
                     if ($invitationInfo->mentor) {
                         $redirectMentorApp = true;
                     }
                 }
             }
             $model->save(false);
             if (isset($_POST['UserInfo'])) {
                 // get entered personal info
                 $infoModel->attributes = $_POST['UserInfo'];
                 $infoModel->user_id = $model->id;
                 $infoModel->save(false);
             }
             //newUserLogin($model, $pw);
             $login = new LoginForm();
             $login->username = $model->username;
             $login->password = $pw;
             $login->login();
             if ($model->isProMentor) {
                 $proMentor = new ProjectMentor();
                 $proMentor->user_id = $model->id;
                 $proMentor->max_hours = 0;
                 $proMentor->max_projects = 0;
                 $proMentor->save(false);
             }
             if ($model->isDomMentor) {
                 $domMentor = new DomainMentor();
                 $domMentor->user_id = $model->id;
                 $domMentor->max_tickets = 0;
                 $domMentor->save();
             }
             if ($model->isPerMentor) {
                 $perMentor = new PersonalMentor();
                 $perMentor->user_id = $model->id;
                 $perMentor->max_hours = 0;
                 $perMentor->max_mentees = 0;
                 $perMentor->save();
             }
             if ($redirectMentorApp) {
                 $this->redirect("/coplat/index.php/application/portal");
             } else {
                 $this->redirect("/coplat/index.php/");
//.........这里部分代码省略.........
开发者ID:acuba001,项目名称:Collaborative-Platform,代码行数:101,代码来源:UserController.php


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