$db->documents->bookmarks('text', 0, false);\r
$db->documents->numberSections('text', 0, false);\r
$db->documents->links('text', 0, false);\r
+ $db->documents->localHash('varchar', 64, false);\r
// Clés\r
$db->documents->primary('pk_documents', 'document_id');\r
$db->documents->index('index_documents_file', 'BTREE', 'file');\r
$db->documents->index('index_documents_date', 'BTREE', 'date');\r
+ $db->documents->index('index_documents_localHash', 'BTREE', 'localHash');\r
$db->documents->reference('fk_documents_proprietaire', 'proprietaire', 'utilisateurs', 'utilisateur_id');\r
// .\r
// Table pages des documents\r
if ($pages == 'all') {\r
$doc = $this->getDocumentById($id);\r
$this->totalPages += $doc->generalInfos['pages'];\r
- trigger_error('all : ' . $doc->generalInfos['pages']);\r
} else {\r
$this->totalPages += count($pages);\r
- trigger_error($pages);\r
}\r
}\r
$this->totalDoc = count($this->documents);\r
}\r
}\r
\r
+ public function addDocument()\r
+ {\r
+ $_SESSION['conversionSession'] = array();\r
+ $_SESSION['conversionSession'][$this->args['document_id']] = 'all';\r
+ $_SESSION['conversionSessionReload'] = true;\r
+ }\r
+\r
public function reload()\r
{\r
global $core;\r
\r
public function testDocuments()\r
{\r
+ global $core;\r
+\r
$toload = $this->xml->addChild('toLoad');\r
$alreadyLoaded = $this->xml->addChild('alreadyLoaded');\r
\r
+ $hash = array();\r
+\r
foreach($this->args['fileName'] as $k => $name) {\r
- $toload->addChild('file', $name);\r
+ $o = new wsDocumentLocalInfos();\r
+ $o->fileName = $name;\r
+ $o->fileSize = intval($this->args['fileSize'][$k]);\r
+ $o->modificationDate = intval($this->args['modificationDate'][$k]);\r
+ $o->creationDate = intval($this->args['creationDate'][$k]);\r
+\r
+ $hash[$k] = md5(serialize($o));\r
+ }\r
+\r
+ $in = array();\r
+ foreach($hash as $h) {\r
+ $in[] = "'" . $h . "'";\r
+ }\r
+\r
+ $sql = 'SELECT document_id,localHash FROM documents WHERE localHash';\r
+ if (count($in) == 1) {\r
+ $sql .= ' = ' . implode(',', $in);\r
+ } else {\r
+ $sql .= ' IN (' . implode(',', $in) . ')';\r
+ }\r
+\r
+ $al = array();\r
+ $r = $core->con->select($sql);\r
+ while ($r->fetch()) {\r
+ $k = array_search($r->localHash, $hash);\r
+ $al[$k] = true;\r
+ $f = $alreadyLoaded->addChild('file', $this->args['fileName'][$k]);\r
+ $f->addAttribute('document_id', $r->document_id);\r
+ }\r
+\r
+ foreach($this->args['fileName'] as $k => $name) {\r
+ if (!isset($al[$k])) {\r
+ $toload->addChild('file', $name);\r
+ }\r
}\r
}\r
\r
<?php\r
class wsDAODocument extends extranetDAO {\r
public static $normal = array('document_id', 'file', 'proprietaire', 'pages', 'date', 'numberSections');\r
- public static $complex = array('localInfos', 'bookmarks', 'generalInfos','conversionInfos', 'trim');\r
+ public static $complex = array('localInfos', 'bookmarks', 'generalInfos', 'conversionInfos', 'trim');\r
\r
public function singleton($r)\r
{\r
$c->$k = serialize($data[$k]);\r
}\r
}\r
+ if (isset($data['localInfos'])) {\r
+ $c->localHash = md5($c->localInfos);\r
+ }\r
\r
if ($data['document_id'] == 'new') {\r
$document_id = $c->document_id = $this->getNextId();\r
<?php\r
-class wsDocumentLocalInfos extends wsParametres {\r
- public function initFields()\r
- {\r
- parent::initFields();\r
- $this->fields['fileName'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __("Nom du fichier"), 'extra' => false, 'grade' => 0);\r
- $this->fields['fileSize'] = array('type' => 'integer', 'default' => '', 'editable' => true, 'label' => __("Couleur des sous-menus"), 'extra' => false, 'grade' => 0);\r
- $this->fields['modificationDate'] = array('type' => 'date', 'default' => TIME, 'editable' => true, 'label' => __("Date de dernière modification"), 'extra' => false, 'grade' => 0);\r
- $this->fields['creationDate'] = array('type' => 'date', 'default' => TIME, 'editable' => true, 'label' => __("Date de dernière modification"), 'extra' => false, 'grade' => 0);\r
- }\r
+class wsDocumentLocalInfos {\r
+ public $fileName;\r
+ public $fileSize;\r
+ public $modificationDate;\r
+ public $creationDate;\r
}\r
\r
?>
\ No newline at end of file
protected $bookmarks;\r
protected $numberSections;\r
protected $links;\r
+ protected $localHash;\r
// Crop & cut\r
protected $autocrop;\r
protected $manualcrop;\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