|
Perforce Chronicle 2012.2/486814
API Documentation
|
Action helper to specify a custom help URL. More...
Public Member Functions | |
| getUrl () | |
| Retrieves a custom URL to use for application help. | |
| setUrl ($url) | |
| Sets a custom URL to use for Help dialogs. | |
Public Attributes | |
| const | HELP_BASE_URL = 'docs/manual' |
| const | HELP_COOKIE = 'help-page' |
| const | HELP_DEFAULT_PAGE = 'introduction.overview.html' |
Protected Attributes | |
| $_url = null | |
Action helper to specify a custom help URL.
| Ui_Controller_Helper_HelpUrl::getUrl | ( | ) |
Retrieves a custom URL to use for application help.
If the instance URL is unset, we fall back to a cookie-stored URL, and if that is unset, we fall back to a default page.
{
$url = $this->_url;
$request = Zend_Controller_Front::getInstance()->getRequest();
$baseUrl = $request->getBaseUrl();
$helpBase = static::HELP_BASE_URL;
// if a context-specific url is set, use it.
if ($url && P4Cms_Uri::isRelativeUri($url)) {
$url = implode('/', array($baseUrl, $helpBase, $url));
}
// get the URL from the cookie, if not set
$url = $url ?: $request->getCookie(static::HELP_COOKIE);
// use the default URL, if still not set
$url = $url ?: implode('/', array($baseUrl, $helpBase, static::HELP_DEFAULT_PAGE));
return $url;
}
| Ui_Controller_Helper_HelpUrl::setUrl | ( | $ | url | ) |
Sets a custom URL to use for Help dialogs.
| string | $url | the URL to use when help dialogs are to be opened. |
{
$this->_url = $url;
return $this;
}
Ui_Controller_Helper_HelpUrl::$_url = null [protected] |
| const Ui_Controller_Helper_HelpUrl::HELP_BASE_URL = 'docs/manual' |
| const Ui_Controller_Helper_HelpUrl::HELP_COOKIE = 'help-page' |
| const Ui_Controller_Helper_HelpUrl::HELP_DEFAULT_PAGE = 'introduction.overview.html' |