Esempio n. 1
0
 /**
  * This function queries all the menu elements and returns them in an
  * autocomplete array if needed.
  *
  * @access public
  * @param boolean $parameters['forAutocompletion']
  *        	Do we prepare the array
  *        	for the autocompletion mechanism?
  * @param integer $parameters['idOfParent']
  *        	the ID of the page the
  *        	list of page news we want
  * @param integer $parameters['type']
  *        	the menu
  * @return int[] <code>NULL</code>, if there are no order person available
  *         or
  *         the query is erroneous or the array with keys
  */
 public static function getListOfTypeMenuElement($parameters)
 {
     if (isset($parameters['type'])) {
         $structuredKeys = array();
         $values = array();
         $keys = array();
         foreach (MenuElement::$rawMenuElements as $id => $array) {
             $object = new MenuElement();
             if ($array['type'] === $parameters['type']) {
                 $object->setId($id);
                 $object->setCompleteMenuElement();
                 $keys[] = $id;
                 $title = $object->translate(array('property' => 'label'));
                 $structuredKeys[$id] = array('id' => $id, 'object' => $object, 'title' => $title);
                 $values[] = $title;
             }
         }
         if (isset($parameters['forAutocompletion']) && $parameters['forAutocompletion']) {
             $a[] = $values;
             $a[] = $keys;
             return $a;
         } else {
             return $structuredKeys;
         }
     } else {
         exit('Which menu?');
     }
 }