示例#1
0
文件: main.php 项目: eric116/BotQueue
 /**
  * @param Bot $bot
  * @return array
  */
 private function _getStatusButtons($bot)
 {
     $buttons = array();
     $buttons['pause'] = array("url" => $bot->getUrl() . "/pause", "icon" => "icon-pause", "text" => "pause job");
     $buttons['dropjob'] = array("url" => $bot->getUrl() . "/dropjob", "icon" => "icon-stop", "text" => "stop job");
     $buttons['edit'] = array("url" => $bot->getUrl() . "/edit", "icon" => "icon-cog", "text" => "edit bot");
     $buttons['play'] = array("url" => $bot->getUrl() . "/play", "icon" => "icon-play", "text" => "resume job");
     $buttons['qa'] = array("url" => $bot->getCurrentJob()->getUrl() . "/qa", "icon" => "icon-check", "text" => "verify output");
     $buttons['offline'] = array("url" => $bot->getUrl() . "/setstatus/offline", "icon" => "icon-stop", "text" => "take offline");
     $buttons['online'] = array("url" => $bot->getUrl() . "/setstatus/idle", "icon" => "icon-play", "text" => "bring online");
     $buttons['retire'] = array("url" => $bot->getUrl() . "/retire", "icon" => "icon-lock", "text" => "retire bot");
     $buttons['delete'] = array("url" => $bot->getUrl() . "/delete", "icon" => "icon-remove", "text" => "delete bot");
     $buttons['error'] = array("url" => $bot->getURL() . "/error", "icon" => "icon-exclamation-sign", "text" => "error mode");
     return $buttons;
 }
示例#2
0
文件: bot.php 项目: ricberw/BotQueue
 public function set_status()
 {
     $this->assertLoggedIn();
     try {
         //how do we find them?
         if ($this->args('id')) {
             $bot = new Bot($this->args('id'));
         }
         //did we really get someone?
         if (!$bot->isHydrated()) {
             throw new Exception("Could not find that bot.");
         }
         if (!$bot->isMine()) {
             throw new Exception("You cannot view that bot.");
         }
         if ($bot->get('status') == 'working' && $this->args('status') == 'offline') {
             throw new Exception("You cannot take a working bot offline through the web interface.  Use the client app instead.");
         }
         if ($this->args('status') == 'offline') {
             Activity::log("took the bot " . $bot->getLink() . " offline.");
         } else {
             Activity::log("brought the bot " . $bot->getLink() . " online.");
         }
         $bot->set('status', $this->args('status'));
         $bot->save();
         $this->forwardToUrl($bot->getUrl());
     } catch (Exception $e) {
         $this->set('megaerror', $e->getMessage());
         $this->setTitle("Change Bot Status - Error");
     }
 }