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


PHP Batch类代码示例

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


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

示例1: fetchProfileDetailsByBusinessData

 /**
  * Fetch profile details by business data
  *
  * @param Batch $batch The batch to add this to
  * @param string[] $parameters The parameters for request
  * @throws \Exception
  */
 public function fetchProfileDetailsByBusinessData(Batch $batch, $parameters)
 {
     if ($batch->hasBeenCommitted()) {
         throw new \Exception("Attempting to add task to a batch which has already been comitted!");
     }
     $parameters['batch-id'] = $batch->getBatchId();
     $this->api->post('/v4/ld/fetch-profile-details-by-business-data', $parameters);
 }
开发者ID:silktide,项目名称:brightlocal-api,代码行数:15,代码来源:Client.php

示例2: testBatchFile

 function testBatchFile()
 {
     global $client;
     $batchID = 0;
     $uploadedFilePath = "";
     //BatchSave
     $batch = new Batch();
     $batch->setBatchStatusId("Waiting");
     $batch->setBatchTypeId("ItemImport");
     $batch->setCompanyId(31115);
     $batch->setName("ItemImportTest.xls");
     $batch->setOptions("Add File");
     $batchFile = new BatchFile();
     $batchFile->setName("ItemImportTest.xls");
     $filename = "c:\\Batch\\ItemImportTest.xls";
     $contents = $this->ReadContents($filename);
     $batchFile->setFilePath($filename);
     $batchFile->setSize(strlen($contents));
     $batchFile->setContent($contents);
     $batchFiles = array($batchFile);
     $batch->setFiles($batchFiles);
     $batchSaveResult = $client->BatchSave($batch);
     $this->assertEqual(SeverityLevel::$Success, $batchSaveResult->getResultCode());
     $batchID = $batchSaveResult->getBatchId();
     //BatchFileSave- save BatchFile in that BAtchFile only
     $file = new BatchFile();
     //Set BatchId for recently stored batch
     $file->setBatchId($batchID);
     $file->setName("Error.xls");
     $file->setSize(100);
     $file->setContentType("content type");
     $filename = "c:\\Batch\\Errors.xls";
     $contents = $this->ReadContents($filename);
     $file->setContent($contents);
     $fileSaveResult = $client->BatchFileSave($file);
     $this->assertEqual(SeverityLevel::$Success, $fileSaveResult->getResultCode());
     //BatchFileFetch
     $fetchRequest = new FetchRequest();
     $fetchRequest->setFields("*,Content");
     $fetchRequest->setFilters("BatchFileId=" . $fileSaveResult->getBatchFileId());
     $batchFileFetchResult = $client->BatchFileFetch($fetchRequest);
     $this->assertEqual(SeverityLevel::$Success, $batchFileFetchResult->getResultCode());
     foreach ($batchFileFetchResult->getBatchFiles() as $batchFile) {
         $this->assertEqual("Error.xls", $batchFile->getName());
     }
     //BatchFile delete
     $delRequest = new DeleteRequest();
     $delRequest->setFilters("BatchFileId=" . $fileSaveResult->getBatchFileId());
     $delRequest->setMaxCount(1);
     $delResult = $client->BatchFileDelete($delRequest);
     $this->assertEqual(SeverityLevel::$Success, $delResult->getResultCode());
     //Batch Delete
     $delRequest = new DeleteRequest();
     $delRequest->setFilters("BatchId=" . $batchID);
     $delResult = $client->BatchDelete($delRequest);
     $this->assertEqual(SeverityLevel::$Success, $delResult->getResultCode());
 }
开发者ID:vijaynalawade-avalara,项目名称:AvaTax-SOAP-PHP-SDK,代码行数:57,代码来源:BatchSvcTest.php

示例3: batchjsonAction

 function batchjsonAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     $batchID = $this->_request->getParam('batchID');
     Zend_Loader::loadClass('Batch');
     Zend_Loader::loadClass('Document');
     $batchObj = new Batch();
     $batch = $batchObj->getByID($batchID);
     if (!$batch) {
         throw new Zend_Controller_Action_Exception('Cannnot find this page: ' . $this->_request->getRequestUri(), 404);
     }
     $batch["documents"] = $batchObj->documents;
     header('Content-Type: application/json; charset=utf8');
     echo Zend_Json::encode($batch);
 }
开发者ID:shawngraham,项目名称:gap2,代码行数:15,代码来源:GeoparseController.php

示例4: create

 public static function create($batchId, $urlId, $proxyId, $updateBatch)
 {
     SystemUtility::log('PING START', true);
     SystemUtility::log('GATHERING DATA');
     # Update batch here in case something crashes below
     if ($updateBatch) {
         SystemUtility::log('THIS IS THE LAST PING IN BATCH');
         $batch = \Batch::findFirst();
         $batch->updatedAt = SystemUtility::getSqlNowDate();
         $batch->save();
     }
     $url = \Url::findFirst($urlId);
     $proxy = \Proxy::findFirst($proxyId);
     # Create new ping
     $ping = new \Ping();
     $ping->batchId = $batchId;
     $ping->proxyId = $proxyId;
     $ping->httpCode = self::HTTP_CODE_IN_PROGRESS;
     $ping->duration = 0;
     $ping->error = '';
     $ping->save();
     self::doPing($ping, $url, $proxy);
     SystemUtility::log('PING END');
     return $ping;
 }
开发者ID:sweetdevel,项目名称:pingaroo,代码行数:25,代码来源:PingHelper.php

示例5: actionDelete

 public function actionDelete()
 {
     if (array_key_exists("batchIds", $_POST)) {
         $batchIds = (array) $_POST["batchIds"];
         $batch = new Batch();
         $batch->organizationId = Yii::app()->user->getOrgId();
         /*this is important to avoid one moderator to edit/delete other org batches*/
         foreach ($batchIds as $bId) {
             $batch->id = $bId;
             $batch->delete();
         }
         $this->render('delete');
     } else {
         Yii::app()->end();
     }
 }
开发者ID:rhl4ttr,项目名称:hello-world,代码行数:16,代码来源:BatchController.php

示例6: processWindow

 public function processWindow($window, $id, $ctrl, $param1, $param2)
 {
     global $neardBs, $neardBins, $neardLang, $neardWinbinder;
     $name = $neardWinbinder->getText($this->wbInputName[WinBinder::CTRL_OBJ]);
     $target = $neardWinbinder->getText($this->wbInputDest[WinBinder::CTRL_OBJ]);
     switch ($id) {
         case $this->wbBtnDest[WinBinder::CTRL_ID]:
             $target = $neardWinbinder->sysDlgPath($window, $neardLang->getValue(Lang::GENSSL_PATH), $target);
             if ($target && is_dir($target)) {
                 $neardWinbinder->setText($this->wbInputDest[WinBinder::CTRL_OBJ], $target . '\\');
             }
             break;
         case $this->wbBtnSave[WinBinder::CTRL_ID]:
             $neardWinbinder->setProgressBarMax($this->wbProgressBar, self::GAUGE_SAVE + 1);
             $neardWinbinder->incrProgressBar($this->wbProgressBar);
             $target = Util::formatUnixPath($target);
             if (Batch::genSslCertificate($name, $target)) {
                 $neardWinbinder->incrProgressBar($this->wbProgressBar);
                 $neardWinbinder->messageBoxInfo(sprintf($neardLang->getValue(Lang::GENSSL_CREATED), $name), $neardLang->getValue(Lang::GENSSL_TITLE));
                 $neardWinbinder->destroyWindow($window);
             } else {
                 $neardWinbinder->messageBoxError($neardLang->getValue(Lang::GENSSL_CREATED_ERROR), $neardLang->getValue(Lang::GENSSL_TITLE));
                 $neardWinbinder->resetProgressBar($this->wbProgressBar);
             }
             break;
         case IDCLOSE:
         case $this->wbBtnCancel[WinBinder::CTRL_ID]:
             $neardWinbinder->destroyWindow($window);
             break;
     }
 }
开发者ID:RobertoMalatesta,项目名称:neard,代码行数:31,代码来源:class.action.genSslCertificate.php

示例7: action_post

 public function action_post($id)
 {
     if (Request::$is_ajax) {
         if (isset($_POST['message']) && Batch::exists($id)) {
             Batch::client_post($id, $_POST['message']);
         }
     } else {
         $this->request->status = 403;
     }
 }
开发者ID:rlm80,项目名称:Kohana-Batch,代码行数:10,代码来源:batch.php

示例8: 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

示例9: getProcessedResponse

 /**
  * Get the batch part identified by the array key (0...n) or its id (if it was set with nextBatchPartId($id) )
  *
  * @throws ClientException
  * @return mixed $partId
  */
 public function getProcessedResponse()
 {
     $response = $this->getResponse();
     switch ($this->_type) {
         case 'getdocument':
             $json = $response->getJson();
             $options = $this->getCursorOptions();
             $options['isNew'] = false;
             $response = Document::createFromArray($json, $options);
             break;
         case 'document':
             $json = $response->getJson();
             if ($json['error'] === false) {
                 $id = $json[Document::ENTRY_ID];
                 $response = $id;
             }
             break;
         case 'getedge':
             $json = $response->getJson();
             $options = $this->getCursorOptions();
             $options['isNew'] = false;
             $response = Edge::createFromArray($json, $options);
             break;
         case 'edge':
             $json = $response->getJson();
             if ($json['error'] === false) {
                 $id = $json[Edge::ENTRY_ID];
                 $response = $id;
             }
             break;
         case 'getcollection':
             $json = $response->getJson();
             $options = $this->getCursorOptions();
             $options['isNew'] = false;
             $response = Collection::createFromArray($json, $options);
             break;
         case 'collection':
             $json = $response->getJson();
             if ($json['error'] === false) {
                 $id = $json[Collection::ENTRY_ID];
                 $response = $id;
             }
             break;
         case 'cursor':
             $options = $this->getCursorOptions();
             $options['isNew'] = false;
             $response = new Cursor($this->_batch->getConnection(), $response->getJson(), $options);
             break;
         default:
             throw new ClientException('Could not determine response data type.');
             break;
     }
     return $response;
 }
开发者ID:vinigomescunha,项目名称:ArangoDB-Ajax-PHP-Example,代码行数:60,代码来源:BatchPart.php

示例10: saveRelationship

 /**
  * Save the given relationship
  *
  * @param Relationship $rel
  * @return boolean
  */
 public function saveRelationship(Relationship $rel)
 {
     if ($this->openBatch) {
         $this->openBatch->save($rel);
         return true;
     }
     if ($rel->hasId()) {
         return $this->runCommand(new Command\UpdateRelationship($this, $rel));
     } else {
         return $this->runCommand(new Command\CreateRelationship($this, $rel));
     }
 }
开发者ID:momoim,项目名称:momo-api,代码行数:18,代码来源:Client.php

示例11: __construct

 public function __construct($args)
 {
     global $neardCore, $neardLang, $neardBins, $neardWinbinder;
     if (file_exists($neardCore->getExec())) {
         $action = file_get_contents($neardCore->getExec());
         if ($action == self::QUIT) {
             Batch::exitApp();
         } elseif ($action == self::RESTART) {
             Batch::restartApp();
         }
         @unlink($neardCore->getExec());
     }
 }
开发者ID:RobertoMalatesta,项目名称:neard,代码行数:13,代码来源:class.action.exec.php

示例12: testWriteManyMany_CreateParentAndChildren_WritesManyMany

 /**
  *
  */
 public function testWriteManyMany_CreateParentAndChildren_WritesManyMany()
 {
     $parent = new Batman();
     $parent->Name = 'Bruce Wayne';
     $parent->Car = 'Bat mobile';
     $children = array();
     for ($i = 0; $i < 5; $i++) {
         $child = new Child();
         $child->Name = 'Soldier #' . $i;
         $children[] = $child;
     }
     $batch = new \Batch();
     $batch->write(array($parent));
     $batch->write($children);
     $sets = array();
     foreach ($children as $child) {
         $sets[] = array($parent, 'Children', $child);
     }
     $batch->writeManyMany($sets);
     $parent = Human::get()->first();
     $this->assertEquals(5, $parent->Children()->Count());
 }
开发者ID:helpfulrobot,项目名称:littlegiant-silverstripe-batchwrite,代码行数:25,代码来源:BatchWriteManyManyTest.php

示例13: list_batches

 public static function list_batches()
 {
     global $user;
     $list = new List_IO("BaseBatchList", "ajax.php?nav=base", "batch_list_batches", "batch_count_batches", $argument_array, "BatchList");
     $list->add_column("", "symbol", false, "16px");
     $list->add_column(Language::get_message("BaseGeneralListColumnName", "general"), "name", true, null);
     $list->add_column(Language::get_message("BaseGeneralListColumnStatus", "general"), "status", true, null);
     $list->add_column(Language::get_message("BaseGeneralListColumnUser", "general"), "user", true, null);
     $list->add_column(Language::get_message("BaseGeneralListColumnCreatedAt", "general"), "created_at", true, null);
     $template = new HTMLTemplate("base/batch/list.html");
     if ($user->is_admin() and Batch::get_type_id_by_internal_name("TEST") != null) {
         $template->set_var("test_batch", true);
     } else {
         $template->set_var("test_batch", false);
     }
     $template->set_var("list", $list->get_list());
     $template->output();
 }
开发者ID:suxinde2009,项目名称:www,代码行数:18,代码来源:batch.io.php

示例14: processWindow

 public function processWindow($window, $id, $ctrl, $param1, $param2)
 {
     global $neardBs, $neardBins, $neardLang, $neardWinbinder;
     $serverName = $neardWinbinder->getText($this->wbInputServerName[WinBinder::CTRL_OBJ]);
     $documentRoot = $neardWinbinder->getText($this->wbInputDocRoot[WinBinder::CTRL_OBJ]);
     switch ($id) {
         case $this->wbInputServerName[WinBinder::CTRL_ID]:
             $neardWinbinder->setText($this->wbLabelExp[WinBinder::CTRL_OBJ], sprintf($neardLang->getValue(Lang::VHOST_EXP_LABEL), $serverName, $documentRoot));
             $neardWinbinder->setEnabled($this->wbBtnSave[WinBinder::CTRL_OBJ], empty($serverName) ? false : true);
             break;
         case $this->wbBtnDocRoot[WinBinder::CTRL_ID]:
             $documentRoot = $neardWinbinder->sysDlgPath($window, $neardLang->getValue(Lang::VHOST_DOC_ROOT_PATH), $documentRoot);
             if ($documentRoot && is_dir($documentRoot)) {
                 $neardWinbinder->setText($this->wbInputDocRoot[WinBinder::CTRL_OBJ], $documentRoot . '\\');
                 $neardWinbinder->setText($this->wbLabelExp[WinBinder::CTRL_OBJ], sprintf($neardLang->getValue(Lang::VHOST_EXP_LABEL), $serverName, $documentRoot . '\\'));
             }
             break;
         case $this->wbBtnSave[WinBinder::CTRL_ID]:
             $neardWinbinder->setProgressBarMax($this->wbProgressBar, self::GAUGE_SAVE + 1);
             $neardWinbinder->incrProgressBar($this->wbProgressBar);
             if (is_file($neardBs->getVhostsPath() . '/' . $serverName . '.conf')) {
                 $neardWinbinder->messageBoxError(sprintf($neardLang->getValue(Lang::VHOST_ALREADY_EXISTS), $serverName), $neardLang->getValue(Lang::ADD_VHOST_TITLE));
                 $neardWinbinder->resetProgressBar($this->wbProgressBar);
                 break;
             }
             if (Batch::genSslCertificate($serverName) && file_put_contents($neardBs->getVhostsPath() . '/' . $serverName . '.conf', $neardBins->getApache()->getVhostContent($serverName, $documentRoot)) !== false) {
                 $neardWinbinder->incrProgressBar($this->wbProgressBar);
                 Util::addWindowsHost('127.0.0.1', $serverName);
                 $neardWinbinder->incrProgressBar($this->wbProgressBar);
                 $neardBins->getApache()->getService()->restart();
                 $neardWinbinder->incrProgressBar($this->wbProgressBar);
                 $neardWinbinder->messageBoxInfo(sprintf($neardLang->getValue(Lang::VHOST_CREATED), $serverName, $serverName, $documentRoot), $neardLang->getValue(Lang::ADD_VHOST_TITLE));
                 $neardWinbinder->destroyWindow($window);
             } else {
                 $neardWinbinder->messageBoxError($neardLang->getValue(Lang::VHOST_CREATED_ERROR), $neardLang->getValue(Lang::ADD_VHOST_TITLE));
                 $neardWinbinder->resetProgressBar($this->wbProgressBar);
             }
             break;
         case IDCLOSE:
         case $this->wbBtnCancel[WinBinder::CTRL_ID]:
             $neardWinbinder->destroyWindow($window);
             break;
     }
 }
开发者ID:RobertoMalatesta,项目名称:neard,代码行数:44,代码来源:class.action.addVhost.php

示例15: pathinfo

<?php

require_once "header.php";
if ($session->is_logged_in()) {
    $loggeduser = User::get_by_id($session->user_id);
}
$pathinfo = pathinfo($_SERVER["PHP_SELF"]);
$basename = $pathinfo["basename"];
$currentFile = str_replace(".php", "", $basename);
$pageURL = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
echo "<input id='batchid' type='hidden'  value='" . $_GET['id'] . "'>";
if (isset($_GET['id'])) {
    $batch = Batch::get_by_id($_GET['id']);
    $school = School::get_by_id($batch->schoolid);
    $batchUsers = BatchUser::getUsersInBatch($batch->id);
    if ($session->is_logged_in()) {
        if (!User::get_by_id($session->user_id)->is_super_admin()) {
            if ($batch->pending == 1 || $batch->enabled == 0) {
                header("location: index.php?negative");
            }
        }
    } else {
        if ($batch->pending == 1 || $batch->enabled == 0) {
            header("location: index.php?negative");
        }
    }
} else {
    header("location: index.php?negative");
}
?>
开发者ID:NemOry,项目名称:Skoolyf,代码行数:30,代码来源:batch.php


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