function affichage($tab_new_values, $session, $DEBUG = FALSE) { $PHP_SELF = $_SERVER['PHP_SELF']; if ($session == "") { $URL = "{$PHP_SELF}"; } else { $URL = "{$PHP_SELF}?session={$session}"; } /**************************************/ // affichage du titre echo "<br><center><H1> " . _('config_abs_titre') . "</H1></center>\n"; echo "<br>\n"; /**************************************/ affiche_bouton_retour($session); // affichage de la liste des type d'absence existants $tab_enum = get_tab_from_mysql_enum_field("conges_type_absence", "ta_type", $DEBUG); foreach ($tab_enum as $ta_type) { if ($ta_type == "conges_exceptionnels" && $_SESSION['config']['gestion_conges_exceptionnels'] == FALSE) { } else { $divers_maj_1 = 'divers_' . $ta_type . '_maj_1'; $config_abs_comment = 'config_abs_comment_' . $ta_type; $legend = _($divers_maj_1); $comment = _($config_abs_comment); echo "<br>\n"; echo "<table width=\"100%\">\n"; echo "<tr><td>\n"; echo " <fieldset class=\"cal_saisie\">\n"; echo " <legend class=\"boxlogin\">{$legend}</legend>\n"; echo " <i>{$comment}</i><br><br>\n"; //requête qui récupère les informations de la table conges_type_absence $sql1 = 'SELECT * FROM conges_type_absence WHERE ta_type = \'' . SQL::quote($ta_type) . '\''; $ReqLog1 = SQL::query($sql1); if ($ReqLog1->num_rows != 0) { echo " <table cellpadding=\"2\" class=\"tablo\" >\n"; echo " <tr>\n"; echo " <td><b><u>" . _('config_abs_libelle') . "</b></u></td>\n"; echo " <td><b><u>" . _('config_abs_libelle_short') . "</b></u></td>\n"; echo " <td></td>\n"; echo " <td></td>\n"; echo " </tr>\n"; while ($data = $ReqLog1->fetch_array()) { $ta_id = $data['ta_id']; $ta_libelle = $data['ta_libelle']; $ta_short_libelle = $data['ta_short_libelle']; if ($session == "") { $text_modif = "<a href=\"{$PHP_SELF}?action=modif&id_to_update={$ta_id}\">" . _('form_modif') . "</a>"; $text_suppr = "<a href=\"{$PHP_SELF}?action=suppr&id_to_update={$ta_id}\">" . _('form_supprim') . "</a>"; } else { $text_modif = "<a href=\"{$PHP_SELF}?session={$session}&action=modif&id_to_update={$ta_id}\">" . _('form_modif') . "</a>"; $text_suppr = "<a href=\"{$PHP_SELF}?session={$session}&action=suppr&id_to_update={$ta_id}\">" . _('form_supprim') . "</a>"; } echo " <tr><td><b>{$ta_libelle}</b></td><td>{$ta_short_libelle}</td><td>{$text_modif}</td><td>{$text_suppr}</td></tr>\n"; } echo " </table>\n"; echo "</td></tr>\n"; echo "</table>\n"; } echo " </table>\n"; echo "</td></tr>\n"; echo "</table>\n"; } } /**************************************/ // saisie de nouveaux type d'absence echo "<br>\n"; echo "<table width=\"100%\">\n"; echo "<tr><td>\n"; echo " <form action=\"{$URL}\" method=\"POST\"> \n"; echo " <fieldset class=\"cal_saisie\">\n"; echo " <legend class=\"boxlogin\">" . _('config_abs_add_type_abs') . "</legend>\n"; echo " " . _('config_abs_add_type_abs_comment') . "\n"; echo " <table cellpadding=\"2\" >\n"; echo " <tr>\n"; echo " <td>" . _('config_abs_libelle') . "</td>\n"; echo " <td>" . _('config_abs_libelle_short') . "</td>\n"; echo " <td>" . _('divers_type') . "</td>\n"; echo " </tr>\n"; echo " <tr>\n"; $new_libelle = isset($tab_new_values['libelle']) ? $tab_new_values['libelle'] : ""; $new_short_libelle = isset($tab_new_values['short_libelle']) ? $tab_new_values['short_libelle'] : ""; $new_type = isset($tab_new_values['type']) ? $tab_new_values['type'] : ""; echo " <td><input type=\"text\" name=\"tab_new_values[libelle]\" size=\"20\" maxlength=\"20\" value=\"{$new_libelle}\" ></td>\n"; echo " <td><input type=\"text\" name=\"tab_new_values[short_libelle]\" size=\"3\" maxlength=\"3\" value=\"{$new_short_libelle}\" ></td>\n"; echo " <td>\n"; echo "<SELECT NAME=tab_new_values[type]>\n"; foreach ($tab_enum as $option) { if ($option == "conges_exceptionnels" && $_SESSION['config']['gestion_conges_exceptionnels'] == FALSE) { } else { if ($option == $new_type) { echo "<OPTION selected>{$option}</OPTION>\n"; } else { echo "<OPTION>{$option}</OPTION>\n"; } } } echo "</SELECT>\n"; echo " </td></tr>\n"; echo " </table>\n"; echo " <input type=\"hidden\" name=\"action\" value=\"new\">\n"; echo " <input type=\"submit\" value=\"" . _('form_ajout') . "\"><br>\n"; echo " </form>\n"; echo "</td></tr>\n"; echo "</table>\n"; // Bouton de retour : différent suivant si on vient des pages d'install ou de l'appli echo "<br><br>\n"; affiche_bouton_retour($session); echo "<br><br>\n"; }
function affichage($tab_new_values, $session, $DEBUG = FALSE) { $PHP_SELF = $_SERVER['PHP_SELF']; if ($session == "") { $URL = "{$PHP_SELF}?onglet=type_absence"; } else { $URL = "{$PHP_SELF}?session={$session}&onglet=type_absence"; } /**************************************/ // affichage du titre echo "<h1>" . _('config_abs_titre') . "</h1>\n"; /**************************************/ // affiche_bouton_retour($session); // affichage de la liste des type d'absence existants $tab_enum = get_tab_from_mysql_enum_field("conges_type_absence", "ta_type", $DEBUG); foreach ($tab_enum as $ta_type) { if ($ta_type == "conges_exceptionnels" && $_SESSION['config']['gestion_conges_exceptionnels'] == FALSE) { } else { $divers_maj_1 = 'divers_' . $ta_type . '_maj_1'; $config_abs_comment = 'config_abs_comment_' . $ta_type; $legend = _($divers_maj_1); $comment = _($config_abs_comment); echo "<h2>{$legend}</h2>\n"; echo "<p>{$comment}</p>\n"; //requête qui récupère les informations de la table conges_type_absence $sql1 = 'SELECT * FROM conges_type_absence WHERE ta_type = \'' . SQL::quote($ta_type) . '\''; $ReqLog1 = SQL::query($sql1); if ($ReqLog1->num_rows != 0) { echo " <table class=\"table table-hover table-responsive table-condensed table-striped\">\n"; echo " <tr>\n"; echo " <th>" . _('config_abs_libelle') . "</th>\n"; echo " <th>" . _('config_abs_libelle_short') . "</th>\n"; echo " <th></th>\n"; echo " </tr>\n"; while ($data = $ReqLog1->fetch_array()) { $ta_id = $data['ta_id']; $ta_libelle = $data['ta_libelle']; $ta_short_libelle = $data['ta_short_libelle']; if ($session == "") { $text_modif = "<a href=\"{$PHP_SELF}?action=modif&id_to_update={$ta_id}&onglet=type_absence\" title=\"" . _('form_modif') . "\"><i class=\"fa fa-pencil\"></i></a>"; $text_suppr = "<a href=\"{$PHP_SELF}?action=suppr&id_to_update={$ta_id}&onglet=type_absence\" title=\"" . _('form_supprim') . "\"><i class=\"fa fa-times-circle\"></i></a>"; } else { $text_modif = "<a href=\"{$PHP_SELF}?session={$session}&action=modif&id_to_update={$ta_id}&onglet=type_absence\" title=\"" . _('form_modif') . "\"><i class=\"fa fa-pencil\"></i></a>"; $text_suppr = "<a href=\"{$PHP_SELF}?session={$session}&action=suppr&id_to_update={$ta_id}&onglet=type_absence\" title=\"" . _('form_supprim') . "\"><i class=\"fa fa-times-circle\"></i></a>"; } echo " <tr><td><strong>{$ta_libelle}</strong></td><td>{$ta_short_libelle}</td><td class=\"action\">{$text_modif} {$text_suppr}</td></tr>\n"; } echo " </table>\n"; echo "<hr/>\n"; } } } /**************************************/ // saisie de nouveaux type d'absence echo "<h2>" . _('config_abs_add_type_abs') . "</h2>\n"; echo "<p>" . _('config_abs_add_type_abs_comment') . "</p>\n"; echo " <form action=\"{$URL}\" method=\"POST\"> \n"; echo " <table class=\"table table-hover table-responsive table-condensed table-striped\">\n"; echo " <tr>\n"; echo " <th>" . _('config_abs_libelle') . "</th>\n"; echo " <th>" . _('config_abs_libelle_short') . "</th>\n"; echo " <th>" . _('divers_type') . "</th>\n"; echo " </tr>\n"; echo " <tr>\n"; $new_libelle = isset($tab_new_values['libelle']) ? $tab_new_values['libelle'] : ""; $new_short_libelle = isset($tab_new_values['short_libelle']) ? $tab_new_values['short_libelle'] : ""; $new_type = isset($tab_new_values['type']) ? $tab_new_values['type'] : ""; echo " <td><input class=\"form-control\" type=\"text\" name=\"tab_new_values[libelle]\" size=\"20\" maxlength=\"20\" value=\"{$new_libelle}\" ></td>\n"; echo " <td><input class=\"form-control\" type=\"text\" name=\"tab_new_values[short_libelle]\" size=\"3\" maxlength=\"3\" value=\"{$new_short_libelle}\" ></td>\n"; echo " <td>\n"; echo "<select class=\"form-control\" name=tab_new_values[type]>\n"; foreach ($tab_enum as $option) { if ($option == "conges_exceptionnels" && $_SESSION['config']['gestion_conges_exceptionnels'] == FALSE) { } else { if ($option == $new_type) { echo "<option selected>{$option}</option>\n"; } else { echo "<option>{$option}</option>\n"; } } } echo "</select>\n"; echo " </td></tr>\n"; echo " </table>\n"; echo " <input type=\"hidden\" name=\"action\" value=\"new\">\n"; echo "<hr/>\n"; echo "<input type=\"submit\" class=\"btn btn-success\" value=\"" . _('form_ajout') . "\"><br>\n"; echo "</form>\n"; }