/** * * @param type $componentName * @return type */ public static function parseComponentName($componentName) { $call = ""; $parsedComponent = explode('.', $componentName); if (count($parsedComponent) == 1 || $parsedComponent[0] === 'core') { $call .= '\\Centreon\\Internal\\Form\\Component\\' . ucfirst($componentName); } else { $call .= '\\' . CamelCaseTransformation::customToCamelCase($parsedComponent[0], '-') . '\\Forms\\Components\\'; for ($i = 1; $i < count($parsedComponent); $i++) { $call .= ucfirst($parsedComponent[$i]); } } return $call; }
/** * Init event listeners of modules */ public static function initEventListeners() { $moduleList = Informations::getModuleList(); foreach ($moduleList as $module) { $listenersPath = Informations::getModulePath($module) . '/listeners/'; if (file_exists($listenersPath)) { $ModuleListenersList = glob($listenersPath . '*'); foreach ($ModuleListenersList as $moduleListenersPath) { $mTarget = substr($moduleListenersPath, strlen($listenersPath)); $mSource = CamelCaseTransformation::customToCamelCase($module, '-'); self::attachModuleEventListeners($mSource, $mTarget, $moduleListenersPath); } } } }
/** * * @param type $validatorName * @return type */ protected function parseValidatorName($validatorName) { $call = ""; $parsedValidator = explode('.', $validatorName); if ($parsedValidator[0] === 'core') { $call .= '\\Centreon\\Internal\\Form\\Validators\\'; } else { $call .= '\\' . CamelCaseTransformation::customToCamelCase($parsedValidator[0], '-') . '\\Forms\\Validators\\'; } for ($i = 1; $i < count($parsedValidator); $i++) { $call .= ucfirst($parsedValidator[$i]); } return $call; }