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


PHP Batches::save方法代码示例

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


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

示例1: addBatches

 static function addBatches($input)
 {
     $batch = new Batches();
     $batch->batch_name = $input['batchName'];
     $batch->franchisee_id = Session::get('franchiseId');
     $batch->season_id = $input['season_id'];
     $batch->class_id = $input['classId'];
     $batch->course_id = $input['courseId'];
     $batch->start_date = $input['startDate'];
     $batch->end_date = $input['endDate'];
     //                if(isset($input['classAmount'])){
     //                    $batch->class_amount=$input['classAmount'];
     //                }
     $batch->preferred_time = $input['preferredTime'];
     $batch->preferred_end_time = $input['preferredEndTime'];
     if (isset($input['location_id'])) {
         $batch->location_id = $input['location_id'];
     }
     if ($input['leadInstructor'] != "") {
         $batch->lead_instructor = $input['leadInstructor'];
     } else {
         $batch->lead_instructor = null;
     }
     if ($input['alternateInstructor'] != "") {
         $batch->alternate_instructor = $input['alternateInstructor'];
     } else {
         $batch->alternate_instructor = null;
     }
     $batch->created_by = Session::get('userId');
     $batch->created_at = date("Y-m-d H:i:s");
     $batch->save();
     return $batch;
 }
开发者ID:Headrun-php,项目名称:TLG,代码行数:33,代码来源:Batches.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 Batches();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Batches'])) {
         $model->attributes = $_POST['Batches'];
         $list = $_POST['Batches'];
         if (!$list['start_date']) {
             $s_d = "";
         } else {
             $s_d = date('Y-m-d', strtotime($list['start_date']));
         }
         if (!$list['end_date']) {
             $e_d = "";
         } else {
             $e_d = date('Y-m-d', strtotime($list['end_date']));
         }
         $model->start_date = $s_d;
         $model->end_date = $e_d;
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:SoftScape,项目名称:open-school-CE,代码行数:30,代码来源:BatchesController.php

示例3: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Courses();
     $model_1 = new Batches();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Courses'])) {
         $model_1->attributes = $_POST['Batches'];
         $model->attributes = $_POST['Courses'];
         $model->validate();
         if ($model_1->validate()) {
             if ($model->save()) {
                 $list = $_POST['Batches'];
                 if (!$list['start_date']) {
                     $s_d = "";
                 } else {
                     $s_d = date('Y-m-d', strtotime($list['start_date']));
                 }
                 if (!$list['end_date']) {
                     $e_d = "";
                 } else {
                     $e_d = date('Y-m-d', strtotime($list['end_date']));
                 }
                 $model_1->course_id = Yii::app()->db->getLastInsertId();
                 $model_1->start_date = $s_d;
                 $model_1->end_date = $e_d;
                 $model_1->save();
                 $this->redirect(array('/courses'));
             }
         }
     }
     $this->render('create', array('model' => $model, 'model_1' => $model_1));
 }
开发者ID:akilraj1255,项目名称:rajeshwari,代码行数:37,代码来源:CoursesController.php

示例4: save_batch

 public function save_batch($edit_id = false)
 {
     if ($this->input->post("submit")) {
         if ($this->_submit_validate() === FALSE) {
             $data['title'] = "Stock Management::Add New Stock (Error)";
             $data['content_view'] = "add_batch_view";
             $this->base_params($data);
         } else {
             if ($edit_id != false) {
                 $batch = Batches::getBatch($edit_id);
                 $batch = $batch[0];
                 $disbursement = Disbursements::getBatchEntry($edit_id);
                 $disbursement = $disbursement[0];
             } else {
                 if ($edit_id == false) {
                     $batch = new Batches();
                     $disbursement = new Disbursements();
                 }
             }
             $batch->Vaccine_Id = $this->input->post("vaccine_id");
             $batch->Batch_Number = $this->input->post("batch_number");
             $batch->Expiry_Date = $this->input->post("expiry_date");
             $batch->Manufacturing_Date = $this->input->post("manufacturing_date");
             $batch->Manufacturer = $this->input->post("manufacturer");
             $batch->Lot_Number = $this->input->post("lot_number");
             $batch->Origin_Country = $this->input->post("origin_country");
             $batch->Arrival_Date = $this->input->post("arrival_date");
             $batch->Quantity = str_replace(",", "", $this->input->post("quantity"));
             $batch->Timestamp = date("U");
             $batch->Added_By = $this->session->userdata('user_id');
             $batch->Year = date('Y');
             $batch->save();
             $disbursement->Batch_Id = $batch->id;
             $disbursement->Date_Issued = $this->input->post("arrival_date");
             $disbursement->Quantity = str_replace(",", "", $this->input->post("quantity"));
             $disbursement->Batch_Number = $this->input->post("batch_number");
             $disbursement->Vaccine_Id = $this->input->post("vaccine_id");
             $disbursement->Issued_To_National = "0";
             $disbursement->Timestamp = date("U");
             $disbursement->Added_By = $this->session->userdata('user_id');
             $disbursement->Stock_At_Hand = Disbursements::getNationalPeriodBalance($this->input->post("vaccine_id"), date("U"));
             $disbursement->Date_Issued_Timestamp = strtotime($this->input->post('arrival_date'));
             $disbursement->save();
             redirect("batch_management");
         }
     }
 }
开发者ID:EuniceManyasi,项目名称:DVI,代码行数:47,代码来源:batch_management.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 Courses();
     $model_1 = new Batches();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Courses'])) {
         $model_1->attributes = $_POST['Batches'];
         $model->attributes = $_POST['Courses'];
         if ($model->save()) {
             $model_1->course_id = Yii::app()->db->getLastInsertId();
             $model_1->save();
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model, 'model_1' => $model_1));
 }
开发者ID:SoftScape,项目名称:open-school-CE,代码行数:21,代码来源:CoursesController.php


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