mirror of
https://github.com/monstra-cms/monstra.git
synced 2025-08-12 08:04:10 +02:00
Add Monstra from HG Commit 683dcb70c4cc
This commit is contained in:
53
plugins/box/menu/menu.plugin.php
Normal file
53
plugins/box/menu/menu.plugin.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Menu plugin
|
||||
*
|
||||
* @package Monstra
|
||||
* @subpackage Plugins
|
||||
* @author Romanenko Sergey / Awilum
|
||||
* @copyright 2012 Romanenko Sergey / Awilum
|
||||
* @version 1.0.0
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
// Register plugin
|
||||
Plugin::register( __FILE__,
|
||||
__('Menu', 'menu'),
|
||||
__('Menu manager', 'menu'),
|
||||
'1.0.0',
|
||||
'Awilum',
|
||||
'http://monstra.org/',
|
||||
null,
|
||||
'box');
|
||||
|
||||
|
||||
if (Session::exists('user_role') && in_array(Session::get('user_role'), array('admin'))) {
|
||||
|
||||
// Include Admin
|
||||
Plugin::admin('menu', 'box');
|
||||
|
||||
}
|
||||
|
||||
|
||||
class Menu {
|
||||
|
||||
public static function get() {
|
||||
|
||||
// Get menu table
|
||||
$menu = new Table('menu');
|
||||
|
||||
// Select all items
|
||||
$items = $menu->select(null, 'all', null, array('id', 'name', 'link', 'target', 'order'), 'order', 'ASC');
|
||||
|
||||
// Display view
|
||||
View::factory('box/menu/views/frontend/index')
|
||||
->assign('items', $items)
|
||||
->assign('uri', Uri::segments())
|
||||
->assign('defpage', Option::get('defaultpage'))
|
||||
->display();
|
||||
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user