trigger_error(count($this->documents));\r
\r
foreach($this->documents as $doc) {\r
- $this->currentDoc = $doc;\r
- $this->serialize();\r
- $this->currentDoc->globalOperations();\r
- $this->updateCountPages();\r
- $this->currentDoc = $dao->updateFromObject($this->currentDoc);\r
-\r
if ($this->documentsPages[$doc->document_id] == 'all') {\r
$docPages = range(1, $doc->generalInfos['pages']);\r
+ $range = null;\r
+ $onlyTexts = false;\r
} else {\r
$docPages = $this->documentsPages[$doc->document_id];\r
+ $range = array();\r
+ foreach($docPages as $p) {\r
+ $range[] = $p;\r
+ }\r
+ $range = implode(',', $range);\r
+ $onlyTexts = true;\r
}\r
\r
- foreach($docPages as $i=>$page) {\r
- $this->currentDocPage = $i+1;\r
+ $this->currentDoc = $doc;\r
+ $this->serialize();\r
+ $this->currentDoc->globalOperations($range, $onlyTexts);\r
+ $this->updateCountPages();\r
+ $this->currentDoc = $dao->updateFromObject($this->currentDoc);\r
+\r
+ foreach($docPages as $i => $page) {\r
+ $this->currentDocPage = $i + 1;\r
$this->totalDocPage = count($docPages);\r
$this->setProgress(($this->processedPages / $this->totalPages) * 100);\r
$this->currentDoc->processOnePage($page, false);\r
}\r
}\r
\r
+ public function processConversionSessionAsync()\r
+ {\r
+ cubePHP::neverStop();\r
+ try {\r
+ $conversion = wsConversionSession::openFromGUID($_POST['sessionConversionGUID']);\r
+ $conversion->process();\r
+ }\r
+ catch(Exception $e) {\r
+ file_put_contents(CACHE . '/conversionExceptions.txt', print_r($e, true), FILE_APPEND);\r
+ }\r
+ $conversion->destroy();\r
+ }\r
+\r
+ public function getConversionSessionProgress()\r
+ {\r
+ set_time_limit(1);\r
+ $session = wsConversionSession::openFromGUID($_SESSION['sessionConversionGUID']);\r
+ $p = $session->getProgress();\r
+ $this->xml->addChild('progress', $p['progress']);\r
+ $this->xml->addChild('processedDoc', $p['processedDoc']);\r
+ $this->xml->addChild('totalDoc', $p['totalDoc']);\r
+ $this->xml->addChild('currentDoc', $p['currentDoc']);\r
+ $this->xml->addChild('currentDocPage', $p['currentDocPage']);\r
+ $this->xml->addChild('totalDocPage', $p['totalDocPage']);\r
+ }\r
+\r
public function uploadThemeFile()\r
{\r
foreach($_FILES as $varname => $infos) {\r
$pa->addAttribute('document_page', $info['document_page']);\r
$pa->addAttribute('width', $dim[0]);\r
$pa->addAttribute('height', $dim[1]);\r
+ $pa->addAttribute('resolution', $info['resolution']);\r
+ $pa->addAttribute('quality', $info['quality']);\r
+ $pa->addAttribute('methode', $info['method']);\r
+ $pa->addAttribute('objects', $info['objects']);\r
$docs[] = $info['document_id'];\r
$defaultNum[] = $info['defaultNum'];\r
}\r
}\r
}\r
\r
- public function processConversionSessionAsync()\r
- {\r
- cubePHP::neverStop();\r
- try {\r
- $conversion = wsConversionSession::openFromGUID($_POST['sessionConversionGUID']);\r
- $conversion->process();\r
- }\r
- catch(Exception $e) {\r
- file_put_contents(CACHE . '/conversionExceptions.txt', print_r($e, true), FILE_APPEND);\r
- }\r
- $conversion->destroy();\r
- }\r
-\r
- public function getConversionSessionProgress()\r
- {\r
- set_time_limit(1);\r
- $session = wsConversionSession::openFromGUID($_SESSION['sessionConversionGUID']);\r
- $p = $session->getProgress();\r
- $this->xml->addChild('progress', $p['progress']);\r
- $this->xml->addChild('processedDoc', $p['processedDoc']);\r
- $this->xml->addChild('totalDoc', $p['totalDoc']);\r
- $this->xml->addChild('currentDoc', $p['currentDoc']);\r
- $this->xml->addChild('currentDocPage', $p['currentDocPage']);\r
- $this->xml->addChild('totalDocPage', $p['totalDocPage']);\r
- }\r
-\r
public function getTheme()\r
{\r
global $core;\r
public function getPagesOfBook($book_id)\r
{\r
$pages = array();\r
- $r = $this->con->select('SELECT b.*,d.numberSections AS num,d.pages AS doc_pages FROM book_pages b LEFT JOIN documents d ON d.document_id=b.document_id WHERE b.book_id=\'' . $this->con->escape($book_id) . '\' ORDER BY book_page');\r
+ $r = $this->con->select('SELECT b.*,d.numberSections AS num,d.conversionInfos AS conversion,d.pages AS doc_pages FROM book_pages b LEFT JOIN documents d ON d.document_id=b.document_id WHERE b.book_id=\'' . $this->con->escape($book_id) . '\' ORDER BY book_page');\r
while ($r->fetch()) {\r
$n = explode(',', $r->num);\r
- $pages[$r->book_page] = array('document_id' => $r->document_id, 'document_page' => $r->document_page, 'defaultNum' => $n[$r->document_page-1], 'nb_pages' => $r->doc_pages);\r
+ if ($r->conversion != '') {\r
+ $c = unserialize($r->conversion);\r
+ $c = $c->pages[$r->document_page];\r
+ }\r
+ $pages[$r->book_page] = array('document_id' => $r->document_id, 'document_page' => $r->document_page, 'defaultNum' => $n[$r->document_page-1], 'nb_pages' => $r->doc_pages, 'resolution' => $c->resolution, 'quality' => $c->quality, 'method' => $c->method, 'objects' => $c->objects);\r
}\r
return $pages;\r
}\r
$twords = explode("\n", trim($ipage));\r
\r
foreach($twords as $woadata) {\r
-\r
list($woa, $worddata) = explode(',', trim($woadata));\r
list($total, $wordslist) = explode("\t", $worddata, 2);\r
\r
- if($woa==''){\r
+ if ($woa == '') {\r
continue;\r
}\r
\r
*/\r
public function compile3($book_id, $complete)\r
{\r
- //cubePHP::neverStop();\r
-\r
+ // cubePHP::neverStop();\r
$filesToCopy = array();\r
$finalDir = WS_BOOKS . '/final/' . $book_id . '/';\r
$workingDir = WS_BOOKS . '/working/' . $book_id . '/';\r
\r
$flex = new cubeFlexCompiler('FluidbookDatas', $compilerDir, 'flash.display.Sprite', explode(';', AS3_SOURCES), MXMLC_PATH);\r
$flexLight = new cubeFlexCompiler('FluidbookDatasLight', $compilerDir, 'flash.display.Sprite', explode(';', AS3_SOURCES), MXMLC_PATH);\r
- $flex->addVariable('links', $book->links,false,true,'JSONObject');\r
- $flex->addVariable('signature', $exportSignature,false,true,'JSONObject');\r
- $flexLight->addVariable('datas', $book->parametres->toStandardObject(),false,true,'JSONObject');\r
+ $flex->addVariable('links', $book->links, false, true, 'JSONObject');\r
+ $flex->addVariable('signature', $exportSignature, false, true, 'JSONObject');\r
+ $flexLight->addVariable('datas', $book->parametres->toStandardObject(), false, true, 'JSONObject');\r
$flexLight->addVariable('id', $book_id, false, true, 'uint');\r
\r
- $flex->addVariable('traductions', wsLang::getTraductionWithId($book->traductions),false,true,'JSONObject');\r
- $flex->addVariable('chapters', $book->chapters,false,true,'JSONObject');\r
+ $flex->addVariable('traductions', wsLang::getTraductionWithId($book->traductions), false, true, 'JSONObject');\r
+ $flex->addVariable('chapters', $book->chapters, false, true, 'JSONObject');\r
$flex->addVariable('extras', '<extras>' . $book->extras . '</extras>', false, true, 'XML');\r
$flex->addVariable('numerotation', $book->numerotation, false, true, 'String');\r
- $flexLight->addVariable('theme', $theme->parametres->toStandardObject(),false,true,'JSONObject');\r
+ $flexLight->addVariable('theme', $theme->parametres->toStandardObject(), false, true, 'JSONObject');\r
$flexLight->addVariable('pages', count($pages));\r
$flexLight->addVariable('fwidth', round($size[0]), false, true, 'Number');\r
$flexLight->addVariable('fheight', round($size[1]), false, true, 'Number');\r
$flexLight->addVariable('pagesInDatas', $complete, false, true, 'Boolean');\r
- $flex->addVariable('index', $index,false,true,'JSONObject');\r
- $flex->addVariable('textes', $textes,false,true,'JSONObject');\r
+ $flex->addVariable('index', $index, false, true, 'JSONObject');\r
+ $flex->addVariable('textes', $textes, false, true, 'JSONObject');\r
foreach($pages as $i => $infos) {\r
$swffile = WS_DOCS . '/' . $infos['document_id'] . '/p' . $infos['document_page'] . '.swf';\r
if ($i == 1) {\r
return $this->generalInfos['pages'];\r
}\r
\r
- public function globalOperations()\r
+ public function globalOperations($range = null, $onlyTexts = false)\r
{\r
$this->getInfos();\r
if ($this->CropAndCut()) {\r
$this->getInfos($this->cropped, true);\r
}\r
- $this->getLinksAndTexts();\r
+ $this->getLinksAndTexts($range, $onlyTexts);\r
}\r
\r
public function CropAndCut()\r
}\r
}\r
\r
- public function processRange($range)\r
+ public function processRange($pages)\r
{\r
foreach($pages as $i) {\r
$this->processOnePage($i);\r
}\r
}\r
\r
- public function getLinksAndTexts()\r
+ public function getLinksAndTexts($range, $onlyTexts = false)\r
{\r
$fwstk = new cubeCommandLine('fwstk');\r
$fwstk->setPath(CONVERTER_PATH);\r
$fwstk->setArg('--input ' . $this->cropped);\r
$fwstk->setArg('--extractTexts ' . $this->out . '%s%d.txt');\r
- $fwstk->setArg('--extractLinks ' . $this->out . 'p%d.csv');\r
+ if (!$onlyTexts) {\r
+ $fwstk->setArg('--extractLinks ' . $this->out . 'p%d.csv');\r
+ }\r
+ if (!is_null($range)) {\r
+ $fwstk->setArg('--range ' . $range);\r
+ }\r
$fwstk->execute();\r
$this->addToLog($fwstk);\r
\r
\r
public function makeMiniShot($page)\r
{\r
- $this->makeShotFixedWidth($page, 'p', 200, 90, 4, 'GS');\r
+ $this->makeShotFixedWidth($page, 'p', 100, 90, 4, 'GS');\r
}\r
\r
public function makeRealShot($page)\r
fwrite($pointer, $c);\r
}\r
\r
-\r
public function __destruct()\r
{\r
if (isset($this->common_log_pointer) && is_resource($this->common_log_pointer)) {\r