/**
  * Builds the export version of the HTML pages
  */
 public static function buildPages()
 {
     echo "\nBuilding static pages\n--------------------------------------------------------------------------------\n";
     // set the PageController buildMode to SHOW_EXPORT
     ModulaiseController::$buildMode = SHOW_EXPORT;
     // set the static content path to right value
     ModulaiseController::$staticContentPath = PATH_MODULES_BUILD;
     // Reset global modules
     ModulaiseController::initialize();
     // read all modulenames
     $allPages = ModulaiseUtils::getDirectoryAsArray(ModulaiseController::$DIR_DOCUMENT_ROOT . DIRECTORY_SEPARATOR . PATH_PAGES);
     foreach ($allPages as $file) {
         if (ModulaiseUtils::EndsWith($file, ".php")) {
             // figure out filename to write
             if (PATH_PAGES_COMPILED != "") {
                 echo "Writing static page     : " . ModulaiseController::$DIR_DOCUMENT_ROOT . DIRECTORY_SEPARATOR . PATH_PAGES_COMPILED . DIRECTORY_SEPARATOR . substr($file, 0, -4) . ".html\n";
             } else {
                 echo "Writing static page     : " . ModulaiseController::$DIR_DOCUMENT_ROOT . DIRECTORY_SEPARATOR . substr($file, 0, -4) . ".html\n";
             }
             include ModulaiseController::$DIR_DOCUMENT_ROOT . DIRECTORY_SEPARATOR . PATH_PAGES . DIRECTORY_SEPARATOR . $file;
         }
     }
 }
 /**
  * Prints ant properties
  */
 public static function getAntProperties()
 {
     // read all module templates
     $allModuleTemplates = ModulaiseUtils::getDirectoryAsArray(ModulaiseController::$DIR_DOCUMENT_ROOT . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . PATH_BOILERPLATES_MODULES);
     echo "# List all moduletemplates from boilerplates/modules folder\n";
     $firstLoop = true;
     // loop all modules files
     foreach ($allModuleTemplates as $templateName) {
         if ($firstLoop) {
             echo "ALL_MODULE_TEMPLATES_DEFAULT=" . $templateName . "\n";
             echo "ALL_MODULE_TEMPLATES=";
             $firstLoop = false;
         } else {
             echo ",";
         }
         echo $templateName;
     }
     // read all page templates
     $allPageTemplates = ModulaiseUtils::getDirectoryAsArray(ModulaiseController::$DIR_DOCUMENT_ROOT . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . PATH_BOILERPLATES_PAGES);
     echo "\n\n# List all pagetemplates from boilerplates/pages folder\n";
     $firstLoop = true;
     // loop all modules files
     foreach ($allPageTemplates as $templateName) {
         if ($firstLoop) {
             echo "ALL_PAGE_TEMPLATES_DEFAULT=" . $templateName . "\n";
             echo "ALL_PAGE_TEMPLATES=";
             $firstLoop = false;
         } else {
             echo ",";
         }
         echo $templateName;
     }
     // read all project templates
     $allBoilerPlates = ModulaiseUtils::getDirectoryAsArray(ModulaiseController::$DIR_DOCUMENT_ROOT . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . PATH_BOILERPLATES_PROJECTS);
     echo "\n\n# List all boilerplates from boilerplates/projects folder\n";
     $firstLoop = true;
     // loop all modules files
     foreach ($allBoilerPlates as $boilerPlate) {
         if ($firstLoop) {
             echo "ALL_BOILERPLATES_DEFAULT=" . $boilerPlate . "\n";
             echo "ALL_BOILERPLATES=";
             $firstLoop = false;
         } else {
             echo ",";
         }
         echo $boilerPlate;
     }
     // read all build packages
     $allBuildPackages = ModulaiseUtils::getDirectoryAsArray(ModulaiseController::$DIR_DOCUMENT_ROOT . DIRECTORY_SEPARATOR . PATH_BUILDS);
     // flip, we want latest builds first
     $allBuildPackages = array_reverse($allBuildPackages, true);
     echo "\n\n# List all buildPackages from build folder\n";
     $firstLoop = true;
     $i = 0;
     // loop all modules files
     foreach ($allBuildPackages as $buildTag) {
         $i++;
         if ($i < 20 && ModulaiseUtils::EndsWith($buildTag, ".zip")) {
             if ($firstLoop) {
                 echo "ALL_BUILDPACKAGES_DEFAULT=" . substr($buildTag, 0, -4) . "\n";
                 echo "ALL_BUILDPACKAGES=";
                 $firstLoop = false;
             } else {
                 echo ",";
             }
             echo substr($buildTag, 0, -4);
         }
     }
     // read all deploy destinations
     $allDeployDestinations = ModulaiseUtils::getDirectoryAsArray(ModulaiseController::$DIR_DOCUMENT_ROOT . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . PATH_TO_DEPLOY_TARGETS, ONLY_DIRECTORIES);
     echo "\n\n# List all deploy destinations from config-project folder\n";
     $firstLoop = true;
     // loop all modules files
     foreach ($allDeployDestinations as $destination) {
         if ($firstLoop) {
             echo "ALL_DEPLOY_DESTINATIONS_DEFAULT=" . $destination . "\n";
             echo "ALL_DEPLOY_DESTINATIONS=";
             $firstLoop = false;
         } else {
             echo ",";
         }
         echo $destination;
     }
 }
 public static function getPages()
 {
     // Get all pages
     $returnArray = array();
     $pageDirectory = ModulaiseController::$DIR_DOCUMENT_ROOT . DIRECTORY_SEPARATOR . PATH_PAGES;
     $allPages = ModulaiseUtils::getDirectoryAsArray($pageDirectory);
     foreach ($allPages as $file) {
         if (ModulaiseUtils::EndsWith($file, ".php")) {
             $pageName = substr($file, 0, -4);
             $currentLink = PATH_PAGES . "/" . substr($file, 0, -4) . ".php";
             $cacheLink = PATH_PAGES . "/" . substr($file, 0, -4) . ".php?writeCachedHtml=true";
             $exportLink = PATH_PAGES_COMPILED . "/" . substr($file, 0, -4) . ".html";
             array_push($returnArray, new ModulaiseIndexPageElement($pageName, $currentLink, $exportLink, $cacheLink));
         }
     }
     return $returnArray;
 }