177 lines
4.6 KiB
PHP
177 lines
4.6 KiB
PHP
<?php
|
|
|
|
use Glpi\Event;
|
|
include ('../inc/includes.php');
|
|
Session::checkLoginUser();
|
|
include_once(GLPI_ROOT . "/functionsophalglpi.php");
|
|
|
|
|
|
if(Session::getCurrentInterface() == "helpdesk") {
|
|
Html::helpHeader("DRH", '', $_SESSION["glpiname"]);
|
|
} else {
|
|
Html::header("DRH", '', "", "");
|
|
}
|
|
|
|
/*
|
|
function callWebService($matricule , $operation){
|
|
|
|
$url = "http://si.sophal.net/controller/Webservices.php";
|
|
$accessKey = 'D*G-KaNdRgUkXp2s5v8y/B?E(H+MbQeS';
|
|
|
|
$data = array(
|
|
'accessKey' => $accessKey ,
|
|
'matricule' => $matricule,
|
|
'operation' => $operation,
|
|
);
|
|
|
|
$resource = curl_init();
|
|
curl_setopt($resource, CURLOPT_URL, $url);
|
|
curl_setopt($resource, CURLOPT_HTTPHEADER, array('Content-Type:multipart/form-data'));
|
|
curl_setopt($resource, CURLOPT_POST, 1);
|
|
curl_setopt($resource, CURLOPT_RETURNTRANSFER, 1);
|
|
curl_setopt($resource, CURLOPT_POSTFIELDS, $data);
|
|
$response = curl_exec($resource);
|
|
|
|
curl_close($resource);
|
|
|
|
if ($response !== false) {
|
|
return $response;
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
function getMatricule(){
|
|
|
|
global $DB;
|
|
|
|
$query = "SELECT registration_number as matricule from glpi_users
|
|
where glpi_users.id ='".$_SESSION["glpiID"]."' ";
|
|
$result = $DB->query($query);
|
|
|
|
if ($result->num_rows > 0) {
|
|
$res = $result->fetch_assoc();
|
|
return $res['matricule'];
|
|
}
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
*/
|
|
|
|
$matricule = getMatricule();
|
|
$List = callWebService($matricule , 'get_BulletinListe');
|
|
|
|
//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);
|
|
|
|
echo "<div class='center'>
|
|
<table border='0' class='tab_cadrehov js-dynamitable'>
|
|
<thead>
|
|
<tr class='tab_bg_2'>
|
|
<th ><a href=''> Opération </a></th>
|
|
<th class=''><a href=''>Bulletin de Paie</a></th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
<tbody>";
|
|
if(isset($List)){
|
|
if(sizeof($List) > 0){
|
|
foreach ($List as $List) {
|
|
result($List , $CFG_GLPI["root_doc"]);
|
|
}
|
|
}
|
|
}else{
|
|
echo "<tr style=' text-align: center;'><td colspan='7'>Aucune donnée trouvée</td></tr>";
|
|
}
|
|
echo" </tbody>
|
|
<tfoot>
|
|
<tr class='tab_bg_2'>
|
|
<th ><a > Opération </a></th>
|
|
<th class=''><a href=''>Bulletin de Paie</a></th>
|
|
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
</div>";
|
|
|
|
if (Session::getCurrentInterface() == "helpdesk") {
|
|
Html::helpFooter();
|
|
} else {
|
|
Html::footer();
|
|
}
|
|
|
|
|
|
|
|
function result($List , $root){
|
|
$months = array(1=>"Janvier", 2=>"Février", 3=>"Mars", 4=>"Avril", 5=>"Mai", 6=>"Juin",
|
|
7=>"Juillet", 8=>"Août", 9=>"Septembre", 10=>"Octobre", 11=>"Novembre", 12=>"Décembre");
|
|
$moisNbr = substr($List['PeriodePaie'], -2);
|
|
$annee = substr($List['PeriodePaie'], 0,-2);
|
|
echo ' <tr class="tab_bg_1">
|
|
<td valign="top"><a href="'.$root.'/front/drh.pdf.php?periode='.$List['PeriodePaie'].'&numbulletin='.$List['Numbulletin'].'"> Exporter en PDF</a></td>
|
|
<td valign="top" style="font-weight:bold">Mois de '.$months[(int)$moisNbr].' '.$annee.'</td>
|
|
</tr>';
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getList(){
|
|
|
|
global $DB;
|
|
|
|
|
|
$query = "SELECT * from boite_idees where user_id = '".$_SESSION["glpiID"]."'";
|
|
$result = $DB->query($query);
|
|
$List = array();
|
|
if ($result->num_rows > 0) {
|
|
|
|
while($row = $result->fetch_assoc()) {
|
|
$List[] = $row;
|
|
}
|
|
|
|
}
|
|
return $List;
|
|
}
|
|
|
|
$link = $CFG_GLPI["root_doc"];
|
|
$user = Session::getCurrentInterface();
|
|
?>
|
|
|
|
<script>
|
|
var link = <?php echo json_encode($link); ?>;
|
|
var user = <?php echo json_encode($user); ?>;
|
|
var userlink;
|
|
if(user == "helpdesk"){
|
|
userlink ='<li class="breadcrumb_item"><a href="'+link+'/front/helpdesk.public.php" title="Accueil">Accueil</a></li>';
|
|
}else{
|
|
userlink = '<li class="breadcrumb_item"><a href="'+link+'/front/central.php" title="Accueil">Accueil</a></li>';
|
|
}
|
|
|
|
$(document).ready(function(){
|
|
|
|
$("#c_ssmenu2").html('<ul>'+
|
|
userlink+
|
|
'<li class="breadcrumb_item"><a href="" title="">Ressources Humaines</a></li>'+
|
|
'<li class="breadcrumb_item"><a href="" class="here" title="Boite à idées"><i class="far fa-sticky-note"></i> Bulletin de Paie</a></li>'+
|
|
|
|
'</li>'+
|
|
'</ul>');
|
|
|
|
});
|
|
</script>
|