* @package tao */ class ModelHelper { /** * returns the modules of an extension from the ontology * * @access public * @author Jerome Bogaerts, * @param string $extensionID * @return array */ public static function getModules($extensionId) { $returnValue = []; foreach (ControllerHelper::getControllers($extensionId) as $controllerClassName) { $shortName = strpos($controllerClassName, '\\') !== false ? substr($controllerClassName, strrpos($controllerClassName, '\\') + 1) : substr($controllerClassName, strrpos($controllerClassName, '_') + 1) ; $uri = AccessService::singleton()->makeEMAUri($extensionId, $shortName); $returnValue[$uri] = new \core_kernel_classes_Resource($uri); } return (array) $returnValue; } /** * returns the actions of a module from the ontology * * @access public * @author Jerome Bogaerts, * @param Resource $module * @return array */ public static function getActions(\core_kernel_classes_Resource $module) { $returnValue = []; $controllerClassName = MapHelper::getControllerFromUri($module->getUri()); try { foreach (ControllerHelper::getActions($controllerClassName) as $actionName) { $uri = MapHelper::getUriForAction($controllerClassName, $actionName); $returnValue[$uri] = new \core_kernel_classes_Resource($uri); } } catch (\ReflectionException $e) { // unknown controller, no actions returned } return (array) $returnValue; } }