public function onEvent($event, $data)
 {
     foreach ((array) $this->getClass('PushbulletManager')->find() as $Token) {
         $bulletHandler = new PushbulletHandler($Token->get('token'));
         $bulletHandler->pushNote('', $data['HostName'] . ' Failed', 'This host has failed to image');
     }
 }
 public function add_post()
 {
     try {
         $token = trim($_REQUEST['apiToken']);
         if ($this->getClass('PushbulletManager')->exists(trim($_REQUEST['apiToken']))) {
             throw new Exception('Account already linked');
         }
         if (!$token) {
             throw new Exception('Please enter an access token');
         }
         $bulletHandler = new PushbulletHandler($token);
         $userInfo = $bulletHandler->getUserInformation();
         $Bullet = new Pushbullet(array('token' => $token, 'name' => $userInfo->name, 'email' => $userInfo->email));
         if ($Bullet->save()) {
             $bulletHandler->pushNote('', 'FOG', 'Account linked');
             $this->FOGCore->setMessage('Account Added!');
             $this->FOGCore->redirect('?node=pushbullet&sub=list');
         }
     } catch (Exception $e) {
         $this->FOGCore->setMessage($e->getMessage());
         $this->FOGCore->redirect($this->formAction);
     }
 }