コード例 #1
0
ファイル: slicer.php プロジェクト: JoonasMelin/BotQueue
 public function job_update()
 {
     $this->set('area', 'jobs');
     try {
         //load the data and check for errors.
         $job = new SliceJob($this->args('id'));
         if (!$job->isHydrated()) {
             throw new Exception("That slice job does not exist.");
         }
         if ($job->get('user_id') != User::$me->id) {
             throw new Exception("You do not have access to view this slice job.");
         }
         if ($job->get('status') != 'pending') {
             throw new Exception("This slice job is not in a pending state.");
         }
         if ($this->args('pass')) {
             $job->pass();
         }
         if ($this->args('fail')) {
             $job->fail();
         }
         $this->forwardToUrl($job->getUrl());
     } catch (Exception $e) {
         $this->setTitle("Slice Job - Error");
         $this->set('megaerror', $e->getMessage());
     }
 }