Пример #1
0
 /**
  * Return the "away" userstate object
  * @return \thebuggenie\core\entities\Userstate
  */
 public static function getAwayState()
 {
     try {
         return \thebuggenie\core\entities\Userstate::getB2DBTable()->selectByID(self::get(self::SETTING_AWAYSTATE));
     } catch (\Exception $e) {
         return null;
     }
 }
Пример #2
0
 public function runSetState(framework\Request $request)
 {
     try {
         $state = entities\Userstate::getB2DBTable()->selectById($request['state_id']);
         $this->getUser()->setState($state);
         $this->getUser()->save();
         return $this->renderJSON(array('userstate' => $this->getI18n()->__($state->getName())));
     } catch (\Exception $e) {
         $this->getResponse()->setHttpStatus(400);
         return $this->renderJSON(array('error' => $this->getI18n()->__('An error occured while trying to update your status')));
     }
 }