mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
add mehtod __invoke()
This commit is contained in:
parent
94682fb0ff
commit
caf1501c89
|
@ -41,6 +41,24 @@ class SeedDMS_Controller_Common {
|
|||
$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) {
|
||||
$this->params = $params;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user