/** * Returns the url to ab ajax module whose content is rendered as is * @param ModuleBase $module The module * @param array $args The url parameters * @return string Returns the ajax url */ static function AjaxUrl(ModuleBase $module, array $args = array()) { $allArgs = array('module' => ClassFinder::ModuleType($module)) + $args; $guard = new UserGuard(); $user = $guard->GetUser(); if (!$user) { throw new \Exception('Security breach on ajax url: no backend user logged in'); } $allArgs['__backendUser'] = $user->GetID(); return 'ajax.php?' . http_build_query($allArgs); }
/** * Returns the module type, composed by bundle and module name * @return string Returns a simplified type string */ static function MyType() { return ClassFinder::ModuleType(new static()); }