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


PHP Batch::find方法代码示例

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


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

示例1: indexAction

 /**
  * The start action, it shows the "search" view
  */
 public function indexAction()
 {
     $searchParams = ['ping.batchId' => 'batchId', 'ping.proxyId' => 'proxyId', 'b.urlId' => 'urlId'];
     Tag::setDefaults(array('urlId' => $this->request->get('urlId'), 'proxyId' => $this->request->get('proxyId'), 'pingId' => $this->request->get('pingId'), 'batchId' => $this->request->get('batchId')));
     $this->view->pings = $this->searchPings($searchParams);
     $this->view->proxies = Proxy::find();
     $this->view->urls = Url::find();
     $this->view->batches = Batch::find();
     #$this->view->disable();
 }
开发者ID:sweetdevel,项目名称:pingaroo,代码行数:13,代码来源:PingController.php

示例2: indexAction

 /**
  * The start action, it shows the "search" view
  */
 public function indexAction()
 {
     $batchId = $this->request->get('batchId');
     $name = $this->request->get('name');
     $httpCode = $this->request->get('httpCode');
     if (!is_numeric($httpCode)) {
         $httpCode = '';
     }
     if (is_numeric($batchId)) {
         $batch = Batch::findFirst($batchId);
         if (!empty($batch)) {
             $batch->name = $name ?: $batch->name;
         }
     } else {
         $batch = new Batch();
     }
     Tag::setDefaults(array('batchId' => $batchId, 'name' => $name, 'httpCode' => $httpCode));
     $this->view->batch = $batch;
     $this->view->batchIds = Batch::find();
     $this->view->pings = $this->searchPings();
     #$this->view->disable();
 }
开发者ID:sweetdevel,项目名称:pingaroo,代码行数:25,代码来源:BatchController.php

示例3: postFormPart

 /**
  * Every time you click a tab or the 'next' button, this function fires. 
  * It combines the Input fields with the JobConfiguration that we already have in the Session.
  */
 public function postFormPart($next)
 {
     if (Input::has('batch')) {
         // TODO: Validate for CSRF
         $batch = Batch::find(Input::get('batch'));
         // TODO -- is saving batch in the session a good idea ?
         Session::put('batch', serialize($batch));
     } else {
         $batch = unserialize(Session::get('batch'));
         if (empty($batch)) {
             Session::flash('flashNotice', 'Please select a batch first.');
             return Redirect::to("jobs2/batch");
         }
     }
     return Redirect::to("jobs2/submit");
 }
开发者ID:harixxy,项目名称:CrowdTruth,代码行数:20,代码来源:JobsController2.php

示例4: d011

 public function d011($id = null)
 {
     if (!is_null($id)) {
         $result = Batch::find($id);
         $result->delete();
         ZiUtil::to_json(json_encode("{ success: true}"));
         return;
     }
     App::flash('error', 'Terjadi kesalahan pada inputan anda.');
     App::redirect('batch.index');
 }
开发者ID:suryakencana,项目名称:tekkadan,代码行数:11,代码来源:Batch.php

示例5: postFormPart

 public function postFormPart($next)
 {
     $jc = unserialize(Session::get('jobconf', serialize(new JobConfiguration())));
     if (isset($jc->content)) {
         $jcc = $jc->content;
     } else {
         $jcc = array();
     }
     $template = Session::get('template');
     if (Input::has('batch')) {
         // TODO: CSRF
         $batch = Batch::find(Input::get('batch'));
         Session::put('batch', serialize($batch));
     } else {
         $batch = unserialize(Session::get('batch'));
         if (empty($batch)) {
             Session::flash('flashNotice', 'Please select a batch first.');
             return Redirect::to("jobs/batch");
         }
     }
     if (Input::has('template')) {
         // Create the JobConfiguration object if it doesn't already exist.
         $ntemplate = Input::get('template');
         if (empty($template) or $template != $ntemplate) {
             $jc = JobConfiguration::fromJSON(Config::get('config.templatedir') . "{$ntemplate}.json");
         }
         $template = $ntemplate;
         $origjobconf = 'jcid';
         // TODO!
         // FOR TESTING -> static questiontemplate. // TODO!
         $filename = Config::get('config.templatedir') . $template . '.questiontemplate.json';
         if (file_exists($filename)) {
             $testdata = json_decode(file_get_contents($filename), true);
         } else {
             $testdata = null;
         }
         /*if($testdata == null) 
         		Session::flash('flashNotice', 'JSON not found or incorrectly formatted.');*/
         $qt = new QuestionTemplate();
         $qt->format = $batch->format;
         $qt->domain = $batch->domain;
         $qt->content = $testdata;
         $hash = md5(serialize($qt->content));
         $existing = QuestionTemplate::where('hash', $hash)->pluck('_id');
         if ($existing) {
             $qtid = $existing;
         } else {
             $qt->hash = $hash;
             $qt->save();
             $qtid = $qt->_id;
         }
         Session::put('questiontemplateid', $qtid);
         //////////////////////////////////////////////////////////
     } else {
         if (empty($jc)) {
             // No JobConfiguration and no template selected, not good.
             if ($next != 'template') {
                 Session::flash('flashNotice', 'Please select a template first.');
             }
             return Redirect::to("jobs/template");
         } else {
             // There already is a JobConfiguration object. Merge it with Input!
             $jcc = array_merge($jcc, Input::get());
             // If leaving the details page...
             if (Input::has('title')) {
                 $jcc['answerfields'] = Input::get('answerfields', false);
                 if ($next == 'nextplatform') {
                     if (isset($jcc['platform'][0])) {
                         $next = $jcc['platform'][0];
                     } else {
                         Session::flash('flashNotice', 'Please select a platform first');
                         return Redirect::to("jobs/platform");
                     }
                 }
             }
             // If leaving the Platform page....:
             if (Input::has('platformpage')) {
                 $jcc['platform'] = Input::get('platform', array());
             }
             // DEFAULT VALUES
             if (!isset($jcc['eventType'])) {
                 $jcc['eventType'] = 'HITReviewable';
             }
             if (!isset($jcc['frameheight'])) {
                 $jcc['frameheight'] = 650;
             }
             unset($jcc['_token']);
             $jc->content = $jcc;
             // After specific platform tab, call the method and determine which is next.
             $pid = Input::get('platformid', false);
             if ($pid) {
                 $platform = App::make($pid);
                 $jc = $platform->updateJobConf($jc);
                 if ($next == 'nextplatform') {
                     $nextindex = array_search($pid, $jc->content['platform']) + 1;
                     if (array_key_exists($nextindex, $jc->content['platform'])) {
                         $next = $jc->content['platform'][$nextindex];
                     } else {
                         $next = 'submit';
                     }
//.........这里部分代码省略.........
开发者ID:harixxy,项目名称:CrowdTruth,代码行数:101,代码来源:JobsController.php

示例6: fire

 /**
  * Message Queue Listener + Process task
  * @param job   $job            Laravel job object
  * @param object    $message    message detail (contains task id)
  */
 public function fire($job, $message)
 {
     $id = intval($message['id']);
     $batch = Batch::find($id);
     if ($batch->cancel) {
         $job->delete();
         $batch->setStatus('canceled');
         return;
     }
     $batch->setStatus('running');
     $batch->stampBeginExecDatetime();
     $rscriptCommand = Config::get('r.rscript');
     $rAppPath = base_path() . "/rscripts/app.R batch_controller.R";
     $execCommand = $rscriptCommand . " " . $rAppPath . " " . $id;
     $process = new Process($execCommand);
     $process->start();
     while ($process->isRunning()) {
         usleep(200000);
         if (Batch::isCanceled($id)) {
             // Kill Process
             $process->stop(3, SIGINT);
             $batch->setStatus('canceled');
             $batch->stampFinishDatetime();
             $job->delete();
             return;
         }
     }
     $output = $process->getOutput();
     # get new status after exec R file
     $batch = Batch::find($id);
     $batch->stampFinishDatetime();
     # write to logfile
     $logfile = fopen(base_path() . '/public/batchreport/' . $batch->id . ".log", "w+");
     fwrite($logfile, $output);
     fclose($logfile);
     # Check if task if finish running
     if ($batch->status != "success") {
         $batch->setStatus('fail');
     }
     try {
         $job->delete();
     } catch (\Exception $e) {
     }
 }
开发者ID:withlovee,项目名称:HAII,代码行数:49,代码来源:BatchController.php


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