#15; Implémentation du module 'chart/network' fonctionnelle
This commit is contained in:
parent
86656309f7
commit
a19f4d5ae9
|
@ -168,6 +168,14 @@
|
|||
"parameters": {
|
||||
"subject": { "description": "Identifiant du sujet à étudier,", "type": "id" }
|
||||
}
|
||||
},
|
||||
|
||||
"network": {
|
||||
"description": "Renvoie les données pour un graphique relationnel de type 'réseau'",
|
||||
"permissions": ["admin"],
|
||||
"parameters": {
|
||||
"subject": { "description": "Identifiant du sujet à étudier,", "type": "id" }
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -651,7 +651,7 @@
|
|||
|
||||
// Si erreur
|
||||
if( $phone === false )
|
||||
return array( 'ModuleError' => ManagerError::ModuleError );
|
||||
$phone = array();
|
||||
|
||||
/* (2) On récupère les données facebook */
|
||||
$db = new lightdb('facebook_db', __ROOT__.'/src/dynamic/');
|
||||
|
@ -660,6 +660,10 @@
|
|||
|
||||
// Si erreur
|
||||
if( $facebook === false )
|
||||
$facebook = array();
|
||||
|
||||
/* (3) Si aucune donnée, erreur */
|
||||
if( count($phone) + count($facebook) == 0 )
|
||||
return array( 'ModuleError' => ManagerError::ModuleError );
|
||||
|
||||
|
||||
|
@ -667,6 +671,46 @@
|
|||
=========================================================*/
|
||||
$nodes = array();
|
||||
|
||||
/* (1) Contacts parmi les données téléphoniques */
|
||||
if( isset($phone['contacts']) )
|
||||
foreach($phone['contacts'] as $contact)
|
||||
if( isset($contact['studies2']) )
|
||||
array_push( $nodes, array(
|
||||
'id' => $contact['id'],
|
||||
'label' => $contact['name'],
|
||||
'type' => 'phone'
|
||||
) );
|
||||
|
||||
|
||||
/* (2) Contacts parmi les données facebook */
|
||||
if( isset($facebook['contacts']) )
|
||||
foreach($facebook['contacts'] as $contact)
|
||||
if( isset($contact['studies2']) )
|
||||
array_push( $nodes, array(
|
||||
'id' => $contact['id'],
|
||||
'label' => $contact['name'],
|
||||
'type' => 'facebook'
|
||||
) );
|
||||
|
||||
|
||||
|
||||
/* [3] On récupère toutes les relations
|
||||
=========================================================*/
|
||||
$edges = array();
|
||||
|
||||
/* (1) Parmi les relations des données téléphoniques */
|
||||
if( isset($phone['relations']) )
|
||||
foreach($phone['relations'] as $relation)
|
||||
array_push($edges, array($relation['idA'], $relation['idB']) );
|
||||
|
||||
|
||||
/* (2) Parmi les relations des données facebook */
|
||||
if( isset($facebook['relations']) )
|
||||
foreach($facebook['relations'] as $relation)
|
||||
array_push($edges, array($relation['idA'], $relation['idB']) );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,14 @@
|
|||
<?php define('__ROOT__', dirname(dirname(__FILE__)) );
|
||||
|
||||
require_once __ROOT__.'/manager/autoloader.php';
|
||||
|
||||
use \manager\ModuleRequest;
|
||||
use \manager\ManagerError;
|
||||
|
||||
debug();
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
@ -6,11 +17,29 @@
|
|||
<script type='text/javascript' src='/f/js/api-min/js/lib'></script> <!-- Gestion des transactions avec le serveur -->
|
||||
</head>
|
||||
<body style='display: flex; flex-direction: row; justify-content: space-around; flex-wrap: wrap;'>
|
||||
|
||||
|
||||
<?php
|
||||
/* [1] On récupère les données
|
||||
=========================================================*/
|
||||
$req = new ModuleRequest('chart/network', array('subject'=>273));
|
||||
$res = $req->dispatch();
|
||||
|
||||
if( $res->error != ManagerError::Success )
|
||||
var_dump( ManagerError::explicit($res->error) );
|
||||
|
||||
var_dump($res->getAll());
|
||||
|
||||
|
||||
/* [2] Gestion spatiale
|
||||
=========================================================*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* [3] On affiche le contenu
|
||||
=========================================================*/
|
||||
echo "<?xml version='1.0' encoding='UTF-8' standalone='no'?>";
|
||||
echo "<svg version='1.1' style='width: 40em; height: 40em;border:1px solid black'>";
|
||||
echo "<svg version='1.1' width='1000' height='1000' style='width: 40em; height: 40em;border:1px solid black'>";
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue