/** * Prints a pane from this page * @param string $paneId */ public function printPane($paneId) { // If we are going to show an export if (ModulaiseController::$buildMode == SHOW_EXPORT) { switch ($paneId) { case PANE_JS_HEAD: echo ModulaiseUtils::getJsImportStatement(FOLDER_COMPILED . "/js/" . FILENAME_JSHEAD_COMPILED); return true; case PANE_JS_FOOT: echo ModulaiseUtils::getJsImportStatement(FOLDER_COMPILED . "/js/" . FILENAME_JSFOOT_COMPILED); return true; case PANE_CSS: echo ModulaiseUtils::getCssImportStatement(FOLDER_COMPILED . "/css/" . FILENAME_CSS_COMPILED); return true; default: return $this->paneContent->printPane($paneId); return true; } } return $this->paneContent->printPane($paneId); }
/** * Initialize */ public function initialize($moduleId) { $debug = false; // first get the directory contents of the module $targetDir = ModulaiseController::$DIR_DOCUMENT_ROOT . DIRECTORY_SEPARATOR . ModulaiseController::$PATH_MODULES . DIRECTORY_SEPARATOR . $moduleId; $moduleDirectory = ModulaiseUtils::getDirectoryAsArray($targetDir, ONLY_DIRECTORIES); foreach ($moduleDirectory as $outerDir) { $d = explode(DELIMITER, $outerDir); if ($debug) { ModulaiseController::printComment("\n\n" . get_class() . "->initializePaneContent(): \nd[0]=" . $d[0] . "\nd[1]=" . $d[1] . "\nd[2]=" . $d[2] . "\n\n"); } // check for html if ($d[0] == "html") { // html_head pane if (isset($d[1]) && $d[1] == "head") { $priorityId = -1; if (isset($d[2]) && ctype_digit($d[2])) { $priorityId = intval($d[2]); } if (!isset($d[2])) { $priorityId = 75; } if ($priorityId != -1) { // Set target pane if ($priorityId < 50) { $targetPane = PANE_HTML_HEAD_FIRST; } else { $targetPane = PANE_HTML_HEAD_LAST; } // add all snippets from html_head directory to panecontent $innerDirectory = ModulaiseUtils::getDirectoryAsArray($targetDir . DIRECTORY_SEPARATOR . $outerDir, ONLY_FILES); foreach ($innerDirectory as $file) { $this->addFileSnippet($moduleId, $targetPane, $priorityId, $outerDir . DIRECTORY_SEPARATOR . $file); } } } // html_foot pane if (isset($d[1]) && $d[1] == "foot") { $priorityId = -1; if (isset($d[2]) && ctype_digit($d[2])) { $priorityId = intval($d[2]); } if (!isset($d[2])) { $priorityId = 75; } if ($priorityId != -1) { // Set target pane if ($priorityId < 50) { $targetPane = PANE_HTML_FOOT_FIRST; } else { $targetPane = PANE_HTML_FOOT_LAST; } // add all snippets from html_foot directory to panecontent $innerDirectory = ModulaiseUtils::getDirectoryAsArray($targetDir . DIRECTORY_SEPARATOR . $outerDir, ONLY_FILES); foreach ($innerDirectory as $file) { $this->addFileSnippet($moduleId, $targetPane, $priorityId, $outerDir . DIRECTORY_SEPARATOR . $file); } } } } // check for javascript if ($d[0] == "js") { // js_head pane if (isset($d[1]) && $d[1] == "head") { $priorityId = -1; if (isset($d[2]) && ctype_digit($d[2])) { $priorityId = intval($d[2]); } if (!isset($d[2])) { $priorityId = 75; } if ($priorityId != -1) { $targetPane = PANE_JS_HEAD; // add all snippets from js_head directory to panecontent $innerDirectory = ModulaiseUtils::getDirectoryAsArray($targetDir . DIRECTORY_SEPARATOR . $outerDir, ONLY_FILES); if ($debug) { ModulaiseController::printComment("\n\n" . get_class() . "->initializePaneContent(): innerDirectory=" . $innerDirectory . "\n\n"); } foreach ($innerDirectory as $file) { if ($debug) { ModulaiseController::printComment("\n\n" . get_class() . "->initializePaneContent(): " . $moduleId . ", " . $targetPane . ", " . $priorityId . ", " . $outerDir . DIRECTORY_SEPARATOR . $file . "\n\n"); } if (ModulaiseController::$buildMode == SHOW_DEVELOPMENT) { $this->addStringSnippet($moduleId, $targetPane, $priorityId, ModulaiseUtils::getJsImportStatement($moduleId . "/" . $outerDir . "/" . $file)); } if (ModulaiseController::$buildMode == SHOW_EXPORT) { } if (ModulaiseController::$buildMode == BUILD_EXPORT) { $this->addFileSnippet($moduleId, $targetPane, $priorityId, $outerDir . DIRECTORY_SEPARATOR . $file); } } } } // js_foot pane if (isset($d[1]) && $d[1] == "foot") { $priorityId = -1; if (isset($d[2]) && ctype_digit($d[2])) { $priorityId = $d[2]; } if (!isset($d[2])) { $priorityId = 75; } if ($priorityId != -1) { // Set target pane $targetPane = PANE_JS_FOOT; // add all snippets from js_foot directory to panecontent $innerDirectory = ModulaiseUtils::getDirectoryAsArray($targetDir . DIRECTORY_SEPARATOR . $outerDir, ONLY_FILES); foreach ($innerDirectory as $file) { if ($debug) { ModulaiseController::printComment("\n\n" . get_class() . "->initializePaneContent(): " . $moduleId . ", " . $targetPane . ", " . $priorityId . ", " . $outerDir . DIRECTORY_SEPARATOR . $file . "\n\n"); } if (ModulaiseController::$buildMode == SHOW_DEVELOPMENT) { $this->addStringSnippet($moduleId, $targetPane, $priorityId, ModulaiseUtils::getJsImportStatement($moduleId . "/" . $outerDir . "/" . $file)); } if (ModulaiseController::$buildMode == SHOW_EXPORT) { $this->addFileSnippet($moduleId, $targetPane, $priorityId, $outerDir . DIRECTORY_SEPARATOR . $file); } if (ModulaiseController::$buildMode == BUILD_EXPORT) { $this->addFileSnippet($moduleId, $targetPane, $priorityId, $outerDir . DIRECTORY_SEPARATOR . $file); } } } } } // check for css if ($d[0] == "css") { if ($debug) { ModulaiseController::printComment("\n\n" . get_class() . "->initializePaneContent(): d[0]==\"css\"\n\n"); } $priorityId = -1; if (isset($d[1])) { if (ctype_digit($d[1]) || is_int($d[1])) { $priorityId = intval($d[1]); } } if (!isset($d[1])) { $priorityId = 75; } if ($debug) { ModulaiseController::printComment("\n\n" . get_class() . "->initializePaneContent(): priorityId=" . $priorityId . "\n\n"); } if ($priorityId != -1) { if ($debug) { ModulaiseController::printComment("\n\n" . get_class() . "->initializePaneContent(): priorityId != NULL\n\n"); } // add all CSS snippets from css directory to panecontent $innerDirectory = ModulaiseUtils::getDirectoryAsArray($targetDir . DIRECTORY_SEPARATOR . $outerDir, ONLY_FILES); if ($debug) { ModulaiseController::printComment("\n\n" . get_class() . "->initializePaneContent(): innerDirectory=" . $innerDirectory . "\n\n"); } foreach ($innerDirectory as $file) { // set the target pane name to this complicated formula $targetPane = PANE_CSS . "--" . $priorityId . "--" . $file; if ($debug) { ModulaiseController::printComment("\n\n" . get_class() . "->initializePaneContent(): " . $moduleId . ", " . $targetPane . ", " . $priorityId . ", " . $outerDir . DIRECTORY_SEPARATOR . $file . "\n\n"); } if ($debug) { ModulaiseController::printComment("\n\n" . get_class() . "->initializePaneContent(): " . $moduleId . ", " . $targetPane . ", " . $priorityId . ", " . $outerDir . DIRECTORY_SEPARATOR . $file . "\n\n"); } if (ModulaiseController::$buildMode == SHOW_DEVELOPMENT) { $this->addStringSnippet($moduleId, $targetPane, $priorityId, ModulaiseUtils::getCssImportStatement($moduleId . "/" . $outerDir . "/" . $file, $file)); } if (ModulaiseController::$buildMode == SHOW_EXPORT) { } if (ModulaiseController::$buildMode == BUILD_EXPORT) { $this->addExportCssSnippet($moduleId, $targetPane, $priorityId, $outerDir . DIRECTORY_SEPARATOR . $file); } } } } } $this->sortPanes(); return true; }