/**
  * {@inheritdoc }
  */
 public function getControllerClasses()
 {
     if (in_array('Workbench', \Cx\Core\ModuleChecker::getInstance($this->cx->getDb()->getEntityManager(), $this->cx->getDb()->getAdoDb(), $this->cx->getClassLoader())->getCoreModules())) {
         return array('Backend');
     }
     return array();
 }
Ejemplo n.º 2
0
/**
 * Checks if a certain module, specified by param $moduleName, is installed.
 *
 * @param   string  $moduleName
 * @deprecated
 * @return  boolean
 */
function contrexx_isModuleInstalled($moduleName)
{
    static $objModuleChecker = NULL;
    if (!isset($objModuleChecker)) {
        $objModuleChecker = \Cx\Core\ModuleChecker::getInstance(\Env::get('em'), \Env::get('db'), \Env::get('ClassLoader'));
    }
    return $objModuleChecker->isModuleInstalled($moduleName);
}
 /**
  * Checks if the component is active and in the list of legal components (license)
  * @param  boolean $frontend      Are we in frontend mode or not
  * @param  string  $componentName Component name
  * @return boolean True if the component is active and legal, false otherwise
  */
 public function isActive($frontend, $componentName)
 {
     $cx = \Env::get('cx');
     $cn = strtolower($componentName);
     $mc = \Cx\Core\ModuleChecker::getInstance($cx->getDb()->getEntityManager(), $cx->getDb()->getAdoDb(), $cx->getClassLoader());
     if (!in_array($cn, $mc->getModules())) {
         return true;
     }
     if ($frontend) {
         if (!$cx->getLicense()->isInLegalFrontendComponents($cn)) {
             return false;
         }
     } else {
         if (!$cx->getLicense()->isInLegalComponents($cn)) {
             return false;
         }
     }
     if (!$mc->isModuleInstalled($cn)) {
         return false;
     }
     return true;
 }
Ejemplo n.º 4
0
 /**
  * Return the testing folders by component type
  *
  * @param  string $componentType Component type
  *
  * @return array Testing folders by given component type
  */
 private function getTestingFoldersByType($componentType, $useCustomizing)
 {
     $cx = \Env::get('cx');
     $em = $cx->getDb()->getEntityManager();
     // if component type is core then there are possible to have the test files under /core
     // so add that folder too
     if ($componentType == 'core') {
         $this->addTestingFolderToArray('core', $cx->getCodeBaseCorePath());
     }
     $systemComponentRepo = $em->getRepository('Cx\\Core\\Core\\Model\\Entity\\SystemComponent');
     $systemComponents = $systemComponentRepo->findBy(array('type' => $componentType));
     if (!empty($systemComponents)) {
         foreach ($systemComponents as $systemComponent) {
             $this->addTestingFolderToArray($systemComponent->getName(), $systemComponent->getDirectory($useCustomizing));
         }
     }
     // load the old legacy components. assume core_module, module can only possible
     if (in_array($componentType, array('core_module', 'module'))) {
         static $objModuleChecker = NULL;
         if (!isset($objModuleChecker)) {
             $objModuleChecker = \Cx\Core\ModuleChecker::getInstance(\Env::get('em'), \Env::get('db'), \Env::get('ClassLoader'));
         }
         $arrModules = array();
         switch ($componentType) {
             case 'core_module':
                 $arrModules = $objModuleChecker->getCoreModules();
                 break;
             case 'module':
                 $arrModules = $objModuleChecker->getModules();
                 break;
             default:
                 break;
         }
         foreach ($arrModules as $component) {
             if (!array_key_exists($component, $this->testingFolders)) {
                 $componentFolder = $this->getModuleFolder($component, $componentType, $useCustomizing);
                 $this->addTestingFolderToArray($component, $componentFolder);
             }
         }
     }
 }
Ejemplo n.º 5
0
 /**
  * Checks if the component is active and in the list of legal components (license)
  * @return bool True if the component is active and legal, false otherwise
  */
 public function isActive()
 {
     $cx = \Env::get('cx');
     $mc = \Cx\Core\ModuleChecker::getInstance($cx->getDb()->getEntityManager(), $cx->getDb()->getAdoDb(), $cx->getClassLoader());
     if (!in_array($this->getName(), $mc->getModules())) {
         return true;
     }
     if ($cx->getMode() == \Cx\Core\Core\Controller\Cx::MODE_FRONTEND) {
         if (!$cx->getLicense()->isInLegalFrontendComponents($this->getName())) {
             return false;
         }
     } else {
         if (!$cx->getLicense()->isInLegalComponents($this->getName())) {
             return false;
         }
     }
     if (!$mc->isModuleInstalled($this->getName())) {
         return false;
     }
     return true;
 }