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


PHP Queue::isMine方法代码示例

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


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

示例1: edit

 public function edit()
 {
     $this->assertLoggedIn();
     $this->set('area', 'queues');
     try {
         //how do we find them?
         $queue = new Queue($this->args('id'));
         //did we really get someone?
         if (!$queue->isHydrated()) {
             throw new Exception("Could not find that queue.");
         }
         if (!$queue->isMine()) {
             throw new Exception("You do not own this queue.");
         }
         $this->set('queue', $queue);
         $this->setTitle('Edit Queue - ' . $queue->getName());
         //load up our form.
         $form = $this->_createQueueForm($queue);
         $form->action = $queue->getUrl() . "/edit";
         //handle our form
         if ($form->checkSubmitAndValidate($this->args())) {
             $queue->set('name', $this->args('name'));
             $queue->set('delay', $this->args('delay'));
             $queue->save();
             Activity::log("edited the queue " . $queue->getLink() . ".");
             $this->forwardToUrl($queue->getUrl());
         }
         $this->set('form', $form);
     } catch (Exception $e) {
         $this->setTitle('Edit Queue - Error');
         $this->set('megaerror', $e->getMessage());
     }
 }
开发者ID:eric116,项目名称:BotQueue,代码行数:33,代码来源:queue.php

示例2: listjobs

 public function listjobs()
 {
     $this->assertLoggedIn();
     try {
         //did we get a queue?
         $queue = new Queue($this->args('id'));
         if (!$queue->isHydrated()) {
             throw new Exception("Could not find that queue.");
         }
         if (!$queue->isMine()) {
             throw new Exception("You do not have permission to view this queue.");
         }
         $this->set('queue', $queue);
         //what sort of jobs to view?
         $status = $this->args('status');
         if ($status == 'available') {
             $this->setTitle($queue->getName() . "'s Available Jobs");
             $collection = $queue->getJobs($status);
         } else {
             if ($status == 'taken') {
                 $this->setTitle($queue->getName() . "'s Working Jobs");
                 $collection = $queue->getJobs($status);
             } else {
                 if ($status == 'complete') {
                     $this->setTitle($queue->getName() . "'s Finished Jobs");
                     $collection = $queue->getJobs($status);
                 } else {
                     if ($status == 'failure') {
                         $this->setTitle($queue->getName() . "'s Failed Jobs");
                         $collection = $queue->getJobs($status);
                     } else {
                         if ($status == 'all') {
                             $this->setTitle($queue->getName() . "'s Jobs");
                             $collection = $queue->getJobs(null);
                         } else {
                             throw new Exception("That is not a valid status!");
                         }
                     }
                 }
             }
         }
         $per_page = 20;
         $page = $collection->putWithinBounds($this->args('page'), $per_page);
         $this->set('per_page', $per_page);
         $this->set('total', $collection->count());
         $this->set('page', $page);
         $this->set('jobs', $collection->getPage($page, $per_page));
         $this->set('status', $status);
     } catch (Exception $e) {
         $this->setTitle('View Queue - Error');
         $this->set('megaerror', $e->getMessage());
     }
 }
开发者ID:ricberw,项目名称:BotQueue,代码行数:53,代码来源:queue.php

示例3: _createJobsFromFile

 /**
  * @param $file StorageInterface
  * @param $quantity mixed
  * @param $queue_id mixed
  * @param $priority mixed
  * @return array
  * @throws Exception
  */
 private function _createJobsFromFile($file, $quantity, $queue_id, $priority)
 {
     //pull in our quantity
     $quantity = (int) $quantity;
     $quantity = max(1, $quantity);
     $quantity = min(1000, $quantity);
     //queue error checking.
     $queue = new Queue($queue_id);
     if (!$queue->isHydrated()) {
         throw new Exception("That queue does not exist.");
     }
     if (!$queue->isMine()) {
         throw new Exception("You do not have permission to add to that queue.");
     }
     //okay, we good?
     $jobs = $queue->addFile($file, $quantity);
     //priority or not?
     if ($priority) {
         if (!empty($jobs)) {
             foreach ($jobs as $job) {
                 /* @var $job Job */
                 $job->pushToTop();
             }
         }
     }
     return $jobs;
 }
开发者ID:eric116,项目名称:BotQueue,代码行数:35,代码来源:job.php


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