54 lines
2.1 KiB
PHP
54 lines
2.1 KiB
PHP
<?php defined('SYSPATH') or die('No direct access allowed.');
|
|
|
|
/**
|
|
* This class provides access to module configuration.
|
|
*
|
|
* @package OSB
|
|
* @subpackage Module
|
|
* @category Helpers
|
|
* @author Deon George
|
|
* @copyright (c) 2010 Deon George
|
|
* @license http://dev.leenooks.net/license.html
|
|
*/
|
|
class Module_Method {
|
|
/**
|
|
* Display the modules available for a group
|
|
*/
|
|
public static function groupmodules($gid) {
|
|
$modules = array();
|
|
// @todo the database prefix needs to be added to this query
|
|
$query = DB::query(Database::SELECT,'SELECT A.name AS module,A.id AS MOD_ID,B.name AS parent,B.id AS PARENT_ID FROM ab_module A LEFT JOIN ab_module B ON (A.parent_id=B.id AND A.site_id=B.site_id), ab_module_method C, ab_group_method D WHERE A.id=C.module_id AND A.site_id=C.site_id AND D.method_id=C.id AND D.site_id=C.site_id AND D.group_id=:gid AND A.menu_display=1 AND A.site_id=:siteid GROUP BY module')
|
|
->param(':siteid',Config::siteid())
|
|
->param(':gid',$gid);
|
|
|
|
foreach ($query->execute() as $record) {
|
|
$modules[$record['module']]['id'] = $record['MOD_ID'];
|
|
$modules[$record['module']]['parent_id'] = $record['PARENT_ID'];
|
|
$modules[$record['module']]['parent'] = $record['parent'];
|
|
}
|
|
|
|
return $modules;
|
|
}
|
|
|
|
/**
|
|
* Display the methods available for a group
|
|
*/
|
|
public static function groupmethods($gid,$mid) {
|
|
$methods = array();
|
|
// @todo the database prefix needs to be added to this query
|
|
$query = DB::query(Database::SELECT,'SELECT C.id,C.name AS METHOD,A.name AS MODULE,C.page FROM ab_module A, ab_module_method C, ab_group_method D WHERE A.id=C.module_id AND A.site_id=C.site_id AND D.method_id=C.id AND D.site_id=C.site_id AND D.group_id=:gid AND C.module_id=:mid AND C.menu_display=1 AND A.site_id=:siteid')
|
|
->param(':siteid',Config::siteid())
|
|
->param(':gid',$gid)
|
|
->param(':mid',$mid);
|
|
|
|
foreach ($query->execute() as $record) {
|
|
$methods[$record['METHOD']]['id'] = $record['id'];
|
|
$methods[$record['METHOD']]['page'] = $record['page'];
|
|
$methods[$record['METHOD']]['module'] = $record['MODULE'];
|
|
}
|
|
|
|
return $methods;
|
|
}
|
|
}
|
|
?>
|