Gestion des différents types de relations pour les relations
This commit is contained in:
parent
aa0c80dd08
commit
328e6ff2b9
|
@ -86,6 +86,7 @@
|
|||
/* [3] On enregistre les contacts des MINI
|
||||
=========================================================*/
|
||||
$file['contacts'] = array();
|
||||
$file['relations'] = array();
|
||||
|
||||
foreach($mini as $miniData){
|
||||
// On récupère les données du contact associé
|
||||
|
@ -94,9 +95,11 @@
|
|||
if( $miniData['uid'] > $maxId )
|
||||
$maxId = (int) $miniData['uid'];
|
||||
|
||||
$newId = $offset + $miniData['uid'];
|
||||
|
||||
// On remplit les données qui iront dans le fichier pour ce contact
|
||||
array_push($file['contacts'], array(
|
||||
'id' => $offset + $miniData['uid'],
|
||||
'id' => $newId,
|
||||
'name' => $contact['username'],
|
||||
'sexe' => $miniData['sexe'],
|
||||
'age' => $miniData['age'],
|
||||
|
@ -105,21 +108,30 @@
|
|||
'dist' => $miniData['loc']
|
||||
));
|
||||
|
||||
// On enregistre la relation avec EGO
|
||||
array_push($file['relations'], array(
|
||||
'idA' => $subject_id,
|
||||
'idB' => $newId,
|
||||
'type' => 2 // relation cellulaire mineure
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* [4] On enregistre les contacts des FICHES
|
||||
=========================================================*/
|
||||
foreach($fiches as $ficheData){
|
||||
foreach($fiches as $f=>$ficheData){
|
||||
// On récupère les données du contact associé
|
||||
$contact = $contacts[ $ficheData['uid'] ];
|
||||
|
||||
if( $ficheData['uid'] > $maxId )
|
||||
$maxId = (int) $ficheData['uid'];
|
||||
|
||||
$newId = $offset + $ficheData['uid'];
|
||||
|
||||
// On remplit les données qui iront dans le fichier pour ce contact
|
||||
array_push($file['contacts'], array(
|
||||
'id' => $offset + $ficheData['uid'],
|
||||
'id' => $newId,
|
||||
'name' => $contact['username'],
|
||||
'sexe' => $ficheData['sexe'],
|
||||
'age' => $ficheData['age'],
|
||||
|
@ -139,20 +151,52 @@
|
|||
'connectExtra' => $ficheData['connectSpecial']
|
||||
));
|
||||
|
||||
// On enregistre la relation avec EGO
|
||||
array_push($file['relations'], array(
|
||||
'idA' => $subject_id,
|
||||
'idB' => $newId,
|
||||
'type' => ($f<10) ? 4 : 5 // 4->appels 5->sms
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* [5] On enregistre les relations de la MATRICE
|
||||
=========================================================*/
|
||||
$file['relations'] = array();
|
||||
$clen = count($file['contacts']);
|
||||
|
||||
/* (1) On récupére les ids des contacts */
|
||||
$cIdList = array();
|
||||
foreach($file['contacts'] as $c=>$contact){
|
||||
$id = $contact['id'] - $offset;
|
||||
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]) );
|
||||
|
||||
foreach($matrice as $A=>$Bs)
|
||||
foreach($Bs as $B)
|
||||
array_push($file['relations'], array(
|
||||
'idA' => $offset + $A,
|
||||
'idB' => $offset + $B
|
||||
'idA' => $offset + $x,
|
||||
'idB' => $offset + $y,
|
||||
'type' => $relationXY ? 1 : 0 // 0->aucune relation 1->relation alter alter
|
||||
));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* [6] On enregistre tout dans 'lightdb'
|
||||
=========================================================*/
|
||||
|
@ -262,6 +306,7 @@
|
|||
/* [2] On enregistre les contacts des MINI
|
||||
=========================================================*/
|
||||
$file['contacts'] = array();
|
||||
$file['relations'] = array();
|
||||
|
||||
foreach($mini as $miniData){
|
||||
// On récupère les données du contact associé
|
||||
|
@ -270,9 +315,11 @@
|
|||
if( $miniData['uid'] > $maxId )
|
||||
$maxId = (int) $miniData['uid'];
|
||||
|
||||
$newId = $offset + $miniData['uid'];
|
||||
|
||||
// On remplit les données qui iront dans le fichier pour ce contact
|
||||
array_push($file['contacts'], array(
|
||||
'id' => $offset + $miniData['uid'],
|
||||
'id' => $newId,
|
||||
'name' => $contact['username'],
|
||||
'sexe' => $miniData['sexe'],
|
||||
'age' => $miniData['age'],
|
||||
|
@ -281,21 +328,30 @@
|
|||
'dist' => $miniData['loc']
|
||||
));
|
||||
|
||||
// On enregistre la relation avec EGO
|
||||
array_push($file['relations'], array(
|
||||
'idA' => $subject_id,
|
||||
'idB' => $newId,
|
||||
'type' => 3 // relation facebook mineure
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* [3] On enregistre les contacts des FICHES
|
||||
/* [4] On enregistre les contacts des FICHES
|
||||
=========================================================*/
|
||||
foreach($fiches as $ficheData){
|
||||
foreach($fiches as $f=>$ficheData){
|
||||
// On récupère les données du contact associé
|
||||
$contact = $contacts[ $ficheData['uid'] ];
|
||||
|
||||
if( $ficheData['uid'] > $maxId )
|
||||
$maxId = (int) $ficheData['uid'];
|
||||
|
||||
$newId = $offset + $ficheData['uid'];
|
||||
|
||||
// On remplit les données qui iront dans le fichier pour ce contact
|
||||
array_push($file['contacts'], array(
|
||||
'id' => $offset + $ficheData['uid'],
|
||||
'id' => $newId,
|
||||
'name' => $contact['username'],
|
||||
'sexe' => $ficheData['sexe'],
|
||||
'age' => $ficheData['age'],
|
||||
|
@ -306,6 +362,7 @@
|
|||
'famsit' => $ficheData['famsit'],
|
||||
'city' => $ficheData['city'],
|
||||
'cp' => $ficheData['cp'],
|
||||
'quartier' => $ficheData['quartier'],
|
||||
'duration' => $ficheData['duration'],
|
||||
'context' => $ficheData['context'],
|
||||
'contextExtra' => $ficheData['contextSpecial'],
|
||||
|
@ -314,20 +371,33 @@
|
|||
'connectExtra' => $ficheData['connectSpecial']
|
||||
));
|
||||
|
||||
// On enregistre la relation avec EGO
|
||||
array_push($file['relations'], array(
|
||||
'idA' => $subject_id,
|
||||
'idB' => $newId,
|
||||
'type' => ($f<10) ? 6 : 7 // 6->historique 7->messenger
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* [4] On enregistre les relations de la MATRICE
|
||||
/* [5] On enregistre les relations de la MATRICE
|
||||
=========================================================*/
|
||||
$file['relations'] = array();
|
||||
foreach($file['contacts'] as $y=>$yContact)
|
||||
foreach($file['contacts'] as $x=>$xContact)
|
||||
if( $x < $y ){ // On affiche que sous la diagonale
|
||||
|
||||
// Si relation alter-alter
|
||||
$relationXY = isset($matrice[$yContact['id']]) && in_array($xContact['id'], $matrice[$yContact['id']]);
|
||||
|
||||
foreach($matrice as $A=>$Bs)
|
||||
foreach($Bs as $B)
|
||||
array_push($file['relations'], array(
|
||||
'idA' => $offset + $A,
|
||||
'idB' => $offset + $B
|
||||
'idA' => $yContact['id'],
|
||||
'idB' => $xContact['id'],
|
||||
'type' => $relationXY ? 1 : 0 // 0->aucune relation 1->relation alter alter
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* [5] On enregistre tout dans 'lightdb'
|
||||
=========================================================*/
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
|
||||
|
||||
|
||||
"contacts": {
|
||||
"sexe": { "0":"Homme", "1":"Femme", "2":"Indéterminé" },
|
||||
"age": {
|
||||
|
@ -137,6 +136,19 @@
|
|||
"connect": {
|
||||
"0": "Oui",
|
||||
"1": "Non"
|
||||
},
|
||||
|
||||
|
||||
|
||||
"relations": {
|
||||
"0": "Aucune relation",
|
||||
"1": "Relation alter-alter",
|
||||
"2": "Relation cellulaire mineure",
|
||||
"3": "Relation facebook mineure",
|
||||
"4": "Top 10 des appels",
|
||||
"5": "Top 10 des sms",
|
||||
"6": "Top 10 de l'historique Facebook",
|
||||
"7": "Top 10 de Facebook Messenger"
|
||||
}
|
||||
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1 +1 @@
|
|||
{"1":{"line":0,"hash":"af7f39edaef1c7c03ab4a2368ee37f62a8ba09e8"}}
|
||||
{"1":{"line":0,"hash":"af7f39edaef1c7c03ab4a2368ee37f62a8ba09e8"},"377":{"line":1,"hash":"2c10278d180745a62531c4f9d53471a08a5447b1"},"376":{"line":2,"hash":"91f713507ac91faed6eb20276ecf8bd091881b60"}}
|
|
@ -1 +1 @@
|
|||
378
|
||||
3503
|
File diff suppressed because it is too large
Load Diff
|
@ -84,7 +84,7 @@ if( $getAllR->error == ManagerError::Success )
|
|||
<span class='select-container nobold'><select data-name='subject_id'>
|
||||
<option value='.' disabled selected>Identifiant</option>
|
||||
<?php foreach($allSub as $id=>$data)
|
||||
if( !isset($data['phone']) ) // Si aucune donnée pour phone
|
||||
// if( !isset($data['phone']) ) // Si aucune donnée pour phone
|
||||
echo "<option value='$id'>".$data['name']." [$id]</option>";
|
||||
?>
|
||||
</select></span>
|
||||
|
@ -207,7 +207,7 @@ if( $getAllR->error == ManagerError::Success )
|
|||
<span class='select-container nobold'><select data-name='subject_id'>
|
||||
<option value='.' disabled selected>Identifiant</option>
|
||||
<?php foreach($allSub as $id=>$data)
|
||||
if( !isset($data['facebook']) ) // Si aucune donnée pour fb
|
||||
// if( !isset($data['facebook']) ) // Si aucune donnée pour fb
|
||||
echo "<option value='$id'>".$data['name']." [$id]</option>";
|
||||
?>
|
||||
</select></span>
|
||||
|
|
Loading…
Reference in New Issue