示例#1
0
 /**
  * Fill an X_Page_ItemList_PItem object ($items) with a 
  * simple list of static values
  * @param X_Page_ItemList_PItem $items
  * @param array $menuEntries an array of menu entries, keys are locations and values are label keys 
  * @param string $keyPrefix a string prepended to all items key 
  * @param string $locationPrefix a string prepended to all items location
  * @return X_Page_ItemList_PItem
  */
 static function fillStaticMenu(X_Page_ItemList_PItem $items, $menuEntries = array(), $keyPrefix = '', $locationPrefix = '')
 {
     foreach ($menuEntries as $location => $labelKey) {
         $entry = new X_Page_Item_PItem("{$keyPrefix}-{$location}", X_Env::_($labelKey));
         $entry->setDescription(APPLICATION_ENV == 'development' ? "{$locationPrefix}{$location}" : null);
         $entry->setGenerator(__METHOD__)->setIcon('/images/icons/folder_32.png')->setCustom(__METHOD__ . ":location", "{$locationPrefix}{$location}")->setType(X_Page_Item_PItem::TYPE_CONTAINER)->setLink(array('l' => X_Env::encode("{$locationPrefix}{$location}")), 'default', false);
         $items->append($entry);
     }
     return $items;
 }