Exemplo n.º 1
0
 public function dashboard()
 {
     if (User::isLoggedIn()) {
         $bots = User::$me->getActiveBots();
         $this->set('bots', $bots->getAll());
         $this->set('bot_count', $bots->count());
         $on_deck = User::$me->getJobs('available', 'user_sort', 'ASC');
         $this->set('on_deck', $on_deck->getRange(0, 5));
         $this->set('on_deck_count', $on_deck->count());
         $finished = User::$me->getJobs('complete', 'verified_time', 'DESC');
         $this->set('finished', $finished->getRange(0, 5));
         $this->set('finished_count', $finished->count());
         //what style to show?
         if ($this->args('dashboard_style')) {
             User::$me->set('dashboard_style', $this->args('dashboard_style'));
             User::$me->save();
         }
         //do we need to set a default?
         if (!User::$me->get('dashboard_style')) {
             User::$me->set('dashboard_style', 'large_thumbnails');
             User::$me->save();
         }
         //are there any apps requesting access?
         $this->set('request_tokens', OAuthToken::getRequestTokensByIP()->getAll());
         //okay, pull in our dashboard style.
         $this->set('dashboard_style', User::$me->get('dashboard_style'));
     } else {
         die('You must be logged in to view this page.');
     }
 }
Exemplo n.º 2
0
 public function home()
 {
     $this->set('area', 'app');
     if (User::isLoggedIn()) {
         $this->set('apps', User::$me->getMyApps()->getAll());
         $this->set('authorized', User::$me->getAuthorizedApps()->getAll());
         $this->set('requesting', OAuthToken::getRequestTokensByIP()->getAll());
     }
 }
Exemplo n.º 3
0
 public function dashboard()
 {
     if (!User::isLoggedIn()) {
         die('You must be logged in to view this page.');
     }
     //do we need to set a default?
     if (!User::$me->get('dashboard_style')) {
         User::$me->set('dashboard_style', 'large_thumbnails');
         User::$me->save();
     }
     //okay, pull in our dashboard style.
     $this->set('dashboard_style', User::$me->get('dashboard_style'));
     //are there any apps requesting access?
     $this->set('request_tokens', OAuthToken::getRequestTokensByIP()->getAll());
     $this->addTemplate('bot_thumbnail_template', Controller::byName('bot')->renderTemplate('thumbnail'));
     $this->addTemplate('bot_list_template', Controller::byName('bot')->renderTemplate('dashboard_list'));
     $this->addTemplate('job_list_template', Controller::byName('job')->renderTemplate('job_list'));
     $this->addScript('initial_data', "var initialData = " . Controller::byName('main')->renderView('dashboard_data'), "text/javascript");
     $this->addScript("js/backbone.js");
 }