This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
khosb/modules/module/classes/controller/module.php

53 lines
1.3 KiB
PHP
Raw Normal View History

2010-11-29 22:41:08 +00:00
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides MODULE management
*
* @package lnApp
* @subpackage Page/Module
* @category Controllers
* @author Deon George
* @copyright (c) 2010 Deon George
* @license http://dev.leenooks.net/license.html
*/
class Controller_Module extends Controller_TemplateDefault {
public $secure_actions = array(
'edit'=>TRUE,
'list'=>TRUE,
'menu'=>TRUE,
);
public function action_menu() {
// Redirect us to the admin menu, no user facilities here!
Request::instance()->redirect('/admin/module/menu');
}
/**
* Get the list of methods for a class
*/
protected function _methods($class) {
// Get a list of methods this module has
$ch = 'Controller_%s';
$methods = array();
// List of classes where all our methods are, including this one.
$classes = Kohana::config('config.method_directory');
array_unshift($classes,'');
foreach ($classes as $c) {
$cn = sprintf($ch,$c ? $c.'_'.$class : $class);
if (class_exists($cn)) {
$r = new ReflectionClass($cn);
foreach ($r->getMethods() as $method)
if (preg_match('/^Controller_(.*_)?'.$class.'$/i',$method->class) AND ! preg_match('/^_/',$method->name))
array_push($methods,str_replace('action_',($c ? $c.'_' : $c),$method->name));
}
}
return $methods;
}
}
?>