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; }
/** * 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); }