124 lines
3.5 KiB
PHP
124 lines
3.5 KiB
PHP
<?php
|
|
|
|
include ('../inc/utils.class.php');
|
|
|
|
function get_entete($idrfe){
|
|
if(isInjection($idrfe)) { echo "Not Allowed"; return null; }
|
|
global $DB;
|
|
|
|
|
|
$query = "SELECT *,b.id_ligne_fiche_evaluation as id FROM ligne_fiche_evaluation as b ,`resultat_ligne_fiche_evaluation` as a
|
|
WHERE a.id_ligne_fiche_evaluation = b.id_ligne_fiche_evaluation
|
|
and `id_resultat_fiche_evaluation` = ? and b.ordre != 0
|
|
and b.id_parent = 0 and b.comment = 0 ";
|
|
$stmt = $DB->prepare($query);
|
|
|
|
$stmt->bind_param("i" , $idrfe);
|
|
|
|
$stmt->execute();
|
|
$result = $stmt->get_result();
|
|
|
|
if ($result->num_rows > 0) {
|
|
$rows = array();
|
|
while($row = $result->fetch_assoc()) {
|
|
$res[] = $row;
|
|
}
|
|
return $res;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
function get_annee($idrfe){
|
|
if(isInjection($idrfe)) { echo "Not Allowed"; return null; }
|
|
global $DB;
|
|
|
|
|
|
$query = "SELECT resultat_ligne_fiche_evaluation.reponse as annee
|
|
FROM `resultat_ligne_fiche_evaluation`
|
|
WHERE `id_resultat_fiche_evaluation` = ? LIMIT 1";
|
|
$stmt = $DB->prepare($query);
|
|
|
|
$stmt->bind_param("i" , $idrfe);
|
|
|
|
$stmt->execute();
|
|
$result = $stmt->get_result();
|
|
|
|
if ($result->num_rows > 0) {
|
|
$rows = array();
|
|
while($row = $result->fetch_assoc()) {
|
|
$res[] = $row;
|
|
}
|
|
return $res[0]['annee'];
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
function get_lignes($id,$idrfe){
|
|
|
|
global $DB;
|
|
|
|
$res = array();
|
|
//$query = "SELECT * FROM ligne_fiche_evaluation as b ,`resultat_ligne_fiche_evaluation` as a
|
|
//WHERE a.id_ligne_fiche_evaluation = b.id_ligne_fiche_evaluation and `id_resultat_fiche_evaluation` = ".$idrfe." and b.id_parent = ".$id."";
|
|
|
|
$query = "SELECT a.id_ligne_fiche_evaluation,b.id_parent, b.question,b.reponses,a.reponse,a.observation,c.date,c.eval
|
|
FROM resultat_ligne_fiche_evaluation as a
|
|
LEFT JOIN ligne_fiche_evaluation as b ON b.id_ligne_fiche_evaluation = a.id_ligne_fiche_evaluation
|
|
LEFT JOIN resultat_ligne_fiche_eval_annuel as c ON a.id_ligne_fiche_evaluation = c.id_ligne_fiche_evaluation and c.id_resultat_fiche_evaluation = ?
|
|
WHERE a.id_resultat_fiche_evaluation = ? and b.id_parent = ? ";
|
|
$stmt = $DB->prepare($query);
|
|
|
|
$stmt->bind_param("iii" , $idrfe, $idrfe, $id);
|
|
|
|
$stmt->execute();
|
|
$result = $stmt->get_result();
|
|
|
|
if ($result->num_rows > 0) {
|
|
$rows = array();
|
|
while($row = $result->fetch_assoc()) {
|
|
$res[] = $row;
|
|
}
|
|
return $res;
|
|
}
|
|
|
|
return $res;
|
|
}
|
|
|
|
function getUserId($idUser){
|
|
|
|
global $DB;
|
|
$subUsers = array();
|
|
|
|
$query = "SELECT id , CONCAT(realname,' ', firstname) as fullname, registration_number as matricule,users_id_supervisor from glpi_users where id= ? ";
|
|
$stmt = $DB->prepare($query);
|
|
|
|
$stmt->bind_param("i" , $idUser);
|
|
|
|
$stmt->execute();
|
|
$result = $stmt->get_result();
|
|
|
|
if ($result->num_rows > 0) {
|
|
while($row = $result->fetch_assoc()) {
|
|
$subUsers[] = $row;
|
|
}
|
|
return $subUsers[0];
|
|
}
|
|
|
|
return $subUsers;
|
|
}
|
|
|
|
function getRiasecTestResults($idUser,$year){
|
|
global $DB;
|
|
|
|
$query = "SELECT * FROM resultat_eval_psychotechnique WHERE user_id = ? and YEAR(test_date) = ?";
|
|
$stmt = $DB->prepare($query);
|
|
|
|
$stmt->bind_param("ii" , $idUser,$year);
|
|
|
|
$stmt->execute();
|
|
$result = $stmt->get_result();
|
|
return $result->fetch_assoc();
|
|
}
|