$docs = $dao->selectInList($this->documentsId);\r
\r
foreach($docs as $doc) {\r
- trigger_error($doc->document_id);\r
$this->documents[$doc->document_id] = $doc;\r
}\r
$inited = true;\r
$dao = new wsDAODocument($core->con);\r
$daobook = new wsDAOBook($core->con);\r
\r
- trigger_error(count($this->documents));\r
-\r
foreach($this->documents as $doc) {\r
+ $this->currentDoc = $doc;\r
+ $this->serialize();\r
+ if (!$this->reload) {\r
+ $this->currentDoc->globalOperations();\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
- $this->currentDoc = $doc;\r
- $this->serialize();\r
- $this->currentDoc->globalOperations($range, $onlyTexts);\r
$this->updateCountPages();\r
$this->currentDoc = $dao->updateFromObject($this->currentDoc);\r
\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
+ $this->currentDoc->processOnePage($page, true);\r
$this->processedPages++;\r
}\r
$doc = $dao->updateFromObject($doc);\r
$li->creationDate = $this->args['creationDate'];\r
$li->modificationDate = $this->args['modificationDate'];\r
$data['localInfos'] = $li;\r
+ file_put_contents(CACHE . '/debug.txt', print_r($this->args, true));\r
$data['conversionInfos'] = new wsDocumentConversionInfos($this->args['resolution'], $this->args['method'], $this->args['quality'], $this->args['objects']);\r
$document = $dao->sauve($data);\r
$document->copyOriginal($infos['tmp_name']);\r
{\r
$_SESSION['conversionSession'] = array();\r
$_SESSION['conversionSession'][$this->args['document_id']] = 'all';\r
- $_SESSION['conversionSessionReload'] = true;\r
+ $_SESSION['conversionSessionReload'] = false;\r
}\r
\r
public function reload()\r
$r = $core->con->select($sql);\r
while ($r->fetch()) {\r
$k = array_search($r->localHash, $hash);\r
+\r
+ if (!file_exists(WS_DOCS . '/' . $r->document_id . '/original.pdf')) {\r
+ continue;\r
+ }\r
+\r
$al[$k] = true;\r
$f = $alreadyLoaded->addChild('file', $this->args['fileName'][$k]);\r
$f->addAttribute('document_id', $r->document_id);\r
$defaultNum = array();\r
foreach($pages as $page => $info) {\r
$file = WS_DOCS . '/' . $info['document_id'] . '/p' . $info['document_page'] . '.jpg';\r
+ if (!file_exists($file)) {\r
+ continue;\r
+ }\r
$dim = getimagesize($file);\r
+\r
$pa = $p->addChild('page');\r
$pa->addAttribute('page', $page);\r
$pa->addAttribute('document_id', $info['document_id']);\r
return $this->generalInfos['pages'];\r
}\r
\r
- public function globalOperations($range = null, $onlyTexts = false)\r
+ public function globalOperations()\r
{\r
$this->getInfos();\r
if ($this->CropAndCut()) {\r
$this->getInfos($this->cropped, true);\r
}\r
- $this->getLinksAndTexts($range, $onlyTexts);\r
+ $this->getLinksAndTexts();\r
}\r
\r
public function CropAndCut()\r
public function processOnePage($page, $force = true)\r
{\r
// $this->makeRealShot($page);\r
- if ($force || $this) {\r
+ if ($force) {\r
+ $this->addToLog('Processing page #' . $page);\r
$this->makeMiniShot($page);\r
$this->makeSWFFiles($page);\r
}\r
}\r
}\r
\r
- public function getLinksAndTexts($range, $onlyTexts = false)\r
+ public function getLinksAndTexts()\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
- 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->setArg('--extractLinks ' . $this->out . 'p%d.csv');\r
$fwstk->execute();\r
$this->addToLog($fwstk);\r
\r