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


PHP Batch::create方法代码示例

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


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

示例1: create

 /**
  * create new batch task
  * @return mixed
  */
 public function create()
 {
     $data = Input::all();
     $batchData = [];
     $dataTypeValidator = Validator::make(Input::all(), ['dataType' => 'required']);
     if ($dataTypeValidator->fails()) {
         return Redirect::back()->withInput()->with('alert-danger', 'Data type is missing!');
     }
     $dataType = $data['dataType'];
     $rules = ['startDateTime', 'endDateTime'];
     if ($dataType == "WATER") {
         $rules[] = 'waterProblemType';
     } elseif ($dataType == "RAIN") {
         $rules[] = 'rainProblemType';
     }
     if (!isset($data['allStation'])) {
         $rules[] = 'stations';
     }
     foreach ($rules as $r) {
         if (!isset($data[$r])) {
             return Redirect::back()->withInput()->with('alert-danger', $r . ' is incomplete!');
         }
     }
     if ($data['startDateTime'] == "" or $data['endDateTime'] == "") {
         return Redirect::back()->withInput()->with('alert-danger', 'Date is incomplete!');
     }
     $batchData['data_type'] = $data['dataType'];
     if ($batchData['data_type'] == "WATER") {
         $batchData['problem_type'] = $data['waterProblemType'];
     } elseif ($batchData['data_type'] == "RAIN") {
         $batchData['problem_type'] = $data['rainProblemType'];
     }
     if (isset($data['allStation'])) {
         $batchData['all_station'] = true;
     } else {
         $batchData['all_station'] = false;
         $batchData['stations'] = $data['stations'];
     }
     $batchData['start_datetime'] = Date($data['startDateTime']);
     $batchData['end_datetime'] = Date($data['endDateTime']);
     $batchData['add_datetime'] = Date('Y-m-d H:i:s');
     $batch = Batch::create($batchData);
     Queue::push('BatchController', ['id' => $batch->id]);
     return Redirect::to('batch')->with('alert-success', 'Task #' . $batch->id . ' Added Successfully.');
 }
开发者ID:withlovee,项目名称:HAII,代码行数:49,代码来源:BatchController.php

示例2: start_test_handler

 /**
  * @param integer $number_of_batches
  * @return string
  * @throws BaseUserAccessDeniedException
  * @throws BaseBatchInvalidArgumentException
  */
 public static function start_test_handler($number_of_batches)
 {
     global $user;
     if ($user->is_admin()) {
         if (is_numeric($number_of_batches) and $number_of_batches >= 1) {
             for ($i = 1; $i <= $number_of_batches; $i++) {
                 $batch = new Batch(null);
                 $batch->create(1);
             }
             return "1";
         } else {
             throw new BaseBatchInvalidArgumentException();
         }
     } else {
         throw new BaseUserAccessDeniedException();
     }
 }
开发者ID:suxinde2009,项目名称:www,代码行数:23,代码来源:batch.ajax.php

示例3: Batch

<?php

require_once "../../includes/initialize.php";
global $session;
if (!$session->is_logged_in()) {
    redirect_to("../../index.php");
}
if ($_POST['oper'] == 'add') {
    $batch = new Batch();
    $batch->comments = $_POST['comments'];
    $batch->about = $_POST['about'];
    $batch->pending = $_POST['pending'];
    $batch->enabled = $_POST['enabled'];
    $batch->fromyear = $_POST['fromyear'];
    $batch->schoolid = $_POST['schoolid'];
    $batch->create();
    $batchuser = new BatchUser();
    $batchuser->pending = 0;
    $batchuser->enabled = 1;
    $batchuser->schoolid = $batch->schoolid;
    $batchuser->batchid = $batch->id;
    $batchuser->userid = $session->user_id;
    $batchuser->level = 1;
    $batchuser->create();
    $folder_path = "../../public/schools/" . $batch->schoolid . "/yearbooks/" . $batch->id . "/";
    mkdir($folder_path, 0700);
    mkdir($folder_path . "pages", 0700);
    mkdir($folder_path . "files", 0700);
    copy("../../public/index.php", $folder_path . "/pages/index.php");
    copy("../../public/page1.html", $folder_path . "/pages/page1.html");
    $log = new Log($session->user_id, $clientip, "WEB", "CREATED BATCH: " . $_POST['id']);
开发者ID:NemOry,项目名称:Skoolyf,代码行数:31,代码来源:batchs_manipulate.php

示例4: Batch

 if (!Batch::batch_exists($_POST['fromyear'], $school->id)) {
     $object = new Batch();
     $object->fromyear = $_POST['fromyear'];
     $object->about = $_POST['about'];
     $object->comments = $_POST['comments'];
     $object->fbcomments = $_POST['fbcomments'];
     $object->schoolid = $school->id;
     $object->enabled = 1;
     $object->pending = 0;
     $object->pubdate = $_POST['pubdate'];
     $object->published = 0;
     $file = new File($_FILES['cover']);
     if ($file->valid) {
         $object->picture = $file->data;
     }
     $object->create();
     $folder_path = "../../public/schools/" . $school->id . "/yearbooks/" . $object->id . "/";
     mkdir($folder_path, 0700);
     mkdir($folder_path . "pages", 0700);
     mkdir($folder_path . "files", 0700);
     copy("../../public/0.students.php", $folder_path . "/pages/0.students.php");
     copy("../../public/0.page1.html", $folder_path . "/pages/0.page1.html");
     copy("../../public/11.Vision_and-Mission-Sample.html", $folder_path . "/pages/11.Vision_and-Mission-Sample.html");
     copy("../../public/12.7.The_Achievers-Sample.html", $folder_path . "/pages/12.7.The_Achievers-Sample.html");
     copy("../../public/22.Core_Values-Sample.html", $folder_path . "/pages/22.Core_Values-Sample.html");
     copy("../../public/33.Message_of_the_City_Mayor-Sample.html", $folder_path . "/pages/33.Message_of_the_City_Mayor-Sample.html");
     copy("../../public/44.3.History-Sample.html", $folder_path . "/pages/44.3.History-Sample.html");
     copy("../../public/55.5.Message_of_the_Director-Sample.html", $folder_path . "/pages/55.5.Message_of_the_Director-Sample.html");
     $batchuser = new BatchUser();
     $batchuser->schoolid = $school->id;
     $batchuser->batchid = $object->id;
开发者ID:NemOry,项目名称:Skoolyf,代码行数:31,代码来源:create.php

示例5: createBatch

 /**
  * Create a batch
  *
  * @param bool $stopJobOnError Should the batch be stopped on error?
  * @return Batch
  * @throws \Exception
  */
 public function createBatch($stopJobOnError = false)
 {
     $batch = new Batch($this->api);
     $batch->create($stopJobOnError);
     return $batch;
 }
开发者ID:silktide,项目名称:brightlocal-api,代码行数:13,代码来源:BatchFactory.php

示例6: store

 public function store(RegisterBatch $request)
 {
     Batch::create($request->all());
 }
开发者ID:ducaale,项目名称:university-management-app,代码行数:4,代码来源:batchController.php


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