$this->touchCompile($book_id);\r
}\r
\r
- /**\r
- * wsDAOBook::compile3()\r
- *\r
- * @param mixed $book_id\r
- * @param mixed $complete\r
- * @return\r
- */\r
public function compile3($book_id, $complete) {\r
- cubePHP::neverStop();\r
- $filesToCopy = array();\r
- $finalDir = WS_BOOKS . '/final/' . $book_id . '/';\r
- $workingDir = WS_BOOKS . '/working/' . $book_id . '/';\r
+ $res = '';\r
+\r
$compilerDir = WS_BOOKS . '/datasCompiler/' . $book_id . '/';\r
+ $finalDir = WS_BOOKS . '/final/' . $book_id . '/';\r
+\r
+ $book = $this->selectById($book_id);\r
+ $pages = $this->getPagesOfBook($book_id);\r
+\r
+ $flex = new cubeFlexCompiler('FluidbookDatas', $compilerDir, 'flash.display.Sprite', explode(';', AS3_SOURCES), MXMLC_PATH, 10);\r
+ $flexLight = new cubeFlexCompiler('FluidbookDatasLight', $compilerDir, 'flash.display.Sprite', explode(';', AS3_SOURCES), MXMLC_PATH, 10);\r
+\r
+ $filesToCopy = array();\r
+\r
+ $this->compileFlex($book_id, $complete, $compilerDir, $finalDir, $filesToCopy, $book, $pages, $flex, $flexLight);\r
+\r
+ $flexLight->addVariable('checksum', $hash, false, true, 'String');\r
+ $res .= $flex->compile() . "\n\n-------------------\n\n";\r
+ $flexLight->addVariable('datasSize', filesize($compilerDir . '/FluidbookDatas.swf'));\r
+ $res .= $flexLight->compile();\r
+\r
+ $filesToCopy['data/fd.swf'] = $compilerDir . '/FluidbookDatas.swf';\r
+ $filesToCopy['data/fdl.swf'] = $compilerDir . '/FluidbookDatasLight.swf';\r
+ // Copy of files\r
+ // Check if dest dir exists\r
+ if (!file_exists($finalDir . 'data')) {\r
+ mkdir($finalDir . 'data', 0777, true);\r
+ }\r
+ // Check working dir\r
+ if (file_exists($workingDir)) {\r
+ $dr = opendir($workingDir);\r
+ while ($file = readdir($dr)) {\r
+ if ($file == '.' || $file == '..') {\r
+ continue;\r
+ }\r
+ $filesToCopy['data/' . $file] = $workingDir . '/' . $file;\r
+ }\r
+ }\r
+\r
+ foreach ($filesToCopy as $local => $source) {\r
+ $localPath = $finalDir . $local;\r
+ // if (!file_exists($localPath) || filemtime($localPath) < filemtime($source) || filesize($localPath) != filesize($source)) {\r
+ if (is_dir($source)) {\r
+ continue;\r
+ }\r
+ copy($source, $localPath);\r
+ // }\r
+ }\r
+\r
+ $this->compilePDF($book, $pages);\r
+ $this->indexPDF($book, $pages);\r
+ $this->compileHTML5($book_id);\r
+ $this->compileWidget($book, $pages);\r
+\r
+ $this->touchCompile($book_id);\r
+\r
+ return $res;\r
+ }\r
+\r
+ public function compileAir($book_id) {\r
+ $compilerDir = WS_BOOKS . '/air/' . $book_id . '/compiler';\r
+ $finalDir = WS_BOOKS . '/air/' . $book_id . '/';\r
\r
- $res = '';\r
$book = $this->selectById($book_id);\r
$pages = $this->getPagesOfBook($book_id);\r
\r
+ $src = AS3_FLUIDBOOK_SOURCES . '/_src/';\r
+ $lib10 = AS3_FLUIDBOOK_SOURCES . '/lib10/';\r
+ $libs = array(\r
+ $src,\r
+ $lib10,\r
+ AS3_SOURCES,\r
+ $src . 'lib/fluidbook3dLibrary.swc',\r
+ $src . 'lib/mdm.swc',\r
+ $lib10 . 'flash.swc',\r
+ $lib10 . 'flex.swc',\r
+ $lib10 . 'framework.swc',\r
+ );\r
+ $flex = new cubeFlexCompiler('FluidbookAirProjector' . $book_id, $compilerDir, 'com.fluidbook.player.AIRMain', $libs, '/usr/local/flex_sdk_4.5/bin/mxmlc', 'air', 45,800,600,true);\r
+\r
+ $this->compileFlex($book_id, true, $compilerDir, $finalDir, $filesToCopy, $book, $pages, $flex, $flex);\r
+\r
+ return $flex->compile();\r
+ }\r
+\r
+ public function compileFlex($book_id, $complete, $compilerDir, $finalDir, &$filesToCopy, $book, $pages, $flex, $flexLight) {\r
+ cubePHP::neverStop();\r
+\r
+\r
+ $workingDir = WS_BOOKS . '/working/' . $book_id . '/';\r
+\r
+ $res = '';\r
+\r
$daoDoc = new wsDAODocument($this->con);\r
$firstDoc = $daoDoc->selectById($pages[1]['document_id']);\r
$size = $firstDoc->generalInfos['size'];\r
$this->makeTextsIndexes($book_id, $index, $textes);\r
$daoDoc->getLinksAndRulers($book_id, $links, $rulers);\r
\r
- $flex = new cubeFlexCompiler('FluidbookDatas', $compilerDir, 'flash.display.Sprite', explode(';', AS3_SOURCES), MXMLC_PATH, 10);\r
- $flexLight = new cubeFlexCompiler('FluidbookDatasLight', $compilerDir, 'flash.display.Sprite', explode(';', AS3_SOURCES), MXMLC_PATH, 10);\r
\r
$imagesassets = array();\r
$id = 1;\r
$flex->addFont(FONT_PATH . '/' . $lang->font, 'GeneralFont', $lang->charset);\r
$flex->addFont(FONT_PATH . '/FluidbookCredits.ttf', 'CreditsFont', 'ASCII');\r
$flexLight->addFont(FONT_PATH . '/FluidbookLoader.ttf', 'LoaderFont', 'Numerals');\r
- $flexLight->addVariable('checksum', $hash, false, true, 'String');\r
- $res .= $flex->compile() . "\n\n-------------------\n\n";\r
- $flexLight->addVariable('datasSize', filesize($compilerDir . '/FluidbookDatas.swf'));\r
- $res .= $flexLight->compile();\r
-\r
-\r
- $filesToCopy['data/fd.swf'] = $compilerDir . '/FluidbookDatas.swf';\r
- $filesToCopy['data/fdl.swf'] = $compilerDir . '/FluidbookDatasLight.swf';\r
- // Copy of files\r
- // Check if dest dir exists\r
- if (!file_exists($finalDir . 'data')) {\r
- mkdir($finalDir . 'data', 0777, true);\r
- }\r
- // Check working dir\r
- if (file_exists($workingDir)) {\r
- $dr = opendir($workingDir);\r
- while ($file = readdir($dr)) {\r
- if ($file == '.' || $file == '..') {\r
- continue;\r
- }\r
- $filesToCopy['data/' . $file] = $workingDir . '/' . $file;\r
- }\r
- }\r
-\r
- foreach ($filesToCopy as $local => $source) {\r
- $localPath = $finalDir . $local;\r
- // if (!file_exists($localPath) || filemtime($localPath) < filemtime($source) || filesize($localPath) != filesize($source)) {\r
- if (is_dir($source)) {\r
- continue;\r
- }\r
- copy($source, $localPath);\r
- // }\r
- }\r
-\r
- $this->compilePDF($book, $pages);\r
- $this->indexPDF($book, $pages);\r
- $this->compileHTML5($book_id);\r
- $this->compileWidget($book, $pages);\r
-\r
- $this->touchCompile($book_id);\r
-\r
- return $res;\r
}\r
\r
public function compileWidget($book, $pages) {\r
public function compilePDF($book, $pages) {\r
$finalPDF = WS_BOOKS . '/final/' . $book->book_id . '/data/document.pdf';\r
\r
- if (!$book->parametres->pdf && $book->parametres->mobileVersion!='pdf') {\r
+ if (!$book->parametres->pdf && $book->parametres->mobileVersion != 'pdf') {\r
// Si l'export PDF n'est pas activé on supprime le fichier si il existe\r
if (file_exists($finalPDF)) {\r
unlink($finalPDF);\r