mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-11 03:53:13 +00:00
Moved vocabulary to Alchemy namespace
This commit is contained in:
@@ -116,6 +116,27 @@ class caption_Field_Value
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setVocab(\Alchemy\Phrasea\Vocabulary\ControlProvider\ControlProviderInterface $vocabulary, $vocab_id)
|
||||||
|
{
|
||||||
|
|
||||||
|
$params = array(
|
||||||
|
':VocabType' => $vocabulary->getType()
|
||||||
|
, ':VocabularyId' => $vocab_id
|
||||||
|
);
|
||||||
|
|
||||||
|
$sql_up = 'UPDATE metadatas
|
||||||
|
SET VocabularyType = :VocabType, VocabularyId = :VocabularyId
|
||||||
|
WHERE id = :meta_id';
|
||||||
|
$stmt_up = $connbas->prepare($sql_up);
|
||||||
|
$stmt_up->execute($params);
|
||||||
|
$stmt_up->closeCursor();
|
||||||
|
|
||||||
|
$this->set_value($vocabulary->getValue($vocab_id));
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function set_value($value)
|
public function set_value($value)
|
||||||
{
|
{
|
||||||
@@ -206,21 +227,24 @@ class caption_Field_Value
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function create(databox_field &$databox_field, record_Interface $record, $value)
|
public static function create(databox_field &$databox_field, record_Interface $record, $value, \Alchemy\Phrasea\Vocabulary\ControlProvider\ControlProviderInterface $vocabulary = null, $vocabularyId = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
$sbas_id = $databox_field->get_databox()->get_sbas_id();
|
$sbas_id = $databox_field->get_databox()->get_sbas_id();
|
||||||
$connbas = $databox_field->get_connection();
|
$connbas = $databox_field->get_connection();
|
||||||
|
|
||||||
$sql_ins = 'INSERT INTO metadatas (id, record_id, meta_struct_id, value)
|
$sql_ins = 'INSERT INTO metadatas
|
||||||
VALUES
|
(id, record_id, meta_struct_id, value, VocabularyType, VocabularyId)
|
||||||
(null, :record_id, :field, :value)';
|
VALUES
|
||||||
|
(null, :record_id, :field, :value, :VocabType, :VocabId)';
|
||||||
$stmt_ins = $connbas->prepare($sql_ins);
|
$stmt_ins = $connbas->prepare($sql_ins);
|
||||||
$stmt_ins->execute(
|
$stmt_ins->execute(
|
||||||
array(
|
array(
|
||||||
':record_id' => $record->get_record_id(),
|
':record_id' => $record->get_record_id(),
|
||||||
':field' => $databox_field->get_id(),
|
':field' => $databox_field->get_id(),
|
||||||
':value' => $value
|
':value' => $value,
|
||||||
|
':VocabType' => $vocabulary ? $vocabulary->getType() : null,
|
||||||
|
':VocabId' => $vocabulary ? $vocabularyId : null,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$stmt_ins->closeCursor();
|
$stmt_ins->closeCursor();
|
||||||
|
@@ -185,7 +185,7 @@ class databox_field implements cache_cacheableInterface
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$this->Vocabulary = databox_Field_VocabularyControl::get($row['VocabularyControlType']);
|
$this->Vocabulary = \Alchemy\Phrasea\Vocabulary\Controller::get($row['VocabularyControlType']);
|
||||||
$this->VocabularyRestriction = !!$row['RestrictToVocabularyControl'];
|
$this->VocabularyRestriction = !!$row['RestrictToVocabularyControl'];
|
||||||
}
|
}
|
||||||
catch (Exception $e)
|
catch (Exception $e)
|
||||||
@@ -498,7 +498,7 @@ class databox_field implements cache_cacheableInterface
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setVocabularyControl(databox_Field_VocabularyControl_Interface $vocabulary = null)
|
public function setVocabularyControl(\Alchemy\Phrasea\Vocabulary\ControlProvider\ControlProviderInterface $vocabulary = null)
|
||||||
{
|
{
|
||||||
$this->Vocabulary = $vocabulary;
|
$this->Vocabulary = $vocabulary;
|
||||||
|
|
||||||
|
@@ -132,13 +132,13 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
*/
|
*/
|
||||||
protected $modification_date;
|
protected $modification_date;
|
||||||
|
|
||||||
const CACHE_ORIGINAL_NAME = 'originalname';
|
const CACHE_ORIGINAL_NAME = 'originalname';
|
||||||
const CACHE_TECHNICAL_DATAS = 'technical_datas';
|
const CACHE_TECHNICAL_DATAS = 'technical_datas';
|
||||||
const CACHE_MIME = 'mime';
|
const CACHE_MIME = 'mime';
|
||||||
const CACHE_SHA256 = 'sha256';
|
const CACHE_SHA256 = 'sha256';
|
||||||
const CACHE_SUBDEFS = 'subdefs';
|
const CACHE_SUBDEFS = 'subdefs';
|
||||||
const CACHE_GROUPING = 'grouping';
|
const CACHE_GROUPING = 'grouping';
|
||||||
const CACHE_STATUS = 'status';
|
const CACHE_STATUS = 'status';
|
||||||
|
|
||||||
protected static $_regfields;
|
protected static $_regfields;
|
||||||
|
|
||||||
@@ -186,12 +186,12 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
$connbas = $this->databox->get_connection();
|
$connbas = $this->databox->get_connection();
|
||||||
$sql = 'SELECT coll_id, record_id,credate , uuid, moddate, parent_record_id
|
$sql = 'SELECT coll_id, record_id,credate , uuid, moddate, parent_record_id
|
||||||
, type, originalname, bitly, sha256, mime
|
, type, originalname, bitly, sha256, mime
|
||||||
FROM record WHERE record_id = :record_id';
|
FROM record WHERE record_id = :record_id';
|
||||||
$stmt = $connbas->prepare($sql);
|
$stmt = $connbas->prepare($sql);
|
||||||
$stmt->execute(array(':record_id' => $this->record_id));
|
$stmt->execute(array(':record_id' => $this->record_id));
|
||||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
if (!$row)
|
if (!$row)
|
||||||
@@ -210,16 +210,16 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
$this->mime = $row['mime'];
|
$this->mime = $row['mime'];
|
||||||
|
|
||||||
$datas = array(
|
$datas = array(
|
||||||
'mime' => $this->mime
|
'mime' => $this->mime
|
||||||
, 'sha256' => $this->sha256
|
, 'sha256' => $this->sha256
|
||||||
, 'bitly_link' => $this->bitly_link
|
, 'bitly_link' => $this->bitly_link
|
||||||
, 'original_name' => $this->original_name
|
, 'original_name' => $this->original_name
|
||||||
, 'type' => $this->type
|
, 'type' => $this->type
|
||||||
, 'grouping' => $this->grouping
|
, 'grouping' => $this->grouping
|
||||||
, 'uuid' => $this->uuid
|
, 'uuid' => $this->uuid
|
||||||
, 'modification_date' => $this->modification_date
|
, 'modification_date' => $this->modification_date
|
||||||
, 'creation_date' => $this->creation_date
|
, 'creation_date' => $this->creation_date
|
||||||
, 'base_id' => $this->base_id
|
, 'base_id' => $this->base_id
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->set_data_to_cache($datas);
|
$this->set_data_to_cache($datas);
|
||||||
@@ -292,9 +292,9 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
|
|
||||||
$connbas = connection::getPDOConnection($this->get_sbas_id());
|
$connbas = connection::getPDOConnection($this->get_sbas_id());
|
||||||
|
|
||||||
$sql = 'UPDATE record SET type = :type WHERE record_id = :record_id';
|
$sql = 'UPDATE record SET type = :type WHERE record_id = :record_id';
|
||||||
$stmt = $connbas->prepare($sql);
|
$stmt = $connbas->prepare($sql);
|
||||||
$stmt->execute(array(':type' => $type, ':record_id' => $this->get_record_id()));
|
$stmt->execute(array(':type' => $type, ':record_id' => $this->get_record_id()));
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
if ($old_type !== $type)
|
if ($old_type !== $type)
|
||||||
@@ -371,9 +371,9 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
{
|
{
|
||||||
$dstatus = databox_status::getDisplayStatus();
|
$dstatus = databox_status::getDisplayStatus();
|
||||||
$sbas_id = $this->get_sbas_id();
|
$sbas_id = $this->get_sbas_id();
|
||||||
$appbox = appbox::get_instance();
|
$appbox = appbox::get_instance();
|
||||||
$session = $appbox->get_session();
|
$session = $appbox->get_session();
|
||||||
$user = User_Adapter::getInstance($session->get_usr_id(), $appbox);
|
$user = User_Adapter::getInstance($session->get_usr_id(), $appbox);
|
||||||
|
|
||||||
$status = '';
|
$status = '';
|
||||||
|
|
||||||
@@ -382,24 +382,24 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
foreach ($dstatus[$sbas_id] as $n => $statbit)
|
foreach ($dstatus[$sbas_id] as $n => $statbit)
|
||||||
{
|
{
|
||||||
if ($statbit['printable'] == '0' &&
|
if ($statbit['printable'] == '0' &&
|
||||||
!$user->ACL()->has_right_on_base($this->base_id, 'chgstatus'))
|
!$user->ACL()->has_right_on_base($this->base_id, 'chgstatus'))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$x = (substr((strrev($this->get_status())), $n, 1));
|
$x = (substr((strrev($this->get_status())), $n, 1));
|
||||||
|
|
||||||
$source0 = "/skins/icons/spacer.gif";
|
$source0 = "/skins/icons/spacer.gif";
|
||||||
$style0 = "visibility:hidden;display:none;";
|
$style0 = "visibility:hidden;display:none;";
|
||||||
$source1 = "/skins/icons/spacer.gif";
|
$source1 = "/skins/icons/spacer.gif";
|
||||||
$style1 = "visibility:hidden;display:none;";
|
$style1 = "visibility:hidden;display:none;";
|
||||||
if ($statbit["img_on"])
|
if ($statbit["img_on"])
|
||||||
{
|
{
|
||||||
$source1 = $statbit["img_on"];
|
$source1 = $statbit["img_on"];
|
||||||
$style1 = "visibility:auto;display:none;";
|
$style1 = "visibility:auto;display:none;";
|
||||||
}
|
}
|
||||||
if ($statbit["img_off"])
|
if ($statbit["img_off"])
|
||||||
{
|
{
|
||||||
$source0 = $statbit["img_off"];
|
$source0 = $statbit["img_off"];
|
||||||
$style0 = "visibility:auto;display:none;";
|
$style0 = "visibility:auto;display:none;";
|
||||||
}
|
}
|
||||||
if ($x == '1')
|
if ($x == '1')
|
||||||
{
|
{
|
||||||
@@ -416,19 +416,19 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$status .= '<img style="margin:1px;' . $style1 . '" ' .
|
$status .= '<img style="margin:1px;' . $style1 . '" ' .
|
||||||
'class="STAT_' . $this->base_id . '_'
|
'class="STAT_' . $this->base_id . '_'
|
||||||
. $this->record_id . '_' . $n . '_1" ' .
|
. $this->record_id . '_' . $n . '_1" ' .
|
||||||
'src="' . $source1 . '" title="' .
|
'src="' . $source1 . '" title="' .
|
||||||
(isset($statbit["labelon"]) ?
|
(isset($statbit["labelon"]) ?
|
||||||
$statbit["labelon"] :
|
$statbit["labelon"] :
|
||||||
$statbit["lib"]) . '"/>';
|
$statbit["lib"]) . '"/>';
|
||||||
$status .= '<img style="margin:1px;' . $style0 . '" ' .
|
$status .= '<img style="margin:1px;' . $style0 . '" ' .
|
||||||
'class="STAT_' . $this->base_id . '_'
|
'class="STAT_' . $this->base_id . '_'
|
||||||
. $this->record_id . '_' . $n . '_0" ' .
|
. $this->record_id . '_' . $n . '_0" ' .
|
||||||
'src="' . $source0 . '" title="' .
|
'src="' . $source0 . '" title="' .
|
||||||
(isset($statbit["labeloff"]) ?
|
(isset($statbit["labeloff"]) ?
|
||||||
$statbit["labeloff"] :
|
$statbit["labeloff"] :
|
||||||
("non-" . $statbit["lib"])) . '"/>';
|
("non-" . $statbit["lib"])) . '"/>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -481,8 +481,8 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
$sql = "UPDATE record SET coll_id = :coll_id WHERE record_id =:record_id";
|
$sql = "UPDATE record SET coll_id = :coll_id WHERE record_id =:record_id";
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
':coll_id' => $collection->get_coll_id(),
|
':coll_id' => $collection->get_coll_id(),
|
||||||
':record_id' => $this->get_record_id()
|
':record_id' => $this->get_record_id()
|
||||||
);
|
);
|
||||||
|
|
||||||
$stmt = $this->get_databox()->get_connection()->prepare($sql);
|
$stmt = $this->get_databox()->get_connection()->prepare($sql);
|
||||||
@@ -492,7 +492,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
$this->base_id = $collection->get_base_id();
|
$this->base_id = $collection->get_base_id();
|
||||||
|
|
||||||
$appbox->get_session()->get_logger($this->get_databox())
|
$appbox->get_session()->get_logger($this->get_databox())
|
||||||
->log($this, Session_Logger::EVENT_MOVE, $collection->get_coll_id(), '');
|
->log($this, Session_Logger::EVENT_MOVE, $collection->get_coll_id(), '');
|
||||||
|
|
||||||
$this->delete_data_from_cache();
|
$this->delete_data_from_cache();
|
||||||
|
|
||||||
@@ -509,7 +509,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return $this->get_subdef('thumbnailGIF');
|
return $this->get_subdef('thumbnailGIF');
|
||||||
@@ -568,18 +568,18 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
$sql = 'SELECT BIN(status) as status FROM record
|
$sql = 'SELECT BIN(status) as status FROM record
|
||||||
WHERE record_id = :record_id';
|
WHERE record_id = :record_id';
|
||||||
$stmt = $this->get_databox()->get_connection()->prepare($sql);
|
$stmt = $this->get_databox()->get_connection()->prepare($sql);
|
||||||
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
||||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
if (!$row)
|
if (!$row)
|
||||||
throw new Exception('status not found');
|
throw new Exception('status not found');
|
||||||
|
|
||||||
$status = $row['status'];
|
$status = $row['status'];
|
||||||
$n = strlen($status);
|
$n = strlen($status);
|
||||||
while ($n < 64)
|
while ($n < 64)
|
||||||
{
|
{
|
||||||
$status = '0' . $status;
|
$status = '0' . $status;
|
||||||
@@ -599,7 +599,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
public function get_subdef($name)
|
public function get_subdef($name)
|
||||||
{
|
{
|
||||||
$name = strtolower($name);
|
$name = strtolower($name);
|
||||||
|
|
||||||
if (!in_array($name, $this->get_available_subdefs()))
|
if (!in_array($name, $this->get_available_subdefs()))
|
||||||
{
|
{
|
||||||
throw new Exception_Media_SubdefNotFound ();
|
throw new Exception_Media_SubdefNotFound ();
|
||||||
@@ -660,7 +660,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
|
|
||||||
$stmt = $connbas->prepare($sql);
|
$stmt = $connbas->prepare($sql);
|
||||||
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
||||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
$subdefs = array('preview', 'thumbnail');
|
$subdefs = array('preview', 'thumbnail');
|
||||||
@@ -669,7 +669,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
{
|
{
|
||||||
$subdefs[] = $row['name'];
|
$subdefs[] = $row['name'];
|
||||||
}
|
}
|
||||||
$subdefs = array_unique($subdefs);
|
$subdefs = array_unique($subdefs);
|
||||||
$this->set_data_to_cache($subdefs, self::CACHE_SUBDEFS);
|
$this->set_data_to_cache($subdefs, self::CACHE_SUBDEFS);
|
||||||
|
|
||||||
return $subdefs;
|
return $subdefs;
|
||||||
@@ -702,10 +702,10 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
{
|
{
|
||||||
$this->technical_datas = array();
|
$this->technical_datas = array();
|
||||||
$connbas = $this->get_databox()->get_connection();
|
$connbas = $this->get_databox()->get_connection();
|
||||||
$sql = 'SELECT name, value FROM technical_datas WHERE record_id = :record_id';
|
$sql = 'SELECT name, value FROM technical_datas WHERE record_id = :record_id';
|
||||||
$stmt = $connbas->prepare($sql);
|
$stmt = $connbas->prepare($sql);
|
||||||
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
||||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
foreach ($rs as $row)
|
foreach ($rs as $row)
|
||||||
@@ -781,7 +781,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
$dom_doc->formatOutput = true;
|
$dom_doc->formatOutput = true;
|
||||||
$dom_doc->standalone = true;
|
$dom_doc->standalone = true;
|
||||||
|
|
||||||
$record = $dom_doc->createElement('record');
|
$record = $dom_doc->createElement('record');
|
||||||
$record->setAttribute('record_id', $this->get_record_id());
|
$record->setAttribute('record_id', $this->get_record_id());
|
||||||
$dom_doc->appendChild($record);
|
$dom_doc->appendChild($record);
|
||||||
$description = $dom_doc->createElement('description');
|
$description = $dom_doc->createElement('description');
|
||||||
@@ -857,11 +857,11 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
$value = array_pop($field->get_values());
|
$value = array_pop($field->get_values());
|
||||||
|
|
||||||
$this->set_metadatas(
|
$this->set_metadatas(
|
||||||
array(
|
array(
|
||||||
'meta_struct_id' => $field->get_meta_struct_id()
|
'meta_struct_id' => $field->get_meta_struct_id()
|
||||||
, 'meta_id' => $value->getId()
|
, 'meta_id' => $value->getId()
|
||||||
, 'value' => $original_name
|
, 'value' => $original_name
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -870,8 +870,8 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
SET originalname = :originalname WHERE record_id = :record_id';
|
SET originalname = :originalname WHERE record_id = :record_id';
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
':originalname' => $original_name
|
':originalname' => $original_name
|
||||||
, ':record_id' => $this->get_record_id()
|
, ':record_id' => $this->get_record_id()
|
||||||
);
|
);
|
||||||
|
|
||||||
$stmt = $this->get_databox()->get_connection()->prepare($sql);
|
$stmt = $this->get_databox()->get_connection()->prepare($sql);
|
||||||
@@ -889,7 +889,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
*/
|
*/
|
||||||
public function get_title($highlight = false, searchEngine_adapter $searchEngine = null)
|
public function get_title($highlight = false, searchEngine_adapter $searchEngine = null)
|
||||||
{
|
{
|
||||||
$sbas_id = $this->get_sbas_id();
|
$sbas_id = $this->get_sbas_id();
|
||||||
$record_id = $this->get_record_id();
|
$record_id = $this->get_record_id();
|
||||||
|
|
||||||
if ($this->is_grouping())
|
if ($this->is_grouping())
|
||||||
@@ -899,8 +899,8 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
return $regfield['regname'];
|
return $regfield['regname'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$title = '';
|
$title = '';
|
||||||
$appbox = appbox::get_instance();
|
$appbox = appbox::get_instance();
|
||||||
$session = $appbox->get_session();
|
$session = $appbox->get_session();
|
||||||
|
|
||||||
$fields = $this->get_databox()->get_meta_structure();
|
$fields = $this->get_databox()->get_meta_structure();
|
||||||
@@ -918,14 +918,14 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
if (count($fields_to_retrieve) > 0)
|
if (count($fields_to_retrieve) > 0)
|
||||||
{
|
{
|
||||||
$retrieved_fields = $this->get_caption()->get_highlight_fields($highlight, $fields_to_retrieve, $searchEngine);
|
$retrieved_fields = $this->get_caption()->get_highlight_fields($highlight, $fields_to_retrieve, $searchEngine);
|
||||||
$titles = array();
|
$titles = array();
|
||||||
foreach ($retrieved_fields as $key => $value)
|
foreach ($retrieved_fields as $key => $value)
|
||||||
{
|
{
|
||||||
if (trim($value['value'] === ''))
|
if (trim($value['value'] === ''))
|
||||||
continue;
|
continue;
|
||||||
$titles[] = $value['value'];
|
$titles[] = $value['value'];
|
||||||
}
|
}
|
||||||
$title = trim(implode(' - ', $titles));
|
$title = trim(implode(' - ', $titles));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trim($title) === '')
|
if (trim($title) === '')
|
||||||
@@ -1012,7 +1012,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
*/
|
*/
|
||||||
protected function searchRegFields(databox_descriptionStructure $meta_struct)
|
protected function searchRegFields(databox_descriptionStructure $meta_struct)
|
||||||
{
|
{
|
||||||
$fields = null;
|
$fields = null;
|
||||||
$fields["regname"] = "";
|
$fields["regname"] = "";
|
||||||
$fields["regdesc"] = "";
|
$fields["regdesc"] = "";
|
||||||
$fields["regdate"] = "";
|
$fields["regdate"] = "";
|
||||||
@@ -1086,11 +1086,11 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
public function substitute_subdef($name, system_file $pathfile)
|
public function substitute_subdef($name, system_file $pathfile)
|
||||||
{
|
{
|
||||||
$newfilename = $this->record_id . '_0_' . $name
|
$newfilename = $this->record_id . '_0_' . $name
|
||||||
. '.' . $pathfile->get_extension();
|
. '.' . $pathfile->get_extension();
|
||||||
|
|
||||||
$base_url = '';
|
$base_url = '';
|
||||||
|
|
||||||
$original_file = $subdef_def = false;
|
$original_file = $subdef_def = false;
|
||||||
|
|
||||||
if ($name == 'document')
|
if ($name == 'document')
|
||||||
{
|
{
|
||||||
@@ -1140,7 +1140,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
}
|
}
|
||||||
catch (Exception $e)
|
catch (Exception $e)
|
||||||
{
|
{
|
||||||
$path = databox::dispatch($subdef_def->get_path());
|
$path = databox::dispatch($subdef_def->get_path());
|
||||||
system_file::mkdir($path);
|
system_file::mkdir($path);
|
||||||
$original_file = $path . $newfilename;
|
$original_file = $path . $newfilename;
|
||||||
}
|
}
|
||||||
@@ -1150,9 +1150,9 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
if (trim($subdef_def->get_baseurl()) !== '')
|
if (trim($subdef_def->get_baseurl()) !== '')
|
||||||
{
|
{
|
||||||
$base_url = str_replace(
|
$base_url = str_replace(
|
||||||
array((string) $subdef_def->get_path(), $newfilename)
|
array((string) $subdef_def->get_path(), $newfilename)
|
||||||
, array((string) $subdef_def->get_baseurl(), '')
|
, array((string) $subdef_def->get_baseurl(), '')
|
||||||
, $path_file_dest
|
, $path_file_dest
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1169,18 +1169,18 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$appbox = \appbox::get_instance();
|
$appbox = \appbox::get_instance();
|
||||||
$session = $appbox->get_session();
|
$session = $appbox->get_session();
|
||||||
|
|
||||||
$connbas = connection::getPDOConnection($this->get_sbas_id());
|
$connbas = connection::getPDOConnection($this->get_sbas_id());
|
||||||
|
|
||||||
$sql = 'DELETE FROM subdef WHERE record_id= :record_id AND name=:name';
|
$sql = 'DELETE FROM subdef WHERE record_id= :record_id AND name=:name';
|
||||||
$stmt = $connbas->prepare($sql);
|
$stmt = $connbas->prepare($sql);
|
||||||
$stmt->execute(
|
$stmt->execute(
|
||||||
array(
|
array(
|
||||||
':record_id' => $this->record_id
|
':record_id' => $this->record_id
|
||||||
, ':name' => $name
|
, ':name' => $name
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$image_size = $system_file->get_technical_datas();
|
$image_size = $system_file->get_technical_datas();
|
||||||
@@ -1195,18 +1195,18 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
$stmt = $connbas->prepare($sql);
|
$stmt = $connbas->prepare($sql);
|
||||||
|
|
||||||
$stmt->execute(array(
|
$stmt->execute(array(
|
||||||
':record_id' => $this->record_id,
|
':record_id' => $this->record_id,
|
||||||
':name' => $name,
|
':name' => $name,
|
||||||
':baseurl' => $base_url,
|
':baseurl' => $base_url,
|
||||||
':filename' => $system_file->getFilename(),
|
':filename' => $system_file->getFilename(),
|
||||||
':width' => $image_size[system_file::TC_DATAS_WIDTH],
|
':width' => $image_size[system_file::TC_DATAS_WIDTH],
|
||||||
':height' => $image_size[system_file::TC_DATAS_HEIGHT],
|
':height' => $image_size[system_file::TC_DATAS_HEIGHT],
|
||||||
':mime' => $system_file->get_mime(),
|
':mime' => $system_file->get_mime(),
|
||||||
':path' => $system_file->getPath(),
|
':path' => $system_file->getPath(),
|
||||||
':filesize' => $system_file->getSize()
|
':filesize' => $system_file->getSize()
|
||||||
));
|
));
|
||||||
|
|
||||||
$sql = 'UPDATE record SET moddate=NOW() WHERE record_id=:record_id';
|
$sql = 'UPDATE record SET moddate=NOW() WHERE record_id=:record_id';
|
||||||
$stmt = $connbas->prepare($sql);
|
$stmt = $connbas->prepare($sql);
|
||||||
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
@@ -1225,7 +1225,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
$type = $name == 'document' ? 'HD' : $name;
|
$type = $name == 'document' ? 'HD' : $name;
|
||||||
|
|
||||||
$session->get_logger($this->get_databox())
|
$session->get_logger($this->get_databox())
|
||||||
->log($this, Session_Logger::EVENT_SUBSTITUTE, $type, '');
|
->log($this, Session_Logger::EVENT_SUBSTITUTE, $type, '');
|
||||||
}
|
}
|
||||||
catch (Exception $e)
|
catch (Exception $e)
|
||||||
{
|
{
|
||||||
@@ -1243,13 +1243,13 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
protected function set_xml(DOMDocument $dom_doc)
|
protected function set_xml(DOMDocument $dom_doc)
|
||||||
{
|
{
|
||||||
$connbas = $this->get_databox()->get_connection();
|
$connbas = $this->get_databox()->get_connection();
|
||||||
$sql = 'UPDATE record SET xml = :xml WHERE record_id= :record_id';
|
$sql = 'UPDATE record SET xml = :xml WHERE record_id= :record_id';
|
||||||
$stmt = $connbas->prepare($sql);
|
$stmt = $connbas->prepare($sql);
|
||||||
$stmt->execute(
|
$stmt->execute(
|
||||||
array(
|
array(
|
||||||
':xml' => $dom_doc->saveXML(),
|
':xml' => $dom_doc->saveXML(),
|
||||||
':record_id' => $this->record_id
|
':record_id' => $this->record_id
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->reindex();
|
$this->reindex();
|
||||||
@@ -1284,6 +1284,23 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
|
|
||||||
$caption_field = new caption_field($databox_field, $this);
|
$caption_field = new caption_field($databox_field, $this);
|
||||||
|
|
||||||
|
$vocab = $vocab_id = null;
|
||||||
|
|
||||||
|
if ($params['vocabularyId'] && $databox_field->getVocabularyControl())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$vocab = $databox_field->getVocabularyControl();
|
||||||
|
$vocab_id = $params['vocabularyId'];
|
||||||
|
$vocab->validate($vocab_id);
|
||||||
|
}
|
||||||
|
catch (\Exception $e)
|
||||||
|
{
|
||||||
|
$vocab = $vocab_id = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (trim($params['meta_id']) !== '')
|
if (trim($params['meta_id']) !== '')
|
||||||
{
|
{
|
||||||
$tmp_val = trim($params['value']);
|
$tmp_val = trim($params['value']);
|
||||||
@@ -1298,11 +1315,15 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$caption_field_value->set_value($params['value']);
|
$caption_field_value->set_value($params['value']);
|
||||||
|
if($vocab && $vocab_id)
|
||||||
|
{
|
||||||
|
$caption_field_value->setVocab($vocab, $vocab_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$caption_field_value = caption_Field_Value::create($databox_field, $this, $params['value']);
|
$caption_field_value = caption_Field_Value::create($databox_field, $this, $params['value'], $vocab, $vocab_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->caption_record = null;
|
$this->caption_record = null;
|
||||||
@@ -1348,9 +1369,9 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
public function reindex()
|
public function reindex()
|
||||||
{
|
{
|
||||||
$connbas = connection::getPDOConnection($this->get_sbas_id());
|
$connbas = connection::getPDOConnection($this->get_sbas_id());
|
||||||
$sql = 'UPDATE record SET status=(status & ~7 | 4)
|
$sql = 'UPDATE record SET status=(status & ~7 | 4)
|
||||||
WHERE record_id= :record_id';
|
WHERE record_id= :record_id';
|
||||||
$stmt = $connbas->prepare($sql);
|
$stmt = $connbas->prepare($sql);
|
||||||
$stmt->execute(array(':record_id' => $this->record_id));
|
$stmt->execute(array(':record_id' => $this->record_id));
|
||||||
$this->delete_data_from_cache(self::CACHE_STATUS);
|
$this->delete_data_from_cache(self::CACHE_STATUS);
|
||||||
|
|
||||||
@@ -1364,8 +1385,8 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
public function rebuild_subdefs()
|
public function rebuild_subdefs()
|
||||||
{
|
{
|
||||||
$connbas = connection::getPDOConnection($this->get_sbas_id());
|
$connbas = connection::getPDOConnection($this->get_sbas_id());
|
||||||
$sql = 'UPDATE record SET jeton=(jeton | ' . JETON_MAKE_SUBDEF . ') WHERE record_id = :record_id';
|
$sql = 'UPDATE record SET jeton=(jeton | ' . JETON_MAKE_SUBDEF . ') WHERE record_id = :record_id';
|
||||||
$stmt = $connbas->prepare($sql);
|
$stmt = $connbas->prepare($sql);
|
||||||
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
@@ -1378,10 +1399,10 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
public function write_metas()
|
public function write_metas()
|
||||||
{
|
{
|
||||||
$connbas = connection::getPDOConnection($this->get_sbas_id());
|
$connbas = connection::getPDOConnection($this->get_sbas_id());
|
||||||
$sql = 'UPDATE record
|
$sql = 'UPDATE record
|
||||||
SET jeton = ' . (JETON_WRITE_META_DOC | JETON_WRITE_META_SUBDEF) . '
|
SET jeton = ' . (JETON_WRITE_META_DOC | JETON_WRITE_META_SUBDEF) . '
|
||||||
WHERE record_id= :record_id';
|
WHERE record_id= :record_id';
|
||||||
$stmt = $connbas->prepare($sql);
|
$stmt = $connbas->prepare($sql);
|
||||||
$stmt->execute(array(':record_id' => $this->record_id));
|
$stmt->execute(array(':record_id' => $this->record_id));
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
@@ -1397,21 +1418,21 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
$connbas = connection::getPDOConnection($this->get_sbas_id());
|
$connbas = connection::getPDOConnection($this->get_sbas_id());
|
||||||
|
|
||||||
$registry = registry::get_instance();
|
$registry = registry::get_instance();
|
||||||
$sql = 'UPDATE record SET status = 0b' . $status . '
|
$sql = 'UPDATE record SET status = 0b' . $status . '
|
||||||
WHERE record_id= :record_id';
|
WHERE record_id= :record_id';
|
||||||
$stmt = $connbas->prepare($sql);
|
$stmt = $connbas->prepare($sql);
|
||||||
$stmt->execute(array(':record_id' => $this->record_id));
|
$stmt->execute(array(':record_id' => $this->record_id));
|
||||||
|
|
||||||
$sql = 'REPLACE INTO status (id, record_id, name, value) VALUES (null, :record_id, :name, :value)';
|
$sql = 'REPLACE INTO status (id, record_id, name, value) VALUES (null, :record_id, :name, :value)';
|
||||||
$stmt = $connbas->prepare($sql);
|
$stmt = $connbas->prepare($sql);
|
||||||
|
|
||||||
$status = strrev($status);
|
$status = strrev($status);
|
||||||
for ($i = 4; $i < strlen($status); $i++)
|
for ($i = 4; $i < strlen($status); $i++)
|
||||||
{
|
{
|
||||||
$stmt->execute(array(
|
$stmt->execute(array(
|
||||||
':record_id' => $this->get_record_id(),
|
':record_id' => $this->get_record_id(),
|
||||||
':name' => $i,
|
':name' => $i,
|
||||||
':value' => $status[$i]
|
':value' => $status[$i]
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
@@ -1421,10 +1442,10 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
$sphinx = sphinxrt::get_instance($registry);
|
$sphinx = sphinxrt::get_instance($registry);
|
||||||
|
|
||||||
$sbas_params = phrasea::sbas_params();
|
$sbas_params = phrasea::sbas_params();
|
||||||
$sbas_id = $this->get_sbas_id();
|
$sbas_id = $this->get_sbas_id();
|
||||||
if (isset($sbas_params[$sbas_id]))
|
if (isset($sbas_params[$sbas_id]))
|
||||||
{
|
{
|
||||||
$params = $sbas_params[$sbas_id];
|
$params = $sbas_params[$sbas_id];
|
||||||
$sbas_crc = crc32(str_replace(array('.', '%'), '_', sprintf('%s_%s_%s_%s', $params['host'], $params['port'], $params['user'], $params['dbname'])));
|
$sbas_crc = crc32(str_replace(array('.', '%'), '_', sprintf('%s_%s_%s_%s', $params['host'], $params['port'], $params['user'], $params['dbname'])));
|
||||||
$sphinx->update_status(array("metadatas" . $sbas_crc, "metadatas" . $sbas_crc . "_stemmed_en", "metadatas" . $sbas_crc . "_stemmed_fr", "documents" . $sbas_crc), $this->get_sbas_id(), $this->get_record_id(), strrev($status));
|
$sphinx->update_status(array("metadatas" . $sbas_crc, "metadatas" . $sbas_crc . "_stemmed_en", "metadatas" . $sbas_crc . "_stemmed_fr", "documents" . $sbas_crc), $this->get_sbas_id(), $this->get_record_id(), strrev($status));
|
||||||
}
|
}
|
||||||
@@ -1467,9 +1488,9 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$regname = '';
|
$regname = '';
|
||||||
if ($sxe = simplexml_load_string($this->get_xml()))
|
if ($sxe = simplexml_load_string($this->get_xml()))
|
||||||
$regname = (string) $sxe->description->$balisename;
|
$regname = (string) $sxe->description->$balisename;
|
||||||
|
|
||||||
return $regname;
|
return $regname;
|
||||||
}
|
}
|
||||||
@@ -1488,7 +1509,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
|
|
||||||
if ($is_grouping)
|
if ($is_grouping)
|
||||||
{
|
{
|
||||||
$uuid = uuid::generate_v4();
|
$uuid = uuid::generate_v4();
|
||||||
$sha256 = null;
|
$sha256 = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1496,7 +1517,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
$uuid = $system_file->read_uuid();
|
$uuid = $system_file->read_uuid();
|
||||||
if (!uuid::is_valid($uuid))
|
if (!uuid::is_valid($uuid))
|
||||||
{
|
{
|
||||||
$uuid = uuid::generate_v4();
|
$uuid = uuid::generate_v4();
|
||||||
}
|
}
|
||||||
$sha256 = $system_file->get_sha256();
|
$sha256 = $system_file->get_sha256();
|
||||||
}
|
}
|
||||||
@@ -1520,32 +1541,32 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
|
|
||||||
$stmt = $connbas->prepare($sql);
|
$stmt = $connbas->prepare($sql);
|
||||||
$stmt->execute(array(
|
$stmt->execute(array(
|
||||||
':coll_id' => $coll_id
|
':coll_id' => $coll_id
|
||||||
, ':parent_record_id' => ($is_grouping ? 1 : 0)
|
, ':parent_record_id' => ($is_grouping ? 1 : 0)
|
||||||
, ':type' => $type
|
, ':type' => $type
|
||||||
, ':sha256' => $sha256
|
, ':sha256' => $sha256
|
||||||
, ':uuid' => $uuid
|
, ':uuid' => $uuid
|
||||||
, ':originalname' => $original_name
|
, ':originalname' => $original_name
|
||||||
, ':mime' => $system_file->get_mime()
|
, ':mime' => $system_file->get_mime()
|
||||||
));
|
));
|
||||||
|
|
||||||
$record_id = $connbas->lastInsertId();
|
$record_id = $connbas->lastInsertId();
|
||||||
$record = new self($sbas_id, $record_id);
|
$record = new self($sbas_id, $record_id);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$appbox = appbox::get_instance();
|
$appbox = appbox::get_instance();
|
||||||
$session = $appbox->get_session();
|
$session = $appbox->get_session();
|
||||||
$log_id = $session->get_logger($databox)->get_id();
|
$log_id = $session->get_logger($databox)->get_id();
|
||||||
|
|
||||||
$sql = 'INSERT INTO log_docs (id, log_id, date, record_id, action, final, comment)
|
$sql = 'INSERT INTO log_docs (id, log_id, date, record_id, action, final, comment)
|
||||||
VALUES (null, :log_id, now(),
|
VALUES (null, :log_id, now(),
|
||||||
:record_id, "add", :coll_id,"")';
|
:record_id, "add", :coll_id,"")';
|
||||||
$stmt = $connbas->prepare($sql);
|
$stmt = $connbas->prepare($sql);
|
||||||
$stmt->execute(array(
|
$stmt->execute(array(
|
||||||
':log_id' => $log_id,
|
':log_id' => $log_id,
|
||||||
':record_id' => $record_id,
|
':record_id' => $record_id,
|
||||||
':coll_id' => $coll_id
|
':coll_id' => $coll_id
|
||||||
));
|
));
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
}
|
}
|
||||||
@@ -1574,7 +1595,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
|
|
||||||
$tc_datas = $system_file->get_technical_datas();
|
$tc_datas = $system_file->get_technical_datas();
|
||||||
|
|
||||||
$sql = 'REPLACE INTO technical_datas (id, record_id, name, value)
|
$sql = 'REPLACE INTO technical_datas (id, record_id, name, value)
|
||||||
VALUES (null, :record_id, :name, :value)';
|
VALUES (null, :record_id, :name, :value)';
|
||||||
$stmt = $connbas->prepare($sql);
|
$stmt = $connbas->prepare($sql);
|
||||||
|
|
||||||
@@ -1584,9 +1605,9 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
$stmt->execute(array(
|
$stmt->execute(array(
|
||||||
':record_id' => $record_id
|
':record_id' => $record_id
|
||||||
, ':name' => $name
|
, ':name' => $name
|
||||||
, ':value' => $value
|
, ':value' => $value
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
@@ -1620,14 +1641,14 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
|
|
||||||
$stmt = $conn->prepare($sql);
|
$stmt = $conn->prepare($sql);
|
||||||
$stmt->execute($params);
|
$stmt->execute($params);
|
||||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
$records = array();
|
$records = array();
|
||||||
|
|
||||||
foreach ($rs as $row)
|
foreach ($rs as $row)
|
||||||
{
|
{
|
||||||
$k = count($records);
|
$k = count($records);
|
||||||
$records[$k] = new record_adapter($sbas_id, $row['record_id']);
|
$records[$k] = new record_adapter($sbas_id, $row['record_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1652,11 +1673,11 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
*/
|
*/
|
||||||
public function delete()
|
public function delete()
|
||||||
{
|
{
|
||||||
$connbas = $this->get_databox()->get_connection();
|
$connbas = $this->get_databox()->get_connection();
|
||||||
$sbas_id = $this->get_databox()->get_sbas_id();
|
$sbas_id = $this->get_databox()->get_sbas_id();
|
||||||
$appbox = appbox::get_instance();
|
$appbox = appbox::get_instance();
|
||||||
$registry = $appbox->get_registry();
|
$registry = $appbox->get_registry();
|
||||||
$conn = $appbox->get_connection();
|
$conn = $appbox->get_connection();
|
||||||
|
|
||||||
$ftodel = array();
|
$ftodel = array();
|
||||||
foreach ($this->get_subdefs() as $subdef)
|
foreach ($this->get_subdefs() as $subdef)
|
||||||
@@ -1664,30 +1685,30 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
if (!$subdef->is_physically_present())
|
if (!$subdef->is_physically_present())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$ftodel[] = $subdef->get_pathfile();
|
$ftodel[] = $subdef->get_pathfile();
|
||||||
$watermark = $subdef->get_path() . 'watermark_' . $subdef->get_file();
|
$watermark = $subdef->get_path() . 'watermark_' . $subdef->get_file();
|
||||||
if (file_exists($watermark))
|
if (file_exists($watermark))
|
||||||
$ftodel[] = $watermark;
|
$ftodel[] = $watermark;
|
||||||
$stamp = $subdef->get_path() . 'stamp_' . $subdef->get_file();
|
$stamp = $subdef->get_path() . 'stamp_' . $subdef->get_file();
|
||||||
if (file_exists($stamp))
|
if (file_exists($stamp))
|
||||||
$ftodel[] = $stamp;
|
$ftodel[] = $stamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
$origcoll = phrasea::collFromBas($this->get_base_id());
|
$origcoll = phrasea::collFromBas($this->get_base_id());
|
||||||
|
|
||||||
$appbox->get_session()->get_logger($this->get_databox())
|
$appbox->get_session()->get_logger($this->get_databox())
|
||||||
->log($this, Session_Logger::EVENT_DELETE, $origcoll, $this->get_xml());
|
->log($this, Session_Logger::EVENT_DELETE, $origcoll, $this->get_xml());
|
||||||
|
|
||||||
$sql = "DELETE FROM record WHERE record_id = :record_id";
|
$sql = "DELETE FROM record WHERE record_id = :record_id";
|
||||||
$stmt = $connbas->prepare($sql);
|
$stmt = $connbas->prepare($sql);
|
||||||
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
|
||||||
$sql = 'SELECT id FROM metadatas WHERE record_id = :record_id';
|
$sql = 'SELECT id FROM metadatas WHERE record_id = :record_id';
|
||||||
$stmt = $connbas->prepare($sql);
|
$stmt = $connbas->prepare($sql);
|
||||||
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
||||||
$rs = $stmt->fetchAll();
|
$rs = $stmt->fetchAll();
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -1698,7 +1719,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
|
|
||||||
if (isset($sbas_params[$sbas_id]))
|
if (isset($sbas_params[$sbas_id]))
|
||||||
{
|
{
|
||||||
$params = $sbas_params[$sbas_id];
|
$params = $sbas_params[$sbas_id];
|
||||||
$sbas_crc = crc32(str_replace(array('.', '%'), '_', sprintf('%s_%s_%s_%s', $params['host'], $params['port'], $params['user'], $params['dbname'])));
|
$sbas_crc = crc32(str_replace(array('.', '%'), '_', sprintf('%s_%s_%s_%s', $params['host'], $params['port'], $params['user'], $params['dbname'])));
|
||||||
foreach ($rs as $row)
|
foreach ($rs as $row)
|
||||||
{
|
{
|
||||||
@@ -1712,49 +1733,49 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
unset($e);
|
unset($e);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "DELETE FROM metadatas WHERE record_id = :record_id";
|
$sql = "DELETE FROM metadatas WHERE record_id = :record_id";
|
||||||
$stmt = $connbas->prepare($sql);
|
$stmt = $connbas->prepare($sql);
|
||||||
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
$sql = "DELETE FROM prop WHERE record_id = :record_id";
|
$sql = "DELETE FROM prop WHERE record_id = :record_id";
|
||||||
$stmt = $connbas->prepare($sql);
|
$stmt = $connbas->prepare($sql);
|
||||||
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
$sql = "DELETE FROM idx WHERE record_id = :record_id";
|
$sql = "DELETE FROM idx WHERE record_id = :record_id";
|
||||||
$stmt = $connbas->prepare($sql);
|
$stmt = $connbas->prepare($sql);
|
||||||
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
$sql = "DELETE FROM permalinks
|
$sql = "DELETE FROM permalinks
|
||||||
WHERE subdef_id
|
WHERE subdef_id
|
||||||
IN (SELECT subdef_id FROM subdef WHERE record_id=:record_id)";
|
IN (SELECT subdef_id FROM subdef WHERE record_id=:record_id)";
|
||||||
$stmt = $connbas->prepare($sql);
|
$stmt = $connbas->prepare($sql);
|
||||||
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
$sql = "DELETE FROM subdef WHERE record_id = :record_id";
|
$sql = "DELETE FROM subdef WHERE record_id = :record_id";
|
||||||
$stmt = $connbas->prepare($sql);
|
$stmt = $connbas->prepare($sql);
|
||||||
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
$sql = "DELETE FROM technical_datas WHERE record_id = :record_id";
|
$sql = "DELETE FROM technical_datas WHERE record_id = :record_id";
|
||||||
$stmt = $connbas->prepare($sql);
|
$stmt = $connbas->prepare($sql);
|
||||||
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
$sql = "DELETE FROM thit WHERE record_id = :record_id";
|
$sql = "DELETE FROM thit WHERE record_id = :record_id";
|
||||||
$stmt = $connbas->prepare($sql);
|
$stmt = $connbas->prepare($sql);
|
||||||
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
$sql = "DELETE FROM regroup WHERE rid_parent = :record_id";
|
$sql = "DELETE FROM regroup WHERE rid_parent = :record_id";
|
||||||
$stmt = $connbas->prepare($sql);
|
$stmt = $connbas->prepare($sql);
|
||||||
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
$sql = "DELETE FROM regroup WHERE rid_child = :record_id";
|
$sql = "DELETE FROM regroup WHERE rid_child = :record_id";
|
||||||
$stmt = $connbas->prepare($sql);
|
$stmt = $connbas->prepare($sql);
|
||||||
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
@@ -1814,7 +1835,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
echo 'Aucune sous definition a faire pour ' . $this->get_type() . "\n";
|
echo 'Aucune sous definition a faire pour ' . $this->get_type() . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$subdef_class = 'databox_subdef' . ucfirst($this->get_type());
|
$subdef_class = 'databox_subdef' . ucfirst($this->get_type());
|
||||||
$record_subdefs = $this->get_subdefs();
|
$record_subdefs = $this->get_subdefs();
|
||||||
|
|
||||||
foreach ($subdefs as $subdef)
|
foreach ($subdefs as $subdef)
|
||||||
@@ -1876,7 +1897,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
*/
|
*/
|
||||||
protected function generate_subdef(databox_subdefInterface $subdef_class, $pathdest)
|
protected function generate_subdef(databox_subdefInterface $subdef_class, $pathdest)
|
||||||
{
|
{
|
||||||
$registry = registry::get_instance();
|
$registry = registry::get_instance();
|
||||||
$generated = $subdef_class->generate($this, $pathdest, $registry);
|
$generated = $subdef_class->generate($this, $pathdest, $registry);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
@@ -1928,12 +1949,12 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
(null, :log_id, now(), :rec, :referrer, :site)';
|
(null, :log_id, now(), :rec, :referrer, :site)';
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
':log_id' => $log_id
|
':log_id' => $log_id
|
||||||
, ':rec' => $this->get_record_id()
|
, ':rec' => $this->get_record_id()
|
||||||
, ':referrer' => $referrer
|
, ':referrer' => $referrer
|
||||||
, ':site' => $gv_sit
|
, ':site' => $gv_sit
|
||||||
);
|
);
|
||||||
$stmt = $connbas->prepare($sql);
|
$stmt = $connbas->prepare($sql);
|
||||||
$stmt->execute($params);
|
$stmt->execute($params);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
@@ -1974,7 +1995,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
public function get_container_baskets()
|
public function get_container_baskets()
|
||||||
{
|
{
|
||||||
$Core = bootstrap::getCore();
|
$Core = bootstrap::getCore();
|
||||||
$em = $Core->getEntityManager();
|
$em = $Core->getEntityManager();
|
||||||
|
|
||||||
$repo = $em->getRepository('\Entities\Basket');
|
$repo = $em->getRepository('\Entities\Basket');
|
||||||
|
|
||||||
@@ -1992,15 +2013,15 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
public static function get_records_by_originalname(databox $databox, $original_name, $offset_start = 0, $how_many = 10)
|
public static function get_records_by_originalname(databox $databox, $original_name, $offset_start = 0, $how_many = 10)
|
||||||
{
|
{
|
||||||
$offset_start = (int) ($offset_start < 0 ? 0 : $offset_start);
|
$offset_start = (int) ($offset_start < 0 ? 0 : $offset_start);
|
||||||
$how_many = (int) (($how_many > 20 || $how_many < 1) ? 10 : $how_many);
|
$how_many = (int) (($how_many > 20 || $how_many < 1) ? 10 : $how_many);
|
||||||
|
|
||||||
$sql = sprintf('SELECT record_id FROM record
|
$sql = sprintf('SELECT record_id FROM record
|
||||||
WHERE original_name = :original_name LIMIT %d, %d'
|
WHERE original_name = :original_name LIMIT %d, %d'
|
||||||
, $offset_start, $how_many);
|
, $offset_start, $how_many);
|
||||||
|
|
||||||
$stmt = $databox->get_connection()->prepare($sql);
|
$stmt = $databox->get_connection()->prepare($sql);
|
||||||
$stmt->execute(array(':original_name' => $original_name));
|
$stmt->execute(array(':original_name' => $original_name));
|
||||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
$records = array();
|
$records = array();
|
||||||
@@ -2037,18 +2058,18 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
ORDER BY g.ord ASC, dateadd ASC, record_id ASC';
|
ORDER BY g.ord ASC, dateadd ASC, record_id ASC';
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
':GV_site' => $appbox->get_registry()->get('GV_sit')
|
':GV_site' => $appbox->get_registry()->get('GV_sit')
|
||||||
, ':usr_id' => $appbox->get_session()->get_usr_id()
|
, ':usr_id' => $appbox->get_session()->get_usr_id()
|
||||||
, ':record_id' => $this->get_record_id()
|
, ':record_id' => $this->get_record_id()
|
||||||
);
|
);
|
||||||
|
|
||||||
$stmt = $this->get_databox()->get_connection()->prepare($sql);
|
$stmt = $this->get_databox()->get_connection()->prepare($sql);
|
||||||
$stmt->execute($params);
|
$stmt->execute($params);
|
||||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
$set = new set_selection();
|
$set = new set_selection();
|
||||||
$i = 1;
|
$i = 1;
|
||||||
foreach ($rs as $row)
|
foreach ($rs as $row)
|
||||||
{
|
{
|
||||||
$set->add_element(new record_adapter($this->get_sbas_id(), $row['record_id'], $i));
|
$set->add_element(new record_adapter($this->get_sbas_id(), $row['record_id'], $i));
|
||||||
@@ -2081,14 +2102,14 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
|
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
':GV_site' => $appbox->get_registry()->get('GV_sit')
|
':GV_site' => $appbox->get_registry()->get('GV_sit')
|
||||||
, ':usr_id' => $appbox->get_session()->get_usr_id()
|
, ':usr_id' => $appbox->get_session()->get_usr_id()
|
||||||
, ':record_id' => $this->get_record_id()
|
, ':record_id' => $this->get_record_id()
|
||||||
);
|
);
|
||||||
|
|
||||||
$stmt = $this->get_databox()->get_connection()->prepare($sql);
|
$stmt = $this->get_databox()->get_connection()->prepare($sql);
|
||||||
$stmt->execute($params);
|
$stmt->execute($params);
|
||||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
$set = new set_selection();
|
$set = new set_selection();
|
||||||
@@ -2134,9 +2155,9 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
VALUES (null, :parent_record_id, :record_id, NOW(), :ord)';
|
VALUES (null, :parent_record_id, :record_id, NOW(), :ord)';
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
':parent_record_id' => $this->get_record_id()
|
':parent_record_id' => $this->get_record_id()
|
||||||
, ':record_id' => $record->get_record_id()
|
, ':record_id' => $record->get_record_id()
|
||||||
, ':ord' => $ord
|
, ':ord' => $ord
|
||||||
);
|
);
|
||||||
|
|
||||||
$stmt = $connbas->prepare($sql);
|
$stmt = $connbas->prepare($sql);
|
||||||
@@ -2144,7 +2165,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
|
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
$sql = 'UPDATE record SET moddate = NOW() WHERE record_id = :record_id';
|
$sql = 'UPDATE record SET moddate = NOW() WHERE record_id = :record_id';
|
||||||
$stmt = $connbas->prepare($sql);
|
$stmt = $connbas->prepare($sql);
|
||||||
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
@@ -2165,15 +2186,15 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
AND rid_child = :record_id";
|
AND rid_child = :record_id";
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
':parent_record_id' => $this->get_record_id()
|
':parent_record_id' => $this->get_record_id()
|
||||||
, ':record_id' => $record->get_record_id()
|
, ':record_id' => $record->get_record_id()
|
||||||
);
|
);
|
||||||
|
|
||||||
$stmt = $connbas->prepare($sql);
|
$stmt = $connbas->prepare($sql);
|
||||||
$stmt->execute($params);
|
$stmt->execute($params);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
$sql = 'UPDATE record SET moddate = NOW() WHERE record_id = :record_id';
|
$sql = 'UPDATE record SET moddate = NOW() WHERE record_id = :record_id';
|
||||||
$stmt = $connbas->prepare($sql);
|
$stmt = $connbas->prepare($sql);
|
||||||
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
$stmt->execute(array(':record_id' => $this->get_record_id()));
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
Reference in New Issue
Block a user