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:
parent
6630c85ea5
commit
f5a75bb588
|
@ -257,6 +257,7 @@
|
||||||
$db = new lightdb('facebook_db', __ROOT__.'/src/dynamic/');
|
$db = new lightdb('facebook_db', __ROOT__.'/src/dynamic/');
|
||||||
|
|
||||||
|
|
||||||
|
$contacts = '';
|
||||||
/* [1] On construit les fichiers de chaque sujet
|
/* [1] On construit les fichiers de chaque sujet
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
foreach($subjects as $s=>$subjectId){
|
foreach($subjects as $s=>$subjectId){
|
||||||
|
@ -270,24 +271,29 @@
|
||||||
|
|
||||||
/* (2) On construit le CSV */
|
/* (2) On construit le CSV */
|
||||||
$output[$s] = array(
|
$output[$s] = array(
|
||||||
'contacts' => self::parseCSV($subjectData['contacts'], $dict['contacts']),
|
|
||||||
'relations' => self::parseCSV($subjectData['relations'], array())
|
'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
|
// On ferme l'instance de la base de données
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
|
|
||||||
$ouptut['all'] = array(
|
$output['all'] = array(
|
||||||
'contacts' => '',
|
'contacts' => '',
|
||||||
'dict' => ''
|
'dict' => ''
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Pour le nom du répertoire
|
||||||
|
$subjects['all'] = 'all';
|
||||||
|
|
||||||
/* [2] On assemble tous les contacts
|
/* [2] On assemble tous les contacts
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
|
$output['all']['contacts'] = $contacts;
|
||||||
|
|
||||||
/* [3] On ajoute le dictionnaire
|
/* [3] On ajoute le dictionnaire
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -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__);
|
||||||
|
?>
|
|
@ -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__);
|
||||||
|
?>
|
|
@ -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);
|
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);
|
||||||
|
|
|
@ -60,7 +60,23 @@ $('#export-form #export-all').addEventListener('click', function(e){
|
||||||
Notification.success('OK', 'Lancement du téléchargement..');
|
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..');
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue