223 lines
5.2 KiB
PHP
223 lines
5.2 KiB
PHP
<?php
|
|
|
|
include ('../inc/includes.php');
|
|
|
|
|
|
function getIdResultatFicheEvaluationCount() {
|
|
global $DB;
|
|
|
|
$query = "SELECT * from id_resultat_fiche_evaluation_count";
|
|
$result = $DB->query($query);
|
|
|
|
if ($result->num_rows > 0) {
|
|
|
|
$row = $result->fetch_assoc();
|
|
return $row['value'];
|
|
}
|
|
}
|
|
|
|
function increaseIdResultatFicheEvaluationCount() {
|
|
|
|
global $DB;
|
|
|
|
$query = "UPDATE `id_resultat_fiche_evaluation_count` SET `value`=value+1";
|
|
$DB->query($query);
|
|
}
|
|
|
|
|
|
function insertResultatLigneFicheEvaluation($idLigneFicheEvaluation, $idResultatFicheEvaluation, $idCandidat, $reponse, $observation){
|
|
|
|
global $DB;
|
|
|
|
$query = "INSERT INTO resultat_ligne_fiche_evaluation (`id_ligne_fiche_evaluation`, `id_resultat_fiche_evaluation`, `id_candidat`, `reponse`, `observation`) VALUES ('".$idLigneFicheEvaluation."','".$idResultatFicheEvaluation."','".$idCandidat."','".$reponse."', '".$observation."')";
|
|
//echo $query;
|
|
$DB->query($query);
|
|
|
|
return $DB->insert_id();
|
|
}
|
|
|
|
function insertResultatLigneFicheEvaluationAnnuel($idLigneFicheEvaluation, $idResultatFicheEvaluation, $date, $eval){
|
|
|
|
global $DB;
|
|
|
|
$query = "INSERT INTO resultat_ligne_fiche_eval_annuel (`id_ligne_fiche_evaluation`, `id_resultat_fiche_evaluation`, `date`, `eval`) VALUES ('".$idLigneFicheEvaluation."','".$idResultatFicheEvaluation."','".$date."', '".$eval."')";
|
|
//echo $query;
|
|
$DB->query($query);
|
|
|
|
return $DB->insert_id();
|
|
}
|
|
|
|
function isResultatFicheExist($idFicheEvaluation, $dateannuel, $employeeId) {
|
|
|
|
global $DB;
|
|
|
|
$query = "SELECT * from resultat_ligne_fiche_evaluation rlfe LEFT JOIN ligne_fiche_evaluation lfe ON lfe.id_ligne_fiche_evaluation = rlfe.id_ligne_fiche_evaluation where lfe.ordre = 0 and lfe.id_parent = 0 and lfe.id_fiche_evaluation = ".$idFicheEvaluation."
|
|
and id_candidat = ".$employeeId." and reponse = '".$dateannuel."'";
|
|
$result = $DB->query($query);
|
|
|
|
if ($result->num_rows > 0) {
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
|
|
function getFicheEvaluation($id_fiche_evaluation){
|
|
|
|
if(isInjection($id_fiche_evaluation)) {
|
|
echo "Not Allowed";
|
|
return null;
|
|
}
|
|
|
|
global $DB;
|
|
|
|
$query = "SELECT * from fiche_evaluation WHERE id_fiche_evaluation = ".$id_fiche_evaluation;
|
|
$result = $DB->query($query);
|
|
|
|
if ($result->num_rows > 0) {
|
|
$rows = array();
|
|
while($row = $result->fetch_assoc()) {
|
|
$rows[] = $row;
|
|
}
|
|
return $rows[0];
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
function getLignesFicheEvaluation($id_fiche_evaluation){
|
|
|
|
if(isInjection($id_fiche_evaluation)) {
|
|
echo "Not Allowed";
|
|
return null;
|
|
}
|
|
|
|
global $DB;
|
|
|
|
$query = "SELECT * from ligne_fiche_evaluation WHERE id_fiche_evaluation = ".$id_fiche_evaluation." order by ordre";
|
|
$result = $DB->query($query);
|
|
|
|
if ($result->num_rows > 0) {
|
|
$rows = array();
|
|
while($row = $result->fetch_assoc()) {
|
|
$rows[] = $row;
|
|
}
|
|
return $rows;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
|
|
|
|
|
|
function getSubUsersfe($idUser) {
|
|
|
|
global $DB;
|
|
$subUsers = array();
|
|
|
|
$query = "SELECT id , CONCAT(realname,' ', firstname) as fullname from glpi_users where users_id_supervisor ='".$idUser."' and is_active=1 order by fullname";
|
|
$result = $DB->query($query);
|
|
|
|
if ($result->num_rows > 0) {
|
|
$rows = array();
|
|
while($row = $result->fetch_assoc()) {
|
|
$subUsers[] = $row;
|
|
}
|
|
return $subUsers;
|
|
}
|
|
|
|
return $subUsers;
|
|
}
|
|
|
|
function getGroups() {
|
|
|
|
global $DB;
|
|
$groups = array();
|
|
|
|
$query = "SELECT * FROM glpi_groups";
|
|
$result = $DB->query($query);
|
|
|
|
if ($result->num_rows > 0) {
|
|
$rows = array();
|
|
while($row = $result->fetch_assoc()) {
|
|
$groups[] = $row;
|
|
}
|
|
return $groups;
|
|
}
|
|
|
|
return $groups;
|
|
}
|
|
|
|
function getGroupUsers($groupId) {
|
|
|
|
global $DB;
|
|
$groups = array();
|
|
|
|
$query = "SELECT users_id FROM glpi_groups_users where groups_id = ".$groupId;
|
|
$result = $DB->query($query);
|
|
|
|
if ($result->num_rows > 0) {
|
|
$rows = array();
|
|
while($row = $result->fetch_assoc()) {
|
|
$groups[] = $row['users_id'];
|
|
}
|
|
return $groups;
|
|
}
|
|
|
|
return $groups;
|
|
}
|
|
|
|
function evaluationTrack($idResultatFeval, $user) {
|
|
|
|
global $DB;
|
|
|
|
$query = "INSERT INTO `evaluation_tracking`(`id_resultat_feval`, `user`, `comment`) VALUES ('".$idResultatFeval."', '".$user."', 'evaluation')";
|
|
//echo $query;
|
|
$DB->query($query);
|
|
}
|
|
|
|
function cache_all_clear($root){
|
|
$files = glob($root."/*");
|
|
foreach($files as $file) {
|
|
unlink($file);
|
|
}
|
|
}
|
|
|
|
|
|
function getPreviousObjectifs($id_user){
|
|
|
|
global $DB;
|
|
|
|
$query = "SELECT
|
|
id_candidat,reponse
|
|
FROM
|
|
`resultat_ligne_fiche_evaluation`
|
|
LEFT JOIN ligne_fiche_evaluation ON ligne_fiche_evaluation.id_ligne_fiche_evaluation = resultat_ligne_fiche_evaluation.id_ligne_fiche_evaluation
|
|
WHERE
|
|
ligne_fiche_evaluation.id_ligne_fiche_evaluation >= 597 AND ligne_fiche_evaluation.id_ligne_fiche_evaluation <= 619 AND reponse != '' AND id_candidat = ? AND id_resultat_fiche_evaluation =(
|
|
SELECT rrr.id_resultat_fiche_evaluation from resultat_ligne_fiche_evaluation rrr
|
|
WHERE rrr.reponse = year(CURRENT_DATE())-2 and id_candidat = ?
|
|
)
|
|
ORDER BY
|
|
id_resultat_fiche_evaluation ASC;";
|
|
$stmt = $DB->prepare($query);
|
|
|
|
$stmt->bind_param("ii", $id_user,$id_user);
|
|
|
|
$stmt->execute();
|
|
$result = $stmt->get_result();
|
|
|
|
if ($result->num_rows > 0) {
|
|
$rows = array();
|
|
while($row = $result->fetch_assoc()) {
|
|
$rows[] = $row;
|
|
}
|
|
return $rows;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|