/** * Initializes all global settings and all global modules */ public static function initialize() { $debug = false; // set the buildtag if (isset($_REQUEST["buildTag"])) { self::$buildTag = $_REQUEST["buildTag"]; } else { self::$buildTag = "no-buildtag"; } // Include modulaise php scripts to the include path set_include_path(get_include_path() . PATH_SEPARATOR . self::$DIR_MODULAISE_ROOT); // Read global configuration file ModulaiseUtils::readConfigurationFile(ModulaiseController::$DIR_DOCUMENT_ROOT . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . "modulaise" . DIRECTORY_SEPARATOR . "config-global" . DIRECTORY_SEPARATOR . "global.config"); // Read configuration file ModulaiseUtils::readConfigurationFile(ModulaiseController::$DIR_DOCUMENT_ROOT . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . "modulaise" . DIRECTORY_SEPARATOR . "config-project" . DIRECTORY_SEPARATOR . "project.config"); // set the path to modules if not already set if (self::$PATH_MODULES === false) { self::$PATH_MODULES = PATH_MODULES; } // reset cache self::$modulePaneContentsCache = array(); self::$globalPaneContent = new ModulaisePaneContent(); self::$globalModules = array(); // set the static path to the page if (self::$staticContentPath === false) { if (self::$buildMode == SHOW_EXPORT) { self::$staticContentPath = PATH_MODULES_BUILD; } else { self::$staticContentPath = PATH_MODULES_DEVELOPMENT; } } // path to all modules $allModulesPath = self::$DIR_DOCUMENT_ROOT . DIRECTORY_SEPARATOR . self::$PATH_MODULES; if ($debug) { self::printComment("\n\n" . get_class() . "->initialize(): \n\nallModulesPath=" . $allModulesPath . "\n\n"); } // add all global modules to global modules array $allModuleNames = ModulaiseUtils::getDirectoryAsArray($allModulesPath, ONLY_DIRECTORIES); // build a list of all global modules foreach ($allModuleNames as $moduleId) { if (substr($moduleId, 0, 1) == "0") { $module = new ModulaiseModule($moduleId); array_push(self::$globalModules, $module); self::$globalPaneContent->addPaneContent($module->getPaneContent()); } } if ($debug) { $a = print_r(self::$globalPaneContent->getContent(), TRUE); self::printComment("\n\n" . get_class() . "->initialize(): \n\n" . $a . "\n\n"); } }
/** * Initilizes the pane content for this module */ private function initializePaneContent() { if (!$this->paneContent->initialize($this->moduleId)) { ModulaiseController::printComment("\n\nERROR:\nModule could not initialized " . $this->moduleId . "\n\n"); } }
/** * Checks if a pane has content, if it has true is returned */ public function paneHasContent($paneId) { return $this->paneContent->paneHasContent($paneId); }
/** * Concatinates two panecontents into eachother, preserving any priority id's */ function addPaneContent(ModulaisePaneContent $modulaisePaneContent) { $debug = false; if ($debug) { $a = print_r($modulaisePaneContent->getContent(), TRUE); ModulaiseController::printComment("\n\n" . get_class() . "->addPaneContent(): \n\n" . $a . "\n\n"); } // adds paneContent to this paneContent foreach ($modulaisePaneContent->getContent() as $paneId => $paneIdArray) { if ($debug) { ModulaiseController::printComment("\n\n" . get_class() . "->addPaneContent(): foreach modulaisePaneContent->getContent() as paneId=>paneIdArray (" . gettype($modulaisePaneContent->getContent()) . " as " . gettype($paneId) . "=>" . gettype($paneIdArray) . ")\n\n"); } foreach ($paneIdArray as $priorityId => $priorityIdArray) { if ($debug) { ModulaiseController::printComment("\n\n" . get_class() . "->addPaneContent(): foreach paneIdArray as priorityId=>priorityIdArray (" . gettype($paneIdArray) . " as " . gettype($priorityId) . "=>" . gettype($priorityIdArray) . ")\n\n"); } foreach ($priorityIdArray as $key => $snippet) { if ($debug) { ModulaiseController::printComment("\n\n" . get_class() . "->addPaneContent(): foreach priorityIdArray as key=>snippet (" . gettype($priorityIdArray) . " as " . gettype($key) . "=>" . gettype($snippet) . ")\n\n"); ModulaiseController::printComment("\n\n" . get_class() . "->addPaneContent(): paneId, priorityId, snippet (" . gettype($paneId) . ", " . gettype(priorityId) . ", " . gettype($snippet) . ")\n\n"); ModulaiseController::printComment("\n\n" . get_class() . "->addPaneContent(): paneId, priorityId, snippet (" . $paneId . ", " . priorityId . ", " . $snippet . ")\n\n"); } // add to content if (!$this->addContent($paneId, $priorityId, $snippet)) { ModulaiseController::printComment("\n\nERROR:\n" . get_class() . "->addPaneContent(): " . $paneId . ", " . $priorityId . ", " . $snippet . "\n\n"); die; } } } } // Also sort afterwards, to maintain the order of CSS panes $this->sortPanes(); }