public function __construct($submitUrl, $targetId, $formId = null, $args = null)
 {
     // Filter out elements passed by type
     $args = \MUtil_Ra::args(func_get_args(), array('submitUrl' => array('MUtil_Html_UrlArrayAttribute', 'is_array', 'is_string'), 'targetId' => array('MUtil_Html_ElementInterface', 'is_string'), 'formId' => array('Zend_Form', 'is_string')), null, \MUtil_Ra::STRICT);
     // \MUtil_Echo::r($args);
     parent::__construct($args);
 }
예제 #2
0
 /**
  * \MUtil_Ra::args() parameter passing is allowed.
  *
  * @param string $seperatorChar
  * @param string $displaySeperator
  * @param boolean $valuePad
  */
 public function __construct($seperatorChar = ' ', $displaySeperator = ' ', $valuePad = true)
 {
     $args = \MUtil_Ra::args(func_get_args(), array('seperatorChar' => 'is_string', 'displaySeperator' => array('MUtil_Html_HtmlInterface', 'is_string'), 'valuePad' => 'is_boolean'), array('seperatorChar' => ' ', 'displaySeperator' => ' ', 'valuePad' => true));
     $this->seperatorChar = substr($args['seperatorChar'] . ' ', 0, 1);
     $this->displaySeperator = $args['displaySeperator'];
     $this->valuePad = $args['valuePad'];
 }
 /**
  * Gets one or more values for a certain field name.
  *
  * @see \MUtil_Model_ModelAbstract->get()
  *
  * @param string $name Field name
  * @param string|array|null $arrayOrKey1 Null or the name of a single attribute or an array of attribute names
  * @param string $key2 Optional a second attribute name.
  * @return mixed
  */
 public function get($name, $arrayOrKey1 = null, $key2 = null)
 {
     $args = func_get_args();
     $args = \MUtil_Ra::args($args, 1);
     switch (count($args)) {
         case 0:
             if (isset($this->_fields[$name])) {
                 return $this->_fields[$name];
             } else {
                 return array();
             }
         case 1:
             $key = $arrayOrKey1;
             if (isset($this->_fields[$name][$arrayOrKey1])) {
                 return $this->_fields[$name][$arrayOrKey1];
             } else {
                 return null;
             }
         default:
             $results = array();
             foreach ($args as $key) {
                 if (isset($this->_fields[$name][$arrayOrKey1])) {
                     $results[$key] = $this->_fields[$name][$arrayOrKey1];
                 }
             }
             return $results;
     }
 }
예제 #4
0
 public function __construct($repeatable_args = null)
 {
     $args = \MUtil_Ra::args(func_get_args());
     foreach ($args as $id => $repeatable) {
         if (null != $repeatable) {
             $this->addRepeater($repeatable, $id);
         }
     }
 }
 public function __construct(array $options = null)
 {
     $args = \MUtil_Ra::args(func_get_args());
     foreach ($args as $name => $arg) {
         if (!is_int($name)) {
             if (method_exists($this, $fname = 'set' . ucfirst($name))) {
                 $this->{$fname}($arg);
             } else {
                 $this->setJQueryParam($name, $arg);
             }
         }
     }
 }
예제 #6
0
 /**
 *
 * <code>
   $select = $db->select();
   $select->from('gems__rounds', array('gro_id_track', 'gro_id_survey', 'gro_id_round', 'gro_id_order'))->where('gro_id_track = 220');
   $existing = $select->query()->fetchAll();
   \MUtil_Echo::r(\MUtil_Ra_Nested::toTree($existing), 'Auto tree');
   \MUtil_Echo::r(\MUtil_Ra_Nested::toTree($existing, 'gro_id_track', 'gro_id_survey'), 'Named tree with set at end (data loss in this case)');
   \MUtil_Echo::r(\MUtil_Ra_Nested::toTree($existing, 'gro_id_track', 'gro_id_survey', null), 'Named tree with append');
   \MUtil_Echo::r(\MUtil_Ra_Nested::toTree($existing, 'gro_id_track', null, 'gro_id_survey', null), 'Named tree with double append');
 </code>
 */
 public static function toTree(array $data, $key_args = null)
 {
     if (!$data) {
         return $data;
     }
     if (func_num_args() == 1) {
         // Get the keys of the first nested item
         $keys = array_keys(reset($data));
     } else {
         $keys = \MUtil_Ra::args(func_get_args(), 1);
     }
     $valueKeys = array_diff(array_keys(reset($data)), $keys);
     switch (count($valueKeys)) {
         case 0:
             // Drop the last item
             $valueKey = array_pop($keys);
             $valueKeys = false;
             break;
         case 1:
             $valueKey = reset($valueKeys);
             $valueKeys = false;
             break;
     }
     $results = array();
     foreach ($data as $item) {
         $current =& $results;
         foreach ($keys as $key) {
             if (null === $key) {
                 $count = count($current);
                 $current[$count] = array();
                 $current =& $current[$count];
             } elseif (array_key_exists($key, $item)) {
                 $value = $item[$key];
                 if (!array_key_exists($value, $current)) {
                     $current[$value] = array();
                 }
                 $current =& $current[$value];
             }
         }
         if ($valueKeys) {
             foreach ($valueKeys as $key) {
                 $current[$key] = $item[$key];
             }
         } else {
             $current = $item[$valueKey];
         }
     }
     return $results;
 }
 public function __construct()
 {
     $sources = \MUtil_Ra::args(func_get_args());
     $array = array();
     foreach ($sources as $key => $source) {
         // Fix for array sources.
         if (is_string($key)) {
             $array[$key] = $source;
         } else {
             $this->addSource($source);
         }
     }
     if ($array) {
         $this->addSource($array);
     }
 }
예제 #8
0
 public function __construct(\MUtil_Html_PagePanel $panel, $glue = ' ', $args_array = null)
 {
     $args = \MUtil_Ra::args(func_get_args(), array('panel' => 'MUtil_Html_PagePanel', 'glue'), array('glue' => ' '));
     if (isset($args['panel'])) {
         $this->_panel = $args['panel'];
         unset($args['panel']);
     } else {
         throw new \MUtil_Html_HtmlException('Illegal argument: no panel passed to ' . __CLASS__ . ' constructor.');
     }
     if (isset($args['glue'])) {
         $this->setGlue($args['glue']);
         unset($args['glue']);
     } else {
         $this->setGlue($glue);
     }
     $page = $this->toLazy()->page;
     $args = array($page) + $args;
     // We create the element here as this creates as an element using the specifications at this moment.
     // If created at render time the settings might have changed, introducing hard to trace bugs.
     $this->_element = $panel->createPageLink($this->toLazy()->notCurrent(), $page, $args);
 }
예제 #9
0
 /**
  * Create a page panel
  *
  * @param mixed $paginator \MUtil_Ra::args() arguements
  * @param mixed $request
  * @param mixed $translator
  * @param mixed $args
  * @return \MUtil_Html_PagePanel
  */
 public static function pagePanel($paginator = null, $request = null, $translator = null, $args = null)
 {
     $types = array('paginator' => 'Zend_Paginator', 'request' => 'Zend_Controller_Request_Abstract', 'translator' => 'Zend_Translate', 'view' => 'Zend_View');
     $args = \MUtil_Ra::args(func_get_args(), $types, null, \MUtil_Ra::STRICT);
     $panel_args = array();
     foreach (array('baseUrl', 'paginator', 'request', 'scrollingStyle', 'view', 'itemCount') as $var) {
         if (isset($args[$var])) {
             $panel_args[$var] = $args[$var];
             unset($args[$var]);
         }
     }
     if (isset($args['translator'])) {
         $translator = $args['translator'];
         unset($args['translator']);
     } else {
         $translator = \Zend_Registry::get('Zend_Translate');
     }
     if (isset($args['class'])) {
         if ($args['class'] instanceof \MUtil_Html_AttributeInterface) {
             $args['class']->add('browselink');
         } else {
             $args['class'] = new \MUtil_Html_ClassArrayAttribute('browselink', $args['class']);
         }
     } else {
         $args['class'] = new \MUtil_Html_ClassArrayAttribute('browselink');
     }
     // \MUtil_Echo::track($args);
     // \MUtil_Echo::track($panel_args['baseUrl']);
     if (\MUtil_Bootstrap::enabled()) {
         $pager = new \MUtil_Bootstrap_Html_PagePanel($panel_args);
     } else {
         $pager = new \MUtil_Html_PagePanel($panel_args);
     }
     $pager[] = $pager->pageLinks(array($translator->_('<< First'), 'class' => new \MUtil_Html_ClassArrayAttribute('browselink', 'keyHome')), array($translator->_('< Previous'), 'class' => new \MUtil_Html_ClassArrayAttribute('browselink', 'keyPgUp')), array($translator->_('Next >'), 'class' => new \MUtil_Html_ClassArrayAttribute('browselink', 'keyPgDn')), array($translator->_('Last >>'), 'class' => new \MUtil_Html_ClassArrayAttribute('browselink', 'keyEnd')), $translator->_(' | '), $args);
     $pager->div($pager->uptoOffDynamic($translator->_('to'), $translator->_('of'), array('-', 'class' => new \MUtil_Html_ClassArrayAttribute('browselink btn btn-xs', 'keyCtrlUp')), array('+', 'class' => new \MUtil_Html_ClassArrayAttribute('browselink btn btn-xs', 'keyCtrlDown')), null, ' ', $args), array('class' => 'pagination-index rightFloat pull-right'));
     return $pager;
 }
예제 #10
0
파일: Acl.php 프로젝트: GemsTracker/MUtil
 /**
  * Removes a previously set "allow" rule from the ACL
  *
  * @param  \Zend_Acl_Role_Interface|string|array     $roles
  * @param  string|array                             $privileges
  * @uses   \Zend_Acl::allow()
  * @return \Zend_Acl Provides a fluent interface
  */
 public function removePrivilege($roles, $privileges_args)
 {
     $privileges = \MUtil_Ra::args(func_get_args(), 1);
     return $this->removeAllow($roles, null, $privileges);
 }
예제 #11
0
 /**
  * Returns a reset form for handling both the incoming request and the outgoing reset request
  *
  * @param mixed $args_array \MUtil_Ra::args array for LoginForm initiation.
  * @return \Gems_User_Form_ResetRequestForm
  */
 public function getResetRequestForm($args_array = null)
 {
     $args = \MUtil_Ra::args(func_get_args());
     return $this->_loadClass('Form_ResetRequestForm', true, array($args));
 }
 /**
  * Gets a reset password form.
  *
  * @return \Gems_User_Form_ResetForm
  */
 protected function createResetRequestForm()
 {
     $args = \MUtil_Ra::args(func_get_args(), array(), array('labelWidthFactor' => $this->labelWidthFactor));
     $this->initHtml();
     return $this->loader->getUserLoader()->getResetRequestForm($args);
 }
예제 #13
0
 /**
  * Static helper function to create an iframe element.
  *
  * Any extra parameters are added as either content, attributes or handled
  * as special types, if defined as such for this element.
  *
  * @param mixed $src We assume the first element is src, unless a later element is explicitly specified as such
  * @param mixed $arg_array \MUtil_Ra::args arguments
  */
 public static function iFrame($src, $arg_array = null)
 {
     $args = \MUtil_Ra::args(func_get_args(), array('src' => 'MUtil_Html_SrcArrayAttribute'));
     return new self($args);
 }
예제 #14
0
 /**
  * Make an element with the specified tag name.
  *
  * Any extra parameters are added as either content, attributes or handled
  * as special types, if defined as such for this element.
  *
  * @param string $tagName
  * @param mixed $arg_array \MUtil_Ra::args arguments
  */
 public function __construct($tagName, $arg_array = null)
 {
     $args = \MUtil_Ra::args(func_get_args(), 1);
     $this->tagName = $tagName;
     if ($this->_specialTypes) {
         $this->_specialTypes = $this->_specialTypes + $this->_specialTypesDefault;
     } else {
         $this->_specialTypes = $this->_specialTypesDefault;
     }
     if ($this->_allowedChildTags || $this->_defaultChildTag) {
         // These variables influence each other, make sure they match
         if ($this->_allowedChildTags) {
             if (!is_array($this->_allowedChildTags)) {
                 $this->_allowedChildTags = array($this->_allowedChildTags);
             }
         } else {
             $this->_allowedChildTags = array();
         }
         if ($this->_defaultChildTag) {
             if (!in_array($this->_defaultChildTag, $this->_allowedChildTags)) {
                 $this->_allowedChildTags[] = $this->_defaultChildTag;
             }
         } else {
             // Get the first
             $this->_defaultChildTag = reset($this->_allowedChildTags);
         }
     }
     $this->_processParameters($args);
 }
 public function __construct($elementOrId = null, $args = null)
 {
     $args = \MUtil_Ra::args(func_get_args(), array('element' => 'MUtil_Html_ElementInterface', 'attrib' => 'MUtil_Html_AttributeInterface', 'id' => 'is_string'), null, false);
     parent::__construct($args);
 }
예제 #16
0
 /**
  * Constructs a bridge for a model
  *
  * @param \MUtil_Model_ModelAbstract $model The model it is all about
  * @param \MUtil_Html_ElementInterface $args_array
  */
 public function __construct(\MUtil_Model_ModelAbstract $model, $args_array = null)
 {
     parent::__construct($model);
     $this->_chainedBridge = $model->getBridgeFor('display');
     if ($args_array instanceof \MUtil_Html_ElementInterface) {
         $this->table = $args_array;
     } else {
         $args = func_get_args();
         $args = \MUtil_Ra::args($args, 1);
         $this->table = \MUtil_Html::table($args);
     }
 }
예제 #17
0
 public function __construct($arg_array = null)
 {
     $args = \MUtil_Ra::args(func_get_args());
     parent::__construct('p', $args);
 }
예제 #18
0
 /**
  * Change the form into an autosubmit form
  *
  * @param mixed $submitUrl Url as \MUtil_Html_UrlArrayAttribute, array or string
  * @param mixed $targetId Id of html element whose content is replaced by the submit result: \MUtil_Html_ElementInterface or string
  */
 public function setAutoSubmit($submitUrl, $targetId, $selective = false)
 {
     // Filter out elements passed by type
     $args = \MUtil_Ra::args(func_get_args(), array('submitUrl' => array('MUtil_Html_UrlArrayAttribute', 'is_array', 'is_string'), 'targetId' => array('MUtil_Html_ElementInterface', 'is_string')), null, \MUtil_Ra::STRICT);
     if (isset($args['targetId'])) {
         if ($args['targetId'] instanceof \MUtil_Html_ElementInterface) {
             if (isset($args['targetId']->id)) {
                 $args['targetId'] = '#' . $args['targetId']->id;
             } elseif (isset($args['targetId']->class)) {
                 $args['targetId'] = '.' . $args['targetId']->class;
             } else {
                 $args['targetId'] = $args['targetId']->getTagName();
             }
         } else {
             $args['targetId'] = '#' . $args['targetId'];
         }
     }
     if ($selective) {
         $args['selective'] = true;
     }
     $this->_autosubmit = $args;
     $this->_enableAutoSubmitElement($this);
     $this->activateJQuery();
 }
예제 #19
0
 public function __construct($arg_array = null)
 {
     $args = \MUtil_Ra::args(func_get_args());
     parent::__construct('div', array('class' => 'form-group'), $args);
 }
예제 #20
0
 /**
  * Return a sequence with the items separated by spaces
  *
  * @param mixed $args_array \MUtil_Ra::args input
  * @return \self
  */
 public static function createSpaced($args_array = null)
 {
     // BUG FIX: this function used to be called spaced() just
     // like all other static HtmlInterface element creation
     // functions, but as a sequence can contain a sequence
     // this lead to unexpected behaviour.
     $args = \MUtil_Ra::args(func_get_args());
     $seq = new self($args);
     if (!isset($args['glue'])) {
         $seq->setGlue(' ');
     }
     return $seq;
 }
예제 #21
0
 /**
  * Static helper function for creation, used by @see \MUtil_Html_Creator.
  *
  * @param string $src The source
  * @param mixed $arg_array Optional \MUtil_Ra::args processed settings
  * @return \MUtil_Html_ImgElement
  */
 public static function imgFile($src, $arg_array = null)
 {
     $args = \MUtil_Ra::args(func_get_args(), 1);
     $args['src'] = $src;
     if (!isset($args['alt'])) {
         $args['alt'] = '';
     }
     return new self('img', $args);
 }
예제 #22
0
파일: Form.php 프로젝트: GemsTracker/MUtil
 /**
  * Sets the layout to the use of html elements
  *
  * @see \MUtil_Html
  *
  * @param string $html HtmlTag for element or empty sequence when empty
  * @param string $args \MUtil_Ra::args additional arguments for element
  * @return \MUtil_Form (continuation pattern)
  */
 public function setHtml($html = null, $args = null)
 {
     $options = \MUtil_Ra::args(func_get_args(), 1);
     if ($html instanceof \MUtil_Html_ElementInterface) {
         if ($options) {
             foreach ($options as $name => $option) {
                 if (is_int($name)) {
                     $html[] = $option;
                 } else {
                     $html->{$name} = $option;
                 }
             }
         }
     } elseif (null == $html) {
         $html = new \MUtil_Html_Sequence($options);
     } else {
         $html = \MUtil_Html::createArray($html, $options);
     }
     if ($html instanceof \MUtil_Html_FormLayout) {
         $html->setAsFormLayout($this);
     } else {
         // Set this element as the form decorator
         $decorator = new \MUtil_Html_ElementDecorator();
         $decorator->setHtmlElement($html);
         // $decorator->setPrologue($formrep); // Renders hidden elements before this element
         $this->setDecorators(array($decorator, 'AutoFocus', 'Form'));
     }
     $this->_html_element = $html;
     return $this;
 }
예제 #23
0
 public function uptoOffDynamic($upto = '~', $off = '/', $less = '-', $more = '+', $all = null, $glue = ' ', $args = null)
 {
     $argDefaults = array('upto' => '~', 'off' => '/', 'less' => '-', 'more' => '+', 'all' => null, 'glue' => ' ');
     $argNames = array_keys($argDefaults);
     $args = \MUtil_Ra::args(func_get_args(), $argNames, $argDefaults);
     foreach ($argNames as $name) {
         ${$name} = $args[$name];
         unset($args[$name]);
     }
     $seq = new \MUtil_Html_Sequence();
     $seq->setGlue($glue);
     if (null !== $upto) {
         $seq->if($this->pages->totalItemCount, $this->pages->firstItemNumber, 0);
         $seq[] = $upto;
     }
     if (null !== $less) {
         $cless = $this->toLazy()->getItemCountLess();
         $seq[] = $this->createCountLink($cless, $cless, (array) $less + $args);
     }
     if (null !== $upto) {
         $seq[] = $this->pages->lastItemNumber;
     }
     if (null !== $more) {
         $cmore = $this->toLazy()->getItemCountMore();
         $seq[] = $this->createCountLink($cmore, $cmore, (array) $more + $args);
     }
     if (null !== $all) {
         $seq[] = $this->createCountLink($this->toLazy()->getItemCountNotMax(), $this->toLazy()->getItemCountMax(), (array) $all + $args);
     }
     if (null !== $off) {
         if (null !== $upto) {
             $seq[] = $off;
         }
         $seq[] = $this->pages->totalItemCount;
     }
     return $seq;
 }
 protected function findAllowedMenuItem($action)
 {
     $actions = \MUtil_Ra::args(func_get_args());
     $controller = $this->_getParam('controller');
     foreach ($actions as $action) {
         $menuItem = $this->menu->find(array('controller' => $controller, 'action' => $action, 'allowed' => true));
         if ($menuItem) {
             return $menuItem;
         }
     }
 }
예제 #25
0
 /**
  *
  * @param mixed $arg_array \MUtil_Ra::args parameter passing
  */
 public static function sprintf($arg_array = null)
 {
     $args = \MUtil_Ra::args(func_get_args());
     return new self($args);
 }
예제 #26
0
 /**
  * Returns a button that can be clicked to start the progress bar.
  *
  * @param mixed $arg_array \MUtil_Ra::args() arguments to populate link with
  * @return \MUtil_Html_HtmlElement
  */
 public function getStartButton($args_array = 'Start')
 {
     $args = \MUtil_Ra::args(func_get_args());
     $args['onclick'] = 'if (! this.disabled) {' . $this->getFunctionPrefix() . 'Start();} this.disabled = true; event.cancelBubble=true;';
     $button = new \MUtil_Html_HtmlElement('button', $args);
     $button->appendAttrib('class', $this->_buttonClass . ' btn-succes');
     return $button;
 }
예제 #27
0
 /**
  * Returns a sequence of frist, previous, range, next and last conditional links.
  *
  * The condition is them being valid links, otherwise they are returned as span
  * elements.
  *
  * Note: This sequence is not added automatically to this object, you will have to
  * position it manually.
  *
  * @param string $first Label for goto first page link
  * @param string $previous Label for goto previous page link
  * @param string $next Label for goto next page link
  * @param string $last Label for goto last page link
  * @param string $glue In between links glue
  * @param mixed $args \MUtil_Ra::args extra arguments applied to all links
  * @return \MUtil_Html_Sequence
  */
 public function pageLinks($first = '<<', $previous = '<', $next = '>', $last = '>>', $glue = ' ', $args = null)
 {
     $argDefaults = array('first' => '<<', 'previous' => '<', 'next' => '>', 'last' => '>>', 'glue' => ' ');
     $argNames = array_keys($argDefaults);
     $args = \MUtil_Ra::args(func_get_args(), $argNames, $argDefaults);
     foreach ($argNames as $name) {
         ${$name} = $args[$name];
         unset($args[$name]);
     }
     $container = \MUtil_Html::create()->ul(array('class' => 'pagination pagination-sm pull-left'));
     if ($first) {
         // Can be null or array()
         $container[] = $this->firstPage((array) $first + $args);
     }
     if ($previous) {
         // Can be null or array()
         $container[] = $this->previousPage((array) $previous + $args);
     }
     $this->range = true;
     $container[] = $this->rangePages('', $args);
     $this->range = false;
     if ($next) {
         // Can be null or array()
         $container[] = $this->nextPage((array) $next + $args);
     }
     if ($last) {
         // Can be null or array()
         $container[] = $this->lastPage((array) $last + $args);
     }
     return \MUtil_Lazy::iff(\MUtil_Lazy::comp($this->pages->pageCount, '>', 1), $container);
 }
예제 #28
0
 /**
  * Return a mailto: link object
  *
  * @param mixed $email
  * @param mixed $arg_array
  * @return \self
  */
 public static function email($email, $arg_array = null)
 {
     $args = \MUtil_Ra::args(func_get_args(), 1);
     if (isset($args['href'])) {
         $href = $args['href'];
         unset($args['href']);
     } else {
         if (!isset($args['title'])) {
             $args['title'] = $email;
         }
         $href = array('mailto:', $email);
     }
     if (!isset($args['onclick'])) {
         // Make sure the mail link only opens a mail window.
         $args['onclick'] = 'event.cancelBubble=true;';
     }
     return new self($href, $email, $args);
 }
예제 #29
0
 /**
  * Returns a form to change the possword for this user.
  *
  * @param boolean $askOld Ask for the old password, calculated when not set.
  * @return \Gems_Form
  */
 public function getChangePasswordForm($args_array = null)
 {
     if (!$this->canSetPassword()) {
         return;
     }
     $args = \MUtil_Ra::args(func_get_args());
     if (isset($args['askCheck']) && $args['askCheck']) {
         $args['checkFields'] = $this->loadResetPasswordCheckFields();
     }
     return $this->userLoader->getChangePasswordForm($this, $args);
 }
 /**
  * Add a sub item to this item.
  *
  * The argumenets can be any of those used for \Zend_Navigation_Page as well as some Gems specials.<ul>
  * <li>'action' The name of the action.</li>
  * <li>'allowed' Is the user allowed to access this menu item. Is checked against ACL using 'privilige'.</li>
  * <li>'button_only' Never in the menu, only shown as a button by the program.</li>
  * <li>'class' Display class for the menu link.</li>
  * <li>'controller' What controller to use.</li>
  * <li>'icon' Icon to display with the label.</li>
  * <li>'label' The label to display for the menu item.</li>
  * <li>'privilege' The privilege needed to choose the item.</li>
  * <li>'target' Optional target attribute for the link.</li>
  * <li>'type' Optional content type for the link</li>
  * <li>'visible' Is the item visible. Is checked against ACL using 'privilige'.</li>
  * </ul>
  *
  * @see \Zend_Navigation_Page
  *
  * @param array $args_array \MUtil_Ra::args array with defaults 'visible' and 'allowed' true.
  * @return \Gems_Menu_SubMenuItem
  */
 protected function add($args_array)
 {
     // Process parameters.
     $args = \MUtil_Ra::args(func_get_args(), 0, array('visible' => true, 'allowed' => true));
     if (!isset($args['label'])) {
         $args['visible'] = false;
     }
     if (!isset($args['order'])) {
         $args['order'] = 10 * (count($this->_subItems) + 1);
     }
     $page = new \Gems_Menu_SubMenuItem($this->escort, $this, $args);
     $this->_subItems[] = $page;
     return $page;
 }