public function createTOCFiles($data)
 {
     global $conf;
     // Split Tree for translation
     $translationHSFiles = array();
     for ($i = 0; $i < count($data); $i++) {
         $lang = '';
         if ($this->translation) {
             $this->translation->tns = $this->translation->setupTNS($data[$i]['id']);
             $lang = $this->translation->getLangPart($data[$i]['id']);
         }
         // get all the relative URLs
         $translationHSFiles[$lang][] = $data[$i];
     }
     $toc = new siteexport_toc($this->functions);
     if ($this->translation) {
         $translationRoot = curNS($this->translation->tns);
     }
     $hsPrename = curNS(getNS($this->translation->tns)) . '_' . $translationRoot;
     $check = array();
     foreach ($translationHSFiles as $lang => $data) {
         if (count($translationHSFiles) == 1 && $lang == $conf['lang']) {
             // If there is only one language and it is the system language - there is no language
             $lang = '';
         }
         // Prepare Translations
         if (!empty($lang)) {
             $toc->translation =& $this->translation;
             $rootNode = cleanID($this->translation->tns . $lang) . ':';
         } else {
             $toc->translation = null;
             $rootNode = '';
         }
         $tsRootPath = $this->translationRootPath($translationRoot);
         // Create toc and map for each lang
         list($tocData, $mapData, $startPageID) = $toc->__getJavaHelpTOCXML($data, $tsRootPath);
         $this->functions->debug->message("Generating JavaHelpDocZip for language '{$lang}'", null, 2);
         $this->filewriter->__moveDataToZip($tocData, $tsRootPath . $lang . '/' . $this->tocName);
         $this->filewriter->__moveDataToZip($mapData, $tsRootPath . $lang . '/' . $this->mapName);
         // Create HS File
         // array_shift($toc->getMapID($rootNode, &$check))
         $HS = $this->getHSXML($startPageID, $this->functions->getSiteTitle($rootNode), $lang, $tsRootPath);
         $this->filewriter->__moveDataToZip($HS, $hsPrename . '_' . $lang . '.hs');
         // Default Lang
         if ($lang == $conf['lang']) {
             $this->filewriter->__moveDataToZip($HS, $hsPrename . '.hs');
         }
     }
 }
Exemple #2
0
 function __get_siteexport_list_and_init_tocs($NS, $isRedirected = false)
 {
     // Clean up if not redirected
     if (!$isRedirected && !$this->__removeOldZip()) {
         $this->functions->debug->runtimeException("Can't remove old files.");
         return false;
     }
     $data = $this->__get_siteexport_list($NS, $isRedirected);
     if ($isRedirected || empty($data)) {
         // if we have been redirected, simply return the data
         return $data;
     }
     // Create Eclipse Documentation Pages - TOC.xml, Context.xml
     if (!empty($_REQUEST['absolutePath'])) {
         $this->namespace = "";
     }
     //        $this->__removeOldZip( $this->functions->settings->eclipseZipFile );
     if (!empty($_REQUEST['eclipseDocZip'])) {
         $toc = new siteexport_toc($this->functions);
         $this->functions->debug->message("Generating eclipseDocZip", null, 2);
         $this->filewriter->__moveDataToZip($toc->__getTOCXML($data), 'toc.xml');
         $this->filewriter->__moveDataToZip($toc->__getContextXML($data), 'context.xml');
     } else {
         if (!empty($_REQUEST['JavaHelpDocZip'])) {
             $toc = new siteexport_javahelp($this->functions, $this->filewriter);
             $toc->createTOCFiles($data);
             /*            $toc = new siteexport_toc($this->functions);
                         list($tocData, $mapData) = $toc->__getJavaHelpTOCXML($data);
                         $this->functions->debug->message("Generating JavaHelpDocZip", null, 2);
                         $this->filewriter->__moveDataToZip($tocData, 'toc.xml');
                         $this->filewriter->__moveDataToZip($mapData, 'map.xml');
             */
         }
     }
     return $data;
 }