Пример #1
0
 public static function generate(array $params)
 {
     $action = is_array($params) ? array_shift($params) : null;
     Lib\Display::setLayout('admin');
     $user = self::_checkLogin();
     if ($user) {
         self::$_user = $user;
         Lib\Display::addKey('user', $user);
         $message = null;
         $force = false;
         if (Lib\Url::GetBool('created')) {
             $message = ['message' => 'Bracket was created successfully!', 'type' => 'success'];
             $force = true;
         }
         if (Lib\Url::GetBool('edited')) {
             $message = ['message' => 'Bracket was updated successfully!', 'type' => 'success'];
             $force = true;
         }
         // If there's an action, check for that page controller and use it
         if ($action && class_exists('Controller\\Admin\\' . $action, true)) {
             call_user_func(['Controller\\Admin\\' . $action, 'generate'], $params);
         } else {
             // Show the rollup page
             self::_main($message, $force);
         }
     }
 }
Пример #2
0
 public static final function render(array $params)
 {
     // Set some page default things
     Lib\Display::addKey('title', DEFAULT_TITLE);
     Lib\Display::setLayout('default');
     static::_initTemplateHelpers();
     Lib\Display::addKey('CSS_VERSION', CSS_VERSION);
     Lib\Display::addKey('JS_VERSION', JS_VERSION);
     Lib\Display::addKey('USE_MIN', USE_MIN);
     Lib\Display::addKey('user', Api\User::getCurrentUser());
     // Kick off page specific rendering
     static::generate($params);
 }
Пример #3
0
 public static final function render(array $params)
 {
     // Set some page default things
     Lib\Display::addKey('title', DEFAULT_TITLE);
     Lib\Display::setLayout('default');
     static::_initTemplateHelpers();
     Lib\Display::addKey('CSS_VERSION', CSS_VERSION);
     Lib\Display::addKey('JS_VERSION', JS_VERSION);
     Lib\Display::addKey('USE_MIN', USE_MIN);
     $user = Api\User::getCurrentUser();
     Lib\Display::addKey('user', $user);
     // If we have a user, seed the test bucket so that
     // random distribution is deterministic
     if ($user) {
         Lib\TestBucket::initialize($user->id);
     }
     // Kick off page specific rendering
     static::generate($params);
 }
Пример #4
0
 public static function generate(array $params)
 {
     Lib\Display::setLayout('landing');
     Lib\Display::addKey('rounds', Api\Round::getRandomCompletedRounds(30));
     Lib\Display::addKey('phrase', static::$_phrases[rand() % count(static::$_phrases)]);
 }