1053 lines
29 KiB
PHP
1053 lines
29 KiB
PHP
<?php
|
||
|
||
|
||
use Glpi\Event;
|
||
include ('../model_controller/fiche.evaluation.php');
|
||
include ('../inc/utils.class.php');
|
||
|
||
|
||
if (Session::getLoginUserID()) {
|
||
if (Session::getCurrentInterface() == "helpdesk") {
|
||
Html::helpHeader("DRH", '', $_SESSION["glpiname"]);
|
||
} else
|
||
Html::header("DRH", '', "", "");
|
||
} else {
|
||
$_SESSION["glpilanguage"] = $_SESSION['glpilanguage'] ?? $CFG_GLPI['language'];
|
||
// Anonymous FAQ
|
||
Html::simpleHeader(__('FAQ'), [
|
||
/*__('FAQ')*/'FICHE EVALUATION' => ''
|
||
]);
|
||
}
|
||
|
||
echo '<link rel="stylesheet" type="text/css" href="../css/csspopins.css.css" />';
|
||
|
||
if(isset($_GET['fiche'])) {
|
||
$ficheEvaluation = getFicheEvaluation($_GET['fiche']);
|
||
$lignesFicheEvaluation = getLignesFicheEvaluation($_GET['fiche']);
|
||
$blocks = [];
|
||
foreach ($lignesFicheEvaluation as $row) {
|
||
if($row['id_parent'] == 0) {
|
||
$lignesblocks = [];
|
||
foreach ($lignesFicheEvaluation as $row2) {
|
||
if($row['id_ligne_fiche_evaluation'] == $row2['id_parent'])
|
||
$lignesblocks[] = $row2;
|
||
}
|
||
$blocks[] = [$row, $lignesblocks];
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
function addFicheEvaluation($pannuel, $pfiche_id, $pemployeeId) {
|
||
|
||
if($pannuel) {
|
||
for ($k = 0; $k < sizeof($_POST['InsertFormulaire']); $k++) {
|
||
|
||
$pinc = $_POST['InsertFormulaire'][$k];
|
||
$block = $_POST["block".$pinc];
|
||
|
||
if($pemployeeId != "0") {
|
||
if(isResultatFicheExist($pfiche_id, $block, $pemployeeId)) {
|
||
echo "Une Evaluation exist deja";
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
$idResultatFiche = getIdResultatFicheEvaluationCount();
|
||
|
||
for ($y = 0; $y < sizeof($_POST['InsertFormulaire']); $y++) {
|
||
|
||
$dinc = $_POST['InsertFormulaire'][$y];
|
||
$idLigneFiche = $_POST['idLigneFiche'][$y];
|
||
|
||
$reponse = $_POST["reponse".$dinc];
|
||
$block = $_POST["block".$dinc];
|
||
$tablereponses = $_POST["tablereponse".$dinc];
|
||
$comment = $_POST["comment".$dinc];
|
||
|
||
$dateannuel = $_POST["dateannuel".$dinc];
|
||
//$employeeId = $_POST["employee".$dinc];
|
||
$aoption = $_POST["aoption".$dinc];
|
||
|
||
$multireponses = $_POST["multireponse".$inc];
|
||
|
||
|
||
$roptions = $_POST["roption".$inc];
|
||
if($roptions != '') {
|
||
$obs = "[";
|
||
$icount = 0;
|
||
foreach ($roptions as $roption) {
|
||
$icount++;
|
||
if($icount == count($roptions))
|
||
$obs = $obs.$roption;
|
||
else
|
||
$obs = $obs.$roption.",";
|
||
}
|
||
$comment = $obs."]";
|
||
}
|
||
|
||
|
||
$finalreponse = $reponse;
|
||
if($block != '')
|
||
$finalreponse = $block;
|
||
if($tablereponses != '') {
|
||
$finalreponse = "[";
|
||
$icount = 0;
|
||
foreach ($tablereponses as $tablereponse) {
|
||
$icount++;
|
||
if($icount == count($tablereponses))
|
||
$finalreponse = $finalreponse.$tablereponse;
|
||
else
|
||
$finalreponse = $finalreponse.$tablereponse.",";
|
||
}
|
||
$finalreponse = $finalreponse."]";
|
||
}
|
||
if($multireponses != '') {
|
||
$mr = "[";
|
||
$icount = 0;
|
||
foreach ($multireponses as $multireponse) {
|
||
$icount++;
|
||
if($icount == count($multireponses))
|
||
$mr = $mr.$multireponse;
|
||
else
|
||
$mr = $mr.$multireponse.";";
|
||
}
|
||
$finalreponse = $mr."]";
|
||
}
|
||
|
||
insertResultatLigneFicheEvaluation($idLigneFiche, $idResultatFiche, $pemployeeId, $finalreponse, $comment);
|
||
|
||
if($pannuel && $aoption != "")
|
||
insertResultatLigneFicheEvaluationAnnuel($idLigneFiche, $idResultatFiche, $dateannuel, $aoption);
|
||
}
|
||
increaseIdResultatFicheEvaluationCount();
|
||
}
|
||
|
||
if(isset($_POST['save'])) {
|
||
|
||
if(isset($_GET['fiche'])) {
|
||
$fiche_id = $_GET['fiche'];
|
||
|
||
$ficheEvaluation = getFicheEvaluation($fiche_id);
|
||
$annuel = $ficheEvaluation["annuel"];
|
||
|
||
if(sizeof($lignesFicheEvaluation) > 0) {
|
||
|
||
$groupId = $_POST["groupe"];
|
||
if($groupId != "" && $groupId != "0") {
|
||
$gusers = getGroupUsers($groupId);
|
||
//print_r($gusers);
|
||
foreach ($gusers as $guser) {
|
||
addFicheEvaluation($annuel, $fiche_id, $guser);
|
||
}
|
||
} else {
|
||
echo 'users';
|
||
$semployees = $_POST["semployees"];
|
||
foreach ($semployees as $semployee) {
|
||
addFicheEvaluation($annuel, $fiche_id, $semployee);
|
||
evaluationTrack($fiche_id, $_SESSION["glpiname"]);
|
||
}
|
||
}
|
||
|
||
if($annuel){
|
||
$root = $_SERVER['DOCUMENT_ROOT'].$CFG_GLPI["root_doc"]."/temp_sophal/";
|
||
cache_all_clear($root);
|
||
}
|
||
}
|
||
}
|
||
|
||
Html::redirect("fiche.evaluation.list.php");
|
||
}
|
||
|
||
|
||
$users = getSubUsersfe($_SESSION["glpiID"]);
|
||
$groupes = getGroups();
|
||
|
||
|
||
$objectifs = [];
|
||
|
||
foreach($users as $user){
|
||
$objectif = getPreviousObjectifs($user["id"]);
|
||
array_push($objectifs ,[$user["id"],$objectif]);
|
||
}
|
||
|
||
|
||
|
||
|
||
$annuel = $ficheEvaluation["annuel"];
|
||
|
||
|
||
function visibleMenus($rowP) {
|
||
|
||
return $rowP['ordre'] == 1 || $rowP['ordre'] == 3 || $rowP['ordre'] == 10 || $rowP['ordre'] == 11;
|
||
}
|
||
|
||
|
||
echo '<div>
|
||
<form method="post" enctype="multipart/form-data" accept-charset = "character_set">
|
||
<input type="hidden" id="_glpi_csrf_token" name="_glpi_csrf_token" value="'.Session::getNewCSRFToken().'">';
|
||
|
||
if($annuel) {
|
||
echo '<div id="mymenu" class="c_menu center">
|
||
<ul id="menu" class="fullmenu submenu">';
|
||
foreach ($blocks as $row) {
|
||
$q = $row[0]['question'];
|
||
$choices = explode('. ', $q);
|
||
if(count($choices) > 1)
|
||
$q = $choices[1];
|
||
if(visibleMenus($row[0]))
|
||
echo '<li id="'.translate($q).'"><a href="#" class="itemP" onclick="mytoggle(this)";>'.translate($q).'</a></li>';
|
||
if($row[0]['ordre'] == 14)
|
||
echo '<li id="'.translate($q).'"><a href="#" id="SelectedYear" class="itemP" onclick="mytoggle(this)";>Objectifs '.(intval(date("Y") + 1)).'</a></li>';
|
||
}
|
||
echo '</ul>
|
||
</div>';
|
||
|
||
echo'<script>
|
||
var setbackground=$("#c_menu").css("background-color");
|
||
$("#mymenu").css("background-color", setbackground);
|
||
</script>';
|
||
}
|
||
|
||
$blockssize = 0;
|
||
|
||
$inc=1;
|
||
echo "<div class='center'>
|
||
<div class='eight'><h1>".translate(str_replace('\'','"',$ficheEvaluation["nom_fiche_evaluation"]))."</h1></div>
|
||
</div>
|
||
|
||
<div class='center'>";
|
||
|
||
if($annuel) {
|
||
echo "<label style='height:60px;font-weight:bold;color:#fff;' class='set_font'> ".translate('Employé(e)')." </label>";
|
||
echo "<select id='selctemployee' style='position:relative;left:0px;width:150px;height:25px;' name='employee".$inc."' >
|
||
<option value='0'></option>";
|
||
foreach ($users as $user) {
|
||
echo "<option value='".$user['id']."'>".$user['fullname']."</option>";
|
||
}
|
||
echo "</select>
|
||
<button name='addemployee' id='addemployee' class='vsubmit'><i class='fas fa-plus'></i> ".translate('Ajouter')."</button>
|
||
<ul id='myList'></ul>";
|
||
|
||
echo "<br><label hidden style='margin-right:24px;height:60px;font-weight:bold;color:#fff;' class='set_font'> Groupe </label>";
|
||
echo "<select hidden id='selctgroupe' style='margin-right:69px;position:relative;left:0px;width:150px;height:25px;' name='groupe'>
|
||
<option value='0'></option>";
|
||
foreach ($groupes as $groupe) {
|
||
echo "<option value='".$groupe['id']."'>".$groupe['name']."</option>";
|
||
}
|
||
echo "</select>";
|
||
}
|
||
|
||
|
||
|
||
|
||
echo "<div id='respo'><table style='background-color: rgba(255, 255, 255, 0.53);' border='0' id='firsttable' class='tab_cadrehov js-dynamitable set_font' >
|
||
<tbody>";
|
||
if(isset($blocks)){
|
||
if(sizeof($blocks) > 0) {
|
||
$blockssize = count($blocks);
|
||
$blocks_count = 0;
|
||
foreach ($blocks as $row) {
|
||
$isTable = isTable($row[1][0]['reponses']);
|
||
if(($annuel && ($blocks_count == 3 || $blocks_count == $blockssize-2)) || $isTable)
|
||
echo "</table><table style='background-color: rgba(255, 255, 255, 0.53);' border='0' id='first".$row[0]['id_ligne_fiche_evaluation']."' class='tab_cadrehov js-dynamitable set_font'>";
|
||
|
||
if($annuel && $blocks_count == $blockssize-1)
|
||
echo "</table><table style='background-color: rgba(255, 255, 255, 0.53);' id='objectivetable' border='0' class='tab_cadrehov js-dynamitable set_font'>";
|
||
|
||
|
||
result($row, $blocks_count);
|
||
$blocks_count = $blocks_count+1;
|
||
if($isTable)
|
||
echo "</table><table style='background-color: rgba(255, 255, 255, 0.53);' border='0' class='tab_cadrehov js-dynamitable set_font'>";
|
||
}
|
||
}
|
||
}
|
||
echo' </tbody>
|
||
</table>
|
||
</div>
|
||
</div>';
|
||
|
||
|
||
echo'<div class="center"><br><br>
|
||
<button class="vsubmit" type="submit" name="save" value="save" onclick="return checksubmit();">'.translate('Enregistrer').'</button>
|
||
<a class="cancelLink" href="javascript:history.back()" type="reset">'.translate('Annuler').'</a>
|
||
</div>';
|
||
|
||
echo'</form></div>';
|
||
Html::footer();
|
||
|
||
|
||
|
||
function buildEnteteReponse($ebrequired, $ebreponses) {
|
||
|
||
if($ebreponses == "")
|
||
return "";
|
||
|
||
global $inc;
|
||
|
||
$mainreponseString = "";
|
||
|
||
$choices = explode(';', $ebreponses);
|
||
if(count($choices) > 1) {
|
||
$mainreponseString = "<td class='header'><select id='selcteanne' onchange='anneeChanged(this)' style='position:relative;left:0px;width:150px;height:25px;' name='block".$inc."' ".$ebrequired.">
|
||
<option value='0' selected></option>";
|
||
foreach ($choices as $rowch) {
|
||
$mainreponseString = $mainreponseString."<option value='".$rowch."'>".$rowch."</option>";
|
||
}
|
||
|
||
$mainreponseString = $mainreponseString. "<option value='2024'>2024</option>";
|
||
$mainreponseString = $mainreponseString. "<option value='2025' selected>2025</option>";
|
||
$mainreponseString = $mainreponseString."</select></td>";
|
||
}
|
||
|
||
return $mainreponseString;
|
||
}
|
||
|
||
function buildEnteteQuestion($ebquestion) {
|
||
|
||
$questionString = "<strong style='font-size: 14px;'>".translate($ebquestion)."</strong>";
|
||
$astrings = explode(':', $ebquestion, 2);
|
||
if(count($astrings) > 1 && count(explode(':', $ebquestion)) < 4)
|
||
$questionString = "<div class='tooltip'><strong style='font-size: 14px;'>".translate($astrings[0]).":</strong><span style='width:400px;' class='tooltiptext'>".translate($astrings[1])."</span></div>";
|
||
|
||
return $questionString;
|
||
}
|
||
|
||
function buildEnteteComment($ebrequired, $iscomment) {
|
||
|
||
if($iscomment != 1)
|
||
return "";
|
||
|
||
global $inc;
|
||
|
||
return "<textarea style='position:relative;height:50px;width:350px;' name='comment".$inc."' ".$ebrequired."></textarea>";
|
||
}
|
||
|
||
|
||
function buildroption() {
|
||
|
||
global $inc;
|
||
global $annueloptions;
|
||
|
||
$optionString = $optionString."<select class='flex-select' name='roption".$inc."[]'>
|
||
<option value='0' selected></option>";
|
||
foreach ($annueloptions as $aoption) {
|
||
$optionString = $optionString."<option value='".$aoption."' >".translate($aoption)."</option>";
|
||
}
|
||
return $optionString."</select>";
|
||
}
|
||
|
||
|
||
function isSpecialAnnuelBlock($blockscountp) {
|
||
|
||
global $annuel;
|
||
global $blockssize;
|
||
|
||
return $annuel && ($blockscountp == 1 || $blockscountp == $blockssize-1);
|
||
}
|
||
|
||
function buildLigneReponse($lbcount, $lbrequired, $lbreponses, $lbquestion) {
|
||
|
||
global $inc;
|
||
global $annuel;
|
||
global $annueloptions;
|
||
|
||
$reponseWidth = 200;
|
||
if(isSpecialAnnuelBlock($lbcount))
|
||
$reponseWidth = 400;
|
||
|
||
$reponseString = "<textarea class='reponse-textarea' style='width:".$reponseWidth."px;' name='reponse".$inc."' ".$lbrequired."></textarea>";
|
||
|
||
if($lbreponses == 'hidden')
|
||
$reponseString = "";
|
||
|
||
if($lbreponses == 'date')
|
||
$reponseString = "<input type='date' style='position:relative;left:0px;height:25px;width:150px;' name='reponse".$inc."' ".$lbrequired.">";
|
||
|
||
$choices = explode(';', $lbreponses);
|
||
if(count($choices) > 1) {
|
||
$selectDisabled = "";
|
||
if($annuel && (strpos($lbquestion, '3.') !== false))
|
||
$selectDisabled = "disabled";
|
||
if($annuel && (strpos($lbquestion, '4.') !== false))
|
||
$selectDisabled = "disabled";
|
||
|
||
$reponseString = "<select style='position:relative;left:0px;width:150px;height:25px;' name='block".$inc."' ".$lbrequired." ".$selectDisabled.">
|
||
<option value='0' selected></option>";
|
||
foreach ($choices as $rowch) {
|
||
$reponseString = $reponseString."<option value='".$rowch."'>".translate($rowch)."</option>";
|
||
}
|
||
$reponseString = $reponseString."</select>";
|
||
}
|
||
|
||
if( isMultiligne($lbreponses) ) {
|
||
|
||
$reponseString = "<div class='flex-container'><textarea class='flex-textarea' name='multireponse".$inc."[]' ".$lbrequired."></textarea>".buildroption()."</div>";
|
||
$nbrlignes = substr($lbreponses, 1, strlen($lbreponses)-2);
|
||
for($h=1; $h < $nbrlignes; $h++) {
|
||
$reponseString = $reponseString."<div class='flex-container'><textarea class='flex-textarea' name='multireponse".$inc."[]' ".$lbrequired."></textarea>".buildroption()."</div>";
|
||
}
|
||
$reponseString = $reponseString."<button name='addligneMulti' class='vsubmit' onclick='return addLigneMulti(this);'><i class='fas fa-plus'></i> ".translate('Ajouter')."</button>";
|
||
}
|
||
|
||
if( isTable($lbreponses) ) {
|
||
|
||
$treponse = substr($lbreponses, 1, strlen($lbreponses)-2);
|
||
$astrings = explode(',', $treponse);
|
||
if(count($astrings) > 1) {
|
||
$percent = 100/count($astrings);
|
||
$reponseString = "<label style='position:relative;height:25px;width:".$percent."%;'>".translate($astrings[0])."</label>";
|
||
$aleft = 0;
|
||
for($i=1; $i < count($astrings); $i++) {
|
||
$aleft = $aleft+$percent-7;
|
||
$reponseString = $reponseString."<label style='position:relative;left:".$aleft."%;height:25px;width:".$percent."%;'>".translate($astrings[$i])."</label>";
|
||
}
|
||
} else {
|
||
$percent = (100/$treponse)-7;
|
||
$reponseString = "<textarea style='position:relative;height:25px;width:".$percent."%;' name='tablereponse".$inc."[]'></textarea>";
|
||
$aleft = 0;
|
||
for($i=1; $i < $treponse; $i++) {
|
||
$aleft = $aleft+60;
|
||
$reponseString = $reponseString."<textarea style='position:relative;left:".$aleft."px;height:25px;width:".$percent."%;' name='tablereponse".$inc."[]'></textarea>";
|
||
}
|
||
}
|
||
}
|
||
|
||
return $reponseString;
|
||
}
|
||
|
||
function buildLigneQuestion($question, $img_url) {
|
||
|
||
global $inc;
|
||
|
||
$questionString = "<label style='height:60px;font-weight:bold' name='question".$inc."'>".translate($question)."</label>";
|
||
$astrings = explode(':', $question, 2);
|
||
if(count($astrings) > 1 && count(explode(':', $question)) < 4)
|
||
$questionString = "<label style='height:50px;font-weight:bold' name='question".$inc."'>".$astrings[0].":</label><label>"."<br><br>".$astrings[1]."</label>";
|
||
|
||
if($img_url != '')
|
||
$questionString = $questionString."<img src='".$img_url."'>";
|
||
|
||
return $questionString;
|
||
}
|
||
|
||
|
||
function buildLigneComment($lbcount, $lbrequired, $iscomment) {
|
||
|
||
if($iscomment != 1)
|
||
return "";
|
||
|
||
global $inc;
|
||
global $annuel;
|
||
global $annueloptions;
|
||
global $blockssize;
|
||
|
||
$commentHeight = 50;
|
||
if($annuel)
|
||
$commentHeight = 25;
|
||
|
||
$lbdisabled = "";
|
||
/*if($annuel && $lbcount == 1)
|
||
$lbdisabled = "disabled";*/
|
||
|
||
$commentWidth = 300;
|
||
if(isSpecialAnnuelBlock($lbcount))
|
||
$commentWidth = 200;
|
||
|
||
if($annuel && $lbcount != $blockssize-1)
|
||
$commentString = "<div><textarea style='position:relative;height:".$commentHeight."px;width:".$commentWidth."px;' name='comment".$inc."' ".$lbrequired." ".$lbdisabled."></textarea></div>";
|
||
|
||
if($annuel) {
|
||
if(isSpecialAnnuelBlock($lbcount))
|
||
$commentString = $commentString."<div><input class='flex-input' type='date' name='dateannuel".$inc."' ".$lbdisabled."></div>";
|
||
|
||
if($lbcount != $blockssize-1) {
|
||
|
||
$commentString = $commentString."<div><select class='flex-select' name='aoption".$inc."'>
|
||
<option value='0' selected></option>";
|
||
foreach ($annueloptions as $aoption) {
|
||
$commentString = $commentString."<option value='".$aoption."'>".translate($aoption)."</option>";
|
||
}
|
||
$commentString = $commentString."</select></div>";
|
||
}
|
||
}
|
||
|
||
return "<div class='flex-container'>".$commentString."</div>";
|
||
}
|
||
|
||
// Affichage d'un block entier (entete + lignes) = plusieurs tr
|
||
function result($row_data, $blockscount){
|
||
|
||
global $inc;
|
||
global $annuel;
|
||
global $blockssize;
|
||
|
||
$required = '';
|
||
if(!$annuel && $blockscount < 7)
|
||
$required = 'required';
|
||
|
||
/* Affichage entete block */
|
||
|
||
$responses = $row_data[0]['reponses'];
|
||
$mainreponseHTML = buildEnteteReponse($required, $responses);
|
||
$mainquestionHTML = buildEnteteQuestion($row_data[0]['question']);
|
||
$maincommentHTML = buildEnteteComment($required, $row_data[0]['comment']);
|
||
|
||
$mainclospan = 3;
|
||
if($responses != '' && count(explode(';', $responses)) > 1)
|
||
$mainclospan = $mainclospan-1;
|
||
if(isSpecialAnnuelBlock($blockscount))
|
||
$mainclospan = 5;
|
||
|
||
$widthMax = "";
|
||
if($annuel)
|
||
$widthMax = "style='width:60px;'";
|
||
|
||
echo " <tr class='header' style='height:50px; '>
|
||
<input type='hidden' id='InsertFormulaire' name='InsertFormulaire[]' value='".$inc."'>
|
||
<input type='hidden' id='idLigneFiche' name='idLigneFiche[]' value='".$row_data[0]['id_ligne_fiche_evaluation']."'>
|
||
<td ".$widthMax." colspan='".$mainclospan."'>".$mainquestionHTML."</td>
|
||
".$mainreponseHTML;
|
||
|
||
if(!($annuel && $blockscount == 1))
|
||
echo "<td>".$maincommentHTML."<td>";
|
||
|
||
echo "</tr>";
|
||
$inc=$inc+1;
|
||
|
||
/* End Affichage entete block */
|
||
|
||
if(isSpecialAnnuelBlock($blockscount)) {
|
||
if($blockscount == 1)
|
||
echo "<tr style='height:30px;'><td></td><td></td><td style='height:30px;'><div class='flex-container' style='line-height: 30px;'>".translate("J’étais censé réaliser ce qui suit comme objectif")."</div></td><td style='height:30px;'>
|
||
<div class='flex-container' style='line-height: 30px;'><div style='width:250px;height:30px;'>".translate("J’ai réalisé ce qui suit")."</div><div style='height:30px;'>".translate("Date de réalisation")."</div></div></td><td></td></tr>";
|
||
if($blockscount == $blockssize-1)
|
||
echo "<tr style='height:30px;'><td></td><td></td><td style='height:30px;'><div class='flex-container' style='line-height: 30px;'>".translate("Je serai censé de réaliser ce qui suit comme objectif")."</div></td><td style='height:30px;'>
|
||
<div class='flex-container' style='line-height: 30px;'><div style='width:30px;height:30px;'></div><div style='height:30px;'>".translate("Date de réalisation")."</div></div></td><td></td></tr>";
|
||
}
|
||
|
||
|
||
/* Affichage lignes block */
|
||
|
||
$savedInc = -1;
|
||
$linges_blocks = $row_data[1];
|
||
foreach ($linges_blocks as $row) {
|
||
|
||
$isTable = isTable($row['reponses']);
|
||
|
||
$reponseRequired = $required;
|
||
if(isSpecialAnnuelBlock($blockscount) || $isTable) {
|
||
if($savedInc == -1) $savedInc = $inc+2;
|
||
if($inc < $savedInc) {
|
||
if(!(isSpecialAnnuelBlock($blockscount) && $blockscount > 3))
|
||
$reponseRequired = "required";
|
||
}
|
||
}
|
||
|
||
$reponseHTML = buildLigneReponse($blockscount, $reponseRequired, $row['reponses'], $row_data[0]['question']);
|
||
$questionHTML = buildLigneQuestion($row['question'], $row['img_url']);
|
||
if(isSpecialAnnuelBlock($blockscount) || $isTable)
|
||
$questionHTML = "";
|
||
$commentHTML = buildLigneComment($blockscount, $required, $row['comment']);
|
||
|
||
|
||
$qwidth = 420;
|
||
$hidetr="";
|
||
if(isSpecialAnnuelBlock($blockscount) || $isTable) {
|
||
$qwidth = 40;
|
||
if($inc > $savedInc)
|
||
$hidetr="hidden";
|
||
}
|
||
echo " <tr ".$hidetr." ><td><input type='hidden' id='InsertFormulaire' name='InsertFormulaire[]' value='".$inc."'></td>
|
||
<input type='hidden' id='idLigneFiche' name='idLigneFiche[]' value='".$row['id_ligne_fiche_evaluation']."'>
|
||
<td style='max-width:".$qwidth."px;'>".$questionHTML."</td>";
|
||
if($reponseHTML != "")
|
||
echo "<td>".$reponseHTML."</td>";
|
||
echo "<td>".$commentHTML."</td>
|
||
<td></td></tr>";
|
||
|
||
$inc=$inc+1;
|
||
}
|
||
/* End Affichage lignes block */
|
||
|
||
if($annuel && $blockscount == 1)
|
||
echo "<tr><td></td><td></td><td></td><td> <button name='add' class='vsubmit' onclick='return addLigne(\"firsttable\");'><i class='fas fa-plus'></i> ".translate("Ajouter")."</button></td></tr>";
|
||
if($annuel && $blockscount == $blockssize-1)
|
||
echo "<tr><td></td><td></td><td></td><td> <button name='add' class='vsubmit' onclick='return addLigne(\"objectivetable\");'><i class='fas fa-plus'></i> ".translate("Ajouter")."</button></td></tr>";
|
||
|
||
if($isTable)
|
||
echo "<tr><td></td><td></td><td> <button name='addtable' class='vsubmit' onclick='return addLigne(\"first".$row_data[0]['id_ligne_fiche_evaluation']."\");'><i class='fas fa-plus'></i> ".translate("Ajouter")."</button></td></tr>";
|
||
}
|
||
|
||
?>
|
||
|
||
|
||
<style type="text/css">
|
||
input[type="date"]::-webkit-inner-spin-button, input[type="date"]::-webkit-clear-button {
|
||
color: #fff;
|
||
position: relative;
|
||
}
|
||
input[type="date"]::-webkit-datetime-edit {
|
||
color: #fff;
|
||
position: relative;
|
||
}
|
||
input[type="date"]::-webkit-datetime-edit-year-field {
|
||
position: absolute !important;
|
||
//border-left:1px solid #8c8c8c;
|
||
//padding: 2px;
|
||
color:#000;
|
||
left: 46px;
|
||
}
|
||
|
||
input[type="date"]::-webkit-datetime-edit-month-field {
|
||
position: absolute !important;
|
||
//border-left:1px solid #8c8c8c;
|
||
//padding: 2px;
|
||
color:#000;
|
||
left: 26px;
|
||
}
|
||
|
||
input[type="date"]::-webkit-datetime-edit-day-field{
|
||
position: absolute !important;
|
||
//padding: 2px;
|
||
color:#000;
|
||
left: 4px;
|
||
}
|
||
|
||
/* Tooltip container */
|
||
.tooltip {
|
||
position: relative;
|
||
display: inline-block;
|
||
}
|
||
|
||
/* Tooltip text */
|
||
.tooltip .tooltiptext {
|
||
visibility: hidden;
|
||
width: 120px;
|
||
background-color: #555;
|
||
color: #fff;
|
||
text-align: center;
|
||
padding: 5px 0;
|
||
border-radius: 6px;
|
||
|
||
/* Position the tooltip text */
|
||
position: absolute;
|
||
z-index: 1;
|
||
bottom: 125%;
|
||
left: 50%;
|
||
margin-left: -60px;
|
||
|
||
/* Fade in tooltip */
|
||
opacity: 0;
|
||
transition: opacity 0.3s;
|
||
}
|
||
|
||
/* Tooltip arrow */
|
||
.tooltip .tooltiptext::after {
|
||
content: "";
|
||
position: absolute;
|
||
top: 100%;
|
||
left: 50%;
|
||
margin-left: -5px;
|
||
border-width: 5px;
|
||
border-style: solid;
|
||
border-color: #555 transparent transparent transparent;
|
||
}
|
||
|
||
/* Show the tooltip text when you mouse over the tooltip container */
|
||
.tooltip:hover .tooltiptext {
|
||
visibility: visible;
|
||
opacity: 1;
|
||
}
|
||
|
||
.header {
|
||
/*color: #ffffff;*/
|
||
/*background: #6c7ae0;*/
|
||
text-align: center;
|
||
/* background: #1A7AB2;*/
|
||
color: #4a4a4a;
|
||
background: #F2F2F2;
|
||
}
|
||
|
||
|
||
tr:hover.header{
|
||
/*background-color:#6c7ae0;*/
|
||
/*background-color:#1A7AB2;*/
|
||
}
|
||
|
||
.set_font {
|
||
|
||
font-family: 'Poppins', sans-serif;
|
||
}
|
||
|
||
#myList > li {
|
||
display: inline-block;
|
||
margin-left: 10px;
|
||
zoom:1;
|
||
*display:inline;
|
||
}
|
||
|
||
.flex-container {
|
||
display: flex;
|
||
flex-direction: row;
|
||
line-height: 50px;
|
||
padding-top: 12px;
|
||
}
|
||
.flex-input{
|
||
position:relative;left:30px;height:25px;width:150px;top:-10px;
|
||
}
|
||
|
||
.flex-select{
|
||
position:relative;
|
||
left:50px;
|
||
width:180px;
|
||
height:25px;
|
||
top:-10px;
|
||
}
|
||
.flex-textarea
|
||
{
|
||
position:relative;
|
||
left:0px;
|
||
height:25px;
|
||
width:200px;
|
||
top: -10px;
|
||
}
|
||
|
||
.reponse-textarea{
|
||
position:relative;
|
||
left:0px;
|
||
height:25px;
|
||
width:200px;
|
||
}
|
||
|
||
|
||
.vsubmit {
|
||
color: #fff;
|
||
background-color: #129948;
|
||
}
|
||
|
||
body {
|
||
background: url(/fiche_eval_upload/back.svg) 100% 100% / cover;
|
||
|
||
}
|
||
#mymenu {
|
||
/*font-family: 'Poppins', sans-serif;*/
|
||
/*margin-left:35px; */
|
||
/*margin-right:35px;"*/
|
||
}
|
||
.tab_cadrehov {
|
||
font-size: 12px;
|
||
}
|
||
|
||
.eight h1 {
|
||
|
||
text-transform: uppercase;
|
||
font-size: 26px;
|
||
letter-spacing: 1px;
|
||
grid-gap: 22px;
|
||
color: #fff;
|
||
}
|
||
|
||
.eight h1:after, .eight h1:before {
|
||
content: " ";
|
||
display: block;
|
||
border-bottom: 2px solid #ccc;
|
||
background-color: #f8f8f8;
|
||
}
|
||
|
||
.tab_cadrehov th, .tab_cadrehov tr:hover{
|
||
background-color: rgba(255, 255, 255, 0.53);
|
||
}
|
||
|
||
@media only screen and (max-width: 600px) {
|
||
.flex-container {
|
||
display: flex;
|
||
flex-direction: column;
|
||
}
|
||
|
||
.flex-container > div {
|
||
margin: 5px 5px;
|
||
text-align: left;
|
||
}
|
||
.flex-input{
|
||
left : 0px;
|
||
width: 90%;
|
||
}
|
||
.flex-select{
|
||
left : 0px;
|
||
|
||
}
|
||
.flex-textarea
|
||
{
|
||
left : 0px;
|
||
margin-bottom: 15px;
|
||
}
|
||
#respo {
|
||
overflow-x:auto;
|
||
}
|
||
.header {
|
||
text-align: left;
|
||
}
|
||
#firsttable {
|
||
margin-top: 15px;
|
||
}
|
||
|
||
#firsttable tbody td {
|
||
display : block;
|
||
border : 0px ;
|
||
}
|
||
#firsttable tbody tr {
|
||
border-bottom: 1px solid #ADADAD;
|
||
border-top: 1px solid #ADADAD;
|
||
}
|
||
|
||
#firsttable tbody textarea{
|
||
width: 90%;
|
||
}
|
||
|
||
#firsttable tbody select{
|
||
width: 90%;
|
||
}
|
||
|
||
#firsttable tbody input{
|
||
width: 90%;
|
||
}
|
||
|
||
|
||
|
||
}
|
||
</style>
|
||
|
||
<script>
|
||
|
||
var objectifs = <?php echo json_encode($objectifs); ?>;
|
||
console.log("objectifs",objectifs);
|
||
|
||
$(document).ready(function(){
|
||
|
||
var loginUserId = <?php echo json_encode(Session::getLoginUserID()); ?>;
|
||
|
||
var htmlhead = '<ul>';
|
||
if(loginUserId)
|
||
htmlhead = htmlhead+'<li class="breadcrumb_item"><a href="central.php" title="Accueil">Accueil</a></li>'+
|
||
'<li class="breadcrumb_item"><a href="" title="">Ressources Humaines</a></li>'+
|
||
'<li class="breadcrumb_item"><a href="fiche.evaluation.list.php" class="here" title="Evaluations"><i class="far fa-sticky-note"></i> Evaluations</a></li>';
|
||
else
|
||
htmlhead = htmlhead+'<li class="breadcrumb_item"><a href="" class="here" title="Evaluations"><i class="far fa-sticky-note"></i> Evaluations</a></li>';
|
||
htmlhead = htmlhead+'</ul>';
|
||
|
||
$("#c_ssmenu2").html(htmlhead);
|
||
});
|
||
/*
|
||
$('input[type="date"]').change(function(){
|
||
this.value = this.value.split("-").reverse().join("-");
|
||
});*/
|
||
|
||
function checksubmit() {
|
||
|
||
var annuel = <?php echo json_encode($annuel); ?>;
|
||
if(annuel) {
|
||
/*
|
||
if($('#selctemployee').find(":selected").val() == 0) {
|
||
alert('Veuillez choisir un employé');
|
||
return false;
|
||
}*/
|
||
if($('#myList li').length == 0 && $( "#selctgroupe option:selected" ).val() == "0") {
|
||
alert('Veuillez Ajouter un employé');
|
||
return false;
|
||
}
|
||
if($('#selcteanne').find(":selected").val() == 0) {
|
||
alert('Veuillez choisir une année');
|
||
return false;
|
||
}
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
function addLigne(table) {
|
||
|
||
$('#'+table+' tr').each(function(index, tr) {
|
||
if($(tr).is(":hidden")) {
|
||
$(tr).show();
|
||
return false;
|
||
}
|
||
});
|
||
|
||
return false;
|
||
}
|
||
|
||
$("#addemployee").on("click",function(e){
|
||
e.preventDefault();
|
||
addEmployee();
|
||
var idcandidat = $( "#selctemployee option:selected" ).val()
|
||
|
||
for (let i = 0; i < objectifs.length + 0; i++) {
|
||
const users = objectifs[i];
|
||
if(users[0] == idcandidat){
|
||
for (let j = 0; j < users[1].length; j++) {
|
||
const elements = users[j];
|
||
console.log(elements);
|
||
for (let s = 0; s < elements.length; s++) {
|
||
const element = elements[s];
|
||
var ii = s +4;
|
||
$("#firsttable tbody tr:nth-child("+ii+") > td:nth-child(4) textarea").val(element["reponse"]);
|
||
$("#firsttable tbody tr:nth-child("+ii+")").show();
|
||
|
||
}
|
||
}
|
||
}
|
||
|
||
}
|
||
});
|
||
|
||
|
||
function addEmployee() {
|
||
|
||
if($( "#selctemployee option:selected" ).val() == "0")
|
||
return false;
|
||
|
||
let list = document.getElementById("myList");
|
||
let li = document.createElement("li");
|
||
|
||
let input = document.createElement("input");
|
||
input.setAttribute("type", "hidden");
|
||
input.setAttribute('name','semployees[]');
|
||
input.value = $( "#selctemployee option:selected" ).val();
|
||
li.innerText = $( "#selctemployee option:selected" ).text();
|
||
li.appendChild(input);
|
||
|
||
let a = document.createElement("a");
|
||
a.innerText = " X";
|
||
a.onclick = function () {
|
||
this.parentElement.parentElement.removeChild(this.parentElement);
|
||
};
|
||
li.appendChild(a);
|
||
|
||
list.appendChild(li);
|
||
|
||
return false;
|
||
}
|
||
|
||
$(".csubmit").on("click",function loadObjectifs(e){
|
||
e.preventDefault();
|
||
|
||
var idcandidat = $( "#selctemployee option:selected" ).val()
|
||
|
||
for (let i = 0; i < objectifs.length + 0; i++) {
|
||
const users = objectifs[i];
|
||
if(users[0] == idcandidat){
|
||
for (let j = 0; j < users[1].length; j++) {
|
||
const elements = users[j];
|
||
console.log(elements);
|
||
for (let s = 0; s < elements.length; s++) {
|
||
const element = elements[s];
|
||
var ii = s +4;
|
||
$("#firsttable tbody tr:nth-child("+ii+") > td:nth-child(4) textarea").val(element["reponse"]);
|
||
$("#firsttable tbody tr:nth-child("+ii+")").show();
|
||
|
||
}
|
||
}
|
||
}
|
||
|
||
}
|
||
})
|
||
|
||
var annueloptions = <?php echo json_encode($annueloptions); ?>;
|
||
|
||
function addLigneMulti(el) {
|
||
|
||
var name = (el.parentElement.getElementsByTagName('textarea')[0]).name;
|
||
var sname = (el.parentElement.getElementsByTagName('select')[0]).name;
|
||
|
||
let textarea = document.createElement("textarea");
|
||
/*textarea.setAttribute('style','position:relative;left:0px;height:25px;width:200px;');*/
|
||
textarea.setAttribute('class','flex-textarea');
|
||
textarea.setAttribute('name', name);
|
||
/*el.parentElement.insertBefore(textarea, el.parentElement.lastChild);*/
|
||
|
||
|
||
|
||
let select = document.createElement("select");
|
||
/*select.setAttribute('style','position:relative;left:50px;width:180px;height:25px;top:-10px;');*/
|
||
select.setAttribute('class','flex-select');
|
||
select.setAttribute('name', sname);
|
||
/*el.parentElement.insertBefore(select, el.parentElement.lastChild);*/
|
||
var option = document.createElement("option");
|
||
option.value = 0;
|
||
option.text = "";
|
||
select.appendChild(option);
|
||
for (var i = 0; i < annueloptions.length; i++) {
|
||
var option = document.createElement("option");
|
||
option.value = annueloptions[i];
|
||
option.text = annueloptions[i];
|
||
select.appendChild(option);
|
||
}
|
||
|
||
|
||
|
||
let divflex = document.createElement("div");
|
||
divflex.setAttribute('class','flex-container');
|
||
el.parentElement.insertBefore(divflex, el.parentElement.lastChild);
|
||
divflex.appendChild(textarea);
|
||
divflex.appendChild(select);
|
||
|
||
/*el.parentElement.insertBefore(document.createElement("br"), el.parentElement.lastChild);*/
|
||
|
||
return false;
|
||
}
|
||
|
||
function mytoggle(e) {
|
||
|
||
var eindex = -1;
|
||
var submenucount = 0;
|
||
$('.submenu li').each(function(index, li) {
|
||
if(li.id === e.innerHTML){
|
||
eindex = index;
|
||
}
|
||
if(eindex === -1 && li.id.includes("Objectifs"))
|
||
eindex = index;
|
||
submenucount++;
|
||
});
|
||
if(eindex > 2)
|
||
eindex += 1;
|
||
|
||
if(eindex == submenucount)
|
||
eindex += 2;
|
||
|
||
selectTable(eindex);
|
||
}
|
||
|
||
function anneeChanged(e) {
|
||
if(e.value != '')
|
||
atag = document.getElementById("SelectedYear");
|
||
result = parseInt(e.value);
|
||
|
||
result = result > 1 ? (result + 1) : "";
|
||
console.log(atag,e.value,result);
|
||
if ('textContent' in atag) {
|
||
atag.textContent = "Objectifs " + result;
|
||
} else {
|
||
atag.innerText = "Objectifs " + result;
|
||
}
|
||
}
|
||
|
||
selectTable(0);
|
||
|
||
function selectTable(indexp) {
|
||
|
||
var tabindex = 0;
|
||
$('#respo').find('table').each(function() {
|
||
(this).style.display = 'none';
|
||
if(tabindex == indexp) {
|
||
(this).style.display = '';
|
||
}
|
||
tabindex += 1;
|
||
});
|
||
}
|
||
|
||
</script>
|