/**
  * Initialisation
  *
  * @access  private
  */
 private function init()
 {
     // check the content for installed and used modules
     $arrCmActiveModules = array();
     $arrCmInstalledModules = array();
     $qb = $this->em->createQueryBuilder();
     $qb->add('select', 'p')->add('from', 'Cx\\Core\\ContentManager\\Model\\Entity\\Page p')->add('where', $qb->expr()->neq('p.module', $qb->expr()->literal('')));
     $pages = $qb->getQuery()->getResult();
     foreach ($pages as $page) {
         $arrCmInstalledModules[] = $page->getModule();
         if ($page->isActive()) {
             $arrCmActiveModules[] = $page->getModule();
         }
     }
     $arrCmInstalledModules = array_unique($arrCmInstalledModules);
     $arrCmActiveModules = array_unique($arrCmActiveModules);
     // add static modules
     $arrCmInstalledModules[] = 'Block';
     $arrCmInstalledModules[] = 'Crm';
     $arrCmInstalledModules[] = 'Order';
     $arrCmInstalledModules[] = 'Pim';
     $arrCmInstalledModules[] = 'Support';
     $arrCmActiveModules[] = 'Block';
     $arrCmInstalledModules[] = 'upload';
     $arrCmActiveModules[] = 'upload';
     $objResult = $this->db->Execute('SELECT `name`, `is_core`, `is_required` FROM `' . DBPREFIX . 'modules`');
     if ($objResult !== false) {
         while (!$objResult->EOF) {
             $moduleName = $objResult->fields['name'];
             if ($moduleName == 'News') {
                 $this->arrModules[] = $moduleName;
                 //$this->arrCoreModules[] = $moduleName;
                 if (in_array($moduleName, $arrCmInstalledModules)) {
                     $this->arrInstalledModules[] = $moduleName;
                     if (in_array($moduleName, $arrCmInstalledModules)) {
                         $this->arrActiveModules[] = $moduleName;
                     }
                 }
                 $objResult->MoveNext();
                 continue;
             }
             if (!empty($moduleName)) {
                 $isCore = $objResult->fields['is_core'];
                 if ($isCore == 1) {
                     $this->arrCoreModules[] = $moduleName;
                 } else {
                     $this->arrModules[] = $moduleName;
                 }
                 if (in_array($moduleName, $arrCmInstalledModules) && ($isCore || !$isCore && is_dir($this->cl->getFilePath(ASCMS_MODULE_PATH . '/' . $moduleName)))) {
                     $this->arrInstalledModules[] = $moduleName;
                 }
                 if (in_array($moduleName, $arrCmActiveModules) && ($isCore || !$isCore && is_dir($this->cl->getFilePath(ASCMS_MODULE_PATH . '/' . $moduleName)))) {
                     $this->arrActiveModules[] = $moduleName;
                 }
             }
             $objResult->MoveNext();
         }
     }
 }
Beispiel #2
0
 /**
  * Get component controller object by given component name and type
  * Calls before the method preInit() and postInit() hooks are called
  *
  * @param string $componentName component name
  * @param string $componentType component type
  *
  * @return \Cx\Core\Core\Controller\SystemComponentController
  */
 protected function getComponentControllerByNameAndType($componentName, $componentType)
 {
     $component = new \Cx\Core\Core\Model\Entity\SystemComponent();
     $component->setName($componentName);
     $component->setType($componentType);
     // Initialize ComponentController of component if available,
     // otherwise initialize the SystemComponentController
     // Implementation taken from method Cx\Core\Core\Model\Repository\SystemComponentRepository::getComponentControllerClassFor()
     // as that method shall not be used at this point to prevent the
     // system (i.e. the Class Loader) from loading the doctine PHP classes.
     if ($this->cl->getFilePath($component->getDirectory(false) . '/Controller/ComponentController.class.php')) {
         $componentControllerClass = $component->getNamespace() . '\\Controller\\ComponentController';
     } else {
         $componentControllerClass = '\\Cx\\Core\\Core\\Model\\Entity\\SystemComponentController';
     }
     return new $componentControllerClass($component, $this);
 }