46 lines
1.1 KiB
PHP
46 lines
1.1 KiB
PHP
<?php
|
|
if (!defined('_ECRIRE_INC_VERSION')){
|
|
return;
|
|
}
|
|
|
|
|
|
/**
|
|
* fonction de recuperation et liaison image / objet
|
|
*
|
|
* @param $id_objet
|
|
* @param $mode
|
|
* @return array tableau des id_document $Tid_doc
|
|
*/
|
|
function inc_bigform_dist($id_objet,$objet = 'article',$mode='auto') {
|
|
include_spip('inc/joindre_document');
|
|
set_request('joindre_upload','ok');
|
|
|
|
$files = joindre_trouver_fichier_envoye();
|
|
|
|
$html_titre = _request('html_titre');
|
|
$html_ordre = _request('html_ordre');
|
|
|
|
// calcul ordre des titres des files uploades
|
|
$lesTitres = [];
|
|
foreach ($files as $i => $t) {
|
|
$index = array_search($t['name'], $html_ordre);
|
|
$lesTitres[] = $html_titre[$index];
|
|
}
|
|
|
|
$Tid_doc = [];
|
|
if (is_array($files) and count($files)) {
|
|
$ajouter_document = charger_fonction('ajouter_documents', 'action');
|
|
$Tid_doc = $ajouter_document('new', $files, $objet, $id_objet,$mode);
|
|
}
|
|
|
|
if (!empty($html_titre) and count($Tid_doc)) {
|
|
foreach ($Tid_doc as $i => $id_doc) {
|
|
$titre = $lesTitres[$i];
|
|
if ($titre) {
|
|
sql_updateq('spip_documents', array("titre" => $titre), 'id_document='.intval($id_doc));
|
|
}
|
|
}
|
|
}
|
|
|
|
return $Tid_doc;
|
|
}
|