Perforce Chronicle 2012.2/486814
API Documentation

Ui_Controller_Helper_HelpUrl Class Reference

Action helper to specify a custom help URL. More...

List of all members.

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

Detailed Description

Action helper to specify a custom help URL.

Copyright:
2011-2012 Perforce Software. All rights reserved
License:
Please see LICENSE.txt in top-level folder of this distribution.
Version:
2012.2/486814

Member Function Documentation

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.

Returns:
string the current help url.
    {
        $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.

Parameters:
string$urlthe URL to use when help dialogs are to be opened.
Returns:
Ui_Controller_Helper_HelpUrl provide a fluent interface.
    {
        $this->_url = $url;
        return $this;
    }

Member Data Documentation

Ui_Controller_Helper_HelpUrl::$_url = null [protected]
const Ui_Controller_Helper_HelpUrl::HELP_DEFAULT_PAGE = 'introduction.overview.html'

The documentation for this class was generated from the following file: