Beispiel #1
0
 /**
  * Sets default ACL role(s) to use when iterating pages if not explicitly
  * set later with {@link setRole()}
  *
  * @param  midex $role               [optional] role to set. Expects null,
  *                                   string, or an instance of
  *                                   {@link IfwPsn_Vendor_Zend_Acl_Role_Interface}.
  *                                   Default is null, which sets no default
  *                                   role.
  * @throws IfwPsn_Vendor_Zend_View_Exception       if role is invalid
  * @return void
  */
 public static function setDefaultRole($role = null)
 {
     if (null === $role || is_string($role) || $role instanceof IfwPsn_Vendor_Zend_Acl_Role_Interface) {
         self::$_defaultRole = $role;
     } else {
         require_once IFW_PSN_LIB_ROOT . 'IfwPsn/Vendor/Zend/View/Exception.php';
         throw new IfwPsn_Vendor_Zend_View_Exception('$role must be null|string|IfwPsn_Vendor_Zend_Acl_Role_Interface');
     }
 }
Beispiel #2
0
 /**
  * Magic overload: Proxy calls to {@link findRelation()} or container
  *
  * Examples of finder calls:
  * <code>
  * // METHOD                  // SAME AS
  * $h->findRelNext($page);    // $h->findRelation($page, 'rel', 'next')
  * $h->findRevSection($page); // $h->findRelation($page, 'rev', 'section');
  * $h->findRelFoo($page);     // $h->findRelation($page, 'rel', 'foo');
  * </code>
  *
  * @param  string $method             method name
  * @param  array  $arguments          method arguments
  * @throws IfwPsn_Vendor_Zend_Navigation_Exception  if method does not exist in container
  */
 public function __call($method, array $arguments = array())
 {
     if (@preg_match('/find(Rel|Rev)(.+)/', $method, $match)) {
         return $this->findRelation($arguments[0], strtolower($match[1]), strtolower($match[2]));
     }
     return parent::__call($method, $arguments);
 }
Beispiel #3
0
 /**
  * Magic overload: Proxy to other navigation helpers or the container
  *
  * Examples of usage from a view script or layout:
  * <code>
  * // proxy to Menu helper and render container:
  * echo $this->navigation()->menu();
  *
  * // proxy to Breadcrumbs helper and set indentation:
  * $this->navigation()->breadcrumbs()->setIndent(8);
  *
  * // proxy to container and find all pages with 'blog' route:
  * $blogPages = $this->navigation()->findAllByRoute('blog');
  * </code>
  *
  * @param  string $method             helper name or method name in
  *                                    container
  * @param  array  $arguments          [optional] arguments to pass
  * @return mixed                      returns what the proxied call returns
  * @throws IfwPsn_Vendor_Zend_View_Exception        if proxying to a helper, and the
  *                                    helper is not an instance of the
  *                                    interface specified in
  *                                    {@link findHelper()}
  * @throws IfwPsn_Vendor_Zend_Navigation_Exception  if method does not exist in container
  */
 public function __call($method, array $arguments = array())
 {
     // check if call should proxy to another helper
     if ($helper = $this->findHelper($method, false)) {
         return call_user_func_array(array($helper, $method), $arguments);
     }
     // default behaviour: proxy call to container
     return parent::__call($method, $arguments);
 }