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


PHP Students::save方法代码示例

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


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

示例1: addStudent

 static function addStudent($inputs)
 {
     $student = new Students();
     $student->customer_id = $inputs['customerId'];
     $student->franchisee_id = Session::get('franchiseId');
     $student->student_name = $inputs['studentName'];
     $student->student_gender = $inputs['studentGender'];
     $student->student_date_of_birth = date('Y-m-d', strtotime($inputs['studentDob']));
     $student->nickname = $inputs['nickname'];
     $student->school = $inputs['school'];
     $student->location = $inputs['location'];
     $student->hobbies = $inputs['hobbies'];
     $student->emergency_contact = $inputs['emergencyContact'];
     $student->remarks = $inputs['remarks'];
     $student->health_issue = $inputs['healthIssue'];
     $student->created_by = Session::get('userId');
     $student->created_at = date("Y-m-d H:i:s");
     /* echo "<pre>";
     		print_r($student);
     		echo "</pre>"; */
     $student->save();
     if ($student) {
         $commentsInput['customerId'] = $inputs['customerId'];
         $commentsInput['commentText'] = '(' . $inputs['studentName'] . ') ' . Config::get('constants.KIDS_ADDED');
         $commentsInput['commentType'] = 'ACTION_LOG';
         //$commentsInput['reminderDate']   = $inputs['reminderTxtBox'];
         Comments::addComments($commentsInput);
     }
     return $student;
 }
开发者ID:Headrun-php,项目名称:TLG,代码行数:30,代码来源:Students.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 Students();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Students'])) {
         $model->attributes = $_POST['Students'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->identification));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:argenis1763,项目名称:vc,代码行数:17,代码来源:_StudentsController.php

示例3: createAction

 /**
  * Creates a new student
  */
 public function createAction()
 {
     if (!$this->request->isPost()) {
         return $this->dispatcher->forward(array("controller" => "students", "action" => "index"));
     }
     $student = new Students();
     $student->setUserId($this->request->getPost("user_id"));
     $student->setIndCode($this->request->getPost("ind_code"));
     $student->setSheetStaff($this->request->getPost("sheet_staff"));
     $student->setOrderAccept($this->request->getPost("order_accept"));
     $student->setPostForDisplay($this->request->getPost("post_for_display"));
     $student->setOldId($this->request->getPost("old_id"));
     if (!$student->save()) {
         foreach ($student->getMessages() as $message) {
             $this->flash->error($message);
         }
         return $this->dispatcher->forward(array("controller" => "students", "action" => "new"));
     }
     $this->flash->success("student was created successfully");
     return $this->dispatcher->forward(array("controller" => "students", "action" => "index"));
 }
开发者ID:sergeytkachenko,项目名称:angular-gulp-phalcon,代码行数:24,代码来源:StudentsController.php

示例4: actionCreate

 public function actionCreate()
 {
     if (!Yii::app()->my->access("users")) {
         return false;
     }
     $student = new Students();
     if (isset($_REQUEST['Students'])) {
         // добавляем вручную, какие поля будем перезаписывать
         $record = array("shortname", "fullname", "phone", "vkid", "pass", "avatar", "mail");
         foreach ($record as $key) {
             $student->{$key} = $_REQUEST['Students'][$key];
         }
         if ($student->save()) {
             Yii::app()->notify->add("Студент создан", "success");
             $this->render("profile", array("student" => $student));
         }
     } else {
         // просто делаем новую страничкуы
     }
     $this->render('edit', array('student' => $student));
 }
开发者ID:Kapodastr,项目名称:grow,代码行数:21,代码来源:StudentsController.php

示例5: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Students();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Students'])) {
         $model->attributes = $_POST['Students'];
         $list = $_POST['Students'];
         if ($model->admission_date) {
             $model->admission_date = date('Y-m-d', strtotime($model->admission_date));
         }
         if ($model->date_of_birth) {
             $model->date_of_birth = date('Y-m-d', strtotime($model->date_of_birth));
         }
         //$model->photo_data=CUploadedFile::getInstance($model,'photo_data');
         if ($file = CUploadedFile::getInstance($this, 'photo_data')) {
             $model->photo_file_name = $file->name;
             $model->photo_content_type = $file->type;
             $model->photo_file_size = $file->size;
             $model->photo_data = file_get_contents($file->tempName);
         }
         //echo $model->photo_data.'----';
         /*if(isset($_FILES['Students']))
         		{
         			print_r($_FILES['Students']);
         			exit;
         			$tmpName = $_FILES['Students']['tmp_name'];
         		  $fp      = fopen($tmpName, 'r');
         		  $data = fread($fp, filesize($tmpName));
         		  $data = addslashes($data);
         		  fclose($fp);
         		  $model->photo_data = $data;
         		}*/
         if ($model->save()) {
             $this->redirect(array('/guardians/create', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:SoftScape,项目名称:open-school-CE,代码行数:43,代码来源:LeadsController.php

示例6: actionAssign

 public function actionAssign($id)
 {
     $student = new Students();
     $model = $this->loadModel($id);
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Students'])) {
         if ($student->save()) {
             //$this->redirect(array('view','id'=>$model->id));
             $this->redirect(array('requirements/report', 'idr' => $id, 'ids' => $student->id));
         }
     }
     $this->render('assign', array('model' => $model, 'student' => $student));
 }
开发者ID:argenis1763,项目名称:vc,代码行数:14,代码来源:RequirementsController.php

示例7: actionPromote

 public function actionPromote()
 {
     if (isset($_POST['promote'])) {
         if (isset($_POST['sid'])) {
             if (isset($_POST['batch_id']) and $_POST['batch_id'] != NULL) {
                 foreach ($_POST['sid'] as $sid) {
                     $Student = Students::model()->findByAttributes(array('id' => $sid));
                     $new_model = new Students();
                     // $new_model->setAttributes($Student->attributes, false);
                     // $new_model->batch_id= $_POST['batch_id'];
                     // $new_model->id= NULL;
                     $new_model->attributes = $Student->attributes;
                     $new_model->batch_id = $_POST['batch_id'];
                     // $new_model->id=NULL;
                     $new_model->save(false);
                     // file_put_contents("s.txt", print_r($new_model, true));
                     // print_r($model);
                 }
                 Yii::app()->user->setFlash('success', "Promoted All Selected Students To This Batch");
                 $this->redirect(array('batchstudents', 'id' => $_POST['batch_id']));
             } else {
                 Yii::app()->user->setFlash('bid', "Select a batch!");
                 $this->redirect(array('promote', 'id' => $_REQUEST['id']));
             }
         } else {
             if (isset($_POST['batch_id']) and $_POST['batch_id'] != NULL) {
                 Yii::app()->user->setFlash('sid', "Select atleast one student!");
             } else {
                 Yii::app()->user->setFlash('sid', "* Select atleast one student!");
                 Yii::app()->user->setFlash('bid', "* Select a batch!");
             }
             $this->redirect(array('promote', 'id' => $_REQUEST['id']));
         }
     }
     $this->render('promote');
 }
开发者ID:akilraj1255,项目名称:rajeshwari,代码行数:36,代码来源:BatchesController.php

示例8: actionRegistrate

 public function actionRegistrate()
 {
     // asi se crea un usuario (una nueva instancia en memoria volatil)
     $user = Yii::app()->user->um->createBlankUser();
     $profile = new Profile();
     /* echo "<pre>";
        echo print_r($_POST);
        echo "</pre>";
        Yii::app()->end(); */
     if (isset($_POST['CrugeStoredUser']) && isset($_POST['UserType']) && isset($_POST['Profile'])) {
         $validate = true;
         $msg = "";
         $user->username = $_POST['CrugeStoredUser']['username'];
         $user->email = $_POST['CrugeStoredUser']['email'];
         // la establece como "Activada"
         //Yii::app()->user->um->activateAccount($user);
         // verifica para no duplicar
         if (Yii::app()->user->um->loadUser($user->username) != null) {
             $msg .= "El usuario {$user->username} ya ha sido creado.<br/>";
             $validate = false;
         }
         if (Yii::app()->user->um->loadUser($user->email) != null) {
             $msg .= "El email {$user->email} ya ha sido creado.";
             $validate = false;
         }
         if ($validate) {
             // ahora a ponerle una clave
             Yii::app()->user->um->changePassword($user, $_POST['CrugeStoredUser']['newPassword']);
             // IMPORTANTE: guarda usando el API, la cual hace pasar al usuario
             // por el sistema de filtros, por eso user->um->save()
             //
             if (Yii::app()->user->um->save($user)) {
                 //creo un nuevo perfil
                 $profile = new Profile();
                 $profile->attributes = $_POST['Profile'];
                 $profile->date_of_birth = strtotime($_POST['Profile']['date_of_birth']);
                 $profile->email = $user->email;
                 $profile->status = 0;
                 $profile->cruge_user_iduser = $user->primaryKey;
                 $profile->save();
                 //guardo el tipo de user
                 $typeuser = $_POST['UserType'];
                 if ($typeuser == '1') {
                     $student = new Students();
                     $student->profile_id = $profile->id_profile;
                     $student->save();
                     Yii::app()->db->createCommand()->insert('cruge_authassignment', array('userid' => $user->primaryKey, 'bizrule' => null, 'data' => 'N;', 'itemname' => 'Estudiante'));
                 } else {
                     if ($typeuser == '2') {
                         $parent = new Parents();
                         $parent->profile_id = $profile->id_profile;
                         $parent->save();
                         Yii::app()->db->createCommand()->insert('cruge_authassignment', array('userid' => $user->primaryKey, 'bizrule' => null, 'data' => 'N;', 'itemname' => 'Padre'));
                     } else {
                         if ($typeuser == '3') {
                             $tutor = new Tutor();
                             $tutor->profile_id = $profile->id_profile;
                             $tutor->save();
                             Yii::app()->db->createCommand()->insert('cruge_authassignment', array('userid' => $user->primaryKey, 'bizrule' => null, 'data' => 'N;', 'itemname' => 'Tutor'));
                         }
                     }
                 }
                 Yii::app()->crugemailer->sendRegistrationUserEmail($user, $_POST['CrugeStoredUser']['newPassword']);
                 $this->redirect(array('welcome', 'id' => $user->primaryKey));
             } else {
                 $errores = CHtml::errorSummary($user);
                 Yii::app()->user->setFlash('profile-flash', "no se pudo crear el usuario: " . $errores);
                 $this->redirect(array('error'));
                 //echo "no se pudo crear el usuario: ".$errores;
             }
         } else {
             Yii::app()->user->setFlash('error', $msg);
         }
     }
     $this->render('registrate', array('user' => $user, 'profile' => $profile));
 }
开发者ID:argenis1763,项目名称:vc,代码行数:76,代码来源:UsersController.php


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