Пример #1
0
 public function getManagerButtonMap()
 {
     // Vars
     $buttons = array();
     // Generate the button mapping
     if ($this->isInstalled()) {
         $buttons = array(array('method' => 'uninstall', 'label' => 'Uninstall'), array('method' => 'manage', 'label' => 'Manage', 'onclick' => "self.location='" . UrlCommand::createUrl('acl') . "';"));
     } else {
         $buttons = array(array('method' => 'install', 'label' => 'Install'));
     }
     // Result
     return $buttons;
 }
Пример #2
0
 /**
  * Generates the same URL as UrlCommand::createUrl(), but prefixes this with
  * the application's domain name.
  * Note that the protocol (eg. http, https, ftp, etc) is NOT included in the
  * returned URL.
  *
  * @param string $controllerName Controller name (in lower-hyphenated format, eg. controller-name)
  * @param string $actionName Action name (in lower-hyphenated format, eg. action-name)
  * @param mixed $params Action parameters. Order is significant
  * @return string
  */
 public static function createAbsoluteUrl($controllerName = 'index', $actionName = 'index', ...$params)
 {
     // Gather additional arguments into any array
     $allParams = [];
     foreach ($params as $param) {
         if (is_array($param)) {
             foreach ($param as $k => $p) {
                 $allParams[$k] = $p;
             }
         } else {
             $allParams[] = $param;
         }
     }
     // Result
     $p = isset($_SERVER['SERVER_PORT']) ? $_SERVER['SERVER_PORT'] : 80;
     $port = $p != 80 && $p != 443 ? ":" . $p : '';
     return Config::get('app.domain') . $port . UrlCommand::createUrl($controllerName, $actionName, $allParams);
 }
Пример #3
0
 /**
  * Returns the application login View (/core/app-login) so the user can
  * potentially gain core admin access.
  *
  * @param string $referrerUrl After a successful login, the user will be redirected here
  * @return View
  */
 public static function getLoginView($referrerUrl = null)
 {
     // Create the view
     $command = UrlCommand::create('/core/app-login');
     $view = $command->execute();
     $view->refererUrl = $referrerUrl;
     // Result
     return $view;
 }
Пример #4
0
 /**
  * Executes the "/global-view" UrlCommand, stores the resulting View in the
  * cached self::$globalView property and returns it.
  *
  * @return View
  */
 public static function getGlobalView()
 {
     if (self::$globalView === null) {
         $gvCommand = UrlCommand::create('/global-view');
         self::$globalView = $gvCommand->execute();
     }
     return self::$globalView;
 }