Issue #13; Dans l'exportation des données, les fichiers 'contacts.csv' et 'dict.csv' sont mis en commun Pour DOWNLOAD/FACEBOOK aussi

This commit is contained in:
xdrm-brackets 2016-05-20 19:14:30 +02:00
parent 6630c85ea5
commit f5a75bb588
7 changed files with 45 additions and 4 deletions

View File

@ -257,6 +257,7 @@
$db = new lightdb('facebook_db', __ROOT__.'/src/dynamic/');
$contacts = '';
/* [1] On construit les fichiers de chaque sujet
=========================================================*/
foreach($subjects as $s=>$subjectId){
@ -270,24 +271,29 @@
/* (2) On construit le CSV */
$output[$s] = array(
'contacts' => self::parseCSV($subjectData['contacts'], $dict['contacts']),
'relations' => self::parseCSV($subjectData['relations'], array())
);
/* (3) On ajoute les contacts à la liste */
$contacts .= self::parseCSV($subjectData['contacts'], $dict['contacts'], strlen($contacts) == 0 ); // On affiche les colonnes pour la première fois uniquement
}
// On ferme l'instance de la base de données
$db->close();
$ouptut['all'] = array(
$output['all'] = array(
'contacts' => '',
'dict' => ''
);
// Pour le nom du répertoire
$subjects['all'] = 'all';
/* [2] On assemble tous les contacts
=========================================================*/
$output['all']['contacts'] = $contacts;
/* [3] On ajoute le dictionnaire
=========================================================*/

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,9 @@
<?php
header("Content-Type: application/zip; charset=utf-8");
header("Content-Disposition: attachment; filename=facebook_data.zip");
header("Pragma: no-cache");
header("Expires: 0");
readfile('/var/www/socioview/tmp/content_573f459f9cbbf.php');
unlink('/var/www/socioview/tmp/content_573f459f9cbbf.php');
unlink(__FILE__);
?>

View File

@ -0,0 +1,9 @@
<?php
header("Content-Type: application/zip; charset=utf-8");
header("Content-Disposition: attachment; filename=facebook_data.zip");
header("Pragma: no-cache");
header("Expires: 0");
readfile('/var/www/socioview/tmp/content_573f45b0713e5.php');
unlink('/var/www/socioview/tmp/content_573f45b0713e5.php');
unlink(__FILE__);
?>

3
view/js/data-min.js vendored
View File

@ -1,2 +1,3 @@
var subjectList=$("#subject-list"),subjectAdd=$("#add-subject"),exportDeflater=new FormDeflater(document.getElementById("export-form"),["input"],["data-name"]);subjectAdd.addEventListener("click",function(a){a=document.createElement("input");a.type="number";a.dataset.name="subjects";a.placeholder="Sujet";a.style="width: 5em; display: block;";subjectList.appendChild(a)},!1);
$("#export-form #export-all").addEventListener("click",function(a){a=(new FormDeflater(subjectList,["input"],["data-name"])).deflate().subjects;for(var c=[],b=0;b<a.length;b++)0<a[b].length&&!isNaN(a[b])&&c.push(a[b]);"1"==exportDeflater.deflate().phone&&api.send({path:"download/phone",subjects:c},function(a){if(0!=a.ModuleError)return!1;document.location=a.link;Notification.success("OK","Lancement du t\u00e9l\u00e9chargement..")})},!1);
$("#export-form #export-all").addEventListener("click",function(a){var b=(new FormDeflater(subjectList,["input"],["data-name"])).deflate().subjects;a=[];for(var c=0;c<b.length;c++)0<b[c].length&&!isNaN(b[c])&&a.push(b[c]);b=exportDeflater.deflate();"1"==b.phone&&api.send({path:"download/phone",subjects:a},function(a){if(0!=a.ModuleError)return!1;document.location=a.link;Notification.success("OK","Lancement du t\u00e9l\u00e9chargement..")});"1"==b.facebook&&api.send({path:"download/facebook",subjects:a},
function(a){if(0!=a.ModuleError)return!1;document.location=a.link;Notification.success("OK","Lancement du t\u00e9l\u00e9chargement..")})},!1);

View File

@ -60,7 +60,23 @@ $('#export-form #export-all').addEventListener('click', function(e){
Notification.success('OK', 'Lancement du téléchargement..');
});
}
// {5} Si téléchargement de données Facebook //
if( deflated.facebook == '1' ){
api.send({ 'path': 'download/facebook', 'subjects': subjects }, function(res){
// Si erreur
if( res.ModuleError != 0 )
return false;
// Sinon on lance le téléchargement
document.location = res.link;
Notification.success('OK', 'Lancement du téléchargement..');
});
}