487 lines
11 KiB
PHP
487 lines
11 KiB
PHP
<?php
|
|
|
|
ob_Start();
|
|
|
|
|
|
|
|
require_once('tcpdf_include.php');
|
|
|
|
// create new PDF document
|
|
|
|
require_once '../functionsophalglpi.php';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
|
|
|
|
|
|
|
|
// set document information
|
|
|
|
$pdf->SetCreator(PDF_CREATOR);
|
|
|
|
$pdf->SetAuthor('Sophal SPA');
|
|
|
|
$pdf->SetTitle('EVALUATION ANNUELLE');
|
|
|
|
$pdf->SetSubject('EVALUATION ANNUELLE');
|
|
|
|
|
|
|
|
// add a page
|
|
|
|
$pdf->AddPage();
|
|
|
|
|
|
|
|
$pdf->SetFont('helvetica', '', 11);
|
|
|
|
|
|
|
|
|
|
|
|
$res = get_entete($idrfe);
|
|
|
|
$user = getUserId($res[0]['id_candidat']);
|
|
|
|
$annee = is_numeric(get_annee($idrfe)) ? get_annee($idrfe) : '' ;
|
|
|
|
$List = callWebService($user['matricule'] , 'get_MonDossierRH');
|
|
|
|
$profile_riasec = getRiasecTestResults($res[0]['id_candidat'],$annee);
|
|
// $profile_riasec = getRiasecTestResults(458,$annee);
|
|
|
|
|
|
//supprimer UTF-8-BOM
|
|
|
|
for ($i = 0; $i <= 31; ++$i) {
|
|
|
|
$List = str_replace(chr($i), "", $List);
|
|
|
|
}
|
|
|
|
$List = str_replace(chr(127), "", $List);
|
|
|
|
if (0 === strpos(bin2hex($List), 'efbbbf')) {
|
|
|
|
$List = substr($List, 3);
|
|
|
|
}
|
|
|
|
//supprimer UTF-8-BOM
|
|
|
|
|
|
|
|
$List = json_decode($List,true);
|
|
|
|
//print_r($List);
|
|
//print_r($allNotes);
|
|
|
|
|
|
|
|
//$imageContent = file_get_contents($List['photo']);
|
|
|
|
//$path = tempnam(sys_get_temp_dir(), 'prefix');
|
|
|
|
//file_put_contents ($path, $imageContent);
|
|
|
|
|
|
|
|
|
|
|
|
$titre_document = '
|
|
|
|
<table cellpadding="2">
|
|
|
|
<tr>
|
|
|
|
<td colspan="2" align="center"></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td colspan="2" align="center"><h1>EVALUATION ANNUELLE '.$annee.'</h1></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td colspan="2" align="center"></td>
|
|
|
|
</tr>
|
|
|
|
</table><hr> ';
|
|
|
|
$pdf->writeHTML($titre_document, true, false, false, false, '');
|
|
|
|
|
|
|
|
|
|
|
|
$employer_details = '
|
|
|
|
<table cellpadding="2" >
|
|
|
|
<tr>
|
|
|
|
<td style="width:3.2 cm"><strong>Nom & Prenom</strong></td>
|
|
|
|
<td style="width:9.7 cm"> : '.$List['employe']['employe_name'].'</td>
|
|
|
|
<td rowspan="7" align="center"><img src="@' . preg_replace('#^data:image/[^;]+;base64,#', '', $List['photo']) . '" width="120" ></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><strong>Département</strong></td>
|
|
|
|
<td> : '.$List['employe']['DEPARTEMENT'].'</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><strong>Fonction</strong></td>
|
|
|
|
<td> : '.$List['employe']['Libelle'].'</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><strong>Service</strong></td>
|
|
|
|
<td> : '.$List['employe']['SERVICE'].'</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><strong>Matricule</strong></td>
|
|
|
|
<td> : '.$List['employe']['MATRICULE'].'</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><strong>Téléphone</strong></td>
|
|
|
|
<td> : '.$List['employe']['NUMTELEPHONE'].'</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><strong>Date de recrutement</strong></td>
|
|
|
|
<td> : '.date("d-m-Y", strtotime($List['employe']['DateRecrutement'])).'</td>;
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<table>
|
|
|
|
<tr style="line-height: 50%;">
|
|
|
|
<td></td>
|
|
|
|
</tr>
|
|
|
|
</table>';
|
|
|
|
|
|
// print_r($List['postes']);
|
|
// print_r(count($List['postes']));
|
|
$blank_lines_count = 8; //6 - count($List['postes']);
|
|
$pdf->writeHTML($employer_details, true, false, false, false, '');
|
|
$postes = '
|
|
<table cellpadding="2">
|
|
<tr>
|
|
<td colspan="2" align="left"><strong>Différents postes de travail</strong> : </td>
|
|
<td align="center"><strong>Notes</strong> </td>
|
|
</tr><tr><td colspan="2"><ul>';
|
|
foreach($List['postes'] as $val){
|
|
$postes = $postes.'<li>'.$val['poste'].'</li>';
|
|
}
|
|
$postes = $postes.'</ul></td><td align="left"><ul><li><strong>Note Competence</strong> : '.$compNote.'/7</li><li><strong>Note Finale</strong> : '.$finalNote.'/10</li></ul></td></tr></table>';
|
|
$pdf->writeHTML($postes, true, false, false, false, '');
|
|
|
|
$profile = "Contribution operationnel";
|
|
if($compNote > 2 & $compNote < 4)
|
|
$profile = "Apport tactique";
|
|
if($compNote >= 4 & $compNote < 6)
|
|
$profile = "Apport stratégique";
|
|
if($compNote >= 6)
|
|
$profile = "Contribution visionnaire";
|
|
$profile_eval = '
|
|
<table cellpadding="2" >
|
|
<tr>
|
|
<td colspan="3" align="left"><strong>Profile</strong> : </td>
|
|
</tr><tr><td colspan="3"><ul>';
|
|
$profile_eval = $profile_eval.'<li>'.$profile.'</li></ul></td></tr></table>';
|
|
$pdf->writeHTML($profile_eval, true, false, false, false, '');
|
|
|
|
$profile_psycho = '
|
|
<table cellpadding="2" >
|
|
<tr>
|
|
<td align="left"><strong>Profile Psychotechnique</strong> : </td>
|
|
<td colspan="2" align="left"></td>
|
|
</tr><tr><td><ul>';
|
|
|
|
$riasec_score = "N/A";
|
|
$riasec_date = "";
|
|
if($profile_riasec){
|
|
$riasec_score = $profile_riasec['score'];
|
|
$riasec_date = ' (Date d\'evaluation '.date('d-m-Y',strtotime($profile_riasec['test_date'])).')';
|
|
}
|
|
$explaine ='<td colspan="3" align="left"><img height ="200" src="'.$CFG_GLPI["root_doc"].'/pics/raisec.PNG"></td>';
|
|
|
|
$profile_psycho = $profile_psycho.'<li>'.$riasec_score.$riasec_date.'</li></ul></td>'.$explaine.'</tr></table>';
|
|
$pdf->writeHTML($profile_psycho, true, false, false, false, '');
|
|
|
|
|
|
$spacing = '<table cellpadding="2" >';
|
|
for($i = 0; $i < $blank_lines_count ; $i++){
|
|
$spacing = $spacing.'<tr ><td style="width:3.2 cm"> </td><td style="width:9.7 cm"> </td><td> </td></tr>';
|
|
}
|
|
$spacing = $spacing.'</table>';
|
|
|
|
if($blank_lines_count > 0)
|
|
$pdf->writeHTML($spacing, true, false, false, false, 'C');
|
|
$charts = '<div style="float: right;"><table style="float: right;" cellpadding="2" border="1">
|
|
<tr>
|
|
<td style="width:12 cm">Resultats de l\'evaluation</td>
|
|
</tr>
|
|
</table></div>
|
|
';
|
|
$pdf->writeHTML($charts, true, false, false, false, 'C');
|
|
|
|
|
|
|
|
if($image_all_note != 'data:,')
|
|
//$pdf->writeHTML('<img src="@' . preg_replace('#^data:image/[^;]+;base64,#', '', $image_all_note) . '" >', true, false, false, false, 'C');
|
|
|
|
if($graph != 'data:,')
|
|
|
|
$pdf->writeHTML('<img src="@' . preg_replace('#^data:image/[^;]+;base64,#', '', $graph) . '" >', true, false, false, false, 'C');
|
|
|
|
|
|
|
|
$titre_tableau = '';
|
|
|
|
|
|
|
|
for($p = 0; $p < count($res) ; $p++){
|
|
|
|
$debut ='<table border="0.5" cellpadding="2">';
|
|
if($res[$p]['question'] == '1. Performances' ||
|
|
$res[$p]['question'] == '2. Compétences' ||
|
|
$res[$p]['question'] == 'Examen du plan de Formation' ||
|
|
$res[$p]['question'] == '3. Evaluation RH' ||
|
|
$res[$p]['question'] == 'Objectifs'
|
|
){
|
|
$debut = '<br pagebreak="true"/>'.$debut;
|
|
}
|
|
|
|
|
|
if($res[$p]['question'] == '1. Performances' || $res[$p]['question'] == 'Plan de Developpement de Carrière'){
|
|
|
|
$titre_tableau='<tr>
|
|
|
|
<th colspan="4" align="center"><strong>'.$res[$p]['question'].'</strong> </th>
|
|
|
|
</tr>';
|
|
|
|
}elseif($res[$p]['question'] == 'Objectifs'){
|
|
$titre_tableau='<tr>
|
|
|
|
<th colspan="2" align="center"><strong>'.$res[$p]['question'].' '.(intval($annee)+1).'</strong> </th>
|
|
|
|
</tr>';
|
|
}else{
|
|
|
|
$titre_tableau ='<tr>
|
|
|
|
<th colspan="2" align="center"><strong>'.$res[$p]['question'].'</strong> </th>
|
|
|
|
</tr>';
|
|
|
|
}
|
|
|
|
|
|
|
|
$s = '';
|
|
|
|
$ligne = get_lignes($res[$p]['id'],$idrfe) ;
|
|
$objectifs_count = 0;
|
|
if(count($ligne) > 0){
|
|
|
|
|
|
|
|
for($ps = 0; $ps < count($ligne) ; $ps++){
|
|
|
|
if(is_numeric($ligne[$ps]['question']) && $ligne[$ps]['reponses'] != "[2]" && $res[$p]['question'] == '1. Performances'){
|
|
|
|
if($ligne[$ps]['reponse'] != '' ){
|
|
|
|
$s = $s.'<tbody>
|
|
|
|
<tr>
|
|
|
|
<td>'.$ligne[$ps]['reponse'].'</td>
|
|
|
|
<td>'.$ligne[$ps]['observation'].'</td>
|
|
|
|
<td>'.$ligne[$ps]['date'].'</td>
|
|
|
|
<td>'.$ligne[$ps]['eval'].'</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>';
|
|
|
|
}
|
|
|
|
}elseif(!is_numeric($ligne[$ps]['question']) && $ligne[$ps]['reponses'] != "[2]"){
|
|
|
|
$s = $s.'<tbody>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td>'.$ligne[$ps]['question'].'</td>
|
|
|
|
<td>'.$ligne[$ps]['reponse'].'</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>';
|
|
|
|
}elseif(is_numeric($ligne[$ps]['question']) && $ligne[$ps]['reponses'] == "[2]"){
|
|
|
|
$new = explode(",", $ligne[$ps]['reponse']);
|
|
|
|
if($new[0] != '[' && $new[1] != ']'){
|
|
|
|
$s = $s.'<tbody>
|
|
|
|
<tr>
|
|
|
|
<td>'.ltrim($new[0], '[').'</td>
|
|
|
|
<td>'.rtrim($new[1], "]").'</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>';
|
|
|
|
}
|
|
|
|
}elseif(is_numeric($ligne[$ps]['question']) && $ligne[$ps]['reponses'] != "[2]" && $res[$p]['question'] == 'Objectifs'){
|
|
|
|
if($ligne[$ps]['reponse'] != '' ){
|
|
$objectifs_count += 1;
|
|
|
|
$s = $s.'<tbody>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td>'.$ligne[$ps]['reponse'].'</td>
|
|
|
|
<td>'.$ligne[$ps]['date'].'</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>';
|
|
|
|
}
|
|
|
|
}elseif(is_numeric($ligne[$ps]['question']) && $ligne[$ps]['reponses'] == "[4]"){
|
|
|
|
$new = explode(",", $ligne[$ps]['reponse']);
|
|
|
|
if($new[0] != '[' && $new[1] != ']'){
|
|
|
|
$s = $s.'<tbody>
|
|
|
|
<tr>
|
|
|
|
<td>'.ltrim($new[0], '[').'</td>
|
|
|
|
<td>'.$new[1].'</td>
|
|
|
|
<td>'.$new[2].'</td>
|
|
|
|
<td>'.rtrim($new[3], "]").'</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$fin = '</table>
|
|
|
|
|
|
|
|
<table>
|
|
|
|
<tr style="line-height: 100%;">
|
|
|
|
<td></td>
|
|
|
|
</tr>
|
|
|
|
</table>';
|
|
|
|
|
|
|
|
$pdf->writeHTML($debut.$titre_tableau.$s.$fin, true, false, false, false, '');
|
|
|
|
}
|
|
|
|
|
|
$spacing = '<table cellpadding="2">';
|
|
$blank_object_count = 26 - $objectifs_count;
|
|
for($i = 0; $i < $blank_object_count ; $i++){
|
|
$spacing = $spacing.'<tr ><td style="width:3.2 cm"> </td><td style="width:9.7 cm"> </td><td> </td></tr>';
|
|
}
|
|
$spacing = $spacing.'</table>';
|
|
if($blank_object_count>0)
|
|
$pdf->writeHTML($spacing, true, false, false, false, 'C');
|
|
|
|
$user_superviser = getUserID($user['users_id_supervisor']);
|
|
$signature = '<table cellpadding="2">
|
|
<tr >
|
|
<td align="center" style="width:50%">Signature du Salarié<br>('.$user['fullname'].')</td>
|
|
<td align="center" style="width:50%">Signature du Responsable<br>('.$user_superviser['fullname'].')</td>
|
|
</tr>
|
|
</table>';
|
|
|
|
$pdf->writeHTML($signature, true, false, false, false, 'C');
|
|
//Close and output PDF document
|
|
|
|
$pdf->Output('EVALUATION ANNUELLE '.$annee.'.pdf', 'I'); |