Compare commits
72 Commits
feature/ad
...
master
Author | SHA1 | Date |
---|---|---|
xdrm-brackets | 49a3056dcd | |
xdrm-brackets | c37c749087 | |
xdrm-brackets | 142cbff763 | |
xdrm-brackets | 24ba120631 | |
xdrm-brackets | 8b30dbb4d2 | |
xdrm-brackets | 255af4d6b0 | |
xdrm-brackets | 38e479c73c | |
xdrm-brackets | 4573343a94 | |
xdrm-brackets | c2f65a0227 | |
xdrm-brackets | 4175fef281 | |
xdrm-brackets | 0810d0be8e | |
xdrm-brackets | 90d79cf103 | |
xdrm-brackets | 44519c6484 | |
xdrm-brackets | be7fb63f9c | |
xdrm-brackets | bef99c46f8 | |
xdrm-brackets | 4dcc20e470 | |
xdrm-brackets | b5def6ffe8 | |
xdrm-brackets | f980ddd41d | |
xdrm-brackets | 29cacfa11e | |
xdrm-brackets | 0fd0aabd59 | |
xdrm-brackets | e888b04d50 | |
xdrm-brackets | 6be5358247 | |
xdrm-brackets | 6af402fa80 | |
xdrm-brackets | 2b40b7f9cf | |
xdrm-brackets | 0ded7f6bdf | |
xdrm-brackets | aebde78785 | |
xdrm-brackets | 164f3cd4ef | |
xdrm-brackets | 601c7f4ab6 | |
xdrm-brackets | f1d1fe00da | |
xdrm-brackets | 96e5111d5f | |
xdrm-brackets | 91e847789d | |
xdrm-brackets | 3a5d1c54d2 | |
xdrm-brackets | cda98e2fd8 | |
xdrm-brackets | fe9ade8717 | |
xdrm-brackets | 92db51d7aa | |
xdrm-brackets | 89d804a127 | |
xdrm-brackets | a5cbdcb429 | |
xdrm-brackets | ac2d70835b | |
xdrm-brackets | 009b463319 | |
xdrm-brackets | 623b75e67f | |
xdrm-brackets | 361858e604 | |
xdrm-brackets | 4272d15f29 | |
xdrm-brackets | 41a9480e49 | |
xdrm-brackets | 93de3e8c2c | |
xdrm-brackets | 7526e780ad | |
Adrien Marques | 4f56e9e009 | |
xdrm-brackets | 7b253bcff5 | |
xdrm-brackets | 3633d9f344 | |
xdrm-brackets | 8c6fbd9a74 | |
xdrm-brackets | 05aacfdad3 | |
xdrm-brackets | f2da5085f7 | |
xdrm-brackets | 336e8e84a8 | |
xdrm-brackets | 84faf9484e | |
xdrm-brackets | addd51a627 | |
xdrm-brackets | 52740e1ae4 | |
xdrm-brackets | 93112cdd44 | |
xdrm-brackets | fd724ece9d | |
xdrm-brackets | e67b59d110 | |
xdrm-brackets | f875c9dc53 | |
xdrm-brackets | b446ecd09e | |
xdrm-brackets | 4eaf463928 | |
xdrm-brackets | 07e000d8e3 | |
xdrm-brackets | 3c66937ec7 | |
xdrm-brackets | 3d2a4b02ae | |
xdrm-brackets | aa25bf3693 | |
xdrm-brackets | 7626adf3d5 | |
xdrm-brackets | 26f974ef1e | |
xdrm-brackets | a56bd2cc61 | |
xdrm-brackets | fe569b5b31 | |
xdrm-brackets | e77e326a1f | |
xdrm-brackets | 65a1883a53 | |
xdrm-brackets | 64e3ce58ac |
|
@ -1,3 +1,11 @@
|
|||
.ftpconfig
|
||||
sftp-config.json
|
||||
phpunit/coverage/
|
||||
/public_html/tmp/*
|
||||
<<<<<<< HEAD
|
||||
/build/lightdb/storage/*
|
||||
/config/server.json
|
||||
=======
|
||||
/build/lightdb/storage/*/data
|
||||
**.swp
|
||||
>>>>>>> 255af4d6b03408ab9f840db1fea74a35b7bc28c4
|
||||
|
|
|
@ -2,10 +2,11 @@
|
|||
|
||||
/* [1] On definit les chemins absolus si c'est pas deja fait
|
||||
=========================================================*/
|
||||
if( !defined('__ROOT__') ) define('__ROOT__', dirname(__FILE__) );
|
||||
if( !defined('__CONFIG__') ) define('__CONFIG__', __ROOT__.'/config' );
|
||||
if( !defined('__BUILD__') ) define('__BUILD__', __ROOT__.'/build' );
|
||||
if( !defined('__PUBLIC__') ) define('__PUBLIC__', __ROOT__.'/public_html' );
|
||||
if( !defined('__ROOT__') ) define('__ROOT__', dirname(__FILE__) );
|
||||
if( !defined('__CONFIG__') ) define('__CONFIG__', __ROOT__.'/config' );
|
||||
if( !defined('__BUILD__') ) define('__BUILD__', __ROOT__.'/build' );
|
||||
if( !defined('__PUBLIC__') ) define('__PUBLIC__', __ROOT__.'/public_html' );
|
||||
if( !defined('__TMP__') ) define('__TMP__', __ROOT__.'/public_html/tmp' );
|
||||
|
||||
|
||||
/* ACTIVE LE DEBUGGAGE (WARNING + EXCEPTION)
|
||||
|
@ -18,6 +19,9 @@
|
|||
}
|
||||
|
||||
|
||||
// Loads the build facade
|
||||
// require_once __BUILD__.'/Builder.php';
|
||||
|
||||
|
||||
/* AUTOLOADER
|
||||
*
|
||||
|
@ -48,11 +52,10 @@
|
|||
\manager\sessionManager::session_start();
|
||||
|
||||
|
||||
|
||||
/* [3] Gestion des droits des utilisateurs
|
||||
=========================================================*/
|
||||
/* (1) Retourne si l'utilisateur est connecte ou non */
|
||||
function connected(){ return isset($_SESSION['permission']) && count($_SESSION['permission']); }
|
||||
function connected(){ return isset($_SESSION['permission']) && is_array($_SESSION['permission']) && count($_SESSION['permission']) > 0; }
|
||||
|
||||
/* (2) Retourne si l'utilisateur a le status en question */
|
||||
function permission($type){ return connected() && in_array($type, $_SESSION['permission']); }
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
/**************************
|
||||
* Builder *
|
||||
* 05-11-16 *
|
||||
***************************
|
||||
* Designed & Developed by *
|
||||
* xdrm-brackets *
|
||||
***************************
|
||||
* https://xdrm.io/ *
|
||||
**************************/
|
||||
|
||||
|
||||
|
||||
class Builder{
|
||||
|
||||
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace api\core;
|
||||
use \database\core\Database;
|
||||
use \database\core\DatabaseDriver;
|
||||
use \manager\ManagerError;
|
||||
use \api\core\Checker;
|
||||
use \database\core\Repo;
|
||||
|
||||
|
||||
class ModuleRequest{
|
||||
|
@ -106,7 +107,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
/* EXECUTE LE TRAITEMENT ASSOCIE ET REMPLIE LA REPONSE
|
||||
*
|
||||
* @return answer<ModuleResponse> Retourne une reponse de type <ModuleResponse> si tout s'est bien passe
|
||||
|
@ -146,13 +146,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* EXECUTE LE TRAITEMENT ASSOCIE ET RENVOIE UN FICHIER AVEC LE HEADER ET LE BODY SPECIFIE
|
||||
*
|
||||
*/
|
||||
|
@ -201,12 +194,12 @@
|
|||
=========================================================*/
|
||||
if( $fromAjax ){
|
||||
|
||||
|
||||
$tmpfname = '/tmp/download_'.uniqid().'.php';
|
||||
$bodyfname = __BUILD__.'/tmp/content_'.uniqid().'.php';
|
||||
$tmpfname = 'download_'.uniqid().'.php';
|
||||
$link = '/tmp/'.$tmpfname;
|
||||
$bodyfname = __TMP__.'/content_'.uniqid().'.php';
|
||||
|
||||
/* (1) On crée le fichier temporaire */
|
||||
$tmpfnameroot = __BUILD__.$tmpfname;
|
||||
$tmpfnameroot = __TMP__.'/'.$tmpfname;
|
||||
$tmpfile = fopen($tmpfnameroot, 'w');
|
||||
|
||||
fwrite($tmpfile, '<?php'.PHP_EOL);
|
||||
|
@ -235,7 +228,7 @@
|
|||
chmod($tmpfnameroot, 0775);
|
||||
|
||||
$response = new ModuleResponse(ManagerError::Success);
|
||||
$response->append('link', $tmpfname);
|
||||
$response->append('link', $link);
|
||||
|
||||
return $response;
|
||||
|
||||
|
@ -309,9 +302,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* VERIFICATION DU FORMAT ET DE LA COHERENCE DU CHEMIN SPECIFIE
|
||||
*
|
||||
* @path<String> String correspondant au chemin de delegation ("module/methode")
|
||||
|
@ -359,10 +349,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* RETOURNE SI ON A LA PERMISSION D'EXECUTER CETTE METHODE
|
||||
*
|
||||
* @token<String> Token d'acces a l'API (OPTIONNEL)
|
||||
|
@ -430,8 +416,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* VERIFICATION DU TYPE DES PARAMETRES ENVOYES
|
||||
*
|
||||
* @params<Array> Tableau associatif contenant les parametres
|
||||
|
@ -492,9 +476,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* AJOUT DES OPTIONS A PARTIR DE LA CONFIGURATION
|
||||
*
|
||||
*/
|
||||
|
@ -535,9 +516,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* RENVOI LE CHEMIN D'AMORCAGE DE LA METHODE
|
||||
*
|
||||
* @return path<Array> Retourne le chemin d'amorcage de la requete
|
||||
|
|
|
@ -141,7 +141,7 @@
|
|||
ManagerError::setHttpCode($this->error);
|
||||
|
||||
// Type de contenu
|
||||
// header('Content-Type: application/json');
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
|
||||
// On rajoute l'erreur au message
|
||||
$returnData = array_merge(
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace api\module;
|
||||
use \database\core\Database;
|
||||
use \database\core\DatabaseDriver;
|
||||
use \manager\sessionManager;
|
||||
use \api\core\ModuleRequest;
|
||||
use \manager\ManagerError;
|
||||
|
@ -116,23 +116,9 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* DOWNLOAD D'UN FICHIER CONTENANT LES DONNEES SELECTIONNEES
|
||||
*
|
||||
* @subjects<Array> Liste des identifiants des sujets à prendre en compte
|
||||
* @phone<Boolean> Si TRUE, prend en compte les données des questionnaires cellulaires
|
||||
* @facebook<Boolean> Si TRUE, prend en compte les données des questionnaires facebook
|
||||
* @survey<Boolean> Si TRUE, prend en compte les données des questionnaires ResTIC
|
||||
* @all<Boolean> Si TRUE, prend en compte tous les sujets (annule @subjects)
|
||||
*
|
||||
* @return data<File> Retourne une archive .zip contenant toutes les données sélectionnées
|
||||
|
@ -142,15 +128,12 @@
|
|||
extract($params);
|
||||
|
||||
/* (0) Gestion du formattage des paramètres */
|
||||
$subjects = !is_array($subjects) ? [] : $subjects;
|
||||
$phone = !is_bool($phone) ? false : $phone;
|
||||
$facebook = !is_bool($facebook) ? false : $facebook;
|
||||
$survey = !is_bool($survey) ? false : $survey;
|
||||
$all = !is_bool($all) ? false : $all;
|
||||
$subjects = !is_array($subjects) ? [] : $subjects;
|
||||
$all = !is_bool($all) ? false : $all;
|
||||
|
||||
/* [0] On récupère le dictionnaire
|
||||
=========================================================*/
|
||||
$dict = file_get_contents(__BUILD__.'/src/dynamic/dictionary.json');
|
||||
$dict = file_get_contents(__BUILD__.'/lightdb/storage/dictionary.json');
|
||||
|
||||
/* (2) Si une erreur pour le fichier de conf */
|
||||
if( $dict === false )
|
||||
|
@ -164,158 +147,119 @@
|
|||
return [ 'ModuleError' => ManagerError::ParsingFailed ];
|
||||
|
||||
|
||||
/* [1] On construit l'arborescence des données
|
||||
/* [1] Initialisation
|
||||
=========================================================*/
|
||||
/* (1) Fichiers de sortie */
|
||||
$output = [
|
||||
'common_' => [
|
||||
'contacts' => '',
|
||||
'relations' => '',
|
||||
'dict' => ''
|
||||
]
|
||||
'contacts.fiche' => '', // contiendra les contacts et leurs données fiches
|
||||
'contacts.mini' => '', // contiendra les contacts et leurs données mini
|
||||
'relations' => '', // contiendra les relations
|
||||
'dict' => '' // contiendra le dictionnaire de valeurs
|
||||
];
|
||||
|
||||
/* (2) Base de données */
|
||||
$subjectdb = new lightdb('subject');
|
||||
$contactdb = new lightdb('contact');
|
||||
|
||||
|
||||
/* [2] On construit les fichiers de chaque sujet DE TELEPHONE
|
||||
/* [2] On construit la liste des sujets
|
||||
=========================================================*/
|
||||
if( $phone ){ // Si @phone vaut TRUE
|
||||
$subjectindexes = array_keys($subjectdb->index());
|
||||
$subjectids = [];
|
||||
|
||||
// On ouvre une instance de la base de données
|
||||
$db = new lightdb('phone_db');
|
||||
/* (1) On récupère tous les sujets si c'est spécifié */
|
||||
if( $all )
|
||||
|
||||
// Si on doit prendre tous les sujets, on les récupère
|
||||
if( $all )
|
||||
$subjects = array_keys( $db->index() );
|
||||
$subjectids = $subjectindexes;
|
||||
|
||||
// Pour chaque sujet
|
||||
foreach($subjects as $s=>$subjectId){
|
||||
/* (2) Sinon on retire les ids incorrects */
|
||||
else
|
||||
|
||||
/* (1) On récupère les données du sujet en cours */
|
||||
$subjectData = $db->fetch($subjectId);
|
||||
foreach($subjects as $i=>$id)
|
||||
if( in_array($id, $subjectindexes) )
|
||||
$subjectids[] = intval($id);
|
||||
|
||||
// Si on ne trouve rien, on passe au suivant
|
||||
if( $subjectData === false )
|
||||
|
||||
|
||||
/* (3) Si aucun sujet restant -> error */
|
||||
if( count($subjectids) === 0 )
|
||||
return ['ModuleError' => ManagerError::ParamError];
|
||||
|
||||
|
||||
/* [3] Export contacts/relations des sujets selectionnés
|
||||
=========================================================*/
|
||||
foreach($subjectids as $subid){
|
||||
|
||||
/* (1) On récupère les données du sujet */
|
||||
$subject = $subjectdb->fetch($subid);
|
||||
|
||||
// si pas trouvé -> suivant
|
||||
if( $subject === false )
|
||||
continue;
|
||||
|
||||
/* (2) Si aucun contact -> suivant */
|
||||
if( !isset($subject['contacts']) || !is_array($subject['contacts']) )
|
||||
continue;
|
||||
|
||||
/* (3) Pour chaque contact */
|
||||
foreach($subject['contacts'] as $c=>$contactid){
|
||||
|
||||
// {3.1} On récupère le contact //
|
||||
$contact = $contactdb->fetch($contactid);
|
||||
|
||||
// si pas trouvé -> suivant
|
||||
if( $contact === false )
|
||||
continue;
|
||||
|
||||
/* (3) On complète les relations */
|
||||
$output['common_']['relations'] .= self::parseCSV($subjectData['relations'], [], strlen($output['common_']['relations']) == 0 ); // On affiche les colonnes pour la première fois uniquement
|
||||
// {3.2} On ajoute le contact au fichier des FICHES //
|
||||
if( array_key_exists('studies2', $contact) )
|
||||
// On affiche les colonnes pour le premier contact uniquement
|
||||
$output['contacts.fiche'] .= self::parseCSV([$contact], $dict['contacts'], strlen($output['contacts.fiche']) == 0 );
|
||||
|
||||
/* (4) On ajoute les contacts à la liste */
|
||||
$output['common_']['contacts'] .= self::parseCSV($subjectData['contacts'], $dict['contacts'], strlen($output['common_']['contacts']) == 0 ); // On affiche les colonnes pour la première fois uniquement
|
||||
// {3.3} On ajoute le contact au fichier des MINI //
|
||||
if( array_key_exists('studies1', $contact) )
|
||||
// On affiche les colonnes pour le premier contact uniquement
|
||||
$output['contacts.mini'] .= self::parseCSV([$contact], $dict['contacts'], strlen($output['contacts.mini']) == 0 );
|
||||
|
||||
}
|
||||
|
||||
// On ferme l'instance de la base de données
|
||||
$db->close();
|
||||
// On ajoute le sujet à la liste des contacts
|
||||
$output['contacts.mini'] .= self::parseCSV([[
|
||||
'id' => $subid,
|
||||
'name' => $subject['subject']['name']
|
||||
]], [], strlen($output['contacts.mini']) == 0);
|
||||
|
||||
/* (4) Si aucune relation -> suivant */
|
||||
if( !isset($subject['relations']) || !is_array($subject['relations']) )
|
||||
continue;
|
||||
|
||||
/* (5) On ajoute les relations */
|
||||
$output['relations'] .= self::parseCSV($subject['relations'], [], strlen($output['relations']) == 0 );
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* [3] On construit les fichiers de chaque sujet DE FACEBOOK
|
||||
=========================================================*/
|
||||
if( $facebook ){ // Si @facebook vaut TRUE
|
||||
|
||||
// On ouvre une instance de la base de données
|
||||
$db = new lightdb('facebook_db');
|
||||
|
||||
// Si on doit prendre tous les sujets, on les récupère
|
||||
if( $all )
|
||||
$subjects = array_keys( $db->index() );
|
||||
|
||||
// Pour chaque sujet
|
||||
foreach($subjects as $s=>$subjectId){
|
||||
|
||||
/* (1) On récupère les données du sujet en cours */
|
||||
$subjectData = $db->fetch($subjectId);
|
||||
|
||||
// Si on ne trouve rien, on passe au suivant
|
||||
if( $subjectData === false )
|
||||
continue;
|
||||
|
||||
/* (2) On complète les relations */
|
||||
$output['common_']['relations'] .= self::parseCSV($subjectData['relations'], [], strlen($output['common_']['relations']) == 0 ); // On affiche les colonnes pour la première fois uniquement
|
||||
|
||||
/* (3) On ajoute les contacts à la liste */
|
||||
$output['common_']['contacts'] .= self::parseCSV($subjectData['contacts'], $dict['contacts'], strlen($output['common_']['contacts']) == 0 ); // On affiche les colonnes pour la première fois uniquement
|
||||
|
||||
}
|
||||
|
||||
// On ferme l'instance de la base de données
|
||||
$db->close();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* [4] On construit les fichiers de chaque sujet DE FORMULAIRE
|
||||
=========================================================*/
|
||||
if( $survey ){ // Si @survey vaut TRUE
|
||||
|
||||
// On ouvre une instance de la base de données
|
||||
$db = new lightdb('survey_db');
|
||||
|
||||
// Si on doit prendre tous les sujets, on les récupère
|
||||
if( $all )
|
||||
$subjects = array_keys( $db->index() );
|
||||
|
||||
// Pour chaque sujet
|
||||
foreach($subjects as $s=>$subjectId){
|
||||
|
||||
/* (1) On récupère les données du sujet en cours */
|
||||
$subjectData = $db->fetch($subjectId);
|
||||
|
||||
// Si on ne trouve rien, on passe au suivant
|
||||
if( $subjectData === false )
|
||||
continue;
|
||||
|
||||
/* (2) On complète les relations */
|
||||
$output['common_']['relations'] .= self::parseCSV($subjectData['relations'], [], strlen($output['common_']['relations']) == 0 ); // On affiche les colonnes pour la première fois uniquement
|
||||
|
||||
/* (3) On ajoute les contacts à la liste */
|
||||
$output['common_']['contacts'] .= self::parseCSV($subjectData['contacts'], $dict['contacts'], strlen($output['common_']['contacts']) == 0 ); // On affiche les colonnes pour la première fois uniquement
|
||||
|
||||
}
|
||||
|
||||
// On ferme l'instance de la base de données
|
||||
$db->close();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* [5] On ajoute le dictionnaire
|
||||
=========================================================*/
|
||||
$output['common_']['dict'] .= "\"sheet\";\"field\";\"key\";\"value\"\r\n";
|
||||
$output['dict'] .= "\"sheet\";\"field\";\"key\";\"value\"\r\n";
|
||||
foreach($dict as $ds=>$dataset)
|
||||
foreach($dataset as $f=>$field)
|
||||
foreach($field as $key=>$value)
|
||||
$output['common_']['dict'] .= "\"$ds\";\"$f\";\"$key\";\"$value\"\r\n";
|
||||
$output['dict'] .= "\"$ds\";\"$f\";\"$key\";\"$value\"\r\n";
|
||||
|
||||
|
||||
/* [6] Création de l'archive
|
||||
=========================================================*/
|
||||
$zip = new \ZipArchive();
|
||||
$fname = '/tmp/'.time().'.zip';
|
||||
$fname = __TMP__.'/'.time().'.zip';
|
||||
$zip->open($fname, \ZipArchive::CREATE);
|
||||
|
||||
foreach($output as $folder=>$files){
|
||||
|
||||
foreach($files as $file=>$content)
|
||||
if( strlen($content) > 0 )
|
||||
$zip->addFromString($folder.$file.'.csv', $content);
|
||||
}
|
||||
foreach($output as $file=>$content)
|
||||
if( strlen($content) > 0 )
|
||||
$zip->addFromString($file.'.csv', $content);
|
||||
|
||||
$zip->close();
|
||||
|
||||
|
@ -349,9 +293,6 @@
|
|||
/* EXPORT POUR GEPHI OU AUTRE LOGICIEL SUR LE PRINCIPE NODES+EDGES
|
||||
*
|
||||
* @subjects<Array> Liste des identifiants des sujets à prendre en compte
|
||||
* @phone<Boolean> Si TRUE, prend en compte les données des questionnaires cellulaires
|
||||
* @facebook<Boolean> Si TRUE, prend en compte les données des questionnaires facebook
|
||||
* @survey<Boolean> Si TRUE, prend en compte les données des questionnaires ResTIC
|
||||
* @all<Boolean> Si TRUE, prend en compte tous les sujets (annule @subjects)
|
||||
*
|
||||
* @return data<File> Retourne une archive .zip contenant toutes les données sélectionnées
|
||||
|
@ -360,15 +301,12 @@
|
|||
extract($params);
|
||||
|
||||
/* (0) Gestion du formattage des paramètres */
|
||||
$subjects = !is_array($subjects) ? [] : $subjects;
|
||||
$phone = !is_bool($phone) ? false : $phone;
|
||||
$facebook = !is_bool($facebook) ? false : $facebook;
|
||||
$survey = !is_bool($survey) ? false : $survey;
|
||||
$all = !is_bool($all) ? false : $all;
|
||||
$subjects = !is_array($subjects) ? [] : $subjects;
|
||||
$all = !is_bool($all) ? false : $all;
|
||||
|
||||
/* [0] On récupère le dictionnaire
|
||||
=========================================================*/
|
||||
$dict = file_get_contents(__BUILD__.'/src/dynamic/dictionary.json');
|
||||
$dict = file_get_contents(__BUILD__.'/lightdb/storage/dictionary.json');
|
||||
|
||||
/* (2) Si une erreur pour le fichier de conf */
|
||||
if( $dict === false )
|
||||
|
@ -382,198 +320,132 @@
|
|||
return [ 'ModuleError' => ManagerError::ParsingFailed ];
|
||||
|
||||
|
||||
/* [1] On construit l'arborescence des données
|
||||
/* [1] Initialisation
|
||||
=========================================================*/
|
||||
/* (1) Fichiers de sortie */
|
||||
$output = [
|
||||
'common_' => [
|
||||
'contacts' => '',
|
||||
'relations' => '',
|
||||
'dict' => ''
|
||||
],
|
||||
'logs/' => [] // Contiendra les journaux d'appels
|
||||
'gephi.nodes' => '', // contiendra les contacts et leurs données
|
||||
'gephi.edges' => '', // contiendra les relations
|
||||
'dict' => '' // contiendra le dictionnaire de valeurs
|
||||
];
|
||||
|
||||
/* (2) Base de données */
|
||||
$subjectdb = new lightdb('subject');
|
||||
$contactdb = new lightdb('contact');
|
||||
|
||||
|
||||
/* [2] On construit les fichiers de chaque sujet DE TELEPHONE
|
||||
/* [2] On construit la liste des sujets
|
||||
=========================================================*/
|
||||
if( $phone ){ // Si @phone vaut TRUE
|
||||
$subjectindexes = array_keys($subjectdb->index());
|
||||
$subjectids = [];
|
||||
|
||||
// On ouvre une instance de la base de données
|
||||
$db = new lightdb('phone_db');
|
||||
/* (1) On récupère tous les sujets si c'est spécifié */
|
||||
if( $all )
|
||||
|
||||
// Si on doit prendre tous les sujets, on les récupère
|
||||
if( $all )
|
||||
$subjects = array_keys( $db->index() );
|
||||
$subjectids = $subjectindexes;
|
||||
|
||||
// Pour chaque sujet
|
||||
foreach($subjects as $s=>$subjectId){
|
||||
/* (2) Sinon on retire les ids incorrects */
|
||||
else
|
||||
|
||||
/* (1) On récupère les données du sujet en cours */
|
||||
$subjectData = $db->fetch($subjectId);
|
||||
foreach($subjects as $i=>$id)
|
||||
if( in_array($id, $subjectindexes) )
|
||||
$subjectids[] = intval($id);
|
||||
|
||||
// Si on ne trouve rien, on passe au suivant
|
||||
if( $subjectData === false )
|
||||
|
||||
|
||||
/* (3) Si aucun sujet restant -> error */
|
||||
if( count($subjectids) === 0 )
|
||||
return ['ModuleError' => ManagerError::ParamError];
|
||||
|
||||
|
||||
/* [3] Export contacts/relations des sujets selectionnés
|
||||
=========================================================*/
|
||||
foreach($subjectids as $subid){
|
||||
|
||||
/* (1) On récupère les données du sujet */
|
||||
$subject = $subjectdb->fetch($subid);
|
||||
|
||||
// si pas trouvé -> suivant
|
||||
if( $subject === false )
|
||||
continue;
|
||||
|
||||
/* (2) Si aucun contact -> suivant */
|
||||
if( !isset($subject['contacts']) || !is_array($subject['contacts']) )
|
||||
continue;
|
||||
|
||||
/* (3) Pour chaque contact */
|
||||
foreach($subject['contacts'] as $c=>$contactid){
|
||||
|
||||
// {3.1} On récupère le contact //
|
||||
$contact = $contactdb->fetch($contactid);
|
||||
|
||||
// si pas trouvé -> suivant
|
||||
if( $contact === false )
|
||||
continue;
|
||||
|
||||
/* (2) On construit le log s'il existe */
|
||||
$output['logs/'][$subjectId] = self::parseCSV($subjectData['logs'], $dict['logs']);
|
||||
// {3.2} On ajoute le contact au fichier des FICHES //
|
||||
if( array_key_exists('studies2', $contact) ){
|
||||
// On affiche les colonnes pour le premier contact uniquement
|
||||
$contact['type'] = 'fiche';
|
||||
$output['gephi.nodes'] .= self::parseCSV([$contact], $dict['contacts'], strlen($output['gephi.nodes']) == 0 );
|
||||
|
||||
/* (3) On complète les relations */
|
||||
// {1} On retire les valeurs ou le type = 0 //
|
||||
$formattedRelations = [];
|
||||
foreach($subjectData['relations'] as $i=>$relation)
|
||||
if( $relation['type'] != 0 )
|
||||
array_push($formattedRelations, [
|
||||
'source' => $relation['idA'],
|
||||
'target' => $relation['idB'],
|
||||
'weight' => ($relation['idA']==$subjectId) ? .1 : 1, // plus de poids aux relations alter/alter
|
||||
'type' => 'Undirected'
|
||||
]);
|
||||
|
||||
// {2} On ajoute au contenu //
|
||||
$output['common_']['relations'] .= self::parseCSV($formattedRelations, [], strlen($output['common_']['relations']) == 0 ); // On affiche les colonnes pour la première fois uniquement
|
||||
|
||||
/* (4) On ajoute les contacts à la liste */
|
||||
$output['common_']['contacts'] .= self::parseCSV($subjectData['contacts'], $dict['contacts'], strlen($output['common_']['contacts']) == 0 ); // On affiche les colonnes pour la première fois uniquement
|
||||
// {3.3} On ajoute le contact au fichier des MINI //
|
||||
}elseif( array_key_exists('studies1', $contact) ){
|
||||
// On affiche les colonnes pour le premier contact uniquement
|
||||
$contact['type'] = 'mini';
|
||||
$output['gephi.nodes'] .= self::parseCSV([$contact], $dict['contacts'], strlen($output['gephi.nodes']) == 0 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// On ferme l'instance de la base de données
|
||||
$db->close();
|
||||
// On ajoute le sujet à la liste des contacts
|
||||
$output['gephi.nodes'] .= self::parseCSV([[
|
||||
'id' => $subid,
|
||||
'name' => $subject['subject']['name']
|
||||
]], [], strlen($output['gephi.nodes']) == 0);
|
||||
|
||||
/* (4) Si aucune relation -> suivant */
|
||||
if( !isset($subject['relations']) || !is_array($subject['relations']) )
|
||||
continue;
|
||||
|
||||
/* (5) On ajoute les relations */
|
||||
foreach($subject['relations'] as $r=>$rel)
|
||||
|
||||
$output['gephi.edges'] .= self::parseCSV(
|
||||
[[
|
||||
'source' => $rel['idA'],
|
||||
'target' => $rel['idB'],
|
||||
'weight' => ($rel['idA']==$subid) ? .5 : 1,
|
||||
'type' => 'Undirected'
|
||||
]],
|
||||
[],
|
||||
strlen($output['gephi.edges']) == 0
|
||||
);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* [3] On construit les fichiers de chaque sujet DE FACEBOOK
|
||||
=========================================================*/
|
||||
if( $facebook ){ // Si @facebook vaut TRUE
|
||||
|
||||
// On ouvre une instance de la base de données
|
||||
$db = new lightdb('facebook_db');
|
||||
|
||||
// Si on doit prendre tous les sujets, on les récupère
|
||||
if( $all )
|
||||
$subjects = array_keys( $db->index() );
|
||||
|
||||
// Pour chaque sujet
|
||||
foreach($subjects as $s=>$subjectId){
|
||||
|
||||
/* (1) On récupère les données du sujet en cours */
|
||||
$subjectData = $db->fetch($subjectId);
|
||||
|
||||
// Si on ne trouve rien, on passe au suivant
|
||||
if( $subjectData === false )
|
||||
continue;
|
||||
|
||||
/* (2) On complète les relations */
|
||||
// {1} On retire les valeurs ou le type = 0 //
|
||||
$formattedRelations = [];
|
||||
foreach($subjectData['relations'] as $i=>$relation)
|
||||
if( $relation['type'] != 0 )
|
||||
array_push($formattedRelations, [
|
||||
'source' => $relation['idA'],
|
||||
'target' => $relation['idB'],
|
||||
'weight' => ($relation['idA']==$subjectId) ? .1 : 1, // plus de poids aux relations alter/alter
|
||||
'type' => 'Undirected'
|
||||
]);
|
||||
|
||||
// {2} On ajoute au contenu //
|
||||
$output['common_']['relations'] .= self::parseCSV($formattedRelations, [], strlen($output['common_']['relations']) == 0 ); // On affiche les colonnes pour la première fois uniquement
|
||||
|
||||
/* (3) On ajoute les contacts à la liste */
|
||||
$output['common_']['contacts'] .= self::parseCSV($subjectData['contacts'], $dict['contacts'], strlen($output['common_']['contacts']) == 0 ); // On affiche les colonnes pour la première fois uniquement
|
||||
|
||||
}
|
||||
|
||||
// On ferme l'instance de la base de données
|
||||
$db->close();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* [4] On construit les fichiers de chaque sujet DE FORMULAIRE
|
||||
=========================================================*/
|
||||
if( $survey ){ // Si @survey vaut TRUE
|
||||
|
||||
// On ouvre une instance de la base de données
|
||||
$db = new lightdb('survey_db');
|
||||
|
||||
// Si on doit prendre tous les sujets, on les récupère
|
||||
if( $all )
|
||||
$subjects = array_keys( $db->index() );
|
||||
|
||||
// Pour chaque sujet
|
||||
foreach($subjects as $s=>$subjectId){
|
||||
|
||||
/* (1) On récupère les données du sujet en cours */
|
||||
$subjectData = $db->fetch($subjectId);
|
||||
|
||||
// Si on ne trouve rien, on passe au suivant
|
||||
if( $subjectData === false )
|
||||
continue;
|
||||
|
||||
/* (2) On complète les relations */
|
||||
// {1} On retire les valeurs ou le type = 0 //
|
||||
$formattedRelations = [];
|
||||
foreach($subjectData['relations'] as $i=>$relation)
|
||||
if( $relation['type'] != 0 ) // On retire les relations ego/alter
|
||||
array_push($formattedRelations, [
|
||||
'source' => $relation['idA'],
|
||||
'target' => $relation['idB'],
|
||||
'weight' => ($relation['idA']==$subjectId) ? .1 : 1, // plus de poids aux relations alter/alter
|
||||
'type' => 'Undirected'
|
||||
]);
|
||||
|
||||
// {2} On ajoute au contenu //
|
||||
$output['common_']['relations'] .= self::parseCSV($formattedRelations, [], strlen($output['common_']['relations']) == 0 ); // On affiche les colonnes pour la première fois uniquement
|
||||
|
||||
/* (3) On ajoute les contacts à la liste */
|
||||
$output['common_']['contacts'] .= self::parseCSV($subjectData['contacts'], $dict['contacts'], strlen($output['common_']['contacts']) == 0 ); // On affiche les colonnes pour la première fois uniquement
|
||||
|
||||
}
|
||||
|
||||
// On ferme l'instance de la base de données
|
||||
$db->close();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* [5] On ajoute le dictionnaire
|
||||
=========================================================*/
|
||||
$output['common_']['dict'] .= "\"sheet\";\"field\";\"key\";\"value\"\r\n";
|
||||
$output['dict'] .= "\"sheet\";\"field\";\"key\";\"value\"\r\n";
|
||||
foreach($dict as $ds=>$dataset)
|
||||
foreach($dataset as $f=>$field)
|
||||
foreach($field as $key=>$value)
|
||||
$output['common_']['dict'] .= "\"$ds\";\"$f\";\"$key\";\"$value\"\r\n";
|
||||
$output['dict'] .= "\"$ds\";\"$f\";\"$key\";\"$value\"\r\n";
|
||||
|
||||
|
||||
/* [6] Création de l'archive
|
||||
=========================================================*/
|
||||
$zip = new \ZipArchive();
|
||||
$fname = '/tmp/'.time().'.zip';
|
||||
$fname = __TMP__.'/'.time().'.zip';
|
||||
$zip->open($fname, \ZipArchive::CREATE);
|
||||
|
||||
foreach($output as $folder=>$files){
|
||||
|
||||
foreach($files as $file=>$content)
|
||||
if( strlen($content) > 0 )
|
||||
$zip->addFromString($folder.$file.'.csv', $content);
|
||||
}
|
||||
foreach($output as $file=>$content)
|
||||
if( strlen($content) > 0 )
|
||||
$zip->addFromString($file.'.csv', $content);
|
||||
|
||||
$zip->close();
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace api\module;
|
||||
use \manager\sessionManager;
|
||||
use \database\core\Database;
|
||||
use \database\core\DatabaseDriver;
|
||||
use \manager\ManagerError;
|
||||
use \database\core\Repo;
|
||||
use \lightdb\core\lightdb;
|
||||
|
@ -10,6 +10,18 @@
|
|||
class subject{
|
||||
|
||||
|
||||
/* FETCHES NEW SUBJECTS FROM Lab-Surveys Database
|
||||
*
|
||||
* @note: will store new subjects to localStorage
|
||||
*
|
||||
*/
|
||||
private static function fetchNewSubjects(){
|
||||
/* [1] Fetch subjects which have answer this survey
|
||||
=========================================================*/
|
||||
/* (1) Section Title */
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* RETOURNE LA LISTE DE TOUS LES SUJETS
|
||||
|
@ -26,7 +38,7 @@
|
|||
/* [1] On récupére la liste des sujets
|
||||
=========================================================*/
|
||||
/* (1) On initialise et ouvre la bd */
|
||||
$db = new lightdb('survey_db');
|
||||
$db = new lightdb('subject');
|
||||
$ids = array_keys( $db->index() );
|
||||
|
||||
/* (2) On récupère tous les sujets */
|
||||
|
@ -35,37 +47,18 @@
|
|||
|
||||
$sub['creation'] = date('d/m/Y H:i:s', $sub['creation']);
|
||||
$subjects[$id] = $sub;
|
||||
}
|
||||
$db->close();
|
||||
|
||||
|
||||
/* [2] On récupére la liste des sujets pour PHONE
|
||||
=========================================================*/
|
||||
/* (1) On initialise et ouvre la bd */
|
||||
$db = new lightdb('phone_db');
|
||||
$ids = array_keys( $db->index() );
|
||||
$db->close();
|
||||
|
||||
/* (2) Si un des sujets de 'survey' est dans PHONE, on ajoute la mention */
|
||||
foreach($subjects as $id=>$data)
|
||||
if( in_array($id, $ids) ) // Si dans phone
|
||||
/* (3) Si enquête PHONE passée */
|
||||
if( isset($sub['surveys']) && is_array($sub['surveys']) && in_array('phone', $sub['surveys']) )
|
||||
$subjects[$id]['phone'] = true;
|
||||
|
||||
|
||||
|
||||
|
||||
/* [3] On récupére la liste des sujets pour FACEBOOK
|
||||
=========================================================*/
|
||||
/* (1) On initialise et ouvre la bd */
|
||||
$db = new lightdb('facebook_db');
|
||||
$ids = array_keys( $db->index() );
|
||||
$db->close();
|
||||
|
||||
/* (2) Si un des sujets de 'survey' est dans FACBEOOK, on ajoute la mention */
|
||||
foreach($subjects as $id=>$data)
|
||||
if( in_array($id, $ids) ) // Si dans facebook
|
||||
/* (4) Si enquête FACEBOOK passée */
|
||||
if( isset($sub['surveys']) && is_array($sub['surveys']) && in_array('facebook', $sub['surveys']) )
|
||||
$subjects[$id]['facebook'] = true;
|
||||
|
||||
}
|
||||
$db->close();
|
||||
|
||||
|
||||
/* [4] Gestion du retour
|
||||
=========================================================*/
|
||||
|
@ -90,12 +83,12 @@
|
|||
|
||||
|
||||
// Contiendra les sujets
|
||||
$subjects = [];
|
||||
$contacts = [];
|
||||
|
||||
/* [1] On récupére la liste des sujets
|
||||
=========================================================*/
|
||||
/* (1) On initialise et ouvre la bd */
|
||||
$db = new lightdb('survey_db');
|
||||
$db = new lightdb('subject');
|
||||
$fetch = $db->fetch($subject_id);
|
||||
$db->close();
|
||||
|
||||
|
@ -104,44 +97,34 @@
|
|||
return [ 'ModuleError' => ManagerError::ModuleError ];
|
||||
|
||||
/* (3) On enregistre ses contacts s'il en a */
|
||||
if( isset($fetch['contacts']) )
|
||||
foreach($fetch['contacts'] as $contact)
|
||||
$subjects[$contact['id']] = $contact;
|
||||
$db = new lightdb('contact');
|
||||
|
||||
if( isset($fetch['contacts']) ){
|
||||
|
||||
/* [2] On récupére la liste des contacts saisis dans PHONE
|
||||
=========================================================*/
|
||||
/* (1) On initialise et ouvre la bd */
|
||||
$db = new lightdb('phone_db');
|
||||
$fetch = $db->fetch($subject_id);
|
||||
foreach($fetch['contacts'] as $contactId){
|
||||
|
||||
$contact = $db->fetch($contactId);
|
||||
// si le contact n'est pas trouvé -> passe au suivant
|
||||
if( $contact === false )
|
||||
continue;
|
||||
|
||||
$contacts[$contactId] = $contact;
|
||||
|
||||
}
|
||||
}
|
||||
$db->close();
|
||||
|
||||
/* (2) Si on trouve des contacts, on les ajoute */
|
||||
if( $fetch !== false && isset($fetch['contacts']) )
|
||||
foreach($fetch['contacts'] as $contact)
|
||||
$subjects[$contact['id']] = $contact;
|
||||
|
||||
|
||||
|
||||
|
||||
/* [3] On récupére la liste des sujets pour FACEBOOK
|
||||
/* [2] Gestion des relations
|
||||
=========================================================*/
|
||||
/* (1) On initialise et ouvre la bd */
|
||||
$db = new lightdb('facebook_db');
|
||||
$fetch = $db->fetch($subject_id);
|
||||
$db->close();
|
||||
|
||||
/* (2) Si on trouve des contacts, on les ajoute */
|
||||
if( $fetch !== false && isset($fetch['contacts']) )
|
||||
foreach($fetch['contacts'] as $contact)
|
||||
$subjects[$contact['id']] = $contact;
|
||||
/* (1) On récupère toutes les relations */
|
||||
//blabla
|
||||
|
||||
|
||||
/* [4] Gestion du retour
|
||||
=========================================================*/
|
||||
return [
|
||||
'ModuleError' => ManagerError::Success,
|
||||
'subjects' => $subjects
|
||||
'subjects' => $contacts
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -162,7 +145,7 @@
|
|||
|
||||
/* [1] 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 = trim( fgets( $funiq ) );
|
||||
|
||||
|
@ -174,16 +157,20 @@
|
|||
$newId = intval($uniqid) + 1;
|
||||
|
||||
// On crée notre sujet
|
||||
$data = [ 'subject' => [
|
||||
'id' => $newId,
|
||||
'name' => $name,
|
||||
'creation' => time()
|
||||
]];
|
||||
$data = [
|
||||
'subject' => [
|
||||
'id' => $newId,
|
||||
'name' => $name,
|
||||
'creation' => time(),
|
||||
'surveys' => [],
|
||||
'coords' => ''
|
||||
]
|
||||
];
|
||||
|
||||
/* [2] On crée le sujet dans SURVEYS
|
||||
=========================================================*/
|
||||
/* (1) On initialise et ouvre la bd */
|
||||
$db = new lightdb('survey_db');
|
||||
$db = new lightdb('subject');
|
||||
$db->insert( $newId, $data );
|
||||
$db->close();
|
||||
|
||||
|
@ -218,6 +205,7 @@
|
|||
public static function search($params){
|
||||
extract($params);
|
||||
|
||||
|
||||
// Contiendra les sujets
|
||||
$subjects = [];
|
||||
|
||||
|
@ -225,6 +213,10 @@
|
|||
/* [0] Notre fonction de recherche (comparaison)
|
||||
=========================================================*/
|
||||
function compareSearch($A, $B){
|
||||
// Returns all if no search keyword
|
||||
if( $A == '' )
|
||||
return true;
|
||||
|
||||
// {1} On supprime les espaces et tout en minuscule //
|
||||
$A = str_replace(' ', '', strtolower($A));
|
||||
$B = str_replace(' ', '', strtolower($B));
|
||||
|
@ -239,7 +231,7 @@
|
|||
/* [1] On récupére la liste des sujets
|
||||
=========================================================*/
|
||||
/* (1) On initialise et ouvre la bd */
|
||||
$db = new lightdb('survey_db');
|
||||
$db = new lightdb('subject');
|
||||
$ids = array_keys( $db->index() );
|
||||
|
||||
/* (2) On récupère tous les sujets */
|
||||
|
@ -249,41 +241,18 @@
|
|||
|
||||
$sub['creation'] = date('d/m/Y H:i:s', $sub['creation']);
|
||||
$subjects[$id] = $sub;
|
||||
|
||||
/* (3) Si enquête PHONE passée */
|
||||
if( isset($sub['surveys']) && is_array($sub['surveys']) && in_array('phone', $sub['surveys']) )
|
||||
$subjects[$id]['phone'] = true;
|
||||
|
||||
/* (4) Si enquête FACEBOOK passée */
|
||||
if( isset($sub['surveys']) && is_array($sub['surveys']) && in_array('facebook', $sub['surveys']) )
|
||||
$subjects[$id]['facebook'] = true;
|
||||
}
|
||||
}
|
||||
$db->close();
|
||||
|
||||
|
||||
/* [2] On récupére la liste des sujets pour PHONE
|
||||
=========================================================*/
|
||||
/* (1) On initialise et ouvre la bd */
|
||||
$db = new lightdb('phone_db');
|
||||
$ids = array_keys( $db->index() );
|
||||
$db->close();
|
||||
|
||||
/* (2) Si un des sujets de 'survey' est dans PHONE, on ajoute la mention */
|
||||
foreach($subjects as $id=>$data)
|
||||
if( in_array($id, $ids) ) // Si dans phone
|
||||
$subjects[$id]['phone'] = true;
|
||||
|
||||
|
||||
|
||||
|
||||
/* [3] On récupére la liste des sujets pour FACEBOOK
|
||||
=========================================================*/
|
||||
/* (1) On initialise et ouvre la bd */
|
||||
$db = new lightdb('facebook_db');
|
||||
$ids = array_keys( $db->index() );
|
||||
$db->close();
|
||||
|
||||
/* (2) Si un des sujets de 'survey' est dans FACBEOOK, on ajoute la mention */
|
||||
foreach($subjects as $id=>$data)
|
||||
if( in_array($id, $ids) ) // Si dans facebook
|
||||
$subjects[$id]['facebook'] = true;
|
||||
|
||||
|
||||
|
||||
|
||||
/* [4] Retour des données
|
||||
=========================================================*/
|
||||
return [
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace api\module;
|
||||
use \database\core\Database;
|
||||
use \database\core\DatabaseDriver;
|
||||
use \api\core\Checker;
|
||||
use \manager\sessionManager;
|
||||
use \manager\ManagerError;
|
||||
|
@ -78,13 +78,6 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace api\module;
|
||||
use \database\core\Database;
|
||||
use \database\core\DatabaseDriver;
|
||||
use \manager\sessionManager;
|
||||
use \api\core\ModuleRequest;
|
||||
use \manager\ManagerError;
|
||||
|
@ -48,7 +48,7 @@
|
|||
/* [3] Construction du chemin
|
||||
=========================================================*/
|
||||
/* (1) On construit le chemin */
|
||||
$path = __BUILD__.$uploadAuth['root'].'/'.$prefix.'/';
|
||||
$path = __PUBLIC__.$uploadAuth['root'].'/'.$prefix.'/';
|
||||
|
||||
/* (2) On crée le dossier s'il n'existe pas */
|
||||
if ( !file_exists($path) ) mkdir($path, 0775, true);
|
||||
|
@ -70,8 +70,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* EFFECTUE UN UPLOAD D'UN fichier
|
||||
*
|
||||
* @prefix<String> Préfixe (dossier parent) du fichier
|
||||
|
@ -84,8 +82,8 @@
|
|||
*/
|
||||
private static function simpleFile($prefix, $extension, $file, $tester){
|
||||
// Si on est pas connecté, on retourne une erreur -> impossible via token
|
||||
if( !connected() ) return [ 'error' => ManagerError::PermissionError ];
|
||||
if( !file_exists($file['tmp_name']) ) return [ 'error' => ManagerError::UnreachableResource ];
|
||||
if( !connected() ) return ManagerError::PermissionError;
|
||||
if( !file_exists($file['tmp_name']) ) return ManagerError::UnreachableResource;
|
||||
|
||||
|
||||
/* [1] On récupère le chemin du fichier à créer et vérifie le dossier
|
||||
|
@ -125,20 +123,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* IMPORT D'UNE SAUVEGARDE DE FORMULAIRE LOCAL
|
||||
*
|
||||
* @file<FILE> Pointeur vers $_FILES['']
|
||||
|
@ -173,8 +157,8 @@
|
|||
|
||||
|
||||
/* (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']);
|
||||
$checkSubject = $checkSubject && isset($json['subject']['coords']) && is_string($json['subject']['coords']);
|
||||
|
||||
// Erreur des attributs du sujet incorrects ou manquants
|
||||
if( !$checkSubject )
|
||||
|
@ -184,7 +168,11 @@
|
|||
/* (4) Vérification des contacts */
|
||||
foreach($json['contacts'] as $contact){
|
||||
$checkContact = isset($contact['uid']) && is_numeric($contact['uid']);
|
||||
$checkContact = $checkContact && isset($contact['username']) && is_string($contact['username']);
|
||||
$checkContact = $checkContact && (
|
||||
( isset($contact['username']) && is_string($contact['username']) )
|
||||
||
|
||||
( isset($contact['existing']) && is_numeric($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']);
|
||||
|
@ -198,12 +186,13 @@
|
|||
|
||||
/* (5) Vérification des mini-fiches */
|
||||
foreach($json['mini'] as $mini){
|
||||
$checkMini = isset($mini['uid']) && is_numeric($mini['uid']);
|
||||
$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']);
|
||||
$checkMini = $checkMini && isset($mini['loc']) && is_string($mini['loc']);
|
||||
$checkMini = $checkMini && isset($mini['unknown']) && is_bool($mini['unknown']);
|
||||
$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']);
|
||||
$checkMini = $checkMini && isset($mini['loc']) && is_string($mini['loc']);
|
||||
$checkMini = $checkMini && isset($mini['unknown']) && is_bool($mini['unknown']);
|
||||
|
||||
// Si erreur des attributs des mini-fiches incorrects ou manquants
|
||||
if( !$checkMini )
|
||||
|
@ -211,18 +200,21 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
/* (6) Vérification des fiches */
|
||||
foreach($json['fiches'] as $fiches){
|
||||
$checkFiche = isset($fiches['uid']) && is_numeric($fiches['uid']);
|
||||
$checkFiche = $checkFiche && isset($fiches['contact']) && is_numeric($fiches['contact']);
|
||||
$checkFiche = $checkFiche && isset($fiches['sexe']) && is_numeric($fiches['sexe']);
|
||||
$checkFiche = $checkFiche && isset($fiches['age']) && is_string($fiches['age']);
|
||||
$checkFiche = $checkFiche && isset($fiches['interest']) && is_numeric($fiches['interest']);
|
||||
$checkFiche = $checkFiche && isset($fiches['relmark']) && is_numeric($fiches['relmark']);
|
||||
$checkFiche = $checkFiche && isset($fiches['job']) && is_string($fiches['job']);
|
||||
$checkFiche = $checkFiche && isset($fiches['loc']) && (is_numeric($fiches['loc']) || $fiches['loc']=='.');
|
||||
$checkFiche = $checkFiche && isset($fiches['studies']) && is_string($fiches['studies']);
|
||||
$checkFiche = $checkFiche && isset($fiches['famsit']) && is_numeric($fiches['famsit']);
|
||||
$checkFiche = $checkFiche && isset($fiches['reltype']) && is_numeric($fiches['reltype']);
|
||||
$checkFiche = $checkFiche && isset($fiches['medsoc']) && is_numeric($fiches['medsoc']);
|
||||
$checkFiche = $checkFiche && isset($fiches['medrel']) && is_numeric($fiches['medrel']);
|
||||
$checkFiche = $checkFiche && isset($fiches['reltypeSpecial']) && is_string($fiches['reltypeSpecial']);
|
||||
$checkFiche = $checkFiche && isset($fiches['city']) && is_string($fiches['city']);
|
||||
$checkFiche = $checkFiche && isset($fiches['cp']) && is_string($fiches['cp']);
|
||||
|
@ -230,6 +222,7 @@
|
|||
$checkFiche = $checkFiche && isset($fiches['context']) && is_numeric($fiches['context']);
|
||||
$checkFiche = $checkFiche && isset($fiches['contextSpecial']) && is_array($fiches['contextSpecial']);
|
||||
$checkFiche = $checkFiche && isset($fiches['freq']) && is_array($fiches['freq']);
|
||||
$checkFiche = $checkFiche && isset($fiches['irlfreq']) && is_array($fiches['irlfreq']);
|
||||
$checkFiche = $checkFiche && isset($fiches['connect']) && is_array($fiches['connect']);
|
||||
$checkFiche = $checkFiche && isset($fiches['connectSpecial']) && is_array($fiches['connectSpecial']);
|
||||
|
||||
|
@ -287,31 +280,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace api\module;
|
||||
use \manager\sessionManager;
|
||||
use \database\core\Database;
|
||||
use \database\core\DatabaseDriver;
|
||||
use \manager\ManagerError;
|
||||
use \database\core\Repo;
|
||||
|
||||
|
|
161
build/database/core/Database.php → build/database/core/DatabaseDriver.php
Normal file → Executable file
161
build/database/core/Database.php → build/database/core/DatabaseDriver.php
Normal file → Executable file
|
@ -4,84 +4,167 @@
|
|||
use \manager\ManagerError;
|
||||
|
||||
|
||||
class DataBase{
|
||||
class DataBaseDriver{
|
||||
|
||||
/* ATTRIBUTS STATIQUES */
|
||||
public static function config_path(){
|
||||
return [
|
||||
'local' => __CONFIG__.'/database-local.json',
|
||||
'remote' => __CONFIG__.'/database.json'
|
||||
];
|
||||
/* STATIC ATTRIBUTES */
|
||||
private static function conf(){
|
||||
// YOUR CONFIGURATION BEHIND
|
||||
$path = __CONFIG__.'/database-driver.json';
|
||||
|
||||
/* (1) Checks the file */
|
||||
if( !is_file($path) )
|
||||
return [];
|
||||
|
||||
/* (2) Checks json */
|
||||
$parsed = json_decode( file_get_contents($path), true );
|
||||
|
||||
if( !is_array($parsed) )
|
||||
return [];
|
||||
|
||||
/* (3) Returns configuration */
|
||||
return $parsed;
|
||||
}
|
||||
|
||||
private static $pdo;
|
||||
private static $instance;
|
||||
|
||||
private static $path; // Databases configurations files
|
||||
private static $config; // PDO configurations
|
||||
private static $instance = []; // Database driver instance list
|
||||
|
||||
/* ATTRIBUTS */
|
||||
public $error;
|
||||
|
||||
/* ATTRIBUTES */
|
||||
private $host;
|
||||
private $dbname;
|
||||
private $username;
|
||||
private $password;
|
||||
|
||||
public static $error;
|
||||
private $pdo;
|
||||
|
||||
|
||||
public function __construct($host, $dbname, $username, $password){
|
||||
|
||||
/* CONSTRUCTOR OF A DATABASE DRIVER
|
||||
*
|
||||
* @host<String> Database Server's host
|
||||
* @dbname<String> Database name
|
||||
* @username<String> Database username
|
||||
* @password<String> Database password
|
||||
*
|
||||
*/
|
||||
private function __construct($host, $dbname, $username, $password){
|
||||
/* (2) Stores configuration */
|
||||
$this->host = $host;
|
||||
$this->dbname = $dbname;
|
||||
$this->username = $username;
|
||||
$this->password = $password;
|
||||
|
||||
try{
|
||||
self::$pdo = new \PDO('mysql:host='.$this->host.';dbname='.$this->dbname, $this->username, $this->password);
|
||||
|
||||
$this->pdo = new \PDO('mysql:host='.$this->host.';dbname='.$this->dbname, $this->username, $this->password);
|
||||
|
||||
// On signale que tout s'est bien passe
|
||||
self::$error = ManagerError::Success;
|
||||
$this->error = ManagerError::Success;
|
||||
|
||||
}catch(Exception $e){
|
||||
// On signale qu'il y a une erreur
|
||||
self::$error = ManagerError::PDOConnection;
|
||||
$this->error = ManagerError::PDOConnection;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* retourne une instance de la classe */
|
||||
public static function getInstance(){
|
||||
if( self::$instance == null || self::$error != ManagerError::Success ){ // Si aucune instance existante OU erreur de connection
|
||||
|
||||
// chargement de la configuration du server SQL
|
||||
/************************************************
|
||||
**** Multiton Management (static) ****
|
||||
************************************************/
|
||||
|
||||
/* ADDS A NEW CONNECTION
|
||||
*
|
||||
* @label<String> [optional] Database Label
|
||||
*
|
||||
* @return status<Boolean> If added successfully
|
||||
*
|
||||
*/
|
||||
private static function add($label=null){
|
||||
$conf = self::conf();
|
||||
|
||||
/* [1] Default values
|
||||
=========================================================*/
|
||||
/* (1) If label isn't given */
|
||||
is_null($label) && ($label = 'default');
|
||||
|
||||
/* (2) If label and no path */
|
||||
if( $label !== 'default' && !isset($conf[$label]) )
|
||||
return false;
|
||||
|
||||
|
||||
/* [3] Instanciates the driver
|
||||
=========================================================*/
|
||||
try{
|
||||
|
||||
/* (1) If local -> instanciates with local configuration */
|
||||
if( !checkdnsrr($_SERVER['SERVER_NAME'], 'NS') )
|
||||
$conf = json_decode( file_get_contents(self::config_path()['local']), true );
|
||||
self::$instance[$label] = new DatabaseDriver($conf[$label]['local']['host'], $conf[$label]['local']['dbname'], $conf[$label]['local']['user'], $conf[$label]['local']['password']);
|
||||
/* (2) If Remote -> instanciates with Remote configuration */
|
||||
else
|
||||
$conf = json_decode( file_get_contents(self::config_path()['remote']), true );
|
||||
self::$instance[$label] = new DatabaseDriver($conf[$label]['remote']['host'], $conf[$label]['remote']['dbname'], $conf[$label]['remote']['user'], $conf[$label]['remote']['password']);
|
||||
|
||||
// creation de l'instance en fonction des parametres
|
||||
self::$instance = new DataBase($conf['host'], $conf['dbname'], $conf['user'], $conf['password']);
|
||||
return true;
|
||||
|
||||
}catch(\Exception $e){
|
||||
|
||||
/* (3) If fails */
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
|
||||
/* GET A DATABASE DRIVER INSTANCE
|
||||
*
|
||||
* @label<String> [optional] Driver's label
|
||||
*
|
||||
* @return driver<Database> Multiton
|
||||
*
|
||||
*/
|
||||
public static function get($label=null){
|
||||
$conf = self::conf();
|
||||
|
||||
/* [1] Checks arguments
|
||||
=========================================================*/
|
||||
/* (1) Label default value */
|
||||
is_null($label) && ($label = 'default');
|
||||
|
||||
/* (2) If no label, or unknown label */
|
||||
if( is_null($label) || !isset(self::$instance[$label]) ){
|
||||
|
||||
/* (2.1) Try to add the configuration if exists */
|
||||
if( isset($conf[$label]) ){
|
||||
self::add($label);
|
||||
return self::get($label);
|
||||
}
|
||||
|
||||
|
||||
throw new \Exception('Database @label is incorrect.');
|
||||
}
|
||||
|
||||
|
||||
/* [2] Returns instance
|
||||
=========================================================*/
|
||||
return self::$instance[$label];
|
||||
}
|
||||
|
||||
|
||||
/* retourne la connection statique */
|
||||
public static function getPDO(){
|
||||
$instance = self::getInstance();
|
||||
public static function getPDO($label=null){
|
||||
$instance = self::get($label);
|
||||
|
||||
return self::$pdo;
|
||||
return $instance->pdo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function getConfig(){
|
||||
return [
|
||||
'host' => $this->host,
|
||||
'dbname' => $this->dbname,
|
||||
'username' => $this->username
|
||||
];
|
||||
}
|
||||
|
@ -125,8 +208,10 @@
|
|||
for( $i = 0 ; $i < count($fetchData) ; $i++ ) // pour tout les utilisateurs
|
||||
foreach($fetchData[$i] as $col => $val){ // pour toutes les entrées
|
||||
|
||||
if( !\mb_detect_encoding($val, 'UTF-8') )
|
||||
if( \mb_detect_encoding($val) === 'UTF-8' )
|
||||
$fetchData[$i][$col] = utf8_encode($val);
|
||||
else
|
||||
$fetchData[$i][$col] = utf8_encode(utf8_decode($val));
|
||||
|
||||
if( is_int($col) ){ // Si indice numerique
|
||||
if( $nextEquivalent ) // Si suit un indice textuel
|
||||
|
@ -146,8 +231,10 @@
|
|||
// on supprime les doublons des entrées (indice numérique)
|
||||
foreach($fetchData as $i=>$val){ // pour toutes les entrées
|
||||
|
||||
if( !\mb_detect_encoding($val, 'UTF-8') )
|
||||
if( \mb_detect_encoding($val) === 'UTF-8' )
|
||||
$fetchData[$i] = utf8_encode($val);
|
||||
else
|
||||
$fetchData[$i] = utf8_encode(utf8_decode($val));
|
||||
|
||||
if( is_int($i) ){ // Si indice numerique
|
||||
if( $nextEquivalent ) // Si suit un indice textuel
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace database\repo;
|
||||
use \database\core\Database;
|
||||
use \database\core\DatabaseDriver;
|
||||
|
||||
class parentRepo{
|
||||
|
||||
|
@ -30,8 +30,8 @@
|
|||
|
||||
/* [2] On charge la liste des colonnes de la table
|
||||
=========================================================*/
|
||||
$getColumns = Database::getPDO()->query('SHOW COLUMNS FROM '.static::table_name());
|
||||
$cols = Database::delNumeric( $getColumns->fetchAll() );
|
||||
$getColumns = DatabaseDriver::getPDO()->query('SHOW COLUMNS FROM '.static::table_name());
|
||||
$cols = DatabaseDriver::delNumeric( $getColumns->fetchAll() );
|
||||
|
||||
$table_columns = [
|
||||
'_PRIMARY_' => [] // Contiendra les champs de la clé primaire
|
||||
|
@ -84,7 +84,7 @@
|
|||
$getRequestString .= ' ORDER BY 1 ASC';
|
||||
|
||||
// On prépare la requête
|
||||
$getRequest = Database::getPDO()->prepare($getRequestString);
|
||||
$getRequest = DatabaseDriver::getPDO()->prepare($getRequestString);
|
||||
|
||||
|
||||
/* [5] On exécute la requête
|
||||
|
@ -107,7 +107,7 @@
|
|||
|
||||
/* [6] On récupère le résultat
|
||||
=========================================================*/
|
||||
return Database::delNumeric( $getRequest->fetchAll() );
|
||||
return DatabaseDriver::delNumeric( $getRequest->fetchAll() );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace database\repo;
|
||||
use \manager\sessionManager;
|
||||
use \database\core\Database;
|
||||
use \database\core\DatabaseDriver;
|
||||
use \api\core\Checker;
|
||||
|
||||
class token extends parentRepo{
|
||||
|
@ -38,14 +38,14 @@
|
|||
public static function getAll(){
|
||||
/* [1] On prepare et execute la requete
|
||||
=========================================================*/
|
||||
$request = Database::getPDO()->query("SELECT id_token, name, token, expires, (CURDATE() > expires) as expired
|
||||
$request = DatabaseDriver::getPDO()->query("SELECT id_token, name, token, expires, (CURDATE() > expires) as expired
|
||||
FROM api_token
|
||||
ORDER BY expires DESC");
|
||||
|
||||
|
||||
/* [3] On retourne les donnees
|
||||
=========================================================*/
|
||||
return Database::delNumeric( $request->fetchAll() );
|
||||
return DatabaseDriver::delNumeric( $request->fetchAll() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -66,7 +66,7 @@
|
|||
|
||||
/* [1] Verification dans la base de donnees
|
||||
=========================================================*/
|
||||
$check = Database::getPDO()->prepare("SELECT id_token, permission
|
||||
$check = DatabaseDriver::getPDO()->prepare("SELECT id_token, permission
|
||||
FROM api_token
|
||||
WHERE CURDATE() <= expires
|
||||
AND token = :token");
|
||||
|
@ -112,7 +112,7 @@
|
|||
$token = sessionManager::sha1(uniqid());
|
||||
|
||||
// Verification dans la BDD
|
||||
$check = Database::getPDO()->prepare("SELECT id_token FROM api_token WHERE token = :token");
|
||||
$check = DatabaseDriver::getPDO()->prepare("SELECT id_token FROM api_token WHERE token = :token");
|
||||
$check->execute( array( ':token' => $token ) );
|
||||
|
||||
// VRAI un token est identique
|
||||
|
@ -122,7 +122,7 @@
|
|||
|
||||
/* [2] On cree le token
|
||||
=========================================================*/
|
||||
$create = Database::getPDO()->prepare("INSERT INTO api_token(id_token, token, name, expires)
|
||||
$create = DatabaseDriver::getPDO()->prepare("INSERT INTO api_token(id_token, token, name, expires)
|
||||
VALUES(DEFAULT, :token, :name, :expiration)");
|
||||
$create->execute(array(
|
||||
':token' => $token,
|
||||
|
@ -132,7 +132,7 @@
|
|||
|
||||
/* [3] On verifie qu'il a bien ete cree
|
||||
=========================================================*/
|
||||
$created = Database::getPDO()->prepare("SELECT id_token FROM api_token
|
||||
$created = DatabaseDriver::getPDO()->prepare("SELECT id_token FROM api_token
|
||||
WHERE token = :token
|
||||
AND name = :name");
|
||||
$created->execute(array(
|
||||
|
@ -175,7 +175,7 @@
|
|||
|
||||
/* [2] Suppression du token
|
||||
=========================================================*/
|
||||
$remove = Database::getPDO()->prepare("DELETE FROM api_token
|
||||
$remove = DatabaseDriver::getPDO()->prepare("DELETE FROM api_token
|
||||
WHERE id_token = :id_token");
|
||||
$remove->execute(array( ':id_token' => $id_token ));
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace database\repo;
|
||||
use \database\core\Database;
|
||||
use \database\core\DatabaseDriver;
|
||||
use \api\core\Checker;
|
||||
use \manager\sessionManager;
|
||||
use \database\repo\parentRepo;
|
||||
|
@ -32,7 +32,7 @@
|
|||
|
||||
/* [1] On verifie son login/password dans la BDD
|
||||
=========================================================*/
|
||||
$check = Database::getPDO()->prepare("SELECT id_user, login
|
||||
$check = DatabaseDriver::getPDO()->prepare("SELECT id_user, login
|
||||
FROM users
|
||||
WHERE ( login = :username OR mail = :mail ) AND password = :password");
|
||||
$check->execute(array(
|
||||
|
@ -49,7 +49,7 @@
|
|||
|
||||
|
||||
// On retourne le resultat
|
||||
return Database::delNumeric( $result );
|
||||
return DatabaseDriver::delNumeric( $result );
|
||||
}
|
||||
|
||||
|
||||
|
@ -79,7 +79,7 @@
|
|||
|
||||
/* [1] On verifie que le login/mail et reference sont uniques
|
||||
=========================================================*/
|
||||
$checkUnique = Database::getPDO()->prepare("SELECT id_user
|
||||
$checkUnique = DatabaseDriver::getPDO()->prepare("SELECT id_user
|
||||
FROM users
|
||||
WHERE login = :login
|
||||
OR mail = :mail ");
|
||||
|
@ -94,7 +94,7 @@
|
|||
|
||||
/* [2] Creation de l'utilisateur
|
||||
=========================================================*/
|
||||
$create = Database::getPDO()->prepare("INSERT INTO users(id_user, login, password, mail)
|
||||
$create = DatabaseDriver::getPDO()->prepare("INSERT INTO users(id_user, login, password, mail)
|
||||
VALUES(DEFAULT, :login, :password, :mail)");
|
||||
$create->execute(array(
|
||||
':login' => $login,
|
||||
|
@ -104,7 +104,7 @@
|
|||
|
||||
/* [3] Verification de la creation + recuperation id
|
||||
=========================================================*/
|
||||
$checkCreate = Database::getPDO()->prepare("SELECT id_user
|
||||
$checkCreate = DatabaseDriver::getPDO()->prepare("SELECT id_user
|
||||
FROM users
|
||||
WHERE login = :login
|
||||
AND password = :password
|
||||
|
@ -142,7 +142,7 @@
|
|||
public static function remove($id_user){
|
||||
/* [1] On effectue la suppression
|
||||
=========================================================*/
|
||||
$getUser = Database::getPDO()->prepare("DELETE FROM users WHERE id_user = :id_user");
|
||||
$getUser = DatabaseDriver::getPDO()->prepare("DELETE FROM users WHERE id_user = :id_user");
|
||||
$getUser->execute(array( ':id_user' => $id_user ));
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,198 @@
|
|||
<?php
|
||||
|
||||
namespace http\core;
|
||||
|
||||
|
||||
class HttpRequest{
|
||||
|
||||
/* [0] Constants
|
||||
=========================================================*/
|
||||
/* (1) Content-Type */
|
||||
const CT_BINARY = 0; // unknown
|
||||
const CT_TEXT = 1;
|
||||
const CT_JSON = 2;
|
||||
const CT_YAML = 3;
|
||||
const CT_MULTIPART_FORM_DATA = 4;
|
||||
const CT_X_WWW_FORM_URLENCODED = 5;
|
||||
|
||||
|
||||
/* [1] Attributes
|
||||
=========================================================*/
|
||||
private $uri;
|
||||
private $headers;
|
||||
private $method;
|
||||
private $postdata;
|
||||
private $getdata;
|
||||
|
||||
private $type;
|
||||
private $body;
|
||||
|
||||
|
||||
/* [2] Constructs an HTTP Request based on environment
|
||||
*
|
||||
* @return instance<HttpRequest> auto-filled HTTP Request
|
||||
*
|
||||
=========================================================*/
|
||||
public function __construct(){
|
||||
/* [1] Define URI & Status Code & method
|
||||
=========================================================*/
|
||||
$this->uri = $_SERVER['REQUEST_URI'];
|
||||
$this->method = $_SERVER['REQUEST_METHOD'];
|
||||
|
||||
|
||||
/* [2] Define headers
|
||||
=========================================================*/
|
||||
$this->headers = \getallheaders();
|
||||
|
||||
|
||||
/* [3] Define default datasets (GET, POST)
|
||||
=========================================================*/
|
||||
$this->getdata = $_GET;
|
||||
$this->postdata = $_POST;
|
||||
|
||||
|
||||
/* [4] Define BODY & its type
|
||||
=========================================================*/
|
||||
/* (1) Default: set plain/text body */
|
||||
$this->body = \file_get_contents('php://input');
|
||||
|
||||
/* (2) Fetch content type */
|
||||
$this->type = self::getContentType($this->headers['Content-Type']);
|
||||
|
||||
|
||||
/* [5] Parse BODY data -> POST
|
||||
=========================================================*/
|
||||
$this->parseBody();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* GET CONSTANT CT_* FROM `Content-Type` HEADER
|
||||
*
|
||||
* @pContentType<String> `Content-Type` header value
|
||||
*
|
||||
* @return type<int> Constant value
|
||||
*
|
||||
*/
|
||||
private static function getContentType($pContentType=null){
|
||||
/* [1] Checks argv
|
||||
=========================================================*/
|
||||
if( is_null($pContentType) )
|
||||
$pContentType = $_SERVER['CONTENT_TYPE'];
|
||||
|
||||
|
||||
/* [2] Checks types
|
||||
=========================================================*/
|
||||
/* (1) Form Data Types
|
||||
---------------------------------------------------------*/
|
||||
/* (1) multipart/form-data */
|
||||
if( preg_match('/^multipart\/form\-data; boundary=(.+)$/i', $pContentType) )
|
||||
return self::CT_MULTIPART_FORM_DATA;
|
||||
|
||||
/* (2) application/x-www-form-urlencoded */
|
||||
if( preg_match('/^application\/x\-www\-form\-urlencoded/i', $pContentType) )
|
||||
return self::CT_X_WWW_FORM_URLENCODED;
|
||||
|
||||
|
||||
/* (2) Data types
|
||||
---------------------------------------------------------*/
|
||||
/* (1) Basic JSON content type */
|
||||
if( preg_match('/^application\/json/i', $pContentType) )
|
||||
return self::CT_JSON;
|
||||
|
||||
/* (2) Basic YAML content type */
|
||||
if( preg_match('/^application\/yaml/i', $pContentType) )
|
||||
return self::CT_YAML;
|
||||
|
||||
/* (3) Basic TEXT content type */
|
||||
if( preg_match('/text\/[a-z]+/', $pContentType) )
|
||||
return self::CT_TEXT;
|
||||
|
||||
|
||||
/* (3) Default Type
|
||||
---------------------------------------------------------*/
|
||||
return self::CT_BINARY;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* PARSES BODY DATA
|
||||
*
|
||||
*/
|
||||
private function parseBody(){
|
||||
/* [1] If empty body -> do nothing
|
||||
=========================================================*/
|
||||
if( strlen($this->body) === 0 )
|
||||
return true;
|
||||
|
||||
|
||||
/* [2] Management for each ContentType
|
||||
=========================================================*/
|
||||
switch($this->type){
|
||||
|
||||
/* (1) multipart/form-data -> parse for not-POST methods
|
||||
---------------------------------------------------------*/
|
||||
case self::CT_MULTIPART_FORM_DATA:
|
||||
/* (1) Fetch the boundary */
|
||||
if( !preg_match('/boundary=(.+)$/i', $this->headers['Content-Type'], $match) )
|
||||
return false;
|
||||
|
||||
$boundary = $match[1];
|
||||
|
||||
/* (2) Break body into parts */
|
||||
$splitter = "/(?:\n|\r\n|--)*$boundary(?:\n|\r\n|--)?/im";
|
||||
$parts = preg_split($splitter, $this->body);
|
||||
|
||||
/* (3) Process parts */
|
||||
foreach($parts as $part)
|
||||
if( preg_match('/^Content\-Disposition: form\-data; name=\"([^"]+)\"(?:\n|\r\n){2}(.+)$/mi', $part, $match) )
|
||||
$this->postdata[$match[1]] = $match[2];
|
||||
|
||||
/* (4) Erases body */
|
||||
$this->body = '';
|
||||
break;
|
||||
|
||||
|
||||
/* (2) application/x-www-form-urlencoded -> parse for not-POST methods
|
||||
---------------------------------------------------------*/
|
||||
case self::CT_X_WWW_FORM_URLENCODED:
|
||||
/* Auto parse builtin-php function */
|
||||
parse_str($this->body, $this->postdata);
|
||||
|
||||
/* Erases body */
|
||||
$this->body = '';
|
||||
break;
|
||||
|
||||
|
||||
/* (3) application/json -> parse if no error
|
||||
---------------------------------------------------------*/
|
||||
case self::CT_JSON:
|
||||
/* (1) Decode body content */
|
||||
$decoded = json_decode($this->body, true);
|
||||
|
||||
/* (2) If error -> do nothing */
|
||||
if( is_null($decoded) )
|
||||
return;
|
||||
|
||||
/* (3) Parse body into body */
|
||||
$this->body = $decoded;
|
||||
break;
|
||||
|
||||
|
||||
/* (4) application/yaml -> parse if no error
|
||||
---------------------------------------------------------*/
|
||||
case self::CT_YAML:
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function BODY(){ return $this->body; }
|
||||
public function POST(){ return $this->postdata; }
|
||||
public function GET(){ return $this->getdata; }
|
||||
public function HEADERS(){ return $this->headers; }
|
||||
public function METHOD(){ return $this->method; }
|
||||
public function URI(){ return $this->uri; }
|
||||
}
|
|
@ -2,17 +2,17 @@
|
|||
|
||||
namespace lightdb\core;
|
||||
|
||||
|
||||
class lightdb{
|
||||
|
||||
// REPERTOIRE RACINE DE TOUTES LES BDD
|
||||
public static function default_root(){ return __BUILD__.'/lightdb/storage/'; }
|
||||
public static function default_root(){ return __BUILD__.'/lightdb/storage'; }
|
||||
|
||||
// ATTRIBUTS
|
||||
private $root;
|
||||
private $dbname;
|
||||
private $dir;
|
||||
private $index;
|
||||
private $date;
|
||||
private $driver;
|
||||
private $line;
|
||||
|
||||
|
@ -53,42 +53,62 @@
|
|||
$index = json_decode( $fIndex->fgets(), true );
|
||||
|
||||
// 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;
|
||||
|
||||
/* [3] Initialisation du gestionnaire d'acces (SplFileObject)
|
||||
=========================================================*/
|
||||
/* (1) Si le fichier n'existe pas, on le crée */
|
||||
if( !file_exists($this->dir.'data') )
|
||||
file_put_contents($this->dir.'data', '' );
|
||||
$this->data = $this->dir.'data';
|
||||
if( !file_exists($this->data) )
|
||||
file_put_contents($this->data, '' );
|
||||
|
||||
/* (2) On place un 'driver' sur le fichier */
|
||||
$this->driver = new \SplFileObject($this->dir.'data', 'r+');
|
||||
$this->driver = new \SplFileObject($this->data, 'r+');
|
||||
// $this->driver->setFlags( \SplFileObject::SKIP_EMPTY );
|
||||
|
||||
/* (3) On récupère le nombre de lignes */
|
||||
$this->line = -1;
|
||||
while( !$this->driver->eof() ){
|
||||
while( $this->driver->valid() ){
|
||||
$this->line++;
|
||||
$this->driver->fgetcsv();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function close(){ $this->driver = null; }
|
||||
|
||||
|
||||
|
||||
|
||||
/* RETOURNE LA LISTE DES INDEX
|
||||
/* FLUSH LA BDD (erase all)
|
||||
*
|
||||
* @i<String> Index pour lequel on veut la ligne et le hash
|
||||
*/
|
||||
public function flush(){
|
||||
/* (1) On flush les index */
|
||||
$fIndex = new \SplFileObject($this->dir.'index', 'w');
|
||||
$fIndex->fwrite('[]');
|
||||
$fIndex = null;
|
||||
$this->line = 0;
|
||||
$this->index = [];
|
||||
|
||||
/* (2) On flush les data */
|
||||
file_put_contents($this->dir.'data', '' );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* RETOURNE UN INDEX
|
||||
*
|
||||
* @i<String> [OPT] Index pour lequel on veut la ligne et le hash
|
||||
*
|
||||
* @return Index<Array> Tableau associatif contenant le hash et la ligne
|
||||
*
|
||||
*/
|
||||
public function index($i=null){
|
||||
return is_numeric($i) ? $this->index : $this->index;
|
||||
return is_numeric($i) ? $this->index[$i] : $this->index;
|
||||
}
|
||||
|
||||
|
||||
|
@ -103,25 +123,21 @@
|
|||
public function insert($key, $data){
|
||||
/* (1) On vérifie que la clé est unique */
|
||||
if( array_key_exists($key, $this->index) )
|
||||
return true;
|
||||
return false;
|
||||
|
||||
$key = (string) $key;
|
||||
|
||||
/* (2) On ajoute les données aux fichier */
|
||||
$json_data = json_encode($data);
|
||||
$this->driver->seek($this->line);
|
||||
$this->line++;
|
||||
$written = $this->driver->fwrite( $json_data.PHP_EOL );
|
||||
$written = $this->driver->fwrite( $json_data."\n" );
|
||||
|
||||
// Si erreur d'écriture, on retourne FALSE
|
||||
if( is_null($written) )
|
||||
return false;
|
||||
|
||||
/* (3) On enregistre l'index */
|
||||
$this->index[$key] = [
|
||||
'line' => $this->line - 1,
|
||||
'hash' => sha1($json_data)
|
||||
];
|
||||
$this->index[$key] = [ 'line' => $this->line++ ];
|
||||
|
||||
/* (4) On enregistre le fichier index */
|
||||
$fIndex = new \SplFileObject($this->dir.'index', 'w');
|
||||
|
@ -152,13 +168,13 @@
|
|||
foreach($dataset as $key=>$data){
|
||||
$json_data = json_encode($data);
|
||||
$this->line++;
|
||||
$written = $this->driver->fwrite( $json_data.PHP_EOL );
|
||||
$written = $this->driver->fwrite( $json_data."\n" );
|
||||
|
||||
|
||||
/* (3) On enregistre les index */
|
||||
$this->index[$key] = [
|
||||
'line' => $this->line - 1,
|
||||
'hash' => sha1($json_data)
|
||||
'line' => $this->line - 1//,
|
||||
//'hash' => sha1($json_data)
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -173,34 +189,31 @@
|
|||
}
|
||||
|
||||
|
||||
/* RENVOIE LES DONNEES ASSOCIEES A UNE CLE DONNEE
|
||||
*
|
||||
* @key<String> Clé associée à la valeur à récupérer
|
||||
*
|
||||
* @return data<mixed*> Renvoie la valeur associée à la clé, FALSE si erreur
|
||||
*
|
||||
*/
|
||||
public function fetch($key){
|
||||
/* (1) On vérifie que la clé existe bien */
|
||||
if( !array_key_exists($key, $this->index) )
|
||||
return false;
|
||||
/* RENVOIE LES DONNEES ASSOCIEES A UNE CLE DONNEE
|
||||
*
|
||||
* @key<String> Clé associée à la valeur à récupérer
|
||||
*
|
||||
* @return data<mixed*> Renvoie la valeur associée à la clé, FALSE si erreur
|
||||
*
|
||||
*/
|
||||
public function fetch($key){
|
||||
/* (1) On vérifie que la clé existe bien */
|
||||
if( !array_key_exists($key, $this->index) )
|
||||
return false;
|
||||
|
||||
/* (2) On récupère la ligne */
|
||||
$line = $this->index[$key]['line'];
|
||||
|
||||
/* (3) On récupère le contenu */
|
||||
$this->driver->seek($line);
|
||||
$json = json_decode( $this->driver->current(), true );
|
||||
|
||||
// Si erreur de parsage
|
||||
if( is_null($json) )
|
||||
return false;
|
||||
|
||||
return $json;
|
||||
}
|
||||
/* (2) On récupère la ligne */
|
||||
$line = $this->index[$key]['line'];
|
||||
|
||||
/* (3) On récupère le contenu */
|
||||
$this->driver->seek($line);
|
||||
$json = json_decode( $this->driver->current(), true );
|
||||
|
||||
// Si erreur de parsage
|
||||
if( is_null($json) )
|
||||
return false;
|
||||
|
||||
return $json;
|
||||
}
|
||||
|
||||
/* RENVOIE LES DONNEES ASSOCIEES AUX CLES DONNEES
|
||||
*
|
||||
|
@ -248,22 +261,25 @@
|
|||
public function delete($key){
|
||||
/* (1) On vérifie l'existence de la clé */
|
||||
if( !array_key_exists($key, $this->index) )
|
||||
return true; // On considère que l'action souhaitée est effectuée
|
||||
return false; // On considère que l'action souhaitée est effectuée
|
||||
|
||||
$line = $this->index[$key]['line'];
|
||||
|
||||
/* (2) On réarrange la bd pour supprimer la ligne */
|
||||
$tmpfilename = __BUILD__.'/tmp/'.uniqid().'.dat';
|
||||
$tmpfilename = __TMP__.'/'.uniqid().'.dat';
|
||||
$tmpfile = new \SplFileObject($tmpfilename, 'w');
|
||||
$this->driver->seek(0);
|
||||
|
||||
// On recopie toutes les lignes sauf celle à supprimer dans un fichier temporaire
|
||||
while( $this->driver->key() < $this->line ){
|
||||
foreach($this->driver as $k=>$content){
|
||||
// Only valuable lines (not the last linebreak)
|
||||
if( $k >= $this->line )
|
||||
break;
|
||||
|
||||
if( $this->driver->key() != $line )
|
||||
$tmpfile->fwrite( $this->driver->current() );
|
||||
// On n'écrit pas la ligne à supprimer
|
||||
if( $k != $line )
|
||||
$tmpfile->fwrite( $content );
|
||||
|
||||
$this->driver->next();
|
||||
}
|
||||
|
||||
// On décrémente le nb de lignes
|
||||
|
@ -317,6 +333,9 @@
|
|||
$keyLines[$key] = $this->index[$key]['line'];
|
||||
}
|
||||
|
||||
if( count($keyLines) == 0 )
|
||||
return true;
|
||||
|
||||
/* [2] On trie les clés en fonction de leur ligne
|
||||
=========================================================*/
|
||||
$sorted = [];
|
||||
|
@ -342,18 +361,19 @@
|
|||
/* [3] On supprime les lignes à supprimer
|
||||
=========================================================*/
|
||||
/* (1) On réarrange la bd pour supprimer la ligne */
|
||||
$tmpfilename = __BUILD__.'/tmp/'.uniqid().'.dat';
|
||||
$tmpfilename = __TMP__.'/'.uniqid().'.dat';
|
||||
$tmpfile = new \SplFileObject($tmpfilename, 'w');
|
||||
$this->driver->seek(0);
|
||||
|
||||
/* (2) On recopie toutes les lignes sauf celles à supprimer dans un fichier temporaire */
|
||||
while( $this->driver->key() < $this->line ){
|
||||
foreach($this->driver as $key=>$content){
|
||||
// Only valuable lines (not the last linebreak)
|
||||
if( $key >= $this->line ) break;
|
||||
|
||||
// Si la ligne en cours n'est pas dans la liste des lignes à supprimer
|
||||
if( !in_array($this->driver->key(), $sorted) )
|
||||
$tmpfile->fwrite( $this->driver->current() ); // On l'écrit dans le nouveau fichier
|
||||
// On n'écrit pas la ligne à supprimer
|
||||
if( !in_array($key, $sorted) )
|
||||
$tmpfile->fwrite( $content );
|
||||
|
||||
$this->driver->next();
|
||||
}
|
||||
|
||||
$tmpfile = null;
|
||||
|
@ -392,51 +412,7 @@
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* RENVOIE LES DONNEES ASSOCIEES A UN CHAMP DE RECHERCHE
|
||||
*
|
||||
* @nomParam<typeParam> Description du param
|
||||
*
|
||||
* @return nomRetour<typeRetour> Description du retour
|
||||
*
|
||||
*/
|
||||
public function filter($data){
|
||||
/* (1) Si @data est un tableau associatif */
|
||||
if( is_array($data) ){
|
||||
|
||||
$filtered = [];
|
||||
foreach($this->index as $i=>$indexData){
|
||||
$this->driver->seek( $indexData['line'] );
|
||||
$dbData = json_decode( $this->driver->fgets(), true );
|
||||
|
||||
foreach($data as $key=>$value)
|
||||
if( isset($dbData[$key]) && preg_match("#$value#", $dbData[$key]) ){
|
||||
$filtered[$i] = $dbData;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $filtered;
|
||||
|
||||
|
||||
/* (2) Sinon on compare @data en tant que valeur simple */
|
||||
}else{
|
||||
|
||||
$this->tmp = sha1( json_encode($data) );
|
||||
return array_filter($this->index, [$this, 'simpleFilter']);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
protected function simpleFilter($e){ return $e['hash'] == $this->tmp; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
{"id":16,"name":"contact-x","sexe":"1","age":"6","studies2":"1","reltype":"1","dist":"1","job":"12","famsit":"1","city":"35","cp":"10025","quartier":"25","duration":["25","125"],"context":"11","contextExtra":["internet","",""],"freq":["1","6","11","16","21"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"1","interest":"0","irlfreq":["1","6","11","16","21"],"relmark":"0","medrel":"1"}
|
||||
{"id":17,"name":"contact-1","sexe":"0","age":"6","studies2":"6","reltype":"6","dist":"2","job":"6","famsit":"2","city":"16","cp":"10006","quartier":"6","duration":["6","16"],"context":"6","contextExtra":["","",""],"freq":["2","7","12","17","22"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"2","interest":"1","irlfreq":["2","7","12","17","22"],"relmark":"1","medrel":"0"}
|
||||
{"id":18,"name":"contact-2","sexe":"1","age":"7","studies2":"7","reltype":"autre","dist":"3","job":"7","famsit":"3","city":"17","cp":"10007","quartier":"7","duration":["7","17"],"context":"7","contextExtra":["","",""],"freq":["3","8","13","18","23"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"3","interest":"2","irlfreq":["3","8","13","18","23"],"relmark":"2","medrel":"1"}
|
||||
{"id":19,"name":"contact-3","sexe":"2","age":"8","studies2":"0","reltype":"0","dist":"0","job":"8","famsit":"0","city":"18","cp":"10008","quartier":"8","duration":["8","18"],"context":"8","contextExtra":["","",""],"freq":["0","5","10","15","20"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"0","interest":"3","irlfreq":["0","5","10","15","20"],"relmark":"3","medrel":"2"}
|
||||
{"id":20,"name":"contact-4","sexe":"0","age":"9","studies2":"1","reltype":"1","dist":"1","job":"9","famsit":"1","city":"19","cp":"10009","quartier":"9","duration":["9","19"],"context":"9","contextExtra":["","",""],"freq":["1","6","11","16","21"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"1","interest":"4","irlfreq":["1","6","11","16","21"],"relmark":"4","medrel":"0"}
|
||||
{"id":21,"name":"contact-5","sexe":"1","age":"10","studies2":"2","reltype":"2","dist":"2","job":"10","famsit":"2","city":"20","cp":"10010","quartier":"10","duration":["10","110"],"context":"10","contextExtra":["","",""],"freq":["2","7","12","17","22"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"2","interest":"0","irlfreq":["2","7","12","17","22"],"relmark":"0","medrel":"1"}
|
||||
{"id":22,"name":"contact-6","sexe":"2","age":"11","studies2":"3","reltype":"3","dist":"3","job":"11","famsit":"3","city":"21","cp":"10011","quartier":"11","duration":["11","111"],"context":"11","contextExtra":["internet","",""],"freq":["3","8","13","18","23"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"3","interest":"1","irlfreq":["3","8","13","18","23"],"relmark":"1","medrel":"2"}
|
||||
{"id":23,"name":"contact-7","sexe":"0","age":"12","studies2":"4","reltype":"4","dist":"0","job":"12","famsit":"0","city":"22","cp":"10012","quartier":"12","duration":["12","112"],"context":"12","contextExtra":["","association",""],"freq":["0","5","10","15","20"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"0","interest":"2","irlfreq":["0","5","10","15","20"],"relmark":"2","medrel":"0"}
|
||||
{"id":24,"name":"contact-8","sexe":"1","age":"13","studies2":"5","reltype":"5","dist":"1","job":"0","famsit":"1","city":"23","cp":"10013","quartier":"13","duration":["13","113"],"context":"13","contextExtra":["","","autre"],"freq":["1","6","11","16","21"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"1","interest":"3","irlfreq":["1","6","11","16","21"],"relmark":"3","medrel":"1"}
|
||||
{"id":25,"name":"contact-9","sexe":"2","age":"14","studies2":"6","reltype":"6","dist":"2","job":"1","famsit":"2","city":"24","cp":"10014","quartier":"14","duration":["14","114"],"context":"0","contextExtra":["","",""],"freq":["2","7","12","17","22"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"2","interest":"4","irlfreq":["2","7","12","17","22"],"relmark":"4","medrel":"2"}
|
||||
{"id":26,"name":"contact-10","sexe":"0","age":"15","studies2":"7","reltype":"autre","dist":"3","job":"2","famsit":"3","city":"25","cp":"10015","quartier":"15","duration":["15","115"],"context":"1","contextExtra":["","",""],"freq":["3","8","13","18","23"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"3","interest":"0","irlfreq":["3","8","13","18","23"],"relmark":"0","medrel":"0"}
|
||||
{"id":27,"name":"contact-11","sexe":"1","age":"16","studies2":"0","reltype":"0","dist":"0","job":"3","famsit":"0","city":"26","cp":"10016","quartier":"16","duration":["16","116"],"context":"2","contextExtra":["","",""],"freq":["0","5","10","15","20"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"0","interest":"1","irlfreq":["0","5","10","15","20"],"relmark":"1","medrel":"1"}
|
||||
{"id":28,"name":"contact-12","sexe":"2","age":"17","studies2":"1","reltype":"1","dist":"1","job":"4","famsit":"1","city":"27","cp":"10017","quartier":"17","duration":["17","117"],"context":"3","contextExtra":["","",""],"freq":["1","6","11","16","21"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"1","interest":"2","irlfreq":["1","6","11","16","21"],"relmark":"2","medrel":"2"}
|
||||
{"id":29,"name":"contact-13","sexe":"0","age":"18","studies2":"2","reltype":"2","dist":"2","job":"5","famsit":"2","city":"28","cp":"10018","quartier":"18","duration":["18","118"],"context":"4","contextExtra":["","",""],"freq":["2","7","12","17","22"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"2","interest":"3","irlfreq":["2","7","12","17","22"],"relmark":"3","medrel":"0"}
|
||||
{"id":30,"name":"contact-14","sexe":"1","age":"0","studies2":"3","reltype":"3","dist":"3","job":"6","famsit":"3","city":"29","cp":"10019","quartier":"19","duration":["19","119"],"context":"5","contextExtra":["","",""],"freq":["3","8","13","18","23"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"3","interest":"4","irlfreq":["3","8","13","18","23"],"relmark":"4","medrel":"1"}
|
||||
{"id":31,"name":"contact-15","sexe":"2","age":"1","studies2":"4","reltype":"4","dist":"0","job":"7","famsit":"0","city":"30","cp":"10020","quartier":"20","duration":["20","120"],"context":"6","contextExtra":["","",""],"freq":["0","5","10","15","20"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"0","interest":"0","irlfreq":["0","5","10","15","20"],"relmark":"0","medrel":"2"}
|
||||
{"id":32,"name":"contact-16","sexe":"0","age":"2","studies2":"5","reltype":"5","dist":"1","job":"8","famsit":"1","city":"31","cp":"10021","quartier":"21","duration":["21","121"],"context":"7","contextExtra":["","",""],"freq":["1","6","11","16","21"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"1","interest":"1","irlfreq":["1","6","11","16","21"],"relmark":"1","medrel":"0"}
|
||||
{"id":33,"name":"contact-17","sexe":"1","age":"3","studies2":"6","reltype":"6","dist":"2","job":"9","famsit":"2","city":"32","cp":"10022","quartier":"22","duration":["22","122"],"context":"8","contextExtra":["","",""],"freq":["2","7","12","17","22"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"2","interest":"2","irlfreq":["2","7","12","17","22"],"relmark":"2","medrel":"1"}
|
||||
{"id":34,"name":"contact-18","sexe":"2","age":"4","studies2":"7","reltype":"autre","dist":"3","job":"10","famsit":"3","city":"33","cp":"10023","quartier":"23","duration":["23","123"],"context":"9","contextExtra":["","",""],"freq":["3","8","13","18","23"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"3","interest":"3","irlfreq":["3","8","13","18","23"],"relmark":"3","medrel":"2"}
|
||||
{"id":35,"name":"contact-19","sexe":"0","age":"5","studies2":"0","reltype":"0","dist":"0","job":"11","famsit":"0","city":"34","cp":"10024","quartier":"24","duration":["24","124"],"context":"10","contextExtra":["","",""],"freq":["0","5","10","15","20"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"0","interest":"4","irlfreq":["0","5","10","15","20"],"relmark":"4","medrel":"0"}
|
||||
{"id":37,"name":"contact-21","sexe":"2","age":"7","studies2":"2","reltype":"2","dist":"2","job":"0","famsit":"2","city":"36","cp":"10026","quartier":"26","duration":["26","126"],"context":"12","contextExtra":["","association",""],"freq":["2","7","12","17","22"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"2","interest":"1","irlfreq":["2","7","12","17","22"],"relmark":"1","medrel":"2"}
|
||||
{"id":38,"name":"contact-22","sexe":"0","age":"8","studies2":"3","reltype":"3","dist":"3","job":"1","famsit":"3","city":"37","cp":"10027","quartier":"27","duration":["27","127"],"context":"13","contextExtra":["","","autre"],"freq":["3","8","13","18","23"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"3","interest":"2","irlfreq":["3","8","13","18","23"],"relmark":"2","medrel":"0"}
|
||||
{"id":39,"name":"contact-23","sexe":"1","age":"9","studies2":"4","reltype":"4","dist":"0","job":"2","famsit":"0","city":"38","cp":"10028","quartier":"28","duration":["28","128"],"context":"0","contextExtra":["","",""],"freq":["0","5","10","15","20"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"0","interest":"3","irlfreq":["0","5","10","15","20"],"relmark":"3","medrel":"1"}
|
||||
{"id":40,"name":"contact-24","sexe":"2","age":"10","studies2":"5","reltype":"5","dist":"1","job":"3","famsit":"1","city":"39","cp":"10029","quartier":"29","duration":["29","129"],"context":"1","contextExtra":["","",""],"freq":["1","6","11","16","21"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"1","interest":"4","irlfreq":["1","6","11","16","21"],"relmark":"4","medrel":"2"}
|
||||
{"id":41,"name":"contact-25","sexe":"0","age":"11","studies2":"6","reltype":"6","dist":"2","job":"4","famsit":"2","city":"40","cp":"10030","quartier":"30","duration":["30","130"],"context":"2","contextExtra":["","",""],"freq":["2","7","12","17","22"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"2","interest":"0","irlfreq":["2","7","12","17","22"],"relmark":"0","medrel":"0"}
|
||||
{"id":42,"name":"contact-26","sexe":"1","age":"12","studies2":"7","reltype":"autre","dist":"3","job":"5","famsit":"3","city":"41","cp":"10031","quartier":"31","duration":["31","131"],"context":"3","contextExtra":["","",""],"freq":["3","8","13","18","23"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"3","interest":"1","irlfreq":["3","8","13","18","23"],"relmark":"1","medrel":"1"}
|
||||
{"id":43,"name":"contact-27","sexe":"2","age":"13","studies2":"0","reltype":"0","dist":"0","job":"6","famsit":"0","city":"42","cp":"10032","quartier":"32","duration":["32","132"],"context":"4","contextExtra":["","",""],"freq":["0","5","10","15","20"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"0","interest":"2","irlfreq":["0","5","10","15","20"],"relmark":"2","medrel":"2"}
|
||||
{"id":44,"name":"contact-28","sexe":"0","age":"14","studies2":"1","reltype":"1","dist":"1","job":"7","famsit":"1","city":"43","cp":"10033","quartier":"33","duration":["33","133"],"context":"5","contextExtra":["","",""],"freq":["1","6","11","16","21"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"1","interest":"3","irlfreq":["1","6","11","16","21"],"relmark":"3","medrel":"0"}
|
||||
{"id":45,"name":"contact-29","sexe":"1","age":"15","studies2":"2","reltype":"2","dist":"2","job":"8","famsit":"2","city":"44","cp":"10034","quartier":"34","duration":["34","134"],"context":"6","contextExtra":["","",""],"freq":["2","7","12","17","22"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"2","interest":"4","irlfreq":["2","7","12","17","22"],"relmark":"4","medrel":"1"}
|
||||
{"id":46,"name":"contact-30","sexe":"2","age":"16","studies2":"3","reltype":"3","dist":"3","job":"9","famsit":"3","city":"45","cp":"10035","quartier":"35","duration":["35","135"],"context":"7","contextExtra":["","",""],"freq":["3","8","13","18","23"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"3","interest":"0","irlfreq":["3","8","13","18","23"],"relmark":"0","medrel":"2"}
|
||||
{"id":47,"name":"contact-31","sexe":"0","age":"17","studies2":"4","reltype":"4","dist":"0","job":"10","famsit":"0","city":"46","cp":"10036","quartier":"36","duration":["36","136"],"context":"8","contextExtra":["","",""],"freq":["0","5","10","15","20"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"0","interest":"1","irlfreq":["0","5","10","15","20"],"relmark":"1","medrel":"0"}
|
||||
{"id":48,"name":"contact-32","sexe":"1","age":"18","studies2":"5","reltype":"5","dist":"1","job":"11","famsit":"1","city":"47","cp":"10037","quartier":"37","duration":["37","137"],"context":"9","contextExtra":["","",""],"freq":["1","6","11","16","21"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"1","interest":"2","irlfreq":["1","6","11","16","21"],"relmark":"2","medrel":"1"}
|
||||
{"id":49,"name":"contact-33","sexe":"2","age":"0","studies2":"6","reltype":"6","dist":"2","job":"12","famsit":"2","city":"48","cp":"10038","quartier":"38","duration":["38","138"],"context":"10","contextExtra":["","",""],"freq":["2","7","12","17","22"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"2","interest":"3","irlfreq":["2","7","12","17","22"],"relmark":"3","medrel":"2"}
|
||||
{"id":50,"name":"contact-34","sexe":"0","age":"1","studies2":"7","reltype":"autre","dist":"3","job":"0","famsit":"3","city":"49","cp":"10039","quartier":"39","duration":["39","139"],"context":"11","contextExtra":["internet","",""],"freq":["3","8","13","18","23"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"3","interest":"4","irlfreq":["3","8","13","18","23"],"relmark":"4","medrel":"0"}
|
||||
{"id":51,"name":"contact-35","sexe":"1","age":"2","studies2":"0","reltype":"0","dist":"0","job":"1","famsit":"0","city":"50","cp":"10040","quartier":"40","duration":["40","140"],"context":"12","contextExtra":["","association",""],"freq":["0","5","10","15","20"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"0","interest":"0","irlfreq":["0","5","10","15","20"],"relmark":"0","medrel":"1"}
|
||||
{"id":52,"name":"contact-36","sexe":"2","age":"3","studies2":"1","reltype":"1","dist":"1","job":"2","famsit":"1","city":"51","cp":"10041","quartier":"41","duration":["41","141"],"context":"13","contextExtra":["","","autre"],"freq":["1","6","11","16","21"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"1","interest":"1","irlfreq":["1","6","11","16","21"],"relmark":"1","medrel":"2"}
|
||||
{"id":53,"name":"contact-37","sexe":"0","age":"4","studies2":"2","reltype":"2","dist":"2","job":"3","famsit":"2","city":"52","cp":"10042","quartier":"42","duration":["42","142"],"context":"0","contextExtra":["","",""],"freq":["2","7","12","17","22"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"2","interest":"2","irlfreq":["2","7","12","17","22"],"relmark":"2","medrel":"0"}
|
||||
{"id":54,"name":"contact-38","sexe":"1","age":"5","studies2":"3","reltype":"3","dist":"3","job":"4","famsit":"3","city":"53","cp":"10043","quartier":"43","duration":["43","143"],"context":"1","contextExtra":["","",""],"freq":["3","8","13","18","23"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"3","interest":"3","irlfreq":["3","8","13","18","23"],"relmark":"3","medrel":"1"}
|
||||
{"id":55,"name":"contact-39","sexe":"2","age":"6","studies2":"4","reltype":"4","dist":"0","job":"5","famsit":"0","city":"54","cp":"10044","quartier":"44","duration":["44","144"],"context":"2","contextExtra":["","",""],"freq":["0","5","10","15","20"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"0","interest":"4","irlfreq":["0","5","10","15","20"],"relmark":"4","medrel":"2"}
|
||||
{"id":57,"name":"contact-41","sexe":"1","age":"","studies1":"2","reltype":"1","dist":"0"}
|
||||
{"id":58,"name":"contact-42","sexe":"0","age":"2","studies1":"3","reltype":"2","dist":"1"}
|
||||
{"id":59,"name":"contact-43","sexe":"1","age":"3","studies1":"4","reltype":"3","dist":"2"}
|
||||
{"id":60,"name":"contact-44","sexe":"0","age":"4","studies1":"5","reltype":"4","dist":"3"}
|
||||
{"id":63,"name":"contact-x","sexe":"1","age":"6","studies2":"1","reltype":"1","dist":"1","job":"12","famsit":"1","city":"35","cp":"10025","quartier":"25","duration":["25","125"],"context":"11","contextExtra":["internet","",""],"freq":["1","6","11","16","21"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"1","interest":"0","irlfreq":["1","6","11","16","21"],"relmark":"0","medrel":"1"}
|
||||
{"id":64,"name":"contact-1","sexe":"0","age":"6","studies2":"6","reltype":"6","dist":"2","job":"6","famsit":"2","city":"16","cp":"10006","quartier":"6","duration":["6","16"],"context":"6","contextExtra":["","",""],"freq":["2","7","12","17","22"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"2","interest":"1","irlfreq":["2","7","12","17","22"],"relmark":"1","medrel":"0"}
|
||||
{"id":65,"name":"contact-2","sexe":"1","age":"7","studies2":"7","reltype":"autre","dist":"3","job":"7","famsit":"3","city":"17","cp":"10007","quartier":"7","duration":["7","17"],"context":"7","contextExtra":["","",""],"freq":["3","8","13","18","23"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"3","interest":"2","irlfreq":["3","8","13","18","23"],"relmark":"2","medrel":"1"}
|
||||
{"id":66,"name":"contact-3","sexe":"2","age":"8","studies2":"0","reltype":"0","dist":"0","job":"8","famsit":"0","city":"18","cp":"10008","quartier":"8","duration":["8","18"],"context":"8","contextExtra":["","",""],"freq":["0","5","10","15","20"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"0","interest":"3","irlfreq":["0","5","10","15","20"],"relmark":"3","medrel":"2"}
|
||||
{"id":67,"name":"contact-4","sexe":"0","age":"9","studies2":"1","reltype":"1","dist":"1","job":"9","famsit":"1","city":"19","cp":"10009","quartier":"9","duration":["9","19"],"context":"9","contextExtra":["","",""],"freq":["1","6","11","16","21"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"1","interest":"4","irlfreq":["1","6","11","16","21"],"relmark":"4","medrel":"0"}
|
||||
{"id":68,"name":"contact-5","sexe":"1","age":"10","studies2":"2","reltype":"2","dist":"2","job":"10","famsit":"2","city":"20","cp":"10010","quartier":"10","duration":["10","110"],"context":"10","contextExtra":["","",""],"freq":["2","7","12","17","22"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"2","interest":"0","irlfreq":["2","7","12","17","22"],"relmark":"0","medrel":"1"}
|
||||
{"id":69,"name":"contact-6","sexe":"2","age":"11","studies2":"3","reltype":"3","dist":"3","job":"11","famsit":"3","city":"21","cp":"10011","quartier":"11","duration":["11","111"],"context":"11","contextExtra":["internet","",""],"freq":["3","8","13","18","23"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"3","interest":"1","irlfreq":["3","8","13","18","23"],"relmark":"1","medrel":"2"}
|
||||
{"id":70,"name":"contact-7","sexe":"0","age":"12","studies2":"4","reltype":"4","dist":"0","job":"12","famsit":"0","city":"22","cp":"10012","quartier":"12","duration":["12","112"],"context":"12","contextExtra":["","association",""],"freq":["0","5","10","15","20"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"0","interest":"2","irlfreq":["0","5","10","15","20"],"relmark":"2","medrel":"0"}
|
||||
{"id":71,"name":"contact-8","sexe":"1","age":"13","studies2":"5","reltype":"5","dist":"1","job":"0","famsit":"1","city":"23","cp":"10013","quartier":"13","duration":["13","113"],"context":"13","contextExtra":["","","autre"],"freq":["1","6","11","16","21"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"1","interest":"3","irlfreq":["1","6","11","16","21"],"relmark":"3","medrel":"1"}
|
||||
{"id":72,"name":"contact-9","sexe":"2","age":"14","studies2":"6","reltype":"6","dist":"2","job":"1","famsit":"2","city":"24","cp":"10014","quartier":"14","duration":["14","114"],"context":"0","contextExtra":["","",""],"freq":["2","7","12","17","22"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"2","interest":"4","irlfreq":["2","7","12","17","22"],"relmark":"4","medrel":"2"}
|
||||
{"id":73,"name":"contact-10","sexe":"0","age":"15","studies2":"7","reltype":"autre","dist":"3","job":"2","famsit":"3","city":"25","cp":"10015","quartier":"15","duration":["15","115"],"context":"1","contextExtra":["","",""],"freq":["3","8","13","18","23"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"3","interest":"0","irlfreq":["3","8","13","18","23"],"relmark":"0","medrel":"0"}
|
||||
{"id":74,"name":"contact-11","sexe":"1","age":"16","studies2":"0","reltype":"0","dist":"0","job":"3","famsit":"0","city":"26","cp":"10016","quartier":"16","duration":["16","116"],"context":"2","contextExtra":["","",""],"freq":["0","5","10","15","20"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"0","interest":"1","irlfreq":["0","5","10","15","20"],"relmark":"1","medrel":"1"}
|
||||
{"id":75,"name":"contact-12","sexe":"2","age":"17","studies2":"1","reltype":"1","dist":"1","job":"4","famsit":"1","city":"27","cp":"10017","quartier":"17","duration":["17","117"],"context":"3","contextExtra":["","",""],"freq":["1","6","11","16","21"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"1","interest":"2","irlfreq":["1","6","11","16","21"],"relmark":"2","medrel":"2"}
|
||||
{"id":76,"name":"contact-13","sexe":"0","age":"18","studies2":"2","reltype":"2","dist":"2","job":"5","famsit":"2","city":"28","cp":"10018","quartier":"18","duration":["18","118"],"context":"4","contextExtra":["","",""],"freq":["2","7","12","17","22"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"2","interest":"3","irlfreq":["2","7","12","17","22"],"relmark":"3","medrel":"0"}
|
||||
{"id":77,"name":"contact-14","sexe":"1","age":"0","studies2":"3","reltype":"3","dist":"3","job":"6","famsit":"3","city":"29","cp":"10019","quartier":"19","duration":["19","119"],"context":"5","contextExtra":["","",""],"freq":["3","8","13","18","23"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"3","interest":"4","irlfreq":["3","8","13","18","23"],"relmark":"4","medrel":"1"}
|
||||
{"id":78,"name":"contact-15","sexe":"2","age":"1","studies2":"4","reltype":"4","dist":"0","job":"7","famsit":"0","city":"30","cp":"10020","quartier":"20","duration":["20","120"],"context":"6","contextExtra":["","",""],"freq":["0","5","10","15","20"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"0","interest":"0","irlfreq":["0","5","10","15","20"],"relmark":"0","medrel":"2"}
|
||||
{"id":79,"name":"contact-16","sexe":"0","age":"2","studies2":"5","reltype":"5","dist":"1","job":"8","famsit":"1","city":"31","cp":"10021","quartier":"21","duration":["21","121"],"context":"7","contextExtra":["","",""],"freq":["1","6","11","16","21"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"1","interest":"1","irlfreq":["1","6","11","16","21"],"relmark":"1","medrel":"0"}
|
||||
{"id":80,"name":"contact-17","sexe":"1","age":"3","studies2":"6","reltype":"6","dist":"2","job":"9","famsit":"2","city":"32","cp":"10022","quartier":"22","duration":["22","122"],"context":"8","contextExtra":["","",""],"freq":["2","7","12","17","22"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"2","interest":"2","irlfreq":["2","7","12","17","22"],"relmark":"2","medrel":"1"}
|
||||
{"id":81,"name":"contact-18","sexe":"2","age":"4","studies2":"7","reltype":"autre","dist":"3","job":"10","famsit":"3","city":"33","cp":"10023","quartier":"23","duration":["23","123"],"context":"9","contextExtra":["","",""],"freq":["3","8","13","18","23"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"3","interest":"3","irlfreq":["3","8","13","18","23"],"relmark":"3","medrel":"2"}
|
||||
{"id":82,"name":"contact-19","sexe":"0","age":"5","studies2":"0","reltype":"0","dist":"0","job":"11","famsit":"0","city":"34","cp":"10024","quartier":"24","duration":["24","124"],"context":"10","contextExtra":["","",""],"freq":["0","5","10","15","20"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"0","interest":"4","irlfreq":["0","5","10","15","20"],"relmark":"4","medrel":"0"}
|
||||
{"id":84,"name":"contact-21","sexe":"2","age":"7","studies2":"2","reltype":"2","dist":"2","job":"0","famsit":"2","city":"36","cp":"10026","quartier":"26","duration":["26","126"],"context":"12","contextExtra":["","association",""],"freq":["2","7","12","17","22"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"2","interest":"1","irlfreq":["2","7","12","17","22"],"relmark":"1","medrel":"2"}
|
||||
{"id":85,"name":"contact-22","sexe":"0","age":"8","studies2":"3","reltype":"3","dist":"3","job":"1","famsit":"3","city":"37","cp":"10027","quartier":"27","duration":["27","127"],"context":"13","contextExtra":["","","autre"],"freq":["3","8","13","18","23"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"3","interest":"2","irlfreq":["3","8","13","18","23"],"relmark":"2","medrel":"0"}
|
||||
{"id":86,"name":"contact-23","sexe":"1","age":"9","studies2":"4","reltype":"4","dist":"0","job":"2","famsit":"0","city":"38","cp":"10028","quartier":"28","duration":["28","128"],"context":"0","contextExtra":["","",""],"freq":["0","5","10","15","20"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"0","interest":"3","irlfreq":["0","5","10","15","20"],"relmark":"3","medrel":"1"}
|
||||
{"id":87,"name":"contact-24","sexe":"2","age":"10","studies2":"5","reltype":"5","dist":"1","job":"3","famsit":"1","city":"39","cp":"10029","quartier":"29","duration":["29","129"],"context":"1","contextExtra":["","",""],"freq":["1","6","11","16","21"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"1","interest":"4","irlfreq":["1","6","11","16","21"],"relmark":"4","medrel":"2"}
|
||||
{"id":88,"name":"contact-25","sexe":"0","age":"11","studies2":"6","reltype":"6","dist":"2","job":"4","famsit":"2","city":"40","cp":"10030","quartier":"30","duration":["30","130"],"context":"2","contextExtra":["","",""],"freq":["2","7","12","17","22"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"2","interest":"0","irlfreq":["2","7","12","17","22"],"relmark":"0","medrel":"0"}
|
||||
{"id":89,"name":"contact-26","sexe":"1","age":"12","studies2":"7","reltype":"autre","dist":"3","job":"5","famsit":"3","city":"41","cp":"10031","quartier":"31","duration":["31","131"],"context":"3","contextExtra":["","",""],"freq":["3","8","13","18","23"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"3","interest":"1","irlfreq":["3","8","13","18","23"],"relmark":"1","medrel":"1"}
|
||||
{"id":90,"name":"contact-27","sexe":"2","age":"13","studies2":"0","reltype":"0","dist":"0","job":"6","famsit":"0","city":"42","cp":"10032","quartier":"32","duration":["32","132"],"context":"4","contextExtra":["","",""],"freq":["0","5","10","15","20"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"0","interest":"2","irlfreq":["0","5","10","15","20"],"relmark":"2","medrel":"2"}
|
||||
{"id":91,"name":"contact-28","sexe":"0","age":"14","studies2":"1","reltype":"1","dist":"1","job":"7","famsit":"1","city":"43","cp":"10033","quartier":"33","duration":["33","133"],"context":"5","contextExtra":["","",""],"freq":["1","6","11","16","21"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"1","interest":"3","irlfreq":["1","6","11","16","21"],"relmark":"3","medrel":"0"}
|
||||
{"id":92,"name":"contact-29","sexe":"1","age":"15","studies2":"2","reltype":"2","dist":"2","job":"8","famsit":"2","city":"44","cp":"10034","quartier":"34","duration":["34","134"],"context":"6","contextExtra":["","",""],"freq":["2","7","12","17","22"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"2","interest":"4","irlfreq":["2","7","12","17","22"],"relmark":"4","medrel":"1"}
|
||||
{"id":93,"name":"contact-30","sexe":"2","age":"16","studies2":"3","reltype":"3","dist":"3","job":"9","famsit":"3","city":"45","cp":"10035","quartier":"35","duration":["35","135"],"context":"7","contextExtra":["","",""],"freq":["3","8","13","18","23"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"3","interest":"0","irlfreq":["3","8","13","18","23"],"relmark":"0","medrel":"2"}
|
||||
{"id":94,"name":"contact-31","sexe":"0","age":"17","studies2":"4","reltype":"4","dist":"0","job":"10","famsit":"0","city":"46","cp":"10036","quartier":"36","duration":["36","136"],"context":"8","contextExtra":["","",""],"freq":["0","5","10","15","20"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"0","interest":"1","irlfreq":["0","5","10","15","20"],"relmark":"1","medrel":"0"}
|
||||
{"id":95,"name":"contact-32","sexe":"1","age":"18","studies2":"5","reltype":"5","dist":"1","job":"11","famsit":"1","city":"47","cp":"10037","quartier":"37","duration":["37","137"],"context":"9","contextExtra":["","",""],"freq":["1","6","11","16","21"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"1","interest":"2","irlfreq":["1","6","11","16","21"],"relmark":"2","medrel":"1"}
|
||||
{"id":96,"name":"contact-33","sexe":"2","age":"0","studies2":"6","reltype":"6","dist":"2","job":"12","famsit":"2","city":"48","cp":"10038","quartier":"38","duration":["38","138"],"context":"10","contextExtra":["","",""],"freq":["2","7","12","17","22"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"2","interest":"3","irlfreq":["2","7","12","17","22"],"relmark":"3","medrel":"2"}
|
||||
{"id":97,"name":"contact-34","sexe":"0","age":"1","studies2":"7","reltype":"autre","dist":"3","job":"0","famsit":"3","city":"49","cp":"10039","quartier":"39","duration":["39","139"],"context":"11","contextExtra":["internet","",""],"freq":["3","8","13","18","23"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"3","interest":"4","irlfreq":["3","8","13","18","23"],"relmark":"4","medrel":"0"}
|
||||
{"id":98,"name":"contact-35","sexe":"1","age":"2","studies2":"0","reltype":"0","dist":"0","job":"1","famsit":"0","city":"50","cp":"10040","quartier":"40","duration":["40","140"],"context":"12","contextExtra":["","association",""],"freq":["0","5","10","15","20"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"0","interest":"0","irlfreq":["0","5","10","15","20"],"relmark":"0","medrel":"1"}
|
||||
{"id":99,"name":"contact-36","sexe":"2","age":"3","studies2":"1","reltype":"1","dist":"1","job":"2","famsit":"1","city":"51","cp":"10041","quartier":"41","duration":["41","141"],"context":"13","contextExtra":["","","autre"],"freq":["1","6","11","16","21"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"1","interest":"1","irlfreq":["1","6","11","16","21"],"relmark":"1","medrel":"2"}
|
||||
{"id":100,"name":"contact-37","sexe":"0","age":"4","studies2":"2","reltype":"2","dist":"2","job":"3","famsit":"2","city":"52","cp":"10042","quartier":"42","duration":["42","142"],"context":"0","contextExtra":["","",""],"freq":["2","7","12","17","22"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"2","interest":"2","irlfreq":["2","7","12","17","22"],"relmark":"2","medrel":"0"}
|
||||
{"id":101,"name":"contact-38","sexe":"1","age":"5","studies2":"3","reltype":"3","dist":"3","job":"4","famsit":"3","city":"53","cp":"10043","quartier":"43","duration":["43","143"],"context":"1","contextExtra":["","",""],"freq":["3","8","13","18","23"],"connect":["1","3","5","7","9","11"],"connectExtra":["",""],"medsoc":"3","interest":"3","irlfreq":["3","8","13","18","23"],"relmark":"3","medrel":"1"}
|
||||
{"id":102,"name":"contact-39","sexe":"2","age":"6","studies2":"4","reltype":"4","dist":"0","job":"5","famsit":"0","city":"54","cp":"10044","quartier":"44","duration":["44","144"],"context":"2","contextExtra":["","",""],"freq":["0","5","10","15","20"],"connect":["0","2","4","6","8","10"],"connectExtra":["",""],"medsoc":"0","interest":"4","irlfreq":["0","5","10","15","20"],"relmark":"4","medrel":"2"}
|
||||
{"id":104,"name":"contact-41","sexe":"1","age":"","studies1":"2","reltype":"1","dist":"0"}
|
||||
{"id":105,"name":"contact-42","sexe":"0","age":"2","studies1":"3","reltype":"2","dist":"1"}
|
||||
{"id":106,"name":"contact-43","sexe":"1","age":"3","studies1":"4","reltype":"3","dist":"2"}
|
||||
{"id":107,"name":"contact-44","sexe":"0","age":"4","studies1":"5","reltype":"4","dist":"3"}
|
|
@ -0,0 +1 @@
|
|||
{"16":{"line":0},"17":{"line":1},"18":{"line":2},"19":{"line":3},"20":{"line":4},"21":{"line":5},"22":{"line":6},"23":{"line":7},"24":{"line":8},"25":{"line":9},"26":{"line":10},"27":{"line":11},"28":{"line":12},"29":{"line":13},"30":{"line":14},"31":{"line":15},"32":{"line":16},"33":{"line":17},"34":{"line":18},"35":{"line":19},"37":{"line":20},"38":{"line":21},"39":{"line":22},"40":{"line":23},"41":{"line":24},"42":{"line":25},"43":{"line":26},"44":{"line":27},"45":{"line":28},"46":{"line":29},"47":{"line":30},"48":{"line":31},"49":{"line":32},"50":{"line":33},"51":{"line":34},"52":{"line":35},"53":{"line":36},"54":{"line":37},"55":{"line":38},"57":{"line":39},"58":{"line":40},"59":{"line":41},"60":{"line":42},"63":{"line":43},"64":{"line":44},"65":{"line":45},"66":{"line":46},"67":{"line":47},"68":{"line":48},"69":{"line":49},"70":{"line":50},"71":{"line":51},"72":{"line":52},"73":{"line":53},"74":{"line":54},"75":{"line":55},"76":{"line":56},"77":{"line":57},"78":{"line":58},"79":{"line":59},"80":{"line":60},"81":{"line":61},"82":{"line":62},"84":{"line":63},"85":{"line":64},"86":{"line":65},"87":{"line":66},"88":{"line":67},"89":{"line":68},"90":{"line":69},"91":{"line":70},"92":{"line":71},"93":{"line":72},"94":{"line":73},"95":{"line":74},"96":{"line":75},"97":{"line":76},"98":{"line":77},"99":{"line":78},"100":{"line":79},"101":{"line":80},"102":{"line":81},"104":{"line":82},"105":{"line":83},"106":{"line":84},"107":{"line":85}}
|
|
@ -4,14 +4,56 @@
|
|||
"logs": {
|
||||
"direction": { "0": "INCOMING", "1": "OUTGOING", "2": "MISSED" },
|
||||
"type": { "0": "PHONE", "1": "SMS" }
|
||||
},
|
||||
|
||||
|
||||
"questions": {
|
||||
"sexe": { "x": "Civilité" },
|
||||
"age": { "x": "Age" },
|
||||
"studies1": { "x": "Niveau d'études maximal (fiche rapide)" },
|
||||
"studies2": { "x": "Niveau d'études maximal (fiche complète)" },
|
||||
"job": { "x": "Dernière profession exercée" },
|
||||
"city": { "x": "Où habite t-elle/il ? (ville)" },
|
||||
"cp": { "x": "Où habite t-elle/il ? (code postal)" },
|
||||
"quartier": { "x": "Où habite t-elle/il ? (quartier)" },
|
||||
"context": { "x": "Contexte de rencontre" },
|
||||
"contextExtra": { "0": "Internet (quel contexte ? préciser)",
|
||||
"1": "Par une association (quel type ? préciser)",
|
||||
"2": "Autre" },
|
||||
"famsit": { "x": "Situation familiale" },
|
||||
"reltype": { "x": "Type de relation" },
|
||||
"dist": { "x": "À combien de temps est-ce de chez vous (en voiture) ? (si deux domiciles, le plus proche)" },
|
||||
"duration": { "0": "Depuis quand connaissez-vous cette personne ? (mois)",
|
||||
"1": "Depuis quand connaissez-vous cette personne ? (années)" },
|
||||
"freq": { "0": "Avec quelle fréquence discutez-vous avec cette personne face à face ?",
|
||||
"1": "Avec quelle fréquence discutez-vous avec cette personne via téléphone ou skype et équivalent ?",
|
||||
"2": "Avec quelle fréquence discutez-vous avec cette personne via SMS et équivalents ?",
|
||||
"3": "Avec quelle fréquence discutez-vous avec cette personne via courrier éléctronique ?",
|
||||
"4": "Avec quelle fréquence discutez-vous avec cette personne via facebook ou autre réseau social ?" },
|
||||
"irlfreq": { "0": "Selon vous, à quelle fréquence cette personne publie des commentaires personnels ou réagit aux publications des autres ?",
|
||||
"1": "Selon vous, à quelle fréquence cette personne publie des photos personnelles (profil, voyages, etc.) ?",
|
||||
"2": "Selon vous, à quelle fréquence cette personne partage de la musique ou des clips musicaux ?",
|
||||
"3": "Selon vous, à quelle fréquence cette personne partage des informations culturelles (concert, exposition, etc.) ?",
|
||||
"4": "Selon vous, à quelle fréquence cette personne partage des articles, des informations, des contenus avec une portée politique ?" },
|
||||
"connect": { "0": "Ses coordonnées sont dans votre carnet d'adresse",
|
||||
"1": "Son numéro de mobile est enregistré sur votre mobile (ou vous-mêmes êtes sur le sien)",
|
||||
"2": "Elle figure parmi vos amis facebook (idem)",
|
||||
"3": "Elle figure parmi vos amis facebook et vous interagissez avec elle sur ce dispositif régulièrement (idem)",
|
||||
"4": "Vous le suivez sur Twitter (ou elle vous suit)",
|
||||
"5": "Vous communiquez avec cette personne sur Twitter (idem)" },
|
||||
"connectExtra": { "0": "Vous communiquez dans autre réseau",
|
||||
"1": "Vous communiquez dans un autre dispositif (blogs, jeu vidéo ou autre)" },
|
||||
"medsoc": { "x": "Comment cette personne utilise-t-elle les médias sociaux de votre point de vue ?" },
|
||||
"medrel": { "x": "Considérez-vous que vos échange avec cette personne à travers les médias sociaux" },
|
||||
"interest": { "x": "Sur une échelle de 1 à 5, préciser l'intérêt que vous accordez aux contenue qu'elle partage via les médias sociaux" },
|
||||
"relmark": { "x": "Sur une échelle de 1 à 5, comment jugez-vous votre relation à cette personne ?" }
|
||||
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"contacts": {
|
||||
|
||||
"sexe": { "0":"Homme", "1":"Femme", "2":"Indéterminé" },
|
||||
"age": {
|
||||
".": "NA",
|
||||
|
@ -32,49 +74,32 @@
|
|||
},
|
||||
|
||||
"studies2": {
|
||||
".": "NA",
|
||||
"0": "Inconnue",
|
||||
"01": "Pas de scolarité",
|
||||
"02": "Aucun diplôme mais scolarité jusqu'en école primaire ou au collège",
|
||||
"03": "Aucun diplôme mais scolarité au-delà du collège",
|
||||
"04": "Certificat d'études primaires (CEP)",
|
||||
"05": "BEPC, brevet élémentaire, brevet des collèges",
|
||||
"06": "Certificat d'aptitudes professionnelles (CAP), brevet de compagnon, y compris CAPA",
|
||||
"07": "Brevet d'études professionnelles (BEP), y compris BEPA et diplômes agricoles (BAA, BPA) Diplômes sociaux (aide-soignante, auxiliaire de puériculture, travailleuse familiale)",
|
||||
"08": "Baccalauréat général, brevet supérieur BAC ( L, ES, S ou A, B , C, D, D’, E )",
|
||||
"09": "Bac technologique ou professionnel, brevet professionnel ou de technicien BAC (STI, STL, SMS, STT ou F, G, H) BEC, BEI, BEH, capacité en droit Brevet de technicien agricole (BTA)",
|
||||
"10": "Diplôme universitaire de 1er cycle BTS, DUT, DEUG Diplôme des professions sociales ou de santé, d'infirmier(ère) Diplôme universitaire propédeutique, DUEL, DUES, DEUG, PCEM",
|
||||
"11": "Diplôme universitaire de 2ème ou 3ème cycle MASTER, DOCTORAT (y compris médecine, pharmacie, dentaire), Maîtrise, DEA, DESS, CAPES, CAPET, agrégation Diplôme d'ingénieur, d'une grande école, etc."
|
||||
".": "NA",
|
||||
"0": "Aucun diplôme, CEP, BEPC",
|
||||
"1": "CAP, CAPA, BEP, BEPA, Brevet de compagnon, Diplômes sociaux (aide-soignante, auxiliaire de puériculture, travailleuse familiale)",
|
||||
"2": "Bac technologique ou professionnel, brevet professionnel ou de technicien",
|
||||
"3": "Baccalauréat général, brevet supérieur",
|
||||
"4": "Diplôme universitaire de 1er cycle: Licence, BTS, DUT",
|
||||
"5": "Diplôme universitaire de 2ème cycle : MASTER, Maîtrise ou DEA, CAPES",
|
||||
"6": "Doctorat (y compris médecine, pharmacie, dentaire)",
|
||||
"7": "Diplôme d'ingénieur, diplôme d'une grande école de commerce"
|
||||
},
|
||||
|
||||
"job": {
|
||||
".": "NA",
|
||||
"10": "Agriculteurs exploitants (Agriculteurs, maraîchers, viticulteurs…)",
|
||||
"21": "Artisans (Maçons, électriciens, couturiers, boulangers, garagistes, coiffeurs…)",
|
||||
"22": "Commerçants et assimilés (Commerçants en détail ou en gros, buralistes, cafetiers, agents immobiliers…)",
|
||||
"23": "Chefs d'entreprise de 10 salariés ou plus",
|
||||
"31": "Professions libérales et assimilés (Médecins, avocats, notaires, architectes libéraux…)",
|
||||
"32": "Cadres de la fonction publique, professions intellectuelles et artistiques (Personnels administratifs de catégorie A, professeurs de l’enseignement secondaire ou supérieur, médecins hospitaliers, artistes…)",
|
||||
"36": "Cadres d'entreprise (Cadres administratifs, cadres commerciaux, ingénieurs…)",
|
||||
"41": "Professions intermédiaires de l'enseignement, de la santé, de la fonction publique et assimilés (Personnels administratifs de catégorie B, instituteurs, infirmiers, travailleurs sociaux…)",
|
||||
"46": "Professions intermédiaires administratives et commerciales des entreprises (Comptables, chargés de clientèles…)",
|
||||
"47": "Techniciens (Techniciens d’études, techniciens de contrôle, dessinateurs en bâtiment, géomètres…)",
|
||||
"48": "Contremaîtres, agents de maîtrise (Conducteurs de travaux, chefs d’équipe…)",
|
||||
"51": "Employés de la fonction publique (Personnels de catégorie C, agents administratifs, agents de service…)",
|
||||
"54": "Employés administratifs d'entreprise (Secrétaires, agents d’accueil…)",
|
||||
"55": "Employés de commerce (Vendeurs, caissiers…)",
|
||||
"56": "Personnels des services directs aux particuliers (Serveurs, coiffeurs, assistantes maternelles…)",
|
||||
"61": "Ouvriers qualifiés de type industriel ou artisanal (Mécaniciens, chauffeurs, cuisiniers…)",
|
||||
"66": "Ouvriers non qualifiés de type industriel ou artisanal (Ouvrier de production, manœuvres…)",
|
||||
"69": "Ouvriers agricoles (Bergers, ouvriers de la viticulture, bûcherons, ouvrier forestiers…)",
|
||||
"71": "Anciens agriculteurs exploitants",
|
||||
"72": "Anciens artisans, commerçants, chefs d'entreprise",
|
||||
"73": "Anciens cadres",
|
||||
"74": "Anciennes professions intermédiaires",
|
||||
"75": "Anciens employés",
|
||||
"76": "Anciens ouvriers",
|
||||
"81": "Chômeurs n'ayant jamais travaillé",
|
||||
"82": "Inactifs divers (autres que retraités)"
|
||||
".": "NA",
|
||||
"0": "Agriculateur exploitants",
|
||||
"1": "Artisans",
|
||||
"2": "Commerçants et assimilés",
|
||||
"3": "Chefs d'entreprise de 10 salariés ou plus",
|
||||
"4": "Professions libérales et assimilés",
|
||||
"5": "Cadres de la fonction publique, professions intellectuelles et artistiques",
|
||||
"6": "Cadres d'entreprise",
|
||||
"7": "Professions intermétiaires de l'enseignement, de la santé, de la fonction publique et assimilés",
|
||||
"8": "Professions intermédiaires administratives et commerciales des entreprises",
|
||||
"9": "Techniciens",
|
||||
"10": "Contremaîtres, agents de maîtrise",
|
||||
"11": "Employés",
|
||||
"12": "Ouvriers"
|
||||
},
|
||||
|
||||
|
||||
|
@ -102,8 +127,6 @@
|
|||
"3": "En couple avec enfants"
|
||||
},
|
||||
|
||||
|
||||
|
||||
"reltype": {
|
||||
"0": "Père, mère ou équivalent",
|
||||
"1": "Frère ou soeur",
|
||||
|
@ -133,9 +156,46 @@
|
|||
"4": "Jamais"
|
||||
},
|
||||
|
||||
"irlfreq": {
|
||||
"0": "plusieurs fois par semaine",
|
||||
"1": "1 fois par semaine",
|
||||
"2": "1 fois par mois",
|
||||
"3": "1 fois par an ou moins",
|
||||
"4": "Jamais"
|
||||
},
|
||||
|
||||
"connect": {
|
||||
"0": "Oui",
|
||||
"1": "Non"
|
||||
},
|
||||
|
||||
"medsoc": {
|
||||
"0": "D'une personne qui n'utilise pas ou peu les médias sociaux",
|
||||
"1": "D'une personne qui consulte des publications mais partage peu de contenus",
|
||||
"2": "D'une personne qui consulte des publication et partage des contenus de temps en temps",
|
||||
"3": "D'une personne qui partage beaucoup de contenus et s'exprime fréquemment"
|
||||
},
|
||||
|
||||
"medrel": {
|
||||
"0": "N'ont aucun effet sur votre relation",
|
||||
"1": "Vous ont rapproché d'elle",
|
||||
"2": "Vous ont éloigné d'elle"
|
||||
},
|
||||
|
||||
"interest": {
|
||||
"0": "1",
|
||||
"1": "2",
|
||||
"2": "3",
|
||||
"3": "4",
|
||||
"4": "5"
|
||||
},
|
||||
|
||||
"relmark": {
|
||||
"0": "1",
|
||||
"1": "2",
|
||||
"2": "3",
|
||||
"3": "4",
|
||||
"4": "5"
|
||||
}
|
||||
|
||||
},
|
||||
|
@ -152,7 +212,7 @@
|
|||
"6": "Top 10 de l'historique Facebook",
|
||||
"7": "Top 10 de Facebook Messenger"
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
[]
|
File diff suppressed because one or more lines are too long
|
@ -1 +0,0 @@
|
|||
{"1":{"line":0,"hash":"10a358a685d0fbdff78068d891fdd08f06011be4"},"2":{"line":1,"hash":"dad8b6bc0c54a329075ae2a5f55e188dc1fd13fa"},"":{"line":2,"hash":"847db4a9bf7f5397425f60a0c596910216ab8f7c"}}
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,7 @@
|
|||
Contient les équivalences :
|
||||
|
||||
id_subject => {
|
||||
"subject": [données du sujet]
|
||||
"contact": [liste des id des contacts],
|
||||
"relations": [liste des relations]
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
{"2":{"line":0},"4":{"line":1},"5":{"line":2},"6":{"line":3},"7":{"line":4},"8":{"line":5},"9":{"line":6},"10":{"line":7},"11":{"line":8},"12":{"line":9},"13":{"line":10},"14":{"line":11},"15":{"line":12},"1":{"line":13},"3":{"line":14}}
|
|
@ -1,8 +0,0 @@
|
|||
{"subject":{"id":1,"name":"Caroline","creation":1464788890}}
|
||||
{"subject":{"id":2,"name":"Cl\u00e9ment","creation":1464788893}}
|
||||
{"subject":{"id":3,"name":"Coralie","creation":1464788897}}
|
||||
{"subject":{"id":4,"name":"Laurent","creation":1464788899}}
|
||||
{"subject":{"id":5,"name":"Emilie","creation":1464788903}}
|
||||
{"subject":{"id":6,"name":"C\u00e9line","creation":1464788905}}
|
||||
{"subject":{"id":7,"name":"Pierre","creation":1464788908}}
|
||||
{"subject":{"id":8,"name":"Boris","creation":1464788910}}
|
|
@ -1 +0,0 @@
|
|||
{"1":{"line":0,"hash":"9798c2b945e222c48bff804d9819c0d98e88d257"},"2":{"line":1,"hash":"8192621a7f0013e137e63edffdadea6ab7f69565"},"3":{"line":2,"hash":"a7b9d5cf6cfb41c0b100d91d053032bdad3a80da"},"4":{"line":3,"hash":"ef73002b8217c3c3b87a62b8ae4c69b3994c114f"},"5":{"line":4,"hash":"5cf77d4e920f1b418bf78484bc1766fb84baabb9"},"6":{"line":5,"hash":"356e841ad04cb0f553fe47eab88bf550d6853c60"},"7":{"line":6,"hash":"7d070210aed5df40ee7e2ca4b54f29c672d32a89"},"8":{"line":7,"hash":"9e4936de2cf03d46135bbac3589a1e3ce68fb406"}}
|
|
@ -1 +1 @@
|
|||
361
|
||||
107
|
|
@ -75,6 +75,9 @@
|
|||
/* Erreur au niveau javascript */
|
||||
//const JavascriptError = 19; // -> géré en js
|
||||
|
||||
// Already done error
|
||||
const Already = 20;
|
||||
|
||||
|
||||
/* EXPLICITE UN CODE D'ERREUR
|
||||
*
|
||||
|
@ -85,32 +88,33 @@
|
|||
*/
|
||||
public static function explicit($error){
|
||||
switch($error){
|
||||
case self::Success: return "Tout s'est bien deroulé."; break;
|
||||
case self::Success: return "All right."; break;
|
||||
|
||||
case self::ParsingFailed: return "La lecture du fichier JSON ou XML a echouée."; break;
|
||||
case self::ParsingFailed: return "JSON/XML file format error."; break;
|
||||
|
||||
case self::InvalidFlags: return "Les spécifications (drapeaux) sont incorrects."; break;
|
||||
case self::UnreachableResource: return "La ressource n'existe pas (404)."; break;
|
||||
case self::MissingPath: return "Le chemin de délégation n'a pas été renseigné."; break;
|
||||
case self::WrongPathModule: return "Le chemin de délégation est incorrect ('nomModule/nomMethode')."; break;
|
||||
case self::WrongPathRepo: return "Le chemin de délégation est incorrect ('nomRepo/nomMethode')."; break;
|
||||
case self::UnknownModule: return "Le module n'existe pas."; break;
|
||||
case self::UnknownRepo: return "Le repo n'existe pas."; break;
|
||||
case self::UnknownMethod: return "Le methode n'existe pas."; break;
|
||||
case self::UncallableMethod: return "Le methode n'est pas amorçable."; break;
|
||||
case self::InvalidFlags: return "Flags are incorrect."; break;
|
||||
case self::UnreachableResource: return "Resource unreachable (404)."; break;
|
||||
case self::MissingPath: return "Path missing."; break;
|
||||
case self::WrongPathModule: return "Module path incorrect 'module/method'."; break;
|
||||
case self::WrongPathRepo: return "Repository path incorrect 'repo/method'."; break;
|
||||
case self::UnknownModule: return "Requested module not found."; break;
|
||||
case self::UnknownRepo: return "Requested repository not found."; break;
|
||||
case self::UnknownMethod: return "Requested method not found."; break;
|
||||
case self::UncallableMethod: return "Cannot call requested method."; break;
|
||||
|
||||
case self::ParamError: return "Un ou plusieurs paramètres sont manquants ou incorrects."; break;
|
||||
case self::ModuleError: return "Erreur lors du traitement du module."; break;
|
||||
case self::RepoError: return "Erreur lors du traitement du repo."; break;
|
||||
case self::ParamError: return "Wrong or missing parameter(s)."; break;
|
||||
case self::ModuleError: return "Module error."; break;
|
||||
case self::RepoError: return "Repository error."; break;
|
||||
|
||||
case self::PDOConnection: return "La connexion avec la base de données a echouée."; break;
|
||||
case self::PDOConnection: return "Database connection failed."; break;
|
||||
|
||||
case self::TokenError: return "Le token de connection est absent, érroné ou expiré."; break;
|
||||
case self::PermissionError: return "Vous n'avez pas la permission d'effectuer cette action."; break;
|
||||
case self::UploadError: return "Une erreur d'upload est survenue."; break;
|
||||
case self::FormatError: return "Le fichier n'est pas au bon format."; break;
|
||||
case self::TokenError: return "Access token wrong, missing or expired."; break;
|
||||
case self::PermissionError: return "Not granted to do so."; break;
|
||||
case self::UploadError: return "Upload error."; break;
|
||||
case self::FormatError: return "Format error."; break;
|
||||
case self::Already: return "Already done."; break;
|
||||
|
||||
default: return "Description d'erreur inconnue..."; break;
|
||||
default: return "Unknown debug error"; break;
|
||||
}
|
||||
|
||||
// Erreur inconnue
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
// On definit l'id session si donne en argument
|
||||
if( $session_id != null )
|
||||
session_id( $session_id );
|
||||
|
||||
|
||||
// Precaution: on met a jour le cookie
|
||||
setcookie( 'PHPSESSID', session_id(), time()+60*30, '/');
|
||||
|
||||
|
@ -45,7 +45,7 @@
|
|||
/*******************/
|
||||
private static function update_token(){
|
||||
$token = self::$prefix.self::sha1(uniqid());
|
||||
|
||||
|
||||
// On definit le token en session
|
||||
$_SESSION['session_token'] = $token;
|
||||
|
||||
|
@ -53,13 +53,12 @@
|
|||
$_COOKIE['session_token'] = $_SESSION['session_token'];
|
||||
setcookie( 'session_token', $_COOKIE['session_token'], time()+60*30, '/');
|
||||
}
|
||||
|
||||
|
||||
/************/
|
||||
/* AMORCEUR */
|
||||
/************/
|
||||
public static function session_start(){
|
||||
\session_start();
|
||||
return;
|
||||
return \session_start();
|
||||
|
||||
|
||||
/* [1] Génération et Gestion des donnees a utiliser
|
||||
|
@ -85,12 +84,12 @@
|
|||
// On verifie l'id session (5 premiers chars du hash des donnees perso)
|
||||
$valid_sessid = strpos( session_id(), substr(self::$prefix,0,5) ) === 0;
|
||||
|
||||
// Si id session incorrect ou pas de token
|
||||
// Si id session incorrect ou pas de token
|
||||
if( !$valid_sessid )
|
||||
self::reset_session( $sessid ); // On initialise la session (bon id session)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* [3] Verification du token
|
||||
==============================================================*/
|
||||
// On verifie que le token est valide
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace orm\core;
|
||||
|
||||
use \database\core\Database;
|
||||
use \database\core\DatabaseDriver;
|
||||
use \orm\core\SQLBuilder;
|
||||
|
||||
|
||||
|
@ -31,12 +31,18 @@
|
|||
|
||||
const SEL_DISTINCT = true;
|
||||
|
||||
// {3} Gestion du Order By //
|
||||
const ORDER_ASC = '__ASC__';
|
||||
const ORDER_DESC = '__DESC__';
|
||||
|
||||
// {3} Constantes d'insertion //
|
||||
const INSERT_DEFAULT = '__DEFAULT__'; // Valeur DEFAULT (pour insertion)
|
||||
|
||||
/* Attributs */
|
||||
private $driver; // Database driver label
|
||||
private $where; // Tableau associatif contenant les conditions
|
||||
private $select; // Tableau contenant la liste des champs à afficher
|
||||
private $orderby; // Tableau contenant la liste des orderby
|
||||
private $unique; // VRAI si on attend une valeur unique
|
||||
private $schema; // Tableau contenant les informations associées aux données
|
||||
private $joined; // Tableau contenant les Rows liés
|
||||
|
@ -45,30 +51,33 @@
|
|||
/* CONSTRUCTEUR
|
||||
*
|
||||
* @schema<Array> Tableau contenant les informations de la requête
|
||||
* @driver<String> [optional] DatabaseDriver label
|
||||
*
|
||||
*/
|
||||
public function __construct($schema){
|
||||
/* (1) On récupère les informations */
|
||||
public function __construct($schema, $driver=null){
|
||||
/* (1) Database Driver */
|
||||
$this->driver = $driver;
|
||||
|
||||
/* (2) On récupère les informations */
|
||||
$this->schema = $schema;
|
||||
|
||||
/* (2) On initialise les conditions */
|
||||
/* (3) On initialise les conditions */
|
||||
$this->where = [];
|
||||
|
||||
/* (3) On initialise les champs à retourner */
|
||||
/* (4) On initialise les champs à retourner */
|
||||
$this->select = [];
|
||||
|
||||
/* (4) On initialise le caractère 'unique' du résultat */
|
||||
/* (5) On initialise l'ordonnancement' */
|
||||
$this->orderby = [];
|
||||
|
||||
/* (6) On initialise le caractère 'unique' du résultat */
|
||||
$this->unique = false;
|
||||
|
||||
/* (5) On initialise les jointures */
|
||||
/* (7) On initialise les jointures */
|
||||
$this->joined = [];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* FILTRE LES ENTREES D'UNE TABLE AVEC LA CLE PRIMAIRE SPECIFIEE
|
||||
*
|
||||
* @primary<mixed> Clé primaire simple
|
||||
|
@ -158,10 +167,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* FILTRAGE DYNAMIQUES
|
||||
*
|
||||
* @method<String> Nom de la méthode
|
||||
|
@ -183,16 +188,17 @@
|
|||
$column_name = '';
|
||||
|
||||
/* (1) formatte la requête 'MyAttribute' -> 'my_attribute' */
|
||||
for( $l = 0 ; $l < strlen($regex[1]) ; $l++ ){
|
||||
for( $l = 0, $ll = strlen($regex[1]) ; $l < $ll ; $l++ ){
|
||||
$letter = $regex[1][$l];
|
||||
|
||||
// Si la lettre est en majuscule mais que c'est pas la première
|
||||
// Si la lettre est en majuscule mais que c'est pas la première ni un seul mot
|
||||
if( strtoupper($letter) == $letter && $l > 0 )
|
||||
$column_name .= '_';
|
||||
|
||||
$column_name .= strtolower($letter);
|
||||
}
|
||||
|
||||
|
||||
/* (2) On vérifie que la colonne existe */
|
||||
if( !isset($this->schema['columns'][$column_name]) )
|
||||
return $this; // si n'existe pas, on ne fait rien
|
||||
|
@ -200,57 +206,97 @@
|
|||
|
||||
/* [2] On vérifie le type du paramètre
|
||||
=========================================================*/
|
||||
/* (1) Si aucun param, on quitte */
|
||||
if( count($a) == 0 )
|
||||
// On délègue
|
||||
$args = array_merge([$column_name], $a);
|
||||
return call_user_func_array([$this, 'where'], $args);
|
||||
}
|
||||
|
||||
|
||||
public function where($field){
|
||||
// get arguments
|
||||
$args = array_slice(func_get_args(), 1);
|
||||
|
||||
/* [1] Vérification de l'argument @field
|
||||
=========================================================*/
|
||||
/* (1) Type de @field */
|
||||
if( !is_string($field) )
|
||||
return $this;
|
||||
|
||||
/* (2) Si c'est un paramètre seul, on ajoute par défaut self::COND_EQUAL */
|
||||
if( !is_array($a[0]) )
|
||||
$a[0] = [ $a[0], self::COND_EQUAL ];
|
||||
/* (2) On vérifie que la colonne existe */
|
||||
if( !isset($this->schema['columns'][$field]) )
|
||||
return $this; // si n'existe pas, on ne fait rien
|
||||
|
||||
/* (3) Si type INT et pas numérique */
|
||||
if( $this->schema['columns'][$column_name]['type'] == 'int' && !is_numeric($a[0][0]) )
|
||||
/* [2] On vérifie le type du paramètre
|
||||
=========================================================*/
|
||||
/* (1) Si au moins 1 param */
|
||||
if( count($args) < 1 )
|
||||
return $this;
|
||||
|
||||
/* (4) Si type FLOAT et pas numérique */
|
||||
if( $this->schema['columns'][$column_name]['type'] == 'float' && !is_numeric($a[0][0]) )
|
||||
|
||||
/* [3] If `IN` condition
|
||||
=========================================================*/
|
||||
$defaultWhere = $this->where;
|
||||
$inCond = count($args[0]) > 1 && is_array($args[0][0]) && $args[0][1] == self::COND_IN;
|
||||
|
||||
// erreur
|
||||
if( is_array($args[0][0]) && !$inCond )
|
||||
return $this;
|
||||
|
||||
/* (5) Si type STRING et pas string */
|
||||
if( $this->schema['columns'][$column_name]['type'] == 'text' && !is_string($a[0][0]) )
|
||||
return $this;
|
||||
/* (1) Si c'est une condition "IN"
|
||||
---------------------------------------------------------*/
|
||||
if( $inCond ){
|
||||
|
||||
/* (1) On vérifie le type de chaque valeur du IN */
|
||||
$type = $this->schema['columns'][$field]['type'];
|
||||
|
||||
foreach($args[0][0] as $value){
|
||||
if( $type == 'int' && !is_numeric($value) ) return $this;
|
||||
if( $type == 'float' && !is_numeric($value) ) return $this;
|
||||
if( in_array($type, ['text', 'varchar']) && !is_string($value) ) return $this;
|
||||
}
|
||||
|
||||
/* (2) Si c'est une condition "simple"
|
||||
---------------------------------------------------------*/
|
||||
}else{
|
||||
|
||||
/* (1) Si le type de condition est manquant, on met EQUAL par défaut */
|
||||
if( !is_array($args[0]) )
|
||||
$args[0] = [ $args[0], self::COND_EQUAL ];
|
||||
|
||||
/* (2) On vérifie le type de chaque valeur */
|
||||
$type = $this->schema['columns'][$field]['type'];
|
||||
|
||||
if( $type == 'int' && !is_numeric($args[0][0]) ) return $this;
|
||||
if( $type == 'float' && !is_numeric($args[0][0]) ) return $this;
|
||||
if( in_array($type, ['text', 'varchar']) && !is_string($args[0][0]) ) return $this;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* [3] Si type OK, on enregistre la condition
|
||||
=========================================================*/
|
||||
/* (1) Si aucune condition pour ce champ, on crée un tableau */
|
||||
if( !isset($this->where[$column_name]) )
|
||||
$this->where[$column_name] = [];
|
||||
if( !isset($this->where[$field]) )
|
||||
$this->where[$field] = [];
|
||||
|
||||
/* (2) On ajoute la condition */
|
||||
$this->where[$column_name][] = $a[0];
|
||||
|
||||
|
||||
$this->where[$field][] = $args[0];
|
||||
|
||||
// On retourne l'object courant
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* SELECTIONNE UNIQUEMENT LE CHAMP SELECTIONNE
|
||||
*
|
||||
* @field<String> Libellé du champ à afficher
|
||||
* @func<CONST> Fonction d'aggrégation (ou NULL)
|
||||
* @distinct<Boolean> Clause DISTINCT
|
||||
* @alias<String> Alias du champ
|
||||
*
|
||||
* @return this<Rows> Retourne l'object courant
|
||||
*
|
||||
*/
|
||||
public function select($field=null, $func=null, $distinct=false){
|
||||
public function select($field=null, $func=null, $distinct=false, $alias=null){
|
||||
/* [1] On formatte les champs
|
||||
=========================================================*/
|
||||
/* (1) On vérifie le type de @field */
|
||||
|
@ -268,15 +314,32 @@
|
|||
if( !is_null($func) && !in_array($func, $funcList) )
|
||||
return $this;
|
||||
|
||||
// If CONCAT -> force type to TEXT
|
||||
if( $func === Rows::SEL_CONCAT )
|
||||
$this->schema['columns'][$field]['type'] = 'text';
|
||||
|
||||
/* (4) On met la valeur par défaut à @distinct si type mauvais */
|
||||
$distinct = !is_bool($distinct) ? false : $distinct;
|
||||
|
||||
/* (5) Si @alias incorrect, on met @field par défaut */
|
||||
if( !is_string($alias) )
|
||||
$alias = $field;
|
||||
|
||||
/* [2] On enregistre le champ
|
||||
=========================================================*/
|
||||
/* (1) Si aucun SELECT pour ce champ, on le crée */
|
||||
if( !isset($this->select[$field]) )
|
||||
$this->select[$field] = [$func, $distinct];
|
||||
/* (1) Si "SELECT *" on ajout tous les champs */
|
||||
if( $field === '*' ){
|
||||
|
||||
foreach($this->schema['columns'] as $f=>$c)
|
||||
if( !isset($this->select[$f]) )
|
||||
$this->select[$f] = [$func, $distinct, $f];
|
||||
|
||||
/* (2) Si aucun SELECT pour ce champ, on le crée */
|
||||
}else{
|
||||
|
||||
if( !isset($this->select[$field]) )
|
||||
$this->select[$field] = [$func, $distinct, $alias];
|
||||
}
|
||||
|
||||
|
||||
/* [3] On retourne l'object courant
|
||||
|
@ -285,10 +348,47 @@
|
|||
}
|
||||
|
||||
|
||||
/* SELECTIONNE L'ORDONNANCEMENT DES RESULTATS
|
||||
*
|
||||
* @field<String> Libellé du champ à afficher
|
||||
* @order<CONST> Gestion de l'ordre ASC/DESC (ou NULL)
|
||||
*
|
||||
* @return this<Rows> Retourne l'object courant
|
||||
*
|
||||
*/
|
||||
public function orderby($field=null, $order=null){
|
||||
/* [1] On formatte les champs
|
||||
=========================================================*/
|
||||
/* (1) On vérifie le type de @field */
|
||||
if( !is_string($field) )
|
||||
return $this;
|
||||
|
||||
/* (2) On vérifie que la colonne @field existe, sinon on quitte */
|
||||
if( !isset($this->schema['columns'][$field]) && $field != '*' )
|
||||
return $this;
|
||||
|
||||
/* (3) On vérifie @order */
|
||||
$orderList = [self::ORDER_ASC, self::ORDER_DESC];
|
||||
|
||||
// Valeur si NULL
|
||||
$order = is_null($order) ? $orderList[0] : $order;
|
||||
|
||||
// Si ordre non référencée, on quitte
|
||||
if( !in_array($order, $orderList) )
|
||||
return $this;
|
||||
|
||||
|
||||
/* [2] On enregistre le champ
|
||||
=========================================================*/
|
||||
/* (1) On crée le ORDER_BY pour ce champ */
|
||||
$this->orderby[$field] = $order;
|
||||
|
||||
|
||||
/* [3] On retourne l'object courant
|
||||
=========================================================*/
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/* JOINT UNE SECONDE TABLE ()
|
||||
*
|
||||
|
@ -369,11 +469,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* PERMET DE DIRE QUE L'ON VEUT UN RESULTAT UNIQUE
|
||||
*
|
||||
* @return this<Rows> Retourne l'object courant
|
||||
|
@ -391,11 +486,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* MODIFIE DES ENTREES (SANS MODIFICATION DE CLE PRIMAIRE POSSIBLE)
|
||||
*
|
||||
* @updates<Array> Tableau associatif contenant les nouvelles valeurs
|
||||
|
@ -511,7 +601,7 @@
|
|||
$requestString = SQLBuilder::BUILD($requestS).';';
|
||||
|
||||
/* (2) On prépare la requête */
|
||||
$request = Database::getPDO()->prepare($requestString);
|
||||
$request = DatabaseDriver::getPDO($this->driver)->prepare($requestString);
|
||||
|
||||
|
||||
|
||||
|
@ -524,10 +614,6 @@
|
|||
return $updated;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* AJOUTE UNE ENTREE DANS LA TABLE
|
||||
*
|
||||
* @entry<Array> Tableau associatif de la forme (colonne => valeur)
|
||||
|
@ -636,7 +722,7 @@
|
|||
/* [2] On bind les paramètres et exécute la requête
|
||||
=========================================================*/
|
||||
/* (0) On initialise la requête et les paramètres */
|
||||
$request = Database::getPDO()->prepare($requestS.';');
|
||||
$request = DatabaseDriver::getPDO($this->driver)->prepare($requestS.';');
|
||||
$bound = [];
|
||||
|
||||
/* (1) On bind les paramètres */
|
||||
|
@ -655,8 +741,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* SUPPRIME LES ENTREES
|
||||
*
|
||||
* @return status<Boolean> Retourne si TRUE ou FALSE les entrées ont bien été supprimées
|
||||
|
@ -728,7 +812,7 @@
|
|||
$requestString = SQLBuilder::BUILD($requestS).';';
|
||||
|
||||
/* (2) On prépare la requête */
|
||||
$request = Database::getPDO()->prepare($requestString);
|
||||
$request = DatabaseDriver::getPDO($this->driver)->prepare($requestString);
|
||||
|
||||
/* [5] On exécute la requête et retourne le résultat
|
||||
=========================================================*/
|
||||
|
@ -740,13 +824,9 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* RETOURNE LES DONNEES / NULL si une erreur survient
|
||||
*
|
||||
* @execute<Boolean> VRAI si on veut exécuter la requête, sinon renvoie [requete, boundParams]
|
||||
* @execute<Boolean> VRAI si on veut exécuter la requête, sinon renvoie [requete, boundParams]
|
||||
*
|
||||
* @return data<Array> Tableau contenant les champs sélectionnés
|
||||
* @return data<mixed> Valeur du champ sélectionné (si 1 seul champ)
|
||||
|
@ -768,7 +848,6 @@
|
|||
$joinedFetched[$field] = $data['object']->fetch(false);
|
||||
|
||||
|
||||
|
||||
/* [1] On rédige la clause SELECT
|
||||
=========================================================*/
|
||||
/* (1) On formatte les données */
|
||||
|
@ -794,7 +873,6 @@
|
|||
$requestS['SELECT'] = SQLBuilder::SELECT($selectTables);
|
||||
|
||||
|
||||
|
||||
/* [2] On rédige la clause FROM
|
||||
========================================================*/
|
||||
/* (0) On initialise la clause */
|
||||
|
@ -809,8 +887,6 @@
|
|||
// On ajoute la clause FROM de jointure à la clause FROM locale //
|
||||
$requestS['FROM'] = array_merge($data['request']['FROM'], $requestS['FROM']);
|
||||
|
||||
|
||||
|
||||
/* [5] On rédige la clause WHERE/AND
|
||||
=========================================================*/
|
||||
/* (1) On met les conditions locales */
|
||||
|
@ -843,8 +919,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* [6] Clause GROUP BY
|
||||
=========================================================*/
|
||||
/* (0) On initialise la liste des @rows non aggrégés */
|
||||
|
@ -876,7 +950,27 @@
|
|||
if( count($groupBy) > 0)
|
||||
$requestS['GROUPBY'] = SQLBuilder::GROUPBY($groupBy);
|
||||
|
||||
/* [6] Clause ORDER BY
|
||||
=========================================================*/
|
||||
/* (1) On formatte les données */
|
||||
$orderTables = [];
|
||||
|
||||
/* (2) On ajoute les champs locaux */
|
||||
if( count($this->orderby) > 0 )
|
||||
$orderTables[$this->schema['table']] = $this->orderby;
|
||||
|
||||
/* (4) On ajoute les champs des jointures (récursif)*/
|
||||
foreach($joinedFetched as $field=>$data){
|
||||
foreach($data['request']['ORDERBY'] as $table=>$fields) // pour chaque ensemble de champ de chaque table
|
||||
foreach($fields as $field=>$orderBy) // Pour chaque orderby de chaque champ
|
||||
|
||||
if( count($orderBy) > 0 )
|
||||
$orderTables[$table][$field] = $orderBy;
|
||||
|
||||
}
|
||||
|
||||
/* (3) On génère la clause SELECT */
|
||||
$requestS['ORDERBY'] = SQLBuilder::ORDERBY($orderTables);
|
||||
|
||||
/* [6] Clause LIMIT
|
||||
=========================================================*/
|
||||
|
@ -891,10 +985,11 @@
|
|||
|
||||
/* (2) On compose la requête */
|
||||
$requestString = SQLBuilder::BUILD($requestS).';';
|
||||
// var_dump($requestString);
|
||||
|
||||
/* (3) On prépare la requête */
|
||||
$request = Database::getPDO()->prepare($requestString);
|
||||
// var_dump($requestString);
|
||||
$request = DatabaseDriver::getPDO($this->driver)->prepare($requestString);
|
||||
|
||||
|
||||
/* [8] On exécute la requête et retourne le résultat
|
||||
=========================================================*/
|
||||
|
@ -910,10 +1005,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* ON FORMATTE LES DONNEES DE SORTIE
|
||||
*
|
||||
* @data<Array> Données / Tableau de données
|
||||
|
@ -961,32 +1052,45 @@
|
|||
if( !$twoDimensions )
|
||||
$formatted = [$formatted];
|
||||
|
||||
/* (2) On retire les indices numériques */
|
||||
|
||||
/* (2) On récupère les noms des champs à partir des select (alias) */
|
||||
// {1} On récupère les colonnes locales //
|
||||
$existingColumns = $this->schema['columns'];
|
||||
$existingColumns = [];
|
||||
|
||||
foreach($this->select as $field=>$data)
|
||||
$existingColumns[$data[2]] = $this->schema['columns'][$field];
|
||||
|
||||
|
||||
// {2} On ajoute les colonnes des jointures //
|
||||
foreach($this->joined as $j)
|
||||
$existingColumns = array_merge( $existingColumns, $j['object']->schema['columns'] );
|
||||
foreach($j['object']->select as $field=>$data)
|
||||
$existingColumns[$data[2]] = $j['object']->schema['columns'][$field];
|
||||
|
||||
|
||||
// {3} On vérifie chaque clé, si c'est une colonne qui existe //
|
||||
foreach($formatted as $i=>$entry)
|
||||
|
||||
// Pour chaque champ
|
||||
foreach($entry as $index=>$value)
|
||||
foreach($entry as $index=>$value){
|
||||
|
||||
// Si la colonne existe on applique le type
|
||||
if( isset($existingColumns[$index]) ){
|
||||
|
||||
if( $existingColumns[$index]['type'] == 'int' )
|
||||
$formatted[$i][$index] = intval( $value );
|
||||
else if( $existingColumns[$index]['type'] == 'float' )
|
||||
elseif( $existingColumns[$index]['type'] == 'float' )
|
||||
$formatted[$i][$index] = floatval( $value );
|
||||
// String utf8 management
|
||||
elseif( \mb_detect_encoding($value) === 'UTF-8' )
|
||||
$formatted[$i][$index] = utf8_encode($value);
|
||||
else
|
||||
$formatted[$i][$index] = utf8_encode(utf8_decode($value));
|
||||
|
||||
// Si pas non plus une aggrégation et si indice numérique, on le retire
|
||||
}else if( !preg_match('/^agg_.+/', $index) && is_numeric($index) )
|
||||
}else if( !preg_match('/^agg_.+/', $index) && is_numeric($index) )
|
||||
unset($formatted[$i][$index]);
|
||||
|
||||
}
|
||||
|
||||
/* (3) On remet 1 dimension si 1 dimension à la base */
|
||||
if( !$twoDimensions )
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace orm\core;
|
||||
|
||||
use \database\core\Database;
|
||||
use \database\core\DatabaseDriver;
|
||||
use \orm\core\Rows;
|
||||
|
||||
|
||||
|
@ -21,10 +21,16 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* CONSTRUIT LA REQUETE FORMATTEE "ORDER BY" AVEC UNE LISTE DE CHAMPS
|
||||
*
|
||||
* @tables<Array> Liste de champs : [table => fields]
|
||||
*
|
||||
* @return sql<Array> Renvoie un tableau formatté
|
||||
*
|
||||
*/
|
||||
public static function ORDERBY($tables){
|
||||
return $tables;
|
||||
}
|
||||
|
||||
/* CONSTRUIT LA REQUETE FORMATTEE "GROUP BY" AVEC UNE LISTE DE CHAMPS
|
||||
*
|
||||
|
@ -38,10 +44,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* CONSTRUIT LA REQUETE FORMATTEE "FROM" AVEC UNE LISTE DE TABLES
|
||||
*
|
||||
* @tables<Array> Liste de tables OU SQL PUR
|
||||
|
@ -54,10 +56,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* CONSTRUIT LA REQUETE FORMATTEE "UPDATE" AVEC LA TABLE EN QUESTION
|
||||
*
|
||||
* @table<String> Table en question
|
||||
|
@ -70,10 +68,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* CONSTRUIT LA REQUETE FORMATTEE "DELETE" AVEC LA TABLE EN QUESTION
|
||||
*
|
||||
* @table<String> Table en question
|
||||
|
@ -86,10 +80,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* CONSTRUIT LA REQUETE TEXTUELLE "IN" AVEC UNE LISTE DE TABLES
|
||||
*
|
||||
* @field<Array> Tableau contenant [table, field]
|
||||
|
@ -123,13 +113,7 @@
|
|||
}
|
||||
|
||||
return $sql.")";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* CONSTRUIT LA REQUETE TEXTUELLE "WHERE" AVEC UNE LISTE DE TABLES
|
||||
} /* CONSTRUIT LA REQUETE TEXTUELLE "WHERE" AVEC UNE LISTE DE TABLES
|
||||
*
|
||||
* @field<Array> Tableau contenant [table, field]
|
||||
* @valeur<Array> Valeurs de la clause WHERE [valeur, opérateur]
|
||||
|
@ -160,13 +144,7 @@
|
|||
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* CONSTRUIT LA REQUETE FORMATTEE "SET" AVEC UNE LISTE DE TABLES
|
||||
} /* CONSTRUIT LA REQUETE FORMATTEE "SET" AVEC UNE LISTE DE TABLES
|
||||
*
|
||||
* @values<Array> Tableau de la forme [ field=>value, field2=>value2 ]
|
||||
* @bound<Arary> Tableau associatif contenant les variables "bindés" -> ajout des champs
|
||||
|
@ -196,13 +174,7 @@
|
|||
}
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* CONSTRUIT LA REQUETE FORMATTEE "LIMIT" AVEC UN NOMBRE D'ENTREES
|
||||
} /* CONSTRUIT LA REQUETE FORMATTEE "LIMIT" AVEC UN NOMBRE D'ENTREES
|
||||
*
|
||||
* @count<int> Nombre limite
|
||||
*
|
||||
|
@ -223,18 +195,6 @@
|
|||
return $sql;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* CONSTRUIT LA REQUETE A PARTIR D'UNE REQUETTE FORMATTEE
|
||||
*
|
||||
* @request<Arary> Requête formattée
|
||||
|
@ -258,7 +218,7 @@
|
|||
case 'SELECT':
|
||||
$sql .= "SELECT ";
|
||||
$c = 0;
|
||||
foreach($statements as $table=>$fields)
|
||||
foreach($statements as $table=>$fields){
|
||||
foreach($fields as $field=>$select){
|
||||
|
||||
/* (1) On construit le nom du champ */
|
||||
|
@ -274,7 +234,11 @@
|
|||
|
||||
|
||||
/* (4) On ajoute l'alias */
|
||||
if( isset($select[0]) && !is_null($select[0]) )
|
||||
// si défini
|
||||
if( isset($select[2]) )
|
||||
$fieldStr = "$fieldStr as ".$select[2];
|
||||
// si func et non défini
|
||||
elseif( isset($select[0]) && !is_null($select[0]) )
|
||||
$fieldStr = "$fieldStr as agg_$field";
|
||||
else
|
||||
$fieldStr = "$fieldStr";
|
||||
|
@ -283,6 +247,7 @@
|
|||
|
||||
$c++;
|
||||
}
|
||||
}
|
||||
|
||||
$sql .= "\n";
|
||||
break;
|
||||
|
@ -336,7 +301,6 @@
|
|||
case 'UPDATE':
|
||||
$sql .= "UPDATE $statements\n";
|
||||
break;
|
||||
break;
|
||||
|
||||
|
||||
/* (7) Clause SET
|
||||
|
@ -364,17 +328,35 @@
|
|||
|
||||
$sql .= "\n";
|
||||
break;
|
||||
|
||||
/* (9) Clause ORDER BY
|
||||
---------------------------------------------------------*/
|
||||
case 'ORDERBY':
|
||||
|
||||
// si aucun ORDER BY, on quitte
|
||||
if( count($statements) == 0 )
|
||||
continue;
|
||||
|
||||
$sql .= 'ORDER BY ';
|
||||
|
||||
$c = 0;
|
||||
foreach($statements as $table=>$fields)
|
||||
foreach($fields as $field=>$order){
|
||||
|
||||
if( $c > 0 ) $sql .= ', ';
|
||||
|
||||
$sql .= "$table.$field ". substr($order, 2, -2);
|
||||
|
||||
$c++;
|
||||
}
|
||||
|
||||
$sql .= "\n";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* [2] On retourne le résultat
|
||||
=========================================================*/
|
||||
return $sql;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
namespace orm\core;
|
||||
|
||||
use \database\core\Database;
|
||||
use \database\core\DatabaseDriver;
|
||||
use \manager\ManagerError;
|
||||
use \orm\core\Rows;
|
||||
|
||||
|
@ -11,21 +11,20 @@
|
|||
// CLASSE MAITRE
|
||||
class Table{
|
||||
|
||||
private static $database = 'logauth';
|
||||
|
||||
|
||||
/* RENVOIE LES DONNEES D'UNE TABLE
|
||||
*
|
||||
* @table<String> Nom de la table à selectionner
|
||||
* @driver<String> [optional] DatabaseDriver label
|
||||
*
|
||||
* @return this<ORM> Retourne une instance de l'ORM
|
||||
*
|
||||
*/
|
||||
public static function get($table_name){
|
||||
public static function get($table_name, $driver=null){
|
||||
/* [0] Initialisation des attributs
|
||||
=========================================================*/
|
||||
$schema = [
|
||||
'database' => self::$database,
|
||||
'database' => DatabaseDriver::get($driver)->getConfig()['dbname'],
|
||||
'table' => null,
|
||||
'columns' => null
|
||||
];
|
||||
|
@ -34,13 +33,13 @@
|
|||
/* [1] On vérifie que la table existe
|
||||
=========================================================*/
|
||||
/* (1) Requête */
|
||||
$checkTable = Database::getPDO()->query("SHOW tables FROM ".self::$database);
|
||||
$checkTableResult = Database::delNumeric( $checkTable->fetchAll() );
|
||||
$checkTable = DatabaseDriver::getPDO($driver)->query("SHOW tables FROM ".$schema['database']);
|
||||
$checkTableResult = DatabaseDriver::delNumeric( $checkTable->fetchAll() );
|
||||
|
||||
/* (2) On met en forme les données */
|
||||
$tables = [];
|
||||
foreach($checkTableResult as $table)
|
||||
$tables[] = $table['Tables_in_'.self::$database];
|
||||
$tables[] = $table['Tables_in_'.$schema['database']];
|
||||
|
||||
/* (3) Si n'existe pas, on renvoie une erreur */
|
||||
if( !in_array($table_name, $tables) )
|
||||
|
@ -54,8 +53,8 @@
|
|||
/* [2] Si la table existe, on récupère les colonnes
|
||||
=========================================================*/
|
||||
/* (1) On récupère les colonnes */
|
||||
$getColumns = Database::getPDO()->query("SHOW columns FROM ".self::$database.'.'.$table_name);
|
||||
$columnsResult = Database::delNumeric( $getColumns->fetchAll() );
|
||||
$getColumns = DatabaseDriver::getPDO($driver)->query("SHOW columns FROM ".$schema['database'].'.'.$table_name);
|
||||
$columnsResult = DatabaseDriver::delNumeric( $getColumns->fetchAll() );
|
||||
|
||||
/* (2) On met en forme les données */
|
||||
$columns = [];
|
||||
|
@ -85,7 +84,7 @@
|
|||
/* [3] On récupère les clés étrangères
|
||||
=========================================================*/
|
||||
/* (1) On récupère le texte du 'CREATE TABLE' */
|
||||
$getCreateTable = Database::getPDO()->query("show create table ".$table_name);
|
||||
$getCreateTable = DatabaseDriver::getPDO($driver)->query("show create table ".$table_name);
|
||||
if( is_bool($getCreateTable) )
|
||||
throw new \Exception('[*] Cannot fetch constrains');
|
||||
$create_table = $getCreateTable->fetch()['Create Table'];
|
||||
|
@ -102,7 +101,7 @@
|
|||
|
||||
/* [3] On renvoie une instance de 'Rows'
|
||||
=========================================================*/
|
||||
return new Rows($schema);
|
||||
return new Rows($schema, $driver);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"default": {
|
||||
"local": {
|
||||
"host" : "localhost",
|
||||
"dbname" : "nxtic",
|
||||
"user" : "php",
|
||||
"password" : "Qt358nUdyeTxLDM8"
|
||||
},
|
||||
"remote": {
|
||||
"host" : "localhost",
|
||||
"dbname" : "nxtic",
|
||||
"user" : "nxtic-php",
|
||||
"password" : "wxcvbn"
|
||||
}
|
||||
},
|
||||
|
||||
"lab-surveys": {
|
||||
"local": {
|
||||
"host" : "listic-lab-surveys.irit.fr",
|
||||
"dbname" : "lab-surveys",
|
||||
"user" : "lab-surveys",
|
||||
"password" : "wxcvbn"
|
||||
},
|
||||
"remote": {
|
||||
"host" : "listic-lab-surveys.irit.fr",
|
||||
"dbname" : "lab-surveys",
|
||||
"user" : "lab-surveys",
|
||||
"password" : "wxcvbn"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"host" : "localhost",
|
||||
"dbname" : "nxtic",
|
||||
"user" : "php",
|
||||
"password" : "Qt358nUdyeTxLDM8"
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"host" : "xdrm.io",
|
||||
"dbname" : "nxtic",
|
||||
"user" : "php",
|
||||
"password" : "QbzjZACndQM6NmuD"
|
||||
}
|
|
@ -34,7 +34,6 @@
|
|||
"parameters": {}
|
||||
},
|
||||
|
||||
|
||||
"markdown": {
|
||||
"description": "Retourne une description en markdown des différents modules de l'API",
|
||||
"permissions": [],
|
||||
|
@ -42,7 +41,6 @@
|
|||
"parameters": {}
|
||||
},
|
||||
|
||||
|
||||
"apiBlueprint": {
|
||||
"description": "Retourne une documentation de l'API au format API Blueprint.",
|
||||
"permissions": [],
|
||||
|
@ -70,7 +68,6 @@
|
|||
"parameters": {}
|
||||
},
|
||||
|
||||
|
||||
"getById": {
|
||||
"description": "Retourne les informations d'un utilisateur.",
|
||||
"permissions": ["admin"],
|
||||
|
@ -82,7 +79,6 @@
|
|||
}
|
||||
},
|
||||
|
||||
|
||||
"getAll": {
|
||||
"description": "Retourne les informations de tous les utilisateurs.",
|
||||
"permissions": ["admin"],
|
||||
|
@ -92,7 +88,6 @@
|
|||
}
|
||||
},
|
||||
|
||||
|
||||
"create": {
|
||||
"description": "Creation d'un nouvel administrateur.",
|
||||
"permissions": ["admin"],
|
||||
|
@ -106,7 +101,6 @@
|
|||
}
|
||||
},
|
||||
|
||||
|
||||
"remove": {
|
||||
"description": "Suppression d'un utilisateur.",
|
||||
"permissions": ["admin"],
|
||||
|
@ -127,7 +121,6 @@
|
|||
}
|
||||
},
|
||||
|
||||
|
||||
"generate": {
|
||||
"description": "Création d'un token de nom et de durée donnée",
|
||||
"permissions": ["admin"],
|
||||
|
@ -147,7 +140,7 @@
|
|||
"description": "Recherche d'un sujet par nom",
|
||||
"permissions": ["admin"],
|
||||
"parameters": {
|
||||
"name": { "description": "Le nom du sujet", "type": "varchar(1,50)" }
|
||||
"name": { "description": "Le nom du sujet", "type": "varchar(0,50)" }
|
||||
},
|
||||
"output": {
|
||||
"results": { "description": "Liste des sujet associés aux mots-clés.", "type": "array<array<mixed>>" }
|
||||
|
@ -174,7 +167,6 @@
|
|||
}
|
||||
},
|
||||
|
||||
|
||||
"create": {
|
||||
"description": "Creation d'un nouveau sujet.",
|
||||
"permissions": ["admin"],
|
||||
|
@ -190,11 +182,26 @@
|
|||
|
||||
"input": {
|
||||
|
||||
"survey": {
|
||||
"description": "Enregistre les données d'une enquête téléphonique.",
|
||||
"permissions": ["admin"],
|
||||
"parameters": {
|
||||
"subject": { "description": "Données du sujet (id, etc)", "type": "array<mixed>" },
|
||||
"contacts": { "description": "Données des contacts de l'enquête.", "type": "array<array>" },
|
||||
"mini": { "description": "Mini fiches relations sur les contacts de l'enquête.", "type": "array<array>" },
|
||||
"fiches": { "description": "Fiches relation sur les plus proches contacts de l'enquête.", "type": "array<array>" },
|
||||
"matrice": { "description": "Matrice contenant les relations entre les plus proches contacts", "type": "array<array>", "optional": true }
|
||||
},
|
||||
"output": {
|
||||
"subject_id": { "description": "Identifiant du sujet complété", "type": "id" }
|
||||
}
|
||||
},
|
||||
|
||||
"phone": {
|
||||
"description": "Enregistre les données d'une enquête téléphonique.",
|
||||
"permissions": ["admin"],
|
||||
"parameters": {
|
||||
"subject": { "description": "Données sur le sujet de l'enquête.", "type": "array" },
|
||||
"subject": { "description": "Données du sujet (id, etc)", "type": "array<mixed>" },
|
||||
"contacts": { "description": "Données des contacts de l'enquête.", "type": "array<array>" },
|
||||
"mini": { "description": "Mini fiches relations sur les contacts de l'enquête.", "type": "array<array>" },
|
||||
"fiches": { "description": "Fiches relation sur les plus proches contacts de l'enquête.", "type": "array<array>" },
|
||||
|
@ -209,7 +216,7 @@
|
|||
"description": "Enregistre les données d'une enquête facebook.",
|
||||
"permissions": ["admin"],
|
||||
"parameters": {
|
||||
"subject": { "description": "Données sur le sujet de l'enquête.", "type": "array" },
|
||||
"subject": { "description": "Données du sujet (id, etc)", "type": "array<mixed>" },
|
||||
"contacts": { "description": "Données des contacts de l'enquête.", "type": "array<array>" },
|
||||
"mini": { "description": "Mini fiches relations sur les contacts de l'enquête.", "type": "array<array>" },
|
||||
"fiches": { "description": "Fiches relation sur les plus proches contacts de l'enquête.", "type": "array<array>" },
|
||||
|
@ -246,9 +253,6 @@
|
|||
"options": { "download": true },
|
||||
"parameters": {
|
||||
"subjects": { "description": "Identifiants des sujets d'enquêtes à intégrer.", "type": "array<id>", "optional": true },
|
||||
"phone": { "description": "Si vaut TRUE, renvoie les sujets cellulaires.", "type": "boolean", "optional": true },
|
||||
"facebook": { "description": "Si vaut TRUE, renvoie les sujet facebook.", "type": "boolean", "optional": true },
|
||||
"survey": { "description": "Si vaut TRUE, renvoie les sujets ResTIC.", "type": "boolean", "optional": true },
|
||||
"all": { "description": "Si vaut TRUE, renvoie tous les sujets enregistrés.", "type": "boolean", "optional": true }
|
||||
}
|
||||
},
|
||||
|
@ -259,9 +263,6 @@
|
|||
"options": { "download": true },
|
||||
"parameters": {
|
||||
"subjects": { "description": "Identifiants des sujets d'enquêtes à intégrer.", "type": "array<id>", "optional": true },
|
||||
"phone": { "description": "Si vaut TRUE, renvoie les sujets cellulaires.", "type": "boolean", "optional": true },
|
||||
"facebook": { "description": "Si vaut TRUE, renvoie les sujet facebook.", "type": "boolean", "optional": true },
|
||||
"survey": { "description": "Si vaut TRUE, renvoie les sujets ResTIC.", "type": "boolean", "optional": true },
|
||||
"all": { "description": "Si vaut TRUE, renvoie tous les sujets enregistrés.", "type": "boolean", "optional": true }
|
||||
}
|
||||
},
|
||||
|
|
Before Width: | Height: | Size: 324 KiB After Width: | Height: | Size: 324 KiB |
|
@ -53,5 +53,5 @@ $header-height: 4em;
|
|||
=========================================================*/
|
||||
// Transforme une couleur hex en string sans le #
|
||||
@function color-str($color){
|
||||
@return str-slice(#{$color}, 2, str-length(#{$color}));
|
||||
@return str-slice("#{$color}", 2, str-length("#{$color}"));
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue