184 lines
4.5 KiB
PHP
184 lines
4.5 KiB
PHP
<?php
|
|
|
|
define('__ROOT__', dirname(dirname(dirname(__FILE__))) );
|
|
|
|
require_once __ROOT__.'/autoloader.php';
|
|
|
|
|
|
|
|
|
|
use \database\core\Repo;
|
|
use \database\core\DatabaseDriver;
|
|
use \orm\core\Table;
|
|
use \orm\core\Rows;
|
|
|
|
debug();
|
|
|
|
|
|
/* [2] Requests on lab-surveys
|
|
=========================================================*/
|
|
function fetchAllData(){
|
|
$lisst = Table::get('laboratoires', 'lab-surveys')
|
|
->whereIntitule('LISST');
|
|
|
|
$etudes = Table::get('etudes', 'lab-surveys')
|
|
->join('idLaboratoire', $lisst)
|
|
->orderby('idEtude')
|
|
->unique();
|
|
|
|
$fiches = Table::get('fiches', 'lab-surveys')
|
|
->select('idFiche')
|
|
->orderby('idFiche')
|
|
->join('idEtude', $etudes);
|
|
|
|
$questions = Table::get('questionsFiches', 'lab-surveys')
|
|
->select('idQuestionFiche')
|
|
->select('intitule', null, null, 'question')
|
|
->orderby('idQuestionFiche')
|
|
->join('idFiche', $fiches);
|
|
|
|
$repAtt = Table::get('reponsesAttenduesFiches', 'lab-surveys')
|
|
->select('intitule', Rows::SEL_CONCAT, null, 'possible')
|
|
->join('idQuestionFiche', $questions)
|
|
->orderby('idReponseAttendueFiche');
|
|
|
|
$sujets = Table::get('sujets', 'lab-surveys')
|
|
->select('idSujet')
|
|
->select('pseudo')
|
|
->orderby('idSujet');
|
|
|
|
$repSuj = Table::get('reponsesFiches', 'lab-surveys')
|
|
->select('intitule', null, null, 'reponse')
|
|
->join('idSujet', $sujets)
|
|
->join('idQuestionFiche', $repAtt);
|
|
|
|
var_dump( $repSuj->fetch() );
|
|
}
|
|
|
|
|
|
function fetchSujets(){
|
|
$lisst = Table::get('laboratoires', 'lab-surveys')
|
|
->whereIntitule('LISST');
|
|
|
|
$etudes = Table::get('etudes', 'lab-surveys')
|
|
->join('idLaboratoire', $lisst)
|
|
->orderby('idEtude')
|
|
->unique();
|
|
|
|
$sujets = Table::get('sujets', 'lab-surveys')
|
|
->select('idSujet')
|
|
->select('pseudo')
|
|
->join('idEtude', $lisst)
|
|
->orderby('idSujet');
|
|
|
|
var_dump( $sujets->fetch() );
|
|
}
|
|
|
|
|
|
function fetchNbQuestionsPerFiche(){
|
|
$lisst = Table::get('laboratoires', 'lab-surveys')
|
|
->whereIntitule('LISST');
|
|
|
|
$etudes = Table::get('etudes', 'lab-surveys')
|
|
->join('idLaboratoire', $lisst)
|
|
->orderby('idEtude')
|
|
->unique();
|
|
|
|
$fiches = Table::get('fiches', 'lab-surveys')
|
|
->select('idFiche')
|
|
->orderby('idFiche')
|
|
->join('idEtude', $etudes);
|
|
|
|
$questions = Table::get('questionsFiches', 'lab-surveys')
|
|
->select('idQuestionFiche', Rows::SEL_COUNT)
|
|
->join('idFiche', $fiches);
|
|
|
|
var_dump( $questions->fetch() );
|
|
}
|
|
|
|
|
|
function fetchFicheComplete(){
|
|
$lisst = Table::get('laboratoires', 'lab-surveys')
|
|
->whereIntitule('LISST');
|
|
|
|
$etudes = Table::get('etudes', 'lab-surveys')
|
|
->join('idLaboratoire', $lisst)
|
|
->orderby('idEtude')
|
|
->unique();
|
|
|
|
$fiche = Table::get('fiches', 'lab-surveys')
|
|
->select('idFiche')
|
|
->orderby('idFiche')
|
|
->join('idEtude', $etudes)
|
|
->unique();
|
|
|
|
$questions = Table::get('questionsFiches', 'lab-surveys')
|
|
->select('idQuestionFiche')
|
|
->select('intitule')
|
|
->orderby('idQuestionFiche')
|
|
->join('idFiche', $fiche);
|
|
|
|
$rep = Table::get('reponsesAttenduesFiches', 'lab-surveys')
|
|
->select('idReponseAttendueFiche', Rows::SEL_CONCAT, null, 'reponsesid')
|
|
->select('intitule', Rows::SEL_CONCAT, null, 'reponses')
|
|
->orderby('idReponseAttendueFiche')
|
|
->join('idQuestionFiche', $questions);
|
|
|
|
var_dump( $rep->fetch() );
|
|
}
|
|
|
|
|
|
function fetchRelations(){
|
|
$lisst = Table::get('laboratoires', 'lab-surveys')
|
|
->whereIntitule('LISST');
|
|
|
|
$etudes = Table::get('etudes', 'lab-surveys')
|
|
->join('idLaboratoire', $lisst)
|
|
->orderby('idEtude')
|
|
->unique();
|
|
|
|
$A = Table::get('sujets', 'lab-surveys')
|
|
->select('pseudo', null, null, 'A')
|
|
->join('idEtude', $lisst)
|
|
->orderby('idSujet');
|
|
|
|
$B = Table::get('sujets', 'lab-surveys')
|
|
->select('pseudo', null, null, 'B')
|
|
->join('idEtude', $lisst)
|
|
->orderby('idSujet');
|
|
|
|
$cate = Table::get('categoriesRelations', 'lab-surveys')
|
|
->select('intitule', null, null, 'categorie');
|
|
|
|
$rel = Table::get('relations', 'lab-surveys')
|
|
->join('idSujetA', $A)
|
|
->join('idSujetB', $B)
|
|
->join('idCategorieRelation', $cate);
|
|
|
|
var_dump( $rel->fetch() );
|
|
}fetchRelations();
|
|
|
|
|
|
function idQuestionToKey($idQuestion){
|
|
switch($idQuestion){
|
|
case 3: return 'sexe'; break;
|
|
case 6: return 'studies1'; break;
|
|
case 5: return 'famsit'; break;
|
|
case 12: return 'context'; break;
|
|
case 7: return 'reltype'; break;
|
|
case 10: return 'dist'; break;
|
|
case 15: return 'freq[face]'; break;
|
|
case 16: return 'freq[skype]'; break;
|
|
case 17: return 'freq[sms]'; break;
|
|
case 18: return 'freq[mail]'; break;
|
|
case 19: return 'freq[facebook]'; break;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
?>
|