/** * Returns module folder name * * @param string $componentName Component Name * @param string $componentType Component Type * @param boolean $allowCustomizing Check for the customizing folder * * @return string module folder name */ private function getModuleFolder($componentName, $componentType, $allowCustomizing = true) { $basepath = ASCMS_DOCUMENT_ROOT . \Cx\Core\Core\Model\Entity\SystemComponent::getPathForType($componentType); $componentPath = $basepath . '/' . $componentName; if (!$allowCustomizing) { return $componentPath; } return \Env::get('cx')->getClassLoader()->getFilePath($componentPath); }
/** * Returns wheter this component exists or not in the system * Note : It not depends the component type * * @param boolean $allowCustomizing (optional) Set to false if you want to ignore customizings * @return boolean True if it exists, false otherwise */ public function exists($allowCustomizing = true) { foreach (self::$componentTypes as $componentType) { $basepath = ASCMS_DOCUMENT_ROOT . \Cx\Core\Core\Model\Entity\SystemComponent::getPathForType($componentType); $componentPath = $basepath . '/' . $this->componentName; if (!$allowCustomizing) { if (file_exists($componentPath)) { return true; } } if (\Env::get('cx')->getClassLoader()->getFilePath($componentPath)) { return true; } } return false; }
/** * Returns class name to use for decoration * * If the component does not have a class named "ComponentController" * the default SystemComponentController class is used * @param \Cx\Core\Core\Model\Entity\SystemComponent $component Component to get decoration class for * @return string Full qualified class name */ protected function getComponentControllerClassFor(\Cx\Core\Core\Model\Entity\SystemComponent $component) { if (!$this->cx->getClassLoader()->getFilePath($component->getDirectory(false) . '/Controller/ComponentController.class.php')) { return '\\Cx\\Core\\Core\\Model\\Entity\\SystemComponentController'; } $className = $component->getNamespace() . '\\Controller\\ComponentController'; return $className; }
public function __toString() { $this->_load(); return parent::__toString(); }