mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-16 14:41:39 +00:00
add __invoke() method
This commit is contained in:
parent
3de40aa6b1
commit
19aa2b5e45
|
@ -41,6 +41,24 @@ class SeedDMS_Controller_Common {
|
||||||
$this->errormsg = '';
|
$this->errormsg = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call methods with name in $get['action']
|
||||||
|
*
|
||||||
|
* @params array $get $_GET or $_POST variables
|
||||||
|
* @return mixed return value of called method
|
||||||
|
*/
|
||||||
|
function __invoke($get=array()) {
|
||||||
|
if(isset($get['action']) && $get['action']) {
|
||||||
|
if(method_exists($this, $get['action'])) {
|
||||||
|
return $this->{$get['action']}();
|
||||||
|
} else {
|
||||||
|
echo "Missing action '".$get['action']."'";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
return $this->run();
|
||||||
|
}
|
||||||
|
|
||||||
function setParams($params) {
|
function setParams($params) {
|
||||||
$this->params = $params;
|
$this->params = $params;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user