Merged duplication-prevent into dev
This commit is contained in:
commit
f875c9dc53
|
@ -60,7 +60,7 @@
|
|||
// On verifie le type pour chaque element
|
||||
foreach($value as $element)
|
||||
// Si erreur dans au moins 1 element, on retourne que c'est incorrect
|
||||
if( !self::run($elements_type, trim($element) ) )
|
||||
if( !self::run($elements_type, ($element) ) )
|
||||
return false;
|
||||
|
||||
// Si aucune erreur, on retourne que tout est bon
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
/* [0] On récupère l'id unique actuel
|
||||
=========================================================*/
|
||||
$funiq = fopen( __BUILD__.'/src/dynamic/uniqid', 'r+' );
|
||||
$funiq = fopen( __BUILD__.'/lightdb/storage/uniqid', 'r+' );
|
||||
flock($funiq, LOCK_EX); // On verrouille le fichier
|
||||
$uniqid = fgets( $funiq );
|
||||
|
||||
|
@ -40,100 +40,177 @@
|
|||
$subject_id = $subject['subject_id'];
|
||||
|
||||
// Contiendra la valeur de l'id maximum
|
||||
$maxId = 0;
|
||||
$maxId = $offset;
|
||||
|
||||
|
||||
|
||||
|
||||
/* [1] On récupère les logs s'ils existent
|
||||
=========================================================*/
|
||||
// Contiendra le contenu du fichier
|
||||
$file = [ 'logs' => [] ];
|
||||
// /* [1] On récupère les logs s'ils existent
|
||||
// =========================================================*/
|
||||
// // Contiendra le contenu du fichier
|
||||
$file = [
|
||||
"subject" => "",
|
||||
"contacts" => [],
|
||||
"relations" => []
|
||||
];
|
||||
// $file = [ 'logs' => [] ];
|
||||
//
|
||||
//
|
||||
// /* (1) On définit les 2 fichiers utiles */
|
||||
// $tmpfile = __BUILD__.'/tmp/phone_'.$subject['tmp_id'].'.json';
|
||||
//
|
||||
// /* (2) Si on a déja crée le fichier avec le journal d'appel dedans, on le récupère */
|
||||
// $storage_already = is_string($subject['tmp_id']) && strlen($subject['tmp_id']) == 40 && file_exists($tmpfile);
|
||||
//
|
||||
//
|
||||
// /* (3) Si on a déja crée le fichier, on essaie de récupérer son contenu */
|
||||
// if( $storage_already ){
|
||||
// $file = json_decode( file_get_contents($tmpfile), true );
|
||||
//
|
||||
// // erreur
|
||||
// if( $file == null )
|
||||
// return [ 'ModuleRequest' => ManagerError::ParsingFailed ];
|
||||
//
|
||||
// // On incrémente tous les ids de l'offset
|
||||
// foreach($file['logs'] as $i=>$log){
|
||||
// $file['logs'][$i]['id'] = $offset + $log['id'];
|
||||
//
|
||||
// if( $log['id'] > $maxId )
|
||||
// $maxId = (int) $log['id'];
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
/* (1) On définit les 2 fichiers utiles */
|
||||
$tmpfile = __BUILD__.'/tmp/phone_'.$subject['tmp_id'].'.json';
|
||||
|
||||
/* (2) Si on a déja crée le fichier avec le journal d'appel dedans, on le récupère */
|
||||
$storage_already = is_string($subject['tmp_id']) && strlen($subject['tmp_id']) == 40 && file_exists($tmpfile);
|
||||
|
||||
|
||||
/* (3) Si on a déja crée le fichier, on essaie de récupérer son contenu */
|
||||
if( $storage_already ){
|
||||
$file = json_decode( file_get_contents($tmpfile), true );
|
||||
|
||||
// erreur
|
||||
if( $file == null )
|
||||
return [ 'ModuleRequest' => ManagerError::ParsingFailed ];
|
||||
|
||||
// On incrémente tous les ids de l'offset
|
||||
foreach($file['logs'] as $i=>$log){
|
||||
$file['logs'][$i]['id'] = $offset + $log['id'];
|
||||
|
||||
if( $log['id'] > $maxId )
|
||||
$maxId = (int) $log['id'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* [2] On enregistre les données du sujet
|
||||
=========================================================*/
|
||||
/* (1) On crée le sujet */
|
||||
$file['subject'] = [ 'id' => $subject_id ];
|
||||
|
||||
/* (2) On récupère ses contacts facebook */
|
||||
// {2.1} On récupère les données du sujet //
|
||||
$lfacebook = new lightdb('facebook_db');
|
||||
$lfacebook = $lfacebook->fetch($subject_id);
|
||||
|
||||
/* [3] On enregistre les contacts des MINI
|
||||
=========================================================*/
|
||||
$file['contacts'] = [];
|
||||
$file['relations'] = [];
|
||||
// {2.2} si n'existe pas, on a un tableau vide //
|
||||
if( $lfacebook === false )
|
||||
$lfacebook = [ 'contacts' => [] ];
|
||||
|
||||
foreach($mini as $miniData){
|
||||
// On récupère les données du contact associé
|
||||
$contact = $contacts[ $miniData['uid'] ];
|
||||
if( !isset($lfacebook['contacts']) )
|
||||
$lfacebook['contacts'] = [];
|
||||
|
||||
if( $miniData['uid'] > $maxId )
|
||||
$maxId = (int) $miniData['uid'];
|
||||
|
||||
$newId = $offset + $miniData['uid'];
|
||||
/* (3) On récupère ses contacts lab-surveys */
|
||||
// {3.1} On récupère les données du sujet //
|
||||
$lsurvey = new lightdb('survey_db');
|
||||
$lsurvey = $lsurvey->fetch($subject_id);
|
||||
|
||||
// On remplit les données qui iront dans le fichier pour ce contact
|
||||
array_push($file['contacts'], [
|
||||
'id' => $newId,
|
||||
'name' => $contact['username'],
|
||||
'sexe' => $miniData['sexe'],
|
||||
'age' => $miniData['age'],
|
||||
'studies1' => $miniData['studies'],
|
||||
'reltype' => ($miniData['reltype']==10) ? $miniData['reltypeSpecial'] : $miniData['reltype'], // si 'autre' -> valeur, sinon le code
|
||||
'dist' => $miniData['loc']
|
||||
]);
|
||||
// {3.2} si n'existe pas, on a un tableau vide //
|
||||
if( $lsurvey === false )
|
||||
$lsurvey = [ 'contacts' => [] ];
|
||||
|
||||
// On enregistre la relation avec EGO
|
||||
array_push($file['relations'], [
|
||||
'idA' => $subject_id,
|
||||
'idB' => $newId,
|
||||
'type' => 2 // relation cellulaire mineure
|
||||
]);
|
||||
if( !isset($lsurvey['contacts']) )
|
||||
$lsurvey['contacts'] = [];
|
||||
|
||||
|
||||
/* (4) On récupère uniquement la liste des contacts avec le type de fiche qu'ils ont */
|
||||
// {4.1} Contiendra les contacts exportés //
|
||||
$exported = [
|
||||
'fiche' => [],
|
||||
'mini' => []
|
||||
];
|
||||
|
||||
// {4.2} Contiendra les username des contacts exportés //
|
||||
$exportedU = [];
|
||||
|
||||
// {4.3} On récupère les contacts facebook //
|
||||
foreach($lfacebook['contacts'] as $c=>$data){
|
||||
|
||||
if( isset($data['studies2']) ){
|
||||
|
||||
$exported['fiche'][] = $data['id'];
|
||||
$exportedU[$data['id']] = $data['name'];
|
||||
|
||||
}else
|
||||
|
||||
// S'il n'est pas déja dans les fiches
|
||||
if( !in_array($data['id'], $exported['fiche']) ){
|
||||
|
||||
$exported['mini'][] = $data['id'];
|
||||
$exportedU[$data['id']] = $data['name'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// {4.4} On récupère les contacts lab-surveys //
|
||||
foreach($lsurvey['contacts'] as $c=>$data){
|
||||
|
||||
/* [4] On enregistre les contacts des FICHES
|
||||
if( isset($data['studies2']) )
|
||||
|
||||
// On ajoute le contact s'il n'y est pas déja
|
||||
if( !in_array($data['id'], $exported['fiche']) ){
|
||||
|
||||
$exported['fiche'][] = $data['id'];
|
||||
$exportedU['fiche'][] = $data['username'];
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
// On ajoute le contact s'il n'y est pas déja (ni dans mini ni dans fiche)
|
||||
if( !in_array($data['id'], $exported['mini']) && !in_array($data['id'], $exported['fiche']) ){
|
||||
$exported['mini'][] = $data['id'];
|
||||
$exportedU['mini'][] = $data['username'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* [3] On enregistre les contacts des FICHES
|
||||
=========================================================*/
|
||||
$contactsDone = [
|
||||
"existing" => [], // Contacts exportés déja enregistrés
|
||||
"username" => [] // Nouveaux contacts déja enregistrés
|
||||
];
|
||||
|
||||
foreach($fiches as $f=>$ficheData){
|
||||
// On récupère les données du contact associé
|
||||
/* (1) On récupère les données du contact associé */
|
||||
if( !isset($contacts[$ficheData['uid']]) )
|
||||
break;
|
||||
|
||||
$contact = $contacts[ $ficheData['uid'] ];
|
||||
|
||||
if( $ficheData['uid'] > $maxId )
|
||||
$maxId = (int) $ficheData['uid'];
|
||||
/* (2) Si le contact a été importé d'une autre enquête */
|
||||
if( isset($contact['existing']) && is_numeric($contact['existing']) ){
|
||||
$newId = (int) $contact['existing'];
|
||||
$uname = $exportedU[intval($contact['existing'])];
|
||||
// {2.1} S'il a déja une fiche ou qu'on a déja fait une fiche, on quitte //
|
||||
if( in_array(intval($contact['existing']), $exported['fiche']) || in_array($contact['existing'], $contactsDone['existing']) )
|
||||
break;
|
||||
|
||||
$newId = $offset + $ficheData['uid'];
|
||||
/* (3) Si nouveau contact */
|
||||
}else{
|
||||
$newId = (int) ($offset+$ficheData['uid']);
|
||||
$uname = $contact['username'];
|
||||
// {3.1} S'il a déja été saisi, on quitte //
|
||||
if( in_array($contact['username'], $contactsDone['username']) )
|
||||
break;
|
||||
}
|
||||
|
||||
/* (4) Update du @maxId */
|
||||
if( $newId > $maxId )
|
||||
$maxId = (int) $newId;
|
||||
|
||||
// On remplit les données qui iront dans le fichier pour ce contact
|
||||
array_push($file['contacts'], [
|
||||
$file['contacts'][] = [
|
||||
'id' => $newId,
|
||||
'name' => $contact['username'],
|
||||
'name' => $uname,
|
||||
'sexe' => $ficheData['sexe'],
|
||||
'age' => $ficheData['age'],
|
||||
'studies2' => $ficheData['studies'],
|
||||
|
@ -150,18 +227,87 @@
|
|||
'freq' => $ficheData['freq'],
|
||||
'connect' => $ficheData['connect'],
|
||||
'connectExtra' => $ficheData['connectSpecial']
|
||||
]);
|
||||
];
|
||||
|
||||
// On enregistre la relation avec EGO
|
||||
array_push($file['relations'], [
|
||||
$file['relations'][] = [
|
||||
'idA' => $subject_id,
|
||||
'idB' => $newId,
|
||||
'type' => ($f<10) ? 4 : 5 // 4->appels 5->sms
|
||||
]);
|
||||
'type' => ($f<20) ? 4 : 5 // 4->appels 5->sms
|
||||
];
|
||||
|
||||
|
||||
/* (x) Si le contact a été importé d'une autre enquête */
|
||||
if( isset($contact['existing']) && is_numeric($contact['existing']) )
|
||||
$contactsDone['existing'][] = $contact['existing'];
|
||||
/* (x+1) Si nouveau contact */
|
||||
else
|
||||
$contactsDone['username'][] = $contact['username'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* [4] On enregistre les contacts des MINI
|
||||
=========================================================*/
|
||||
foreach($mini as $miniData){
|
||||
/* (1) On récupère les données du contact associé */
|
||||
if( !isset($contacts[$miniData['uid']]) )
|
||||
break;
|
||||
|
||||
$contact = $contacts[ $miniData['uid'] ];
|
||||
|
||||
/* (2) Si le contact a été importé d'une autre enquête */
|
||||
if( isset($contact['existing']) && is_numeric($contact['existing']) ){
|
||||
$newId = (int) $contact['existing'];
|
||||
$uname = $exportedU[intval($contact['existing'])];
|
||||
// {2.1} S'il a déja une fiche ou qu'on a déja fait une fiche (ou mini), on quitte //
|
||||
if( in_array(intval($contact['existing']), $exported['fiche']) || in_array($contact['existing'], $contactsDone['existing']) )
|
||||
break;
|
||||
|
||||
/* (3) Si nouveau contact */
|
||||
}else{
|
||||
$newId = (int) ($offset+$miniData['uid']);
|
||||
$uname = $contact['username'];
|
||||
// {3.1} S'il a déja été saisi, on quitte //
|
||||
if( in_array($contact['username'], $contactsDone['username']) )
|
||||
break;
|
||||
}
|
||||
|
||||
/* (4) Update du @maxId */
|
||||
if( $newId > $maxId )
|
||||
$maxId = (int) $newId;
|
||||
|
||||
|
||||
// On remplit les données qui iront dans le fichier pour ce contact
|
||||
$file['contacts'][] = [
|
||||
'id' => $newId,
|
||||
'name' => $uname,
|
||||
'sexe' => $miniData['sexe'],
|
||||
'age' => $miniData['age'],
|
||||
'studies1' => $miniData['studies'],
|
||||
'reltype' => ($miniData['reltype']==10) ? $miniData['reltypeSpecial'] : $miniData['reltype'], // si 'autre' -> valeur, sinon le code
|
||||
'dist' => $miniData['loc']
|
||||
];
|
||||
|
||||
// On enregistre la relation avec EGO
|
||||
$file['relations'][] = [
|
||||
'idA' => $subject_id,
|
||||
'idB' => $newId,
|
||||
'type' => 2 // relation cellulaire mineure
|
||||
];
|
||||
|
||||
|
||||
/* (x) Si le contact a été importé d'une autre enquête */
|
||||
if( isset($contact['existing']) && is_numeric($contact['existing']) )
|
||||
$contactsDone['existing'][] = $contact['existing'];
|
||||
/* (x+1) Si nouveau contact */
|
||||
else
|
||||
$contactsDone['username'][] = $contact['username'];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* [5] On enregistre les relations de la MATRICE
|
||||
=========================================================*/
|
||||
$clen = count($file['contacts']);
|
||||
|
@ -169,7 +315,8 @@
|
|||
/* (1) On récupére les ids des contacts */
|
||||
$cIdList = [];
|
||||
foreach($file['contacts'] as $c=>$contact){
|
||||
$id = $contact['id'] - $offset;
|
||||
$id = (int) $c;
|
||||
|
||||
if( !in_array($id, $cIdList) )
|
||||
$cIdList[$id] = null;
|
||||
}
|
||||
|
@ -209,14 +356,14 @@
|
|||
=========================================================*/
|
||||
// $maxId += $offset;
|
||||
rewind($funiq); // On revient au début du fichier
|
||||
fwrite($funiq, $offset+$maxId); // On écrit la nouvelle valeur (forcément plus grande)
|
||||
fwrite($funiq, $maxId); // On écrit la nouvelle valeur (forcément plus grande)
|
||||
flock($funiq, LOCK_UN); // On débloque le verrou
|
||||
fclose($funiq);
|
||||
|
||||
/* [8] On supprime le fichier temporaire si existe
|
||||
=========================================================*/
|
||||
if( file_exists($tmpfile) )
|
||||
unlink($tmpfile);
|
||||
// /* [8] On supprime le fichier temporaire si existe
|
||||
// =========================================================*/
|
||||
// if( file_exists($tmpfile) )
|
||||
// unlink($tmpfile);
|
||||
|
||||
|
||||
/* [9] Gestion du retour
|
||||
|
@ -281,7 +428,7 @@
|
|||
|
||||
/* [0] On récupère l'id unique actuel
|
||||
=========================================================*/
|
||||
$funiq = fopen( __BUILD__.'/src/dynamic/uniqid', 'r+' );
|
||||
$funiq = fopen( __BUILD__.'/lightdb/storage/uniqid', 'r+' );
|
||||
flock($funiq, LOCK_EX); // On verrouille le fichier
|
||||
$uniqid = fgets( $funiq );
|
||||
|
||||
|
@ -295,65 +442,178 @@
|
|||
$subject_id = $subject['subject_id'];
|
||||
|
||||
// Contiendra la valeur de l'id maximum
|
||||
$maxId = 0;
|
||||
$maxId = $offset;
|
||||
|
||||
|
||||
|
||||
/* [1] On enregistre les données du sujet
|
||||
|
||||
// /* [1] On récupère les logs s'ils existent
|
||||
// =========================================================*/
|
||||
// // Contiendra le contenu du fichier
|
||||
$file = [
|
||||
"subject" => "",
|
||||
"contacts" => [],
|
||||
"relations" => []
|
||||
];
|
||||
// $file = [ 'logs' => [] ];
|
||||
//
|
||||
//
|
||||
// /* (1) On définit les 2 fichiers utiles */
|
||||
// $tmpfile = __BUILD__.'/tmp/phone_'.$subject['tmp_id'].'.json';
|
||||
//
|
||||
// /* (2) Si on a déja crée le fichier avec le journal d'appel dedans, on le récupère */
|
||||
// $storage_already = is_string($subject['tmp_id']) && strlen($subject['tmp_id']) == 40 && file_exists($tmpfile);
|
||||
//
|
||||
//
|
||||
// /* (3) Si on a déja crée le fichier, on essaie de récupérer son contenu */
|
||||
// if( $storage_already ){
|
||||
// $file = json_decode( file_get_contents($tmpfile), true );
|
||||
//
|
||||
// // erreur
|
||||
// if( $file == null )
|
||||
// return [ 'ModuleRequest' => ManagerError::ParsingFailed ];
|
||||
//
|
||||
// // On incrémente tous les ids de l'offset
|
||||
// foreach($file['logs'] as $i=>$log){
|
||||
// $file['logs'][$i]['id'] = $offset + $log['id'];
|
||||
//
|
||||
// if( $log['id'] > $maxId )
|
||||
// $maxId = (int) $log['id'];
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* [2] On enregistre les données du sujet
|
||||
=========================================================*/
|
||||
/* (1) On crée le sujet */
|
||||
$file['subject'] = [ 'id' => $subject_id ];
|
||||
|
||||
/* (2) On récupère ses contacts phone */
|
||||
// {2.1} On récupère les données du sujet //
|
||||
$lphone = new lightdb('phone_db');
|
||||
$lphone = $lphone->fetch($subject_id);
|
||||
|
||||
/* [2] On enregistre les contacts des MINI
|
||||
=========================================================*/
|
||||
$file['contacts'] = [];
|
||||
$file['relations'] = [];
|
||||
// {2.2} si n'existe pas, on a un tableau vide //
|
||||
if( $lphone === false )
|
||||
$lphone = [ 'contacts' => [] ];
|
||||
|
||||
foreach($mini as $miniData){
|
||||
// On récupère les données du contact associé
|
||||
$contact = $contacts[ $miniData['uid'] ];
|
||||
if( !isset($lphone['contacts']) )
|
||||
$lphone['contacts'] = [];
|
||||
|
||||
if( $miniData['uid'] > $maxId )
|
||||
$maxId = (int) $miniData['uid'];
|
||||
|
||||
$newId = $offset + $miniData['uid'];
|
||||
/* (3) On récupère ses contacts lab-surveys */
|
||||
// {3.1} On récupère les données du sujet //
|
||||
$lsurvey = new lightdb('survey_db');
|
||||
$lsurvey = $lsurvey->fetch($subject_id);
|
||||
|
||||
// On remplit les données qui iront dans le fichier pour ce contact
|
||||
array_push($file['contacts'], [
|
||||
'id' => $newId,
|
||||
'name' => $contact['username'],
|
||||
'sexe' => $miniData['sexe'],
|
||||
'age' => $miniData['age'],
|
||||
'studies1' => $miniData['studies'],
|
||||
'reltype' => ($miniData['reltype']==10) ? $miniData['reltypeSpecial'] : $miniData['reltype'], // si 'autre' -> valeur, sinon le code
|
||||
'dist' => $miniData['loc']
|
||||
]);
|
||||
// {3.2} si n'existe pas, on a un tableau vide //
|
||||
if( $lsurvey === false )
|
||||
$lsurvey = [ 'contacts' => [] ];
|
||||
|
||||
// On enregistre la relation avec EGO
|
||||
array_push($file['relations'], [
|
||||
'idA' => $subject_id,
|
||||
'idB' => $newId,
|
||||
'type' => 3 // relation facebook mineure
|
||||
]);
|
||||
if( !isset($lsurvey['contacts']) )
|
||||
$lsurvey['contacts'] = [];
|
||||
|
||||
|
||||
/* (4) On récupère uniquement la liste des contacts avec le type de fiche qu'ils ont */
|
||||
// {4.1} Contiendra les contacts exportés //
|
||||
$exported = [
|
||||
'fiche' => [],
|
||||
'mini' => []
|
||||
];
|
||||
|
||||
// {4.2} Contiendra les username des contacts exportés //
|
||||
$exportedU = [];
|
||||
|
||||
// {4.3} On récupère les contacts facebook //
|
||||
foreach($lphone['contacts'] as $c=>$data){
|
||||
|
||||
if( isset($data['studies2']) ){
|
||||
|
||||
$exported['fiche'][] = $data['id'];
|
||||
$exportedU[$data['id']] = $data['name'];
|
||||
|
||||
}else
|
||||
|
||||
// S'il n'est pas déja dans les fiches
|
||||
if( !in_array($data['id'], $exported['fiche']) ){
|
||||
|
||||
$exported['mini'][] = $data['id'];
|
||||
$exportedU[$data['id']] = $data['name'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// {4.4} On récupère les contacts lab-surveys //
|
||||
foreach($lsurvey['contacts'] as $c=>$data){
|
||||
|
||||
/* [4] On enregistre les contacts des FICHES
|
||||
if( isset($data['studies2']) )
|
||||
|
||||
// On ajoute le contact s'il n'y est pas déja
|
||||
if( !in_array($data['id'], $exported['fiche']) ){
|
||||
|
||||
$exported['fiche'][] = $data['id'];
|
||||
$exportedU['fiche'][] = $data['username'];
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
// On ajoute le contact s'il n'y est pas déja (ni dans mini ni dans fiche)
|
||||
if( !in_array($data['id'], $exported['mini']) && !in_array($data['id'], $exported['fiche']) ){
|
||||
$exported['mini'][] = $data['id'];
|
||||
$exportedU['mini'][] = $data['username'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* [3] On enregistre les contacts des FICHES
|
||||
=========================================================*/
|
||||
$contactsDone = [
|
||||
"existing" => [], // Contacts exportés déja enregistrés
|
||||
"username" => [] // Nouveaux contacts déja enregistrés
|
||||
];
|
||||
|
||||
|
||||
foreach($fiches as $f=>$ficheData){
|
||||
// On récupère les données du contact associé
|
||||
/* (1) On récupère les données du contact associé */
|
||||
if( !isset($contacts[$ficheData['uid']]) )
|
||||
continue;
|
||||
|
||||
$contact = $contacts[ $ficheData['uid'] ];
|
||||
|
||||
if( $ficheData['uid'] > $maxId )
|
||||
$maxId = (int) $ficheData['uid'];
|
||||
/* (2) Si le contact a été importé d'une autre enquête */
|
||||
if( isset($contact['existing']) && is_numeric($contact['existing']) ){
|
||||
$newId = (int) $contact['existing'];
|
||||
$uname = $exportedU[intval($contact['existing'])];
|
||||
// {2.1} S'il a déja une fiche ou qu'on a déja fait une fiche, on quitte //
|
||||
if( in_array(intval($contact['existing']), $exported['fiche']) || in_array($contact['existing'], $contactsDone['existing']) )
|
||||
continue;
|
||||
|
||||
$newId = $offset + $ficheData['uid'];
|
||||
/* (3) Si nouveau contact */
|
||||
}else{
|
||||
$newId = (int) ($offset+$ficheData['uid']);
|
||||
$uname = $contact['username'];
|
||||
// {3.1} S'il a déja été saisi, on quitte //
|
||||
if( in_array($contact['username'], $contactsDone['username']) )
|
||||
continue;
|
||||
}
|
||||
|
||||
/* (4) Update du @maxId */
|
||||
if( $newId > $maxId )
|
||||
$maxId = (int) $newId;
|
||||
|
||||
// On remplit les données qui iront dans le fichier pour ce contact
|
||||
array_push($file['contacts'], [
|
||||
$file['contacts'][] = [
|
||||
'id' => $newId,
|
||||
'name' => $contact['username'],
|
||||
'name' => $uname,
|
||||
'sexe' => $ficheData['sexe'],
|
||||
'age' => $ficheData['age'],
|
||||
'studies2' => $ficheData['studies'],
|
||||
|
@ -370,52 +630,148 @@
|
|||
'freq' => $ficheData['freq'],
|
||||
'connect' => $ficheData['connect'],
|
||||
'connectExtra' => $ficheData['connectSpecial']
|
||||
]);
|
||||
];
|
||||
|
||||
// On enregistre la relation avec EGO
|
||||
array_push($file['relations'], [
|
||||
$file['relations'][] = [
|
||||
'idA' => $subject_id,
|
||||
'idB' => $newId,
|
||||
'type' => ($f<10) ? 6 : 7 // 6->historique 7->messenger
|
||||
]);
|
||||
'type' => ($f<20) ? 4 : 5 // 4->appels 5->sms
|
||||
];
|
||||
|
||||
|
||||
/* (x) Si le contact a été importé d'une autre enquête */
|
||||
if( isset($contact['existing']) && is_numeric($contact['existing']) )
|
||||
$contactsDone['existing'][] = $contact['existing'];
|
||||
/* (x+1) Si nouveau contact */
|
||||
else
|
||||
$contactsDone['username'][] = $contact['username'];
|
||||
}
|
||||
|
||||
|
||||
/* [4] On enregistre les contacts des MINI
|
||||
=========================================================*/
|
||||
foreach($mini as $miniData){
|
||||
/* (1) On récupère les données du contact associé */
|
||||
if( !isset($contacts[$miniData['uid']]) )
|
||||
continue;
|
||||
|
||||
$contact = $contacts[ $miniData['uid'] ];
|
||||
|
||||
/* (2) Si le contact a été importé d'une autre enquête */
|
||||
if( isset($contact['existing']) && is_numeric($contact['existing']) ){
|
||||
$newId = (int) $contact['existing'];
|
||||
$uname = $exportedU[intval($contact['existing'])];
|
||||
// {2.1} S'il a déja une fiche ou qu'on a déja fait une fiche (ou mini), on quitte //
|
||||
if( in_array(intval($contact['existing']), $exported['fiche']) || in_array($contact['existing'], $contactsDone['existing']) )
|
||||
continue;
|
||||
|
||||
|
||||
/* (3) Si nouveau contact */
|
||||
}else{
|
||||
$newId = (int) ($offset+$miniData['uid']);
|
||||
$uname = $contact['username'];
|
||||
// {3.1} S'il a déja été saisi, on quitte //
|
||||
if( in_array($contact['username'], $contactsDone['username']) )
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
/* (4) Update du @maxId */
|
||||
if( $newId > $maxId )
|
||||
$maxId = (int) $newId;
|
||||
|
||||
|
||||
// On remplit les données qui iront dans le fichier pour ce contact
|
||||
$file['contacts'][] = [
|
||||
'id' => $newId,
|
||||
'name' => $uname,
|
||||
'sexe' => $miniData['sexe'],
|
||||
'age' => $miniData['age'],
|
||||
'studies1' => $miniData['studies'],
|
||||
'reltype' => ($miniData['reltype']==10) ? $miniData['reltypeSpecial'] : $miniData['reltype'], // si 'autre' -> valeur, sinon le code
|
||||
'dist' => $miniData['loc']
|
||||
];
|
||||
|
||||
// On enregistre la relation avec EGO
|
||||
$file['relations'][] = [
|
||||
'idA' => $subject_id,
|
||||
'idB' => $newId,
|
||||
'type' => 2 // relation cellulaire mineure
|
||||
];
|
||||
|
||||
|
||||
/* (x) Si le contact a été importé d'une autre enquête */
|
||||
if( isset($contact['existing']) && is_numeric($contact['existing']) )
|
||||
$contactsDone['existing'][] = $contact['existing'];
|
||||
/* (x+1) Si nouveau contact */
|
||||
else
|
||||
$contactsDone['username'][] = $contact['username'];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* [5] On enregistre les relations de la MATRICE
|
||||
=========================================================*/
|
||||
foreach($file['contacts'] as $y=>$yContact)
|
||||
foreach($file['contacts'] as $x=>$xContact)
|
||||
$clen = count($file['contacts']);
|
||||
// var_dump($file['contacts']);
|
||||
|
||||
/* (1) On récupére les ids des contacts */
|
||||
$cIdList = [];
|
||||
foreach($file['contacts'] as $c=>$contact){
|
||||
$id = (int) $c;
|
||||
|
||||
if( !in_array($id, $cIdList) )
|
||||
$cIdList[$id] = null;
|
||||
}
|
||||
|
||||
ksort($cIdList);
|
||||
|
||||
|
||||
/* (2) On remplit les relations */
|
||||
foreach($cIdList as $y=>$yNull){
|
||||
foreach($cIdList as $x=>$xNull)
|
||||
if( $x < $y ){ // On affiche que sous la diagonale
|
||||
|
||||
$idY = $file['contacts'][$y]['id'] - $offset;
|
||||
$idX = $file['contacts'][$x]['id'] - $offset;
|
||||
|
||||
// Si relation alter-alter
|
||||
$relationXY = isset($matrice[$yContact['id']]) && in_array($xContact['id'], $matrice[$yContact['id']]);
|
||||
$relationXY = isset($matrice[$y]) && in_array($x, $matrice[$y])
|
||||
|| ( isset($matrice[$x]) && in_array($y, $matrice[$x]) );
|
||||
|
||||
array_push($file['relations'], [
|
||||
'idA' => $yContact['id'],
|
||||
'idB' => $xContact['id'],
|
||||
$file['relations'][] = [
|
||||
'idA' => $offset + $x,
|
||||
'idB' => $offset + $y,
|
||||
'type' => $relationXY ? 1 : 0 // 0->aucune relation 1->relation alter alter
|
||||
]);
|
||||
];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* [5] On enregistre tout dans 'lightdb'
|
||||
/* [6] On enregistre tout dans 'lightdb'
|
||||
=========================================================*/
|
||||
$db = new lightdb('facebook_db');
|
||||
$db->insert( $subject_id, $file );
|
||||
$db->close();
|
||||
|
||||
/* [6] On met à jour le nouvel ID unique
|
||||
/* [7] On met à jour le nouvel ID unique
|
||||
=========================================================*/
|
||||
// $maxId += $offset;
|
||||
rewind($funiq); // On revient au début du fichier
|
||||
fwrite($funiq, $offset+$maxId); // On écrit la nouvelle valeur (forcément plus grande)
|
||||
fwrite($funiq, $maxId); // On écrit la nouvelle valeur (forcément plus grande)
|
||||
flock($funiq, LOCK_UN); // On débloque le verrou
|
||||
fclose($funiq);
|
||||
|
||||
// /* [8] On supprime le fichier temporaire si existe
|
||||
// =========================================================*/
|
||||
// if( file_exists($tmpfile) )
|
||||
// unlink($tmpfile);
|
||||
|
||||
/* [7] Gestion du retour
|
||||
|
||||
/* [9] Gestion du retour
|
||||
=========================================================*/
|
||||
return [
|
||||
'ModuleError' => ManagerError::Success,
|
||||
|
|
|
@ -173,8 +173,7 @@
|
|||
|
||||
|
||||
/* (3) Vérification du sujet */
|
||||
$checkSubject = isset($json['subject']['tmp_id']) && ( is_string($json['subject']['tmp_id']) || is_null($json['subject']['tmp_id']) );
|
||||
$checkSubject = $checkSubject && isset($json['subject']['subject_id']) && is_numeric($json['subject']['subject_id']);
|
||||
$checkSubject = isset($json['subject']['subject_id']) && is_numeric($json['subject']['subject_id']);
|
||||
|
||||
// Erreur des attributs du sujet incorrects ou manquants
|
||||
if( !$checkSubject )
|
||||
|
@ -187,7 +186,7 @@
|
|||
$checkContact = $checkContact && isset($contact['username']) && is_string($contact['username']);
|
||||
// Existing ou username.length > 0
|
||||
$checkContact = $checkContact && isset($contact['existing']);
|
||||
$checkContact = $checkContact && ( is_numeric($contact['existing']) || strlen($contact['username']) > 0 );
|
||||
$checkContact = $checkContact && ( strlen($contact['username']) > 0 || intval($contact['existing']) == $contact['existing'] );
|
||||
// $checkContact = $checkContact && isset($contact['sms']) && is_numeric($contact['sms']);
|
||||
// $checkContact = $checkContact && isset($contact['call']) && is_numeric($contact['call']);
|
||||
// $checkContact = $checkContact && isset($contact['countsms']) && is_numeric($contact['countsms']);
|
||||
|
@ -203,6 +202,7 @@
|
|||
/* (5) Vérification des mini-fiches */
|
||||
foreach($json['mini'] as $mini){
|
||||
$checkMini = isset($mini['uid']) && is_numeric($mini['uid']);
|
||||
$checkMini = $checkMini && isset($mini['contact']) && is_numeric($mini['contact']);
|
||||
$checkMini = $checkMini && isset($mini['sexe']) && is_numeric($mini['sexe']);
|
||||
$checkMini = $checkMini && isset($mini['age']) && is_string($mini['age']);
|
||||
$checkMini = $checkMini && isset($mini['studies']) && is_string($mini['studies']);
|
||||
|
|
|
@ -199,8 +199,6 @@
|
|||
}
|
||||
|
||||
/* RENVOIE LES DONNEES ASSOCIEES AUX CLES DONNEES
|
||||
|
||||
|
||||
*
|
||||
* @keys<Array> Clés associées aux valeurs à récupérer
|
||||
*
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1 +1 @@
|
|||
[]
|
||||
{"1":{"line":0,"hash":"ae55953b70b63b6665ea13aef65aef8da8b8c834"},"3":{"line":1,"hash":"e264f35e79e354f1dcadc0bc6b9c2b07dc214ee2"}}
|
File diff suppressed because one or more lines are too long
|
@ -1 +1 @@
|
|||
[]
|
||||
{"3":{"line":0,"hash":"e9aff02e50eb56a848c3580c8a119a5cbe0ec64b"}}
|
|
@ -1 +1 @@
|
|||
361
|
||||
3901
|
|
@ -0,0 +1,852 @@
|
|||
{
|
||||
"subject": {
|
||||
"subject_id": "1"
|
||||
},
|
||||
"contacts": {
|
||||
"0": {
|
||||
"uid": 0,
|
||||
"username": "Ismael",
|
||||
"existing": ".",
|
||||
"hash": 1627075103
|
||||
},
|
||||
"1": {
|
||||
"uid": 1,
|
||||
"username": "Rosa",
|
||||
"existing": ".",
|
||||
"hash": 498192491
|
||||
},
|
||||
"2": {
|
||||
"uid": 2,
|
||||
"username": "Judith",
|
||||
"existing": ".",
|
||||
"hash": 1451575763
|
||||
},
|
||||
"3": {
|
||||
"uid": 3,
|
||||
"username": "Alex",
|
||||
"existing": ".",
|
||||
"hash": 2660323475
|
||||
},
|
||||
"4": {
|
||||
"uid": 4,
|
||||
"username": "Adri",
|
||||
"existing": ".",
|
||||
"hash": 2559488290
|
||||
},
|
||||
"5": {
|
||||
"uid": 5,
|
||||
"username": "Fred",
|
||||
"existing": ".",
|
||||
"hash": 4039469544
|
||||
},
|
||||
"6": {
|
||||
"uid": 6,
|
||||
"username": "Shanone",
|
||||
"existing": ".",
|
||||
"hash": 28222849
|
||||
},
|
||||
"7": {
|
||||
"uid": 7,
|
||||
"username": "Manon",
|
||||
"existing": ".",
|
||||
"hash": 336712847
|
||||
},
|
||||
"8": {
|
||||
"uid": 8,
|
||||
"username": "Java",
|
||||
"existing": ".",
|
||||
"hash": 1359920097
|
||||
},
|
||||
"9": {
|
||||
"uid": 9,
|
||||
"username": "Thalees",
|
||||
"existing": ".",
|
||||
"hash": 2826325950
|
||||
},
|
||||
"10": {
|
||||
"uid": 10,
|
||||
"username": "Crème",
|
||||
"existing": ".",
|
||||
"hash": 4211503315
|
||||
},
|
||||
"11": {
|
||||
"uid": 11,
|
||||
"username": "Margaux",
|
||||
"existing": ".",
|
||||
"hash": 3915760272
|
||||
},
|
||||
"12": {
|
||||
"uid": 12,
|
||||
"username": "Anthony",
|
||||
"existing": ".",
|
||||
"hash": 410858384
|
||||
},
|
||||
"13": {
|
||||
"uid": 13,
|
||||
"username": "Lino",
|
||||
"existing": ".",
|
||||
"hash": 2457771762
|
||||
}
|
||||
},
|
||||
"mini": {},
|
||||
"fiches": {
|
||||
"0": {
|
||||
"sexe": "0",
|
||||
"age": "0",
|
||||
"job": "10",
|
||||
"famsit": "0",
|
||||
"studies": "",
|
||||
"reltype": "0",
|
||||
"reltypeSpecial": "",
|
||||
"city": "10",
|
||||
"quartier": "0",
|
||||
"cp": "10000",
|
||||
"loc": "0",
|
||||
"duration": [
|
||||
"0",
|
||||
"10"
|
||||
],
|
||||
"context": "0",
|
||||
"contextSpecial": [
|
||||
"",
|
||||
"",
|
||||
""
|
||||
],
|
||||
"freq": [
|
||||
"2",
|
||||
"9",
|
||||
"14",
|
||||
"19",
|
||||
"24"
|
||||
],
|
||||
"connect": [
|
||||
"1",
|
||||
"3",
|
||||
"5",
|
||||
"7",
|
||||
"9",
|
||||
"11"
|
||||
],
|
||||
"connectSpecial": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"uid": 0,
|
||||
"contact": 0,
|
||||
"hash": 3977448909,
|
||||
"valid": true,
|
||||
"timestamp": 1478429171540
|
||||
},
|
||||
"1": {
|
||||
"sexe": "1",
|
||||
"age": "1",
|
||||
"job": "21",
|
||||
"famsit": "0",
|
||||
"studies": "01",
|
||||
"reltype": "1",
|
||||
"reltypeSpecial": "",
|
||||
"city": "11",
|
||||
"quartier": "1",
|
||||
"cp": "10001",
|
||||
"loc": "1",
|
||||
"duration": [
|
||||
"1",
|
||||
"11"
|
||||
],
|
||||
"context": "1",
|
||||
"contextSpecial": [
|
||||
"",
|
||||
"",
|
||||
""
|
||||
],
|
||||
"freq": [
|
||||
"4",
|
||||
"9",
|
||||
"14",
|
||||
"19",
|
||||
"24"
|
||||
],
|
||||
"connect": [
|
||||
"1",
|
||||
"3",
|
||||
"5",
|
||||
"7",
|
||||
"9",
|
||||
"11"
|
||||
],
|
||||
"connectSpecial": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"uid": 1,
|
||||
"contact": 1,
|
||||
"hash": 3439453096,
|
||||
"valid": true,
|
||||
"timestamp": 1478429171592
|
||||
},
|
||||
"2": {
|
||||
"sexe": "2",
|
||||
"age": "2",
|
||||
"job": "22",
|
||||
"famsit": "0",
|
||||
"studies": "02",
|
||||
"reltype": "2",
|
||||
"reltypeSpecial": "",
|
||||
"city": "12",
|
||||
"quartier": "2",
|
||||
"cp": "10002",
|
||||
"loc": "2",
|
||||
"duration": [
|
||||
"2",
|
||||
"12"
|
||||
],
|
||||
"context": "2",
|
||||
"contextSpecial": [
|
||||
"",
|
||||
"",
|
||||
""
|
||||
],
|
||||
"freq": [
|
||||
"4",
|
||||
"9",
|
||||
"14",
|
||||
"19",
|
||||
"24"
|
||||
],
|
||||
"connect": [
|
||||
"1",
|
||||
"3",
|
||||
"5",
|
||||
"7",
|
||||
"9",
|
||||
"11"
|
||||
],
|
||||
"connectSpecial": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"uid": 2,
|
||||
"contact": 2,
|
||||
"hash": 2538679406,
|
||||
"valid": true,
|
||||
"timestamp": 1478429171636
|
||||
},
|
||||
"3": {
|
||||
"sexe": "0",
|
||||
"age": "3",
|
||||
"job": "23",
|
||||
"famsit": "0",
|
||||
"studies": "03",
|
||||
"reltype": "3",
|
||||
"reltypeSpecial": "",
|
||||
"city": "13",
|
||||
"quartier": "3",
|
||||
"cp": "10003",
|
||||
"loc": "3",
|
||||
"duration": [
|
||||
"3",
|
||||
"13"
|
||||
],
|
||||
"context": "3",
|
||||
"contextSpecial": [
|
||||
"",
|
||||
"",
|
||||
""
|
||||
],
|
||||
"freq": [
|
||||
"4",
|
||||
"9",
|
||||
"14",
|
||||
"19",
|
||||
"24"
|
||||
],
|
||||
"connect": [
|
||||
"1",
|
||||
"3",
|
||||
"5",
|
||||
"7",
|
||||
"9",
|
||||
"11"
|
||||
],
|
||||
"connectSpecial": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"uid": 3,
|
||||
"contact": 3,
|
||||
"hash": 1448962210,
|
||||
"valid": true,
|
||||
"timestamp": 1478429171695
|
||||
},
|
||||
"4": {
|
||||
"sexe": "1",
|
||||
"age": "4",
|
||||
"job": "31",
|
||||
"famsit": "0",
|
||||
"studies": "04",
|
||||
"reltype": "4",
|
||||
"reltypeSpecial": "",
|
||||
"city": "14",
|
||||
"quartier": "4",
|
||||
"cp": "10004",
|
||||
"loc": "0",
|
||||
"duration": [
|
||||
"4",
|
||||
"14"
|
||||
],
|
||||
"context": "4",
|
||||
"contextSpecial": [
|
||||
"",
|
||||
"",
|
||||
""
|
||||
],
|
||||
"freq": [
|
||||
"4",
|
||||
"9",
|
||||
"14",
|
||||
"19",
|
||||
"24"
|
||||
],
|
||||
"connect": [
|
||||
"1",
|
||||
"3",
|
||||
"5",
|
||||
"7",
|
||||
"9",
|
||||
"11"
|
||||
],
|
||||
"connectSpecial": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"uid": 4,
|
||||
"contact": 4,
|
||||
"hash": 3000740570,
|
||||
"valid": true,
|
||||
"timestamp": 1478429171741
|
||||
},
|
||||
"5": {
|
||||
"sexe": "2",
|
||||
"age": "5",
|
||||
"job": "32",
|
||||
"famsit": "0",
|
||||
"studies": "05",
|
||||
"reltype": "5",
|
||||
"reltypeSpecial": "",
|
||||
"city": "15",
|
||||
"quartier": "5",
|
||||
"cp": "10005",
|
||||
"loc": "1",
|
||||
"duration": [
|
||||
"5",
|
||||
"15"
|
||||
],
|
||||
"context": "5",
|
||||
"contextSpecial": [
|
||||
"",
|
||||
"",
|
||||
""
|
||||
],
|
||||
"freq": [
|
||||
"4",
|
||||
"9",
|
||||
"14",
|
||||
"19",
|
||||
"24"
|
||||
],
|
||||
"connect": [
|
||||
"1",
|
||||
"3",
|
||||
"5",
|
||||
"7",
|
||||
"9",
|
||||
"11"
|
||||
],
|
||||
"connectSpecial": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"uid": 5,
|
||||
"contact": 5,
|
||||
"hash": 1185776066,
|
||||
"valid": true,
|
||||
"timestamp": 1478429171805
|
||||
},
|
||||
"6": {
|
||||
"sexe": "0",
|
||||
"age": "6",
|
||||
"job": "36",
|
||||
"famsit": "0",
|
||||
"studies": "06",
|
||||
"reltype": "6",
|
||||
"reltypeSpecial": "",
|
||||
"city": "16",
|
||||
"quartier": "6",
|
||||
"cp": "10006",
|
||||
"loc": "2",
|
||||
"duration": [
|
||||
"6",
|
||||
"16"
|
||||
],
|
||||
"context": "6",
|
||||
"contextSpecial": [
|
||||
"",
|
||||
"",
|
||||
""
|
||||
],
|
||||
"freq": [
|
||||
"4",
|
||||
"9",
|
||||
"14",
|
||||
"19",
|
||||
"24"
|
||||
],
|
||||
"connect": [
|
||||
"1",
|
||||
"3",
|
||||
"5",
|
||||
"7",
|
||||
"9",
|
||||
"11"
|
||||
],
|
||||
"connectSpecial": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"uid": 6,
|
||||
"contact": 6,
|
||||
"hash": 3580676315,
|
||||
"valid": true,
|
||||
"timestamp": 1478429171858
|
||||
},
|
||||
"7": {
|
||||
"sexe": "1",
|
||||
"age": "7",
|
||||
"job": "41",
|
||||
"famsit": "0",
|
||||
"studies": "07",
|
||||
"reltype": "7",
|
||||
"reltypeSpecial": "",
|
||||
"city": "17",
|
||||
"quartier": "7",
|
||||
"cp": "10007",
|
||||
"loc": "3",
|
||||
"duration": [
|
||||
"7",
|
||||
"17"
|
||||
],
|
||||
"context": "7",
|
||||
"contextSpecial": [
|
||||
"",
|
||||
"",
|
||||
""
|
||||
],
|
||||
"freq": [
|
||||
"4",
|
||||
"9",
|
||||
"14",
|
||||
"19",
|
||||
"24"
|
||||
],
|
||||
"connect": [
|
||||
"1",
|
||||
"3",
|
||||
"5",
|
||||
"7",
|
||||
"9",
|
||||
"11"
|
||||
],
|
||||
"connectSpecial": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"uid": 7,
|
||||
"contact": 7,
|
||||
"hash": 3989377397,
|
||||
"valid": true,
|
||||
"timestamp": 1478429171905
|
||||
},
|
||||
"8": {
|
||||
"sexe": "2",
|
||||
"age": "8",
|
||||
"job": "46",
|
||||
"famsit": "0",
|
||||
"studies": "08",
|
||||
"reltype": "10",
|
||||
"reltypeSpecial": "autre",
|
||||
"city": "18",
|
||||
"quartier": "8",
|
||||
"cp": "10008",
|
||||
"loc": "0",
|
||||
"duration": [
|
||||
"8",
|
||||
"18"
|
||||
],
|
||||
"context": "8",
|
||||
"contextSpecial": [
|
||||
"",
|
||||
"",
|
||||
""
|
||||
],
|
||||
"freq": [
|
||||
"4",
|
||||
"9",
|
||||
"14",
|
||||
"19",
|
||||
"24"
|
||||
],
|
||||
"connect": [
|
||||
"1",
|
||||
"3",
|
||||
"5",
|
||||
"7",
|
||||
"9",
|
||||
"11"
|
||||
],
|
||||
"connectSpecial": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"uid": 8,
|
||||
"contact": 8,
|
||||
"hash": 594979660,
|
||||
"valid": true,
|
||||
"timestamp": 1478429171955
|
||||
},
|
||||
"9": {
|
||||
"sexe": "0",
|
||||
"age": "9",
|
||||
"job": "47",
|
||||
"famsit": "0",
|
||||
"studies": "09",
|
||||
"reltype": "0",
|
||||
"reltypeSpecial": "",
|
||||
"city": "19",
|
||||
"quartier": "9",
|
||||
"cp": "10009",
|
||||
"loc": "1",
|
||||
"duration": [
|
||||
"9",
|
||||
"19"
|
||||
],
|
||||
"context": "9",
|
||||
"contextSpecial": [
|
||||
"",
|
||||
"",
|
||||
""
|
||||
],
|
||||
"freq": [
|
||||
"4",
|
||||
"9",
|
||||
"14",
|
||||
"19",
|
||||
"24"
|
||||
],
|
||||
"connect": [
|
||||
"1",
|
||||
"3",
|
||||
"5",
|
||||
"7",
|
||||
"9",
|
||||
"11"
|
||||
],
|
||||
"connectSpecial": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"uid": 9,
|
||||
"contact": 9,
|
||||
"hash": 1585642677,
|
||||
"valid": true,
|
||||
"timestamp": 1478429172030
|
||||
},
|
||||
"10": {
|
||||
"sexe": "1",
|
||||
"age": "10",
|
||||
"job": "48",
|
||||
"famsit": "0",
|
||||
"studies": "10",
|
||||
"reltype": "1",
|
||||
"reltypeSpecial": "",
|
||||
"city": "20",
|
||||
"quartier": "10",
|
||||
"cp": "10010",
|
||||
"loc": "2",
|
||||
"duration": [
|
||||
"10",
|
||||
"110"
|
||||
],
|
||||
"context": "10",
|
||||
"contextSpecial": [
|
||||
"",
|
||||
"",
|
||||
""
|
||||
],
|
||||
"freq": [
|
||||
"4",
|
||||
"9",
|
||||
"14",
|
||||
"19",
|
||||
"24"
|
||||
],
|
||||
"connect": [
|
||||
"1",
|
||||
"3",
|
||||
"5",
|
||||
"7",
|
||||
"9",
|
||||
"11"
|
||||
],
|
||||
"connectSpecial": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"uid": 10,
|
||||
"contact": 10,
|
||||
"hash": 350296051,
|
||||
"valid": true,
|
||||
"timestamp": 1478429172091
|
||||
},
|
||||
"11": {
|
||||
"sexe": "2",
|
||||
"age": "11",
|
||||
"job": "51",
|
||||
"famsit": "0",
|
||||
"studies": "11",
|
||||
"reltype": "2",
|
||||
"reltypeSpecial": "",
|
||||
"city": "21",
|
||||
"quartier": "11",
|
||||
"cp": "10011",
|
||||
"loc": "3",
|
||||
"duration": [
|
||||
"11",
|
||||
"111"
|
||||
],
|
||||
"context": "11",
|
||||
"contextSpecial": [
|
||||
"internet",
|
||||
"",
|
||||
""
|
||||
],
|
||||
"freq": [
|
||||
"4",
|
||||
"9",
|
||||
"14",
|
||||
"19",
|
||||
"24"
|
||||
],
|
||||
"connect": [
|
||||
"1",
|
||||
"3",
|
||||
"5",
|
||||
"7",
|
||||
"9",
|
||||
"11"
|
||||
],
|
||||
"connectSpecial": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"uid": 11,
|
||||
"contact": 11,
|
||||
"hash": 2556603658,
|
||||
"valid": true,
|
||||
"timestamp": 1478429172141
|
||||
},
|
||||
"12": {
|
||||
"sexe": "0",
|
||||
"age": "12",
|
||||
"job": "54",
|
||||
"famsit": "0",
|
||||
"studies": "",
|
||||
"reltype": "3",
|
||||
"reltypeSpecial": "",
|
||||
"city": "22",
|
||||
"quartier": "12",
|
||||
"cp": "10012",
|
||||
"loc": "0",
|
||||
"duration": [
|
||||
"12",
|
||||
"112"
|
||||
],
|
||||
"context": "12",
|
||||
"contextSpecial": [
|
||||
"",
|
||||
"association",
|
||||
""
|
||||
],
|
||||
"freq": [
|
||||
"4",
|
||||
"9",
|
||||
"14",
|
||||
"19",
|
||||
"24"
|
||||
],
|
||||
"connect": [
|
||||
"1",
|
||||
"3",
|
||||
"5",
|
||||
"7",
|
||||
"9",
|
||||
"11"
|
||||
],
|
||||
"connectSpecial": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"uid": 12,
|
||||
"contact": 12,
|
||||
"hash": 1254626617,
|
||||
"valid": true,
|
||||
"timestamp": 1478429172191
|
||||
},
|
||||
"13": {
|
||||
"sexe": "1",
|
||||
"age": "13",
|
||||
"job": "55",
|
||||
"famsit": "0",
|
||||
"studies": "01",
|
||||
"reltype": "4",
|
||||
"reltypeSpecial": "",
|
||||
"city": "23",
|
||||
"quartier": "13",
|
||||
"cp": "10013",
|
||||
"loc": "1",
|
||||
"duration": [
|
||||
"13",
|
||||
"113"
|
||||
],
|
||||
"context": "13",
|
||||
"contextSpecial": [
|
||||
"",
|
||||
"",
|
||||
"autre"
|
||||
],
|
||||
"freq": [
|
||||
"4",
|
||||
"9",
|
||||
"14",
|
||||
"19",
|
||||
"24"
|
||||
],
|
||||
"connect": [
|
||||
"1",
|
||||
"3",
|
||||
"5",
|
||||
"7",
|
||||
"9",
|
||||
"11"
|
||||
],
|
||||
"connectSpecial": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"uid": 13,
|
||||
"contact": 13,
|
||||
"hash": 1821404092,
|
||||
"valid": true,
|
||||
"timestamp": 1478429175971
|
||||
}
|
||||
},
|
||||
"matrice": {
|
||||
"0": [
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12
|
||||
],
|
||||
"1": [
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12,
|
||||
13
|
||||
],
|
||||
"2": [
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12
|
||||
],
|
||||
"3": [
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12
|
||||
],
|
||||
"4": [
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12
|
||||
],
|
||||
"5": [
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12
|
||||
],
|
||||
"6": [
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
11,
|
||||
12
|
||||
],
|
||||
"7": [
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12
|
||||
],
|
||||
"8": [
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12
|
||||
],
|
||||
"9": [
|
||||
10,
|
||||
11,
|
||||
12
|
||||
],
|
||||
"10": [
|
||||
11
|
||||
]
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
|
@ -306,9 +306,9 @@ var phoneRoutine = function(){
|
|||
|
||||
/* (3) On prépare la requête avec toutes les données */
|
||||
var request = {
|
||||
path: 'input/facebook',
|
||||
path: 'input/phone',
|
||||
|
||||
subject: lsi.export('p_subject')[0]['subject_id'],
|
||||
subject: lsi.export('p_subject')[0],
|
||||
contacts: lsi.export('p_contacts'),
|
||||
mini: lsi.export('p_mini-fiches'),
|
||||
fiches: lsi.export('p_fiches'),
|
||||
|
@ -528,7 +528,7 @@ var facebookRoutine = function(){
|
|||
console.log('> GATHERING ALL DATA');
|
||||
|
||||
/* (1) On met dans la mémoire tout les champs non enregistrés */
|
||||
pSubjectManager.fieldsToStorage();
|
||||
// pSubjectManager.fieldsToStorage();
|
||||
pContactManager.fieldsToStorage();
|
||||
pMiniManager.fieldsToStorage();
|
||||
pFicheManager.fieldsToStorage();
|
||||
|
@ -564,7 +564,7 @@ var facebookRoutine = function(){
|
|||
|
||||
/* (3) On prépare la requête avec toutes les données */
|
||||
var request = {
|
||||
path: 'input/phone',
|
||||
path: 'input/facebook',
|
||||
|
||||
subject: lsi.export('f_subject')[0],
|
||||
contacts: lsi.export('f_contacts'),
|
||||
|
|
|
@ -9,16 +9,16 @@ function(a){Notification.info("INFORMATION","Lancement du t\u00e9l\u00e9chargeme
|
|||
function(a){$('[data-sublink="phone"] #p_local-upload').click()},!1),$('[data-sublink="phone"] #p_local-upload').addEventListener("click",function(a){a.target.value=null},!1),$('[data-sublink="phone"] #p_local-upload').addEventListener("change",function(a){a={path:"upload/local_data",file:$('[data-sublink="phone"] #p_local-upload').files[0]};api.send(a,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("Erreur",a.ModuleError),!1;lsi.set("p_subject",0,a.local_data.subject);lsi["import"]("p_contacts",
|
||||
a.local_data.contacts);lsi["import"]("p_mini-fiches",a.local_data.mini);lsi["import"]("p_fiches",a.local_data.fiches);lsi.set("p_matrice",0,a.local_data.matrice);pSubjectManager.storageToFields();pContactManager.storageToFields();pMatriceManager.storageToFields();pDynamicUpdate(!0)})},!1),$('[data-sublink="phone"] #p_submit-all').addEventListener("click",function(a){console.log("> GATHERING ALL DATA");pContactManager.fieldsToStorage();pMiniManager.fieldsToStorage();pFicheManager.fieldsToStorage();
|
||||
if(!pSubjectManager.check())return Notification.warning("Attention","Vous devez saisir les informations du <i>sujet</i>"),!1;a=lsi["export"]("p_mini-fiches");var b=0,c;for(c in a)if(!isNaN(c)&&(b++,!a[c].valid))return Notification.warning("Attention","La <i>fiche rapide</i> <b>"+b+"</b> est incompl\u00e8te et/ou incorrecte"),!1;a=lsi["export"]("p_fiches");for(c in a)if(!a[c].valid)return Notification.warning("Attention","La <i>fiche compl\u00e8te</i> <b>"+(parseInt(c)+1)+"</b> est incompl\u00e8te et/ou incorrecte"),
|
||||
!1;c={path:"input/facebook",subject:lsi["export"]("p_subject")[0].subject_id,contacts:lsi["export"]("p_contacts"),mini:lsi["export"]("p_mini-fiches"),fiches:lsi["export"]("p_fiches"),matrice:lsi["export"]("p_matrice")[0]};api.send(c,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("ERREUR",a.ModuleError),!1;Notification.success("OK","L'identifiant du sujet est <strong>"+a.subject_id+"</strong> ! Tout s'est bien d\u00e9roul\u00e9.",1E4);console.log(a)},!1)},!1),console.groupEnd())};
|
||||
!1;c={path:"input/phone",subject:lsi["export"]("p_subject")[0],contacts:lsi["export"]("p_contacts"),mini:lsi["export"]("p_mini-fiches"),fiches:lsi["export"]("p_fiches"),matrice:lsi["export"]("p_matrice")[0]};api.send(c,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("ERREUR",a.ModuleError),!1;Notification.success("OK","L'identifiant du sujet est <strong>"+a.subject_id+"</strong> ! Tout s'est bien d\u00e9roul\u00e9.",1E4);console.log(a)},!1)},!1),console.groupEnd())};
|
||||
include("/js/includes/input-phone-subject.js",function(){pLoaded[0]=1;phoneRoutine()});include("/js/includes/input-phone-contact.js",function(){pLoaded[1]=1;phoneRoutine()});include("/js/includes/input-phone-mini.js",function(){pLoaded[2]=1;phoneRoutine()});include("/js/includes/input-phone-fiche.js",function(){pLoaded[3]=1;phoneRoutine()});include("/js/includes/input-phone-matrice.js",function(){pLoaded[4]=1;phoneRoutine()});
|
||||
var fAlready=0,fLoaded=[0,0,0,0,0],facebookRoutine=function(){!Math.min.apply(Math,fLoaded)|fAlready||(fAlready=1,console.groupEnd(),console.group("[facebook] Initialization"),fSubjectManager=new inputFacebookSubject($('[data-sublink="facebook"] article.subject-panel [data-name="subject_id"]'),$('[data-sublink="facebook"] article.subject-panel [data-name="submit"]')),fSubjectManager.attach(fDynamicUpdate),fContactManager=new inputFacebookContact($('[data-sublink="facebook"] article.contact-panel'),
|
||||
$('[data-sublink="facebook"] #f_nav-contact')),fContactManager.attach(fDynamicUpdate),fMiniManager=new inputFacebookMini($('[data-sublink="facebook"] article.mini-relation-panel'),$('[data-sublink="facebook"] #f_nav-mini')),fMiniManager.attach(fDynamicUpdate),fFicheManager=new inputFacebookFiche($('[data-sublink="facebook"] article.relation-panel'),$('[data-sublink="facebook"] #f_nav-fiche')),fFicheManager.top_size=20,fFicheManager.attach(fDynamicUpdate),fMatriceManager=new inputFacebookMatrice($('[data-sublink="facebook"] article.matrice-panel')),
|
||||
fMatriceManager.attach(fDynamicUpdate),$('[data-sublink="facebook"] #f_clear-all').addEventListener("click",function(a){lsi.clear("f_subject");lsi.clear("f_contacts");lsi.clear("f_mini-fiches");lsi.clear("f_fiches");lsi.clear("f_matrice");lsi.clear("f_friends");fSubjectManager.storageToFields();fContactManager.storageToFields();fMiniManager.storageToFields();fFicheManager.storageToFields();fMatriceManager.storageToFields();Notification.success("OK","Les donn\u00e9es ont \u00e9t\u00e9 supprim\u00e9es")},
|
||||
!1),$('[data-sublink="facebook"] #f_export-all').addEventListener("click",function(a){Notification.info("INFORMATION","Lancement du t\u00e9l\u00e9chargement de la sauvegarde");a={subject:lsi["export"]("f_subject")[0],contacts:lsi["export"]("f_contacts"),mini:lsi["export"]("f_mini-fiches"),fiches:lsi["export"]("f_fiches"),matrice:lsi["export"]("f_matrice")[0]};var b=$('[data-sublink="facebook"] #f_download-target');b.download="local-facebook-data.json";b.href="data:application/octet-stream,"+encodeURIComponent(JSON.stringify(a));
|
||||
b.click()},!1),$('[data-sublink="facebook"] #f_import-all').addEventListener("click",function(a){$('[data-sublink="facebook"] #f_local-upload').click()},!1),$('[data-sublink="facebook"] #f_local-upload').addEventListener("click",function(a){a.target.value=null},!1),$('[data-sublink="facebook"] #f_local-upload').addEventListener("change",function(a){a={path:"upload/local_data",file:$('[data-sublink="facebook"] #f_local-upload').files[0]};api.send(a,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("Erreur",
|
||||
a.ModuleError),!1;lsi.set("f_subject",0,a.local_data.subject);lsi["import"]("f_contacts",a.local_data.contacts);lsi["import"]("f_mini-fiches",a.local_data.mini);lsi["import"]("f_fiches",a.local_data.fiches);lsi.set("f_matrice",0,a.local_data.matrice);pSubjectManager.storageToFields();pContactManager.storageToFields();pMatriceManager.storageToFields();pDynamicUpdate(!0)})},!1),$('[data-sublink="facebook"] #f_submit-all').addEventListener("click",function(a){console.log("> GATHERING ALL DATA");pSubjectManager.fieldsToStorage();
|
||||
pContactManager.fieldsToStorage();pMiniManager.fieldsToStorage();pFicheManager.fieldsToStorage();if(!pSubjectManager.check())return Notification.warning("Attention","Vous devez saisir les informations du <i>sujet</i>"),!1;a=lsi["export"]("f_mini-fiches");var b=0,c;for(c in a)if(!isNaN(c)&&(b++,!a[c].valid))return Notification.warning("Attention","La <i>fiche rapide</i> <b>"+b+"</b> est incompl\u00e8te et/ou incorrecte"),!1;a=lsi["export"]("f_fiches");for(c in a)if(!a[c].valid)return Notification.warning("Attention",
|
||||
"La <i>fiche compl\u00e8te</i> <b>"+(parseInt(c)+1)+"</b> est incompl\u00e8te et/ou incorrecte"),!1;c={path:"input/phone",subject:lsi["export"]("f_subject")[0],contacts:lsi["export"]("f_contacts"),mini:lsi["export"]("f_mini-fiches"),fiches:lsi["export"]("f_fiches"),matrice:lsi["export"]("f_matrice")[0]};api.send(c,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("ERREUR",a.ModuleError),!1;Notification.success("OK","L'identifiant du sujet est <strong>"+a.subject_id+"</strong> ! Tout s'est bien d\u00e9roul\u00e9.",
|
||||
a.ModuleError),!1;lsi.set("f_subject",0,a.local_data.subject);lsi["import"]("f_contacts",a.local_data.contacts);lsi["import"]("f_mini-fiches",a.local_data.mini);lsi["import"]("f_fiches",a.local_data.fiches);lsi.set("f_matrice",0,a.local_data.matrice);pSubjectManager.storageToFields();pContactManager.storageToFields();pMatriceManager.storageToFields();pDynamicUpdate(!0)})},!1),$('[data-sublink="facebook"] #f_submit-all').addEventListener("click",function(a){console.log("> GATHERING ALL DATA");pContactManager.fieldsToStorage();
|
||||
pMiniManager.fieldsToStorage();pFicheManager.fieldsToStorage();if(!pSubjectManager.check())return Notification.warning("Attention","Vous devez saisir les informations du <i>sujet</i>"),!1;a=lsi["export"]("f_mini-fiches");var b=0,c;for(c in a)if(!isNaN(c)&&(b++,!a[c].valid))return Notification.warning("Attention","La <i>fiche rapide</i> <b>"+b+"</b> est incompl\u00e8te et/ou incorrecte"),!1;a=lsi["export"]("f_fiches");for(c in a)if(!a[c].valid)return Notification.warning("Attention","La <i>fiche compl\u00e8te</i> <b>"+
|
||||
(parseInt(c)+1)+"</b> est incompl\u00e8te et/ou incorrecte"),!1;c={path:"input/facebook",subject:lsi["export"]("f_subject")[0],contacts:lsi["export"]("f_contacts"),mini:lsi["export"]("f_mini-fiches"),fiches:lsi["export"]("f_fiches"),matrice:lsi["export"]("f_matrice")[0]};api.send(c,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("ERREUR",a.ModuleError),!1;Notification.success("OK","L'identifiant du sujet est <strong>"+a.subject_id+"</strong> ! Tout s'est bien d\u00e9roul\u00e9.",
|
||||
1E4);console.log(a)},!1)},!1),console.groupEnd())};include("/js/includes/input-facebook-subject.js",function(){fLoaded[0]=1;facebookRoutine()});include("/js/includes/input-facebook-contact.js",function(){fLoaded[1]=1;facebookRoutine()});include("/js/includes/input-facebook-mini.js",function(){fLoaded[2]=1;facebookRoutine()});include("/js/includes/input-facebook-fiche.js",function(){fLoaded[3]=1;facebookRoutine()});include("/js/includes/input-facebook-matrice.js",function(){fLoaded[4]=1;facebookRoutine()});
|
||||
var pDynamicUpdate=function(a){var b=a instanceof Element,c=b&&"INPUT"==a.tagName&&"submit"==a.type,g=b&&"SPAN"==a.tagName&&("p_nav-mini"==a.parentNode.id||"p_nav-fiche"==a.parentNode.id),b=b&&"SPAN"==a.tagName&&"p_nav-contact"==a.parentNode.id;if(!c&&!g&&!b&&!0!==a)return!1;console.groupEnd();console.groupEnd();console.group("[phone] Dynamic Update");pMiniManager.fieldsToStorage();pFicheManager.fieldsToStorage();pContactManager.fieldsToStorage();pMatriceManager.fieldsToStorage();pFicheManager.sync();
|
||||
pMiniManager.sync();!0===a?api.send({path:"subject/getFriends",subject_id:pSubjectManager.subject_id.value},function(a){if(0!=a.ModuleError)return console.groupEnd(),!1;lsi["import"]("p_friends",a.subjects);pMiniManager.storageToFields();pFicheManager.storageToFields();pMatriceManager.storageToFields();pContactManager.storageToFields();pMiniManager.updateNavBar();pFicheManager.updateNavBar()}):(pMiniManager.storageToFields(),pFicheManager.storageToFields(),pMatriceManager.storageToFields(),pMiniManager.updateNavBar(),
|
||||
|
|
Loading…
Reference in New Issue