test/debug en cours de `input/phone`
This commit is contained in:
parent
84faf9484e
commit
336e8e84a8
|
@ -96,6 +96,7 @@
|
||||||
$finalid = []; // id_contact -> id_final_contact (existant ou nouveau)
|
$finalid = []; // id_contact -> id_final_contact (existant ou nouveau)
|
||||||
|
|
||||||
foreach($fiches as $f=>$ficheData){
|
foreach($fiches as $f=>$ficheData){
|
||||||
|
|
||||||
/* (1) 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['contact']]) )
|
if( !isset($contacts[$ficheData['contact']]) )
|
||||||
break;
|
break;
|
||||||
|
@ -179,6 +180,7 @@
|
||||||
/* [5] On enregistre les mini + les contacts des mini
|
/* [5] On enregistre les mini + les contacts des mini
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
foreach($mini as $miniData){
|
foreach($mini as $miniData){
|
||||||
|
|
||||||
/* (1) On récupère les données du contact associé */
|
/* (1) On récupère les données du contact associé */
|
||||||
if( !isset($contacts[$miniData['contact']]) )
|
if( !isset($contacts[$miniData['contact']]) )
|
||||||
break;
|
break;
|
||||||
|
@ -202,7 +204,7 @@
|
||||||
/* (3) Si nouveau contact */
|
/* (3) Si nouveau contact */
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
$newId = (int) ($offset+$miniData['uid']);
|
$newId = (int) ($offset+$contact['uid']);
|
||||||
$uname = $contact['username'];
|
$uname = $contact['username'];
|
||||||
|
|
||||||
$finalid[ intval($contact['uid']) ] = $newId;
|
$finalid[ intval($contact['uid']) ] = $newId;
|
||||||
|
@ -252,6 +254,7 @@
|
||||||
|
|
||||||
/* [6] On enregistre les relations de la MATRICE
|
/* [6] On enregistre les relations de la MATRICE
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
|
var_dump($finalid);
|
||||||
$clen = count($finalid);
|
$clen = count($finalid);
|
||||||
|
|
||||||
/* (1) On récupére les ids des contacts */
|
/* (1) On récupére les ids des contacts */
|
||||||
|
@ -315,344 +318,6 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* TRAITE LES DONNÉES D'UN FORMULAIRE DE TYPE TÉLÉPHONIQUE
|
|
||||||
*
|
|
||||||
* @subject<Array> Tableau contenant les données du sujet
|
|
||||||
* @contacts<Array> Tableau contenant les données des contacts
|
|
||||||
* @mini<Array> Tableau contenant les données des mini fiches relation
|
|
||||||
* @fiches<Array> Tableau contenant les données des fiches relation
|
|
||||||
*
|
|
||||||
* @return subject_id<int> Retourne l'id sujet de l'enquête
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public static function xphone($params){
|
|
||||||
extract($params);
|
|
||||||
|
|
||||||
/* [0] On récupère l'id unique actuel
|
|
||||||
=========================================================*/
|
|
||||||
$funiq = fopen( __BUILD__.'/lightdb/storage/uniqid', 'r+' );
|
|
||||||
flock($funiq, LOCK_EX); // On verrouille le fichier
|
|
||||||
$uniqid = fgets( $funiq );
|
|
||||||
|
|
||||||
if( !is_numeric($uniqid) )
|
|
||||||
$uniqid = 0;
|
|
||||||
|
|
||||||
// Décalage à appliquer à tous les ids
|
|
||||||
$offset = intval($uniqid) + 1;
|
|
||||||
|
|
||||||
// on enregistre l'id du sujet
|
|
||||||
$subject_id = $subject['subject_id'];
|
|
||||||
|
|
||||||
// Contiendra la valeur de l'id maximum
|
|
||||||
$maxId = $offset;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// /* [1] On récupère les logs s'ils existent
|
|
||||||
// =========================================================*/
|
|
||||||
// // Contiendra le contenu du fichier
|
|
||||||
$file = [
|
|
||||||
"subject" => "",
|
|
||||||
"contacts" => [],
|
|
||||||
"relations" => []
|
|
||||||
];
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* [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);
|
|
||||||
|
|
||||||
// {2.2} si n'existe pas, on a un tableau vide //
|
|
||||||
if( $lfacebook === false )
|
|
||||||
$lfacebook = [ 'contacts' => [] ];
|
|
||||||
|
|
||||||
if( !isset($lfacebook['contacts']) )
|
|
||||||
$lfacebook['contacts'] = [];
|
|
||||||
|
|
||||||
|
|
||||||
/* (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);
|
|
||||||
|
|
||||||
// {3.2} si n'existe pas, on a un tableau vide //
|
|
||||||
if( $lsurvey === false )
|
|
||||||
$lsurvey = [ 'contacts' => [] ];
|
|
||||||
|
|
||||||
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){
|
|
||||||
|
|
||||||
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){
|
|
||||||
/* (1) On récupère les données du contact associé */
|
|
||||||
if( !isset($contacts[$ficheData['uid']]) )
|
|
||||||
break;
|
|
||||||
|
|
||||||
$contact = $contacts[ $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;
|
|
||||||
|
|
||||||
/* (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
|
|
||||||
$file['contacts'][] = [
|
|
||||||
'id' => $newId,
|
|
||||||
'name' => $uname,
|
|
||||||
'sexe' => $ficheData['sexe'],
|
|
||||||
'age' => $ficheData['age'],
|
|
||||||
'studies2' => $ficheData['studies'],
|
|
||||||
'reltype' => ($ficheData['reltype']==10) ? $ficheData['reltypeSpecial'] : $ficheData['reltype'], // si 'autre' -> valeur, sinon le code
|
|
||||||
'dist' => $ficheData['loc'],
|
|
||||||
'job' => $ficheData['job'],
|
|
||||||
'famsit' => $ficheData['famsit'],
|
|
||||||
'city' => $ficheData['city'],
|
|
||||||
'cp' => $ficheData['cp'],
|
|
||||||
'quartier' => $ficheData['quartier'],
|
|
||||||
'duration' => $ficheData['duration'],
|
|
||||||
'context' => $ficheData['context'],
|
|
||||||
'contextExtra' => $ficheData['contextSpecial'],
|
|
||||||
'freq' => $ficheData['freq'],
|
|
||||||
'connect' => $ficheData['connect'],
|
|
||||||
'connectExtra' => $ficheData['connectSpecial']
|
|
||||||
];
|
|
||||||
|
|
||||||
// On enregistre la relation avec EGO
|
|
||||||
$file['relations'][] = [
|
|
||||||
'idA' => $subject_id,
|
|
||||||
'idB' => $newId,
|
|
||||||
'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']);
|
|
||||||
|
|
||||||
/* (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[$y]) && in_array($x, $matrice[$y])
|
|
||||||
|| ( isset($matrice[$x]) && in_array($y, $matrice[$x]) );
|
|
||||||
|
|
||||||
array_push($file['relations'], [
|
|
||||||
'idA' => $offset + $x,
|
|
||||||
'idB' => $offset + $y,
|
|
||||||
'type' => $relationXY ? 1 : 0 // 0->aucune relation 1->relation alter alter
|
|
||||||
]);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* [6] On enregistre tout dans 'lightdb'
|
|
||||||
=========================================================*/
|
|
||||||
$db = new lightdb('phone_db');
|
|
||||||
$db->insert( $subject_id, $file );
|
|
||||||
$db->close();
|
|
||||||
|
|
||||||
/* [7] On met à jour le nouvel ID unique
|
|
||||||
=========================================================*/
|
|
||||||
// $maxId += $offset;
|
|
||||||
rewind($funiq); // On revient au début du fichier
|
|
||||||
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);
|
|
||||||
|
|
||||||
|
|
||||||
/* [9] Gestion du retour
|
|
||||||
=========================================================*/
|
|
||||||
return [
|
|
||||||
'ModuleError' => ManagerError::Success,
|
|
||||||
'subject_id' => $subject_id
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* TRAITE LES DONNÉES D'UN FORMULAIRE DE TYPE FACEBOOK
|
/* TRAITE LES DONNÉES D'UN FORMULAIRE DE TYPE FACEBOOK
|
||||||
|
@ -846,7 +511,7 @@
|
||||||
/* (3) Si nouveau contact */
|
/* (3) Si nouveau contact */
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
$newId = (int) ($offset+$miniData['uid']);
|
$newId = (int) ($offset+$contact['uid']);
|
||||||
$uname = $contact['username'];
|
$uname = $contact['username'];
|
||||||
|
|
||||||
$finalid[ intval($contact['uid']) ] = $newId;
|
$finalid[ intval($contact['uid']) ] = $newId;
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
$index = json_decode( $fIndex->fgets(), true );
|
$index = json_decode( $fIndex->fgets(), true );
|
||||||
|
|
||||||
// Si erreur de parsage, on retourne une erreur
|
// Si erreur de parsage, on retourne une erreur
|
||||||
if( is_null($index) ) return;
|
if( is_null($index) ) throw new \Exception('[lightdb] index is null');
|
||||||
$this->index = $index;
|
$this->index = $index;
|
||||||
|
|
||||||
/* [3] Initialisation du gestionnaire d'acces (SplFileObject)
|
/* [3] Initialisation du gestionnaire d'acces (SplFileObject)
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
|
||||||
|
{"id":1,"name":"contact-x","sexe":"1","age":"6","studies2":"01","reltype":"7","dist":"1","job":"82","famsit":"0","city":"35","cp":"10025","quartier":"25","duration":["25","125"],"context":"11","contextExtra":["internet","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":2,"name":"contact-1","sexe":"0","age":"6","studies2":"06","reltype":"6","dist":"2","job":"36","famsit":"0","city":"16","cp":"10006","quartier":"6","duration":["6","16"],"context":"6","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":3,"name":"contact-2","sexe":"1","age":"7","studies2":"07","reltype":"7","dist":"3","job":"41","famsit":"0","city":"17","cp":"10007","quartier":"7","duration":["7","17"],"context":"7","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":4,"name":"contact-3","sexe":"2","age":"8","studies2":"08","reltype":"autre","dist":"0","job":"46","famsit":"0","city":"18","cp":"10008","quartier":"8","duration":["8","18"],"context":"8","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":5,"name":"contact-4","sexe":"0","age":"9","studies2":"09","reltype":"0","dist":"1","job":"47","famsit":"0","city":"19","cp":"10009","quartier":"9","duration":["9","19"],"context":"9","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":6,"name":"contact-5","sexe":"1","age":"10","studies2":"10","reltype":"1","dist":"2","job":"48","famsit":"0","city":"20","cp":"10010","quartier":"10","duration":["10","110"],"context":"10","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":7,"name":"contact-6","sexe":"2","age":"11","studies2":"11","reltype":"2","dist":"3","job":"51","famsit":"0","city":"21","cp":"10011","quartier":"11","duration":["11","111"],"context":"11","contextExtra":["internet","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":8,"name":"contact-7","sexe":"0","age":"12","studies2":"","reltype":"3","dist":"0","job":"54","famsit":"0","city":"22","cp":"10012","quartier":"12","duration":["12","112"],"context":"12","contextExtra":["","association",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":9,"name":"contact-8","sexe":"1","age":"13","studies2":"01","reltype":"4","dist":"1","job":"55","famsit":"0","city":"23","cp":"10013","quartier":"13","duration":["13","113"],"context":"13","contextExtra":["","","autre"],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":10,"name":"contact-9","sexe":"2","age":"14","studies2":"02","reltype":"5","dist":"2","job":"56","famsit":"0","city":"24","cp":"10014","quartier":"14","duration":["14","114"],"context":"0","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":11,"name":"contact-10","sexe":"0","age":"15","studies2":"03","reltype":"6","dist":"3","job":"61","famsit":"0","city":"25","cp":"10015","quartier":"15","duration":["15","115"],"context":"1","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":12,"name":"contact-11","sexe":"1","age":"16","studies2":"04","reltype":"7","dist":"0","job":"66","famsit":"0","city":"26","cp":"10016","quartier":"16","duration":["16","116"],"context":"2","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":13,"name":"contact-12","sexe":"2","age":"17","studies2":"05","reltype":"autre","dist":"1","job":"69","famsit":"0","city":"27","cp":"10017","quartier":"17","duration":["17","117"],"context":"3","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":14,"name":"contact-13","sexe":"0","age":"18","studies2":"06","reltype":"0","dist":"2","job":"71","famsit":"0","city":"28","cp":"10018","quartier":"18","duration":["18","118"],"context":"4","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":15,"name":"contact-14","sexe":"1","age":"0","studies2":"07","reltype":"1","dist":"3","job":"72","famsit":"0","city":"29","cp":"10019","quartier":"19","duration":["19","119"],"context":"5","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":16,"name":"contact-15","sexe":"2","age":"1","studies2":"08","reltype":"2","dist":"0","job":"73","famsit":"0","city":"30","cp":"10020","quartier":"20","duration":["20","120"],"context":"6","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":17,"name":"contact-16","sexe":"0","age":"2","studies2":"09","reltype":"3","dist":"1","job":"74","famsit":"0","city":"31","cp":"10021","quartier":"21","duration":["21","121"],"context":"7","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":18,"name":"contact-17","sexe":"1","age":"3","studies2":"10","reltype":"4","dist":"2","job":"75","famsit":"0","city":"32","cp":"10022","quartier":"22","duration":["22","122"],"context":"8","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":19,"name":"contact-18","sexe":"2","age":"4","studies2":"11","reltype":"5","dist":"3","job":"76","famsit":"0","city":"33","cp":"10023","quartier":"23","duration":["23","123"],"context":"9","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":20,"name":"contact-19","sexe":"0","age":"5","studies2":"","reltype":"6","dist":"0","job":"81","famsit":"0","city":"34","cp":"10024","quartier":"24","duration":["24","124"],"context":"10","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":21,"name":"contact-x","sexe":"1","age":"6","studies2":"01","reltype":"7","dist":"1","job":"82","famsit":"0","city":"35","cp":"10025","quartier":"25","duration":["25","125"],"context":"11","contextExtra":["internet","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":22,"name":"contact-1","sexe":"0","age":"6","studies2":"06","reltype":"6","dist":"2","job":"36","famsit":"0","city":"16","cp":"10006","quartier":"6","duration":["6","16"],"context":"6","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":23,"name":"contact-2","sexe":"1","age":"7","studies2":"07","reltype":"7","dist":"3","job":"41","famsit":"0","city":"17","cp":"10007","quartier":"7","duration":["7","17"],"context":"7","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":24,"name":"contact-3","sexe":"2","age":"8","studies2":"08","reltype":"autre","dist":"0","job":"46","famsit":"0","city":"18","cp":"10008","quartier":"8","duration":["8","18"],"context":"8","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":25,"name":"contact-4","sexe":"0","age":"9","studies2":"09","reltype":"0","dist":"1","job":"47","famsit":"0","city":"19","cp":"10009","quartier":"9","duration":["9","19"],"context":"9","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":26,"name":"contact-5","sexe":"1","age":"10","studies2":"10","reltype":"1","dist":"2","job":"48","famsit":"0","city":"20","cp":"10010","quartier":"10","duration":["10","110"],"context":"10","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":27,"name":"contact-6","sexe":"2","age":"11","studies2":"11","reltype":"2","dist":"3","job":"51","famsit":"0","city":"21","cp":"10011","quartier":"11","duration":["11","111"],"context":"11","contextExtra":["internet","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":28,"name":"contact-7","sexe":"0","age":"12","studies2":"","reltype":"3","dist":"0","job":"54","famsit":"0","city":"22","cp":"10012","quartier":"12","duration":["12","112"],"context":"12","contextExtra":["","association",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":29,"name":"contact-8","sexe":"1","age":"13","studies2":"01","reltype":"4","dist":"1","job":"55","famsit":"0","city":"23","cp":"10013","quartier":"13","duration":["13","113"],"context":"13","contextExtra":["","","autre"],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":30,"name":"contact-9","sexe":"2","age":"14","studies2":"02","reltype":"5","dist":"2","job":"56","famsit":"0","city":"24","cp":"10014","quartier":"14","duration":["14","114"],"context":"0","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":31,"name":"contact-10","sexe":"0","age":"15","studies2":"03","reltype":"6","dist":"3","job":"61","famsit":"0","city":"25","cp":"10015","quartier":"15","duration":["15","115"],"context":"1","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":32,"name":"contact-11","sexe":"1","age":"16","studies2":"04","reltype":"7","dist":"0","job":"66","famsit":"0","city":"26","cp":"10016","quartier":"16","duration":["16","116"],"context":"2","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":33,"name":"contact-12","sexe":"2","age":"17","studies2":"05","reltype":"autre","dist":"1","job":"69","famsit":"0","city":"27","cp":"10017","quartier":"17","duration":["17","117"],"context":"3","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":34,"name":"contact-13","sexe":"0","age":"18","studies2":"06","reltype":"0","dist":"2","job":"71","famsit":"0","city":"28","cp":"10018","quartier":"18","duration":["18","118"],"context":"4","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":35,"name":"contact-14","sexe":"1","age":"0","studies2":"07","reltype":"1","dist":"3","job":"72","famsit":"0","city":"29","cp":"10019","quartier":"19","duration":["19","119"],"context":"5","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":36,"name":"contact-15","sexe":"2","age":"1","studies2":"08","reltype":"2","dist":"0","job":"73","famsit":"0","city":"30","cp":"10020","quartier":"20","duration":["20","120"],"context":"6","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":37,"name":"contact-16","sexe":"0","age":"2","studies2":"09","reltype":"3","dist":"1","job":"74","famsit":"0","city":"31","cp":"10021","quartier":"21","duration":["21","121"],"context":"7","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":38,"name":"contact-17","sexe":"1","age":"3","studies2":"10","reltype":"4","dist":"2","job":"75","famsit":"0","city":"32","cp":"10022","quartier":"22","duration":["22","122"],"context":"8","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":39,"name":"contact-18","sexe":"2","age":"4","studies2":"11","reltype":"5","dist":"3","job":"76","famsit":"0","city":"33","cp":"10023","quartier":"23","duration":["23","123"],"context":"9","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
||||||
|
{"id":40,"name":"contact-19","sexe":"0","age":"5","studies2":"","reltype":"6","dist":"0","job":"81","famsit":"0","city":"34","cp":"10024","quartier":"24","duration":["24","124"],"context":"10","contextExtra":["","",""],"freq":["4","9","14","19","24"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""]}
|
|
@ -1 +1 @@
|
||||||
[]
|
{"1":{"line":1,"hash":"53329f79873048ac547733758e8a9748244f19d6"},"2":{"line":2,"hash":"0bd101882347c2d0611fcd650bcfd65d11889d16"},"3":{"line":3,"hash":"2c4296696863e3767381128c9c8e2f2cb6b021f5"},"4":{"line":4,"hash":"6d5ebe34615316f06f6dd3acb242d6c45fd0a4f3"},"5":{"line":5,"hash":"695fb73dd643a997d8de407c3f4833a44a7a453c"},"6":{"line":6,"hash":"986635a51581ca941ebbfc1f507c11601641f74b"},"7":{"line":7,"hash":"9b68019f94e0b453dbe036662deec231136c8ce4"},"8":{"line":8,"hash":"f7d8d23d90bcd939315cc745b96d53172d1e2be9"},"9":{"line":9,"hash":"47ea43ceb3ffac48354347e2e47f0bd90e102981"},"10":{"line":10,"hash":"1016d1c8a6aa59c58fb12d23efb44dba2e0480ae"},"11":{"line":11,"hash":"d32cf2a74a509c2d9196de6e43c8a780f9f505d0"},"12":{"line":12,"hash":"a69bf3702a807c9599b11f66fc85a4b1429d95ab"},"13":{"line":13,"hash":"60b7f129371a0e685d2a9c94cd9c1479007b5c91"},"14":{"line":14,"hash":"92f0e743b79e14dbd0a6087fd42f5a1ddbf93b26"},"15":{"line":15,"hash":"7f95b020b8958b23f759afbd54d9344f4669a535"},"16":{"line":16,"hash":"9db524430354104254d67db4051434bdc68f2d14"},"17":{"line":17,"hash":"3d7e96865f76ef6476c76b67ff49fdc2d21bce4f"},"18":{"line":18,"hash":"44bb7d8cfd73e64c74e22f8bed0d6a5667193531"},"19":{"line":19,"hash":"bff1fe0220fb48033239de52e4176c2e05393932"},"20":{"line":20,"hash":"c662345489073304966f607be98f82b58972ab67"},"21":{"line":21,"hash":"3268a838e132fb080b7dbf7a36df8071facda9e5"},"22":{"line":22,"hash":"ec674f1b5aeead8ddaad30f5b92ef844b19832ee"},"23":{"line":23,"hash":"3d5f103923637361c47a8287b67ae057eae76100"},"24":{"line":24,"hash":"e6abe915b19deb553689fb135eec736fed0cdfe6"},"25":{"line":25,"hash":"5a8a0a4d316cc94c30baff9517f17d7346667e8a"},"26":{"line":26,"hash":"d8f5dcff760645c789b443476a88bcd23328c385"},"27":{"line":27,"hash":"d118b82db5d471969cb743202827c6671795a992"},"28":{"line":28,"hash":"885766f872616d4d81895d97ed60f2b6072a1657"},"29":{"line":29,"hash":"a3e4fe59e1fdbfbfd01cf42cb5a5b1a4dce2a85a"},"30":{"line":30,"hash":"3c51638a6bff5cd6effca6d0013c623c94361bf1"},"31":{"line":31,"hash":"6f520b50be61131e3d78ea1a596a277a9af04165"},"32":{"line":32,"hash":"d85ae569d345a39a6921c62b09f5b55b0543c723"},"33":{"line":33,"hash":"1ee9df42a435ec8cfa0b3ea4a4839ecaa37b31e6"},"34":{"line":34,"hash":"60ff867709af5b4fb530ad68d17fad053e2117aa"},"35":{"line":35,"hash":"910df61f211d5d08ac07bec49f24e65b0e15df5d"},"36":{"line":36,"hash":"5874b4ea65f206fa9052d5679cbc8614c015dd02"},"37":{"line":37,"hash":"bc3fb457c6e97008d7d7ffedfd2f5c2be95ab070"},"38":{"line":38,"hash":"68fb7dc97739414cad3cd4e8f58799cf3059c09e"},"39":{"line":39,"hash":"74c17fdb061b75b87a6b561f8df7025e3dc6aa13"},"40":{"line":40,"hash":"41762132a3e4576443fc798733843450f3a55013"}}
|
|
@ -1 +0,0 @@
|
||||||
[]
|
|
|
@ -1 +0,0 @@
|
||||||
[]
|
|
|
@ -4,4 +4,4 @@
|
||||||
{"subject":{"id":4,"name":"Laurent", "surveys": [], "creation":1464788899}}
|
{"subject":{"id":4,"name":"Laurent", "surveys": [], "creation":1464788899}}
|
||||||
{"subject":{"id":5,"name":"Emilie", "surveys": [], "creation":1464788903}}
|
{"subject":{"id":5,"name":"Emilie", "surveys": [], "creation":1464788903}}
|
||||||
{"subject":{"id":6,"name":"C\u00e9line", "surveys": [], "creation":1464788905}}
|
{"subject":{"id":6,"name":"C\u00e9line", "surveys": [], "creation":1464788905}}
|
||||||
{"subject":{"id":7,"name":"Pierre", "surveys": [], "creation":1464788908}}
|
{"subject":{"id":1,"name":"Caroline","surveys":[],"creation":1464788890}}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"2":{"line":0,"hash":"8192621a7f0013e137e63edffdadea6ab7f69565"},"3":{"line":1,"hash":"a7b9d5cf6cfb41c0b100d91d053032bdad3a80da"},"4":{"line":2,"hash":"ef73002b8217c3c3b87a62b8ae4c69b3994c114f"},"5":{"line":3,"hash":"5cf77d4e920f1b418bf78484bc1766fb84baabb9"},"6":{"line":4,"hash":"356e841ad04cb0f553fe47eab88bf550d6853c60"},"7":{"line":5,"hash":"7d070210aed5df40ee7e2ca4b54f29c672d32a89"},"8":{"line":6,"hash":"9e4936de2cf03d46135bbac3589a1e3ce68fb406"}}
|
{"2":{"line":0,"hash":"a7b9d5cf6cfb41c0b100d91d053032bdad3a80da"},"3":{"line":1,"hash":"ef73002b8217c3c3b87a62b8ae4c69b3994c114f"},"4":{"line":2,"hash":"5cf77d4e920f1b418bf78484bc1766fb84baabb9"},"5":{"line":3,"hash":"356e841ad04cb0f553fe47eab88bf550d6853c60"},"6":{"line":4,"hash":"7d070210aed5df40ee7e2ca4b54f29c672d32a89"},"7":{"line":5,"hash":"9e4936de2cf03d46135bbac3589a1e3ce68fb406"},"1":{"line":6,"hash":"3220079028ee4e722040157bd2e8248cb4c7d637"}}
|
|
@ -1 +0,0 @@
|
||||||
[]
|
|
|
@ -1 +1 @@
|
||||||
4163
|
40
|
|
@ -7,7 +7,22 @@
|
||||||
$sl = new lightdb('subject');
|
$sl = new lightdb('subject');
|
||||||
$cl = new lightdb('contact');
|
$cl = new lightdb('contact');
|
||||||
|
|
||||||
var_dump("New subject survey");
|
|
||||||
|
/* [1] Remove contacts
|
||||||
|
=========================================================*/
|
||||||
|
$sub = $sl->fetch(1);
|
||||||
|
|
||||||
|
$contactIds = $sub['contacts'];
|
||||||
|
$cl->deleteAll($contactsIds);
|
||||||
|
|
||||||
|
/* [2] Reset subject
|
||||||
|
=========================================================*/
|
||||||
|
unset( $sub['contacts'] );
|
||||||
|
unset( $sub['relations'] );
|
||||||
|
$sub['subject']['surveys'] = [];
|
||||||
|
|
||||||
|
$sl->delete(1);
|
||||||
|
$sl->insert(1, $sub);
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue