Skip to content

Commit

Permalink
updating some things for the frontend layouts
Browse files Browse the repository at this point in the history
  • Loading branch information
dogmatic69 committed Feb 1, 2010
1 parent d465ed0 commit bd2a5f4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
16 changes: 10 additions & 6 deletions extensions/libs/views/helpers/infinitas.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,22 +80,22 @@ function _moduleConfig($config = ''){
return $json;
}

function generateMenu($data = array(), $type = 'horizontal'){
function generateDropdownMenu($data = array(), $type = 'horizontal'){
if (empty($data)) {
$this->errors[] = 'There are no items to make the menu with';
return false;
}
$this->_menuData = '<ul class="pureCssMenu pureCssMenum0">';
foreach( $data as $k => $v ){
$this->_menuLevel = 0;
$this->__buildMenu($v, 'MenuItem');
$this->__buildDropdownMenu($v, 'MenuItem');
}
$this->_menuData .= '</ul>';

return $this->_menuData;
}

function __buildMenu($array = array(), $model = ''){
function __buildDropdownMenu($array = array(), $model = ''){
if (empty($array['MenuItem']) || $model = '') {
$this->errors[] = 'nothing passed to generate';
return false;
Expand All @@ -122,6 +122,12 @@ function __buildMenu($array = array(), $model = ''){
$menuLink['action'] = (!empty($array['MenuItem']['action']) ? $array['MenuItem']['action'] : null);
$menuLink[] = (!empty($array['MenuItem']['params']) ? $array['MenuItem']['params'] : null);

foreach($menuLink as $key => $value ){
if (empty($value)) {
unset($menuLink[$key]);
}
}

if ($array['MenuItem']['force_backend']) {
$menuLink['admin'] = true;
}
Expand All @@ -143,15 +149,13 @@ function __buildMenu($array = array(), $model = ''){
$this->_menuData .= '<ul class="pureCssMenum">';
foreach( $array['children'] as $k => $v ){
$this->_menuLevel = 1;
$this->__buildMenu($v, $model);
$this->__buildDropdownMenu($v, $model);
}
$this->_menuData .= '</ul>';
}
$this->_menuData .= '</a>';

$this->_menuData .= '</li>';
}


}
?>
3 changes: 2 additions & 1 deletion infinitas/management/models/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ function getModules($position = null, $admin){
),
'conditions' => array(
'Position.name' => $position,
'Module.admin' => $admin
'Module.admin' => $admin,
'Module.active' => 1
),
'contain' => array(
'Position' => array(
Expand Down
2 changes: 1 addition & 1 deletion views/elements/modules/admin/menu.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
$menuToLoad = (isset($config['menu'])?$config['menu']:'core_admin');
$type = (isset($config['type'])?$config['type']:'horizontal');

echo $this->Infinitas->generateMenu(ClassRegistry::init('Management.MenuItem')->getMenu($menuToLoad), $type);
echo $this->Infinitas->generateDropdownMenu(ClassRegistry::init('Management.MenuItem')->getMenu($menuToLoad), $type);
?>
2 changes: 1 addition & 1 deletion views/elements/modules/main_menu.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
$menuToLoad = (isset($config['menu'])?$config['menu']:'main_menu');
$type = (isset($config['type'])?$config['type']:'horizontal');

echo $this->Infinitas->generateMenu(ClassRegistry::init('Management.MenuItem')->getMenu($menuToLoad), $type);
echo $this->Infinitas->generateDropdownMenu(ClassRegistry::init('Management.MenuItem')->getMenu($menuToLoad), $type);
?>

0 comments on commit bd2a5f4

Please sign in to comment.