format en décryptage

This commit is contained in:
xdrm-brackets 2016-11-05 17:41:42 +01:00
parent a56bd2cc61
commit 26f974ef1e
3 changed files with 158 additions and 28 deletions

View File

@ -4,7 +4,6 @@
"logs": {
"direction": { "0": "INCOMING", "1": "OUTGOING", "2": "MISSED" },
"type": { "0": "PHONE", "1": "SMS" }
},

View File

@ -271,6 +271,10 @@
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;

View File

@ -17,12 +17,11 @@
/* [2] Requests on lab-surveys
=========================================================*/
function fetchAllData(){
$lisst = Table::get('laboratoires', 'lab-surveys')
// ->select('idLaboratoire')
->whereIntitule('LISST');
$etudes = Table::get('etudes', 'lab-surveys')
// ->select('idEtude')
->join('idLaboratoire', $lisst)
->orderby('idEtude')
->unique();
@ -36,21 +35,149 @@
->select('idQuestionFiche')
->select('intitule', null, null, 'question')
->orderby('idQuestionFiche')
// ->unique()
->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);
$sujets = Table::get('sujets', 'lab-surveys')
->select('idSujet')
->select('pseudo');
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;
}
}
var_dump( $v=$repAtt->fetch() );
?>