Verified Commit 0a4c1bec authored by Cyril Vazquez's avatar Cyril Vazquez
Browse files

Move presentation logic for metadata edit from Maarch RM to ext AP

parent 676cb836
......@@ -113,6 +113,13 @@ descriptionSchemes = "{
'uri' : 'seda2/Content',
'controller' : '',
'presenter' : ''
},
'seda' : {
'label' : 'SEDA 1',
'type' : 'php',
'uri' : 'seda/ContentDescription',
'controller' : '',
'presenter' : ''
}
}"
......
......@@ -520,8 +520,22 @@ class content
*
* @return string
*/
public function getEditMetadata($archive, $languageCodes)
public function edit($archive)
{
$this->view->addContentFile("archivesPubliques/contentDescription/metadata.html");
$languageCodes = \laabs::callService("seda/archiveTransferComposition/readLanguageCodes");
foreach ($languageCodes as $languageCode) {
$languageCode->title = ucfirst($languageCode->French);
if ($languageCode->alpha3t) {
$languageCode->value = $languageCode->alpha3t;
} else {
$languageCode->value = $languageCode->alpha3b;
}
}
foreach ($archive->descriptionObject as $descriptionObject) {
$descriptionObject->json = json_encode($descriptionObject);
}
......@@ -549,11 +563,51 @@ class content
if (isset($archive->descriptionObject[0]->keyword)) {
foreach ($archive->descriptionObject[0]->keyword as $keyword) {
$keyword->typeText = $this->view->translator->getText($keyword->type, false, "archivesPubliques/messages");
$keyword->typeText = $this->view->translator->getText($keyword->type, false, "archivesPubliques/messages");
$keyword->json = json_encode($keyword);
}
}
return $archive;
if ($archive->descriptionObject) {
$archive->descriptionObject = $archive->descriptionObject[0];
}
$thesaurusNames = [
"corpname",
"famname",
"geogname",
"name",
"occupation",
"persname",
"subject",
"genreform",
"function"
];
$thesaurusList = new \stdClass();
// Set default thesaurus
$thesaurusList->subject = "T1";
$thesaurusList->genreform = "T3";
$thesaurusList->function = "T2";
$conf = \laabs::Configuration()['recordsManagement'];
if (isset($conf['refDirectory']) || is_dir($conf['refDirectory'])) {
$refDirectory = $conf['refDirectory'];
foreach ($thesaurusNames as $thesaurusName) {
if (glob($conf['refDirectory'].'/'.$thesaurusName.'.*')) {
$thesaurusList->$thesaurusName = $thesaurusName;
}
}
}
$this->view->setSource('thesaurus', $thesaurusList);
$this->view->setSource('languageCodes', $languageCodes);
$this->view->setSource("archive", $archive);
$this->view->merge();
$this->view->translate();
return $this->view->saveHtml();
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment