Exemplo n.º 1
0
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 "<H1> " . _('config_mail_titre') . "</H1>\n";
    echo "<i> " . _('config_mail_alerte_config') . "</i>\n";
    echo "<br><br>\n";
    /**************************************/
    affiche_bouton_retour($session);
    // affichage de la liste des type d'absence existants
    //requête qui récupère les informations de la table conges_type_absence
    $sql1 = "SELECT * FROM conges_mail ";
    $ReqLog1 = SQL::query($sql1);
    echo "    <form action=\"{$URL}\" method=\"POST\"> \n";
    while ($data = $ReqLog1->fetch_array()) {
        $mail_nom = stripslashes($data['mail_nom']);
        $mail_subject = stripslashes($data['mail_subject']);
        $mail_body = stripslashes($data['mail_body']);
        $legend = $mail_nom;
        // echo $mail_nom ;
        $key = $mail_nom . "_comment";
        $comment = _($key);
        echo "<br>\n";
        echo "<table>\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";
        echo "    <table cellpadding=\"2\" class=\"tablo-config\" >\n";
        echo "    <tr>\n";
        echo "    \t<td class=\"config\" valign=\"top\"><b>" . _('config_mail_subject') . "</b></td>\n";
        echo "    \t<td class=\"config\"><input type=\"text\" size=\"80\" name=\"tab_new_values[{$mail_nom}][subject]\" value=\"{$mail_subject}\"></td>\n";
        echo "    </tr>\n";
        echo "    <tr>\n";
        echo "    \t<td class=\"config\" valign=\"top\"><b>" . _('config_mail_body') . "</b></td>\n";
        echo "    \t<td class=\"config\"><textarea rows=\"6\" cols=\"80\" name=\"tab_new_values[{$mail_nom}][body]\" value=\"{$mail_body}\">{$mail_body}</textarea></td>\n";
        echo "    </tr>\n";
        echo "    <tr>\n";
        echo "    \t<td class=\"config\">&nbsp;</td>\n";
        echo "    \t<td class=\"config\">\n";
        echo "    \t\t<i>" . _('mail_remplace_url_accueil_comment') . "<br>\n";
        echo "    \t\t" . _('mail_remplace_sender_name_comment') . "<br>\n";
        echo "    \t\t" . _('mail_remplace_destination_name_comment') . "<br>\n";
        echo "    \t\t" . _('mail_remplace_nb_jours') . "<br>\n";
        echo "    \t\t" . _('mail_remplace_date_debut') . "<br>\n";
        echo "    \t\t" . _('mail_remplace_date_fin') . "<br>\n";
        echo "    \t\t" . _('mail_remplace_commentaire') . "<br>\n";
        echo "    \t\t" . _('mail_remplace_type_absence') . "<br>\n";
        echo "    \t\t" . _('mail_remplace_retour_ligne_comment') . "</i>\n";
        echo "    \t</td>\n";
        echo "    </tr>\n";
        echo "    </table>\n";
        echo "</td></tr>\n";
        echo "</table>\n";
    }
    echo "    <input type=\"hidden\" name=\"action\" value=\"modif\">\n";
    echo "    <input type=\"submit\"  value=\"" . _('form_save_modif') . "\"><br>\n";
    echo "    </form>\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);
}
Exemplo n.º 2
0
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";
}
Exemplo n.º 3
0
function affichage($login_par, $session, $DEBUG = FALSE)
{
    $PHP_SELF = $_SERVER['PHP_SELF'];
    /**************************************/
    // affichage du titre
    echo "<H1><img src=\"" . TEMPLATE_PATH . "img/tux_config_32x32.png\" width=\"32\" height=\"32\" border=\"0\" title=\"" . _('config_logs_titre_2') . "\" alt=\"" . _('config_logs_titre_2') . "\"> " . _('config_logs_titre_1') . "</H1></center>\n";
    echo "<br>\n";
    /**************************************/
    affiche_bouton_retour($session);
    //requête qui récupère les logs
    $sql1 = "SELECT log_user_login_par, log_user_login_pour, log_etat, log_comment, log_date FROM conges_logs ";
    if ($login_par != "") {
        $sql1 = $sql1 . " WHERE log_user_login_par = '{$login_par}' ";
    }
    $sql1 = $sql1 . " ORDER BY log_date";
    $ReqLog1 = SQL::query($sql1);
    if ($ReqLog1->num_rows != 0) {
        echo "<center>\n";
        if ($session == "") {
            echo "<form action=\"{$PHP_SELF}\" method=\"POST\"> \n";
        } else {
            echo "<form action=\"{$PHP_SELF}?session={$session}\" method=\"POST\"> \n";
        }
        echo "<br>\n";
        echo "<table align=\"center\">\n";
        echo "<tr><td class=\"histo\" colspan=\"5\">" . _('voir_les_logs_par') . "</td>";
        if ($login_par != "") {
            echo "<tr><td class=\"histo\" colspan=\"5\">" . _('voir_tous_les_logs') . " <a href=\"{$PHP_SELF}?session={$session}\">" . _('voir_tous_les_logs') . "</a></td>";
        }
        echo "<tr><td class=\"histo\" colspan=\"5\">&nbsp;</td>";
        // titres
        echo "<tr>\n";
        echo "<td>" . _('divers_date_maj_1') . "</td>\n";
        echo "<td>" . _('divers_fait_par_maj_1') . "</td>\n";
        echo "<td>" . _('divers_pour_maj_1') . "</td>\n";
        echo "<td>" . _('divers_comment_maj_1') . "</td>\n";
        echo "<td>" . _('divers_etat_maj_1') . "</td>\n";
        echo "</tr>\n";
        // affichage des logs
        while ($data = $ReqLog1->fetch_array()) {
            $log_login_par = $data['log_user_login_par'];
            $log_login_pour = $data['log_user_login_pour'];
            $log_log_etat = $data['log_etat'];
            $log_log_comment = $data['log_comment'];
            $log_log_date = $data['log_date'];
            echo "<tr>\n";
            echo "<td>{$log_log_date}</td>\n";
            echo "<td><a href=\"{$PHP_SELF}?session={$session}&login_par={$log_login_par}\"><b>{$log_login_par}</b></a></td>\n";
            echo "<td>{$log_login_pour}</td>\n";
            echo "<td>{$log_log_comment}</td>\n";
            echo "<td>{$log_log_etat}</td>\n";
            echo "</tr>\n";
        }
        echo "</table>\n";
        // affichage du bouton pour vider les logs
        echo "<input type=\"hidden\" name=\"action\" value=\"suppr_logs\">\n";
        echo "<input type=\"submit\"  value=\"" . _('form_delete_logs') . "\"><br>";
        echo "</form>\n";
        echo "</center>\n";
    } else {
        echo _('no_logs_in_db') . "><br>";
    }
    echo "<br>\n";
    affiche_bouton_retour($session);
    echo "<br><br>\n";
}
Exemplo n.º 4
0
function affichage($session, $DEBUG = FALSE)
{
    $PHP_SELF = $_SERVER['PHP_SELF'];
    /**************************************/
    // affichage du titre
    echo "<H1><img src=\"" . TEMPLATE_PATH . "img/tux_config_32x32.png\" width=\"32\" height=\"32\" border=\"0\" title=\"" . _('config_appli_titre_2') . "\" alt=\"" . _('config_appli_titre_2') . "\"> " . _('config_appli_titre_1') . "</H1></center>\n";
    echo "<br>\n";
    /**************************************/
    affiche_bouton_retour($session);
    // affichage de la liste des variables
    if ($session == "") {
        echo "<form action=\"{$PHP_SELF}\" method=\"POST\"> \n";
    } else {
        echo "<form action=\"{$PHP_SELF}?session={$session}\" method=\"POST\"> \n";
    }
    echo "<input type=\"hidden\" name=\"action\" value=\"commit\">\n";
    //requête qui récupère les informations de config
    $sql1 = "SELECT * FROM conges_config ORDER BY conf_groupe ASC";
    $ReqLog1 = SQL::query($sql1);
    $old_groupe = "";
    while ($data = $ReqLog1->fetch_array()) {
        $conf_nom = $data['conf_nom'];
        $conf_valeur = $data['conf_valeur'];
        $conf_groupe = $data['conf_groupe'];
        $conf_type = strtolower($data['conf_type']);
        $conf_commentaire = strtolower($data['conf_commentaire']);
        // changement de groupe de variables
        if ($old_groupe != $conf_groupe) {
            if ($old_groupe != "") {
                echo "</td></tr>\n";
                echo "<tr><td align=\"right\">\n";
                echo "<input type=\"submit\"  value=\"" . _('form_save_modif') . "\"><br>";
                echo "</td></tr>\n";
                echo "</table>\n";
            }
            echo "<br>\n";
            echo "<table width=\"100%\">\n";
            echo "<tr><td>\n";
            echo "    <fieldset class=\"cal_saisie\">\n";
            echo "    <legend class=\"boxlogin\">" . _($conf_groupe) . "</legend>\n";
            $old_groupe = $conf_groupe;
        }
        // si on est sur le parametre "lang" on liste les fichiers de langue du répertoire install/lang
        if ($conf_nom == "lang") {
            echo "Choisissez votre langue :<br> \n";
            echo "Choose your language :<br>\n";
            // affichage de la liste des langues supportées ...
            // on lit le contenu du répertoire lang et on parse les nom de ficher (ex lang_fr_francais.php)
            //affiche_select_from_lang_directory("tab_new_values[$conf_nom]");
            affiche_select_from_lang_directory('lang', $conf_valeur);
        } else {
            // affichage commentaire
            echo "<br><i>" . _($conf_commentaire) . "</i><br>\n";
            // affichage saisie variable
            if ($conf_nom == "installed_version") {
                echo "<b>{$conf_nom}&nbsp;&nbsp;=&nbsp;&nbsp;{$conf_valeur}</b><br>";
            } elseif ($conf_type == "texte" || $conf_type == "path") {
                echo "<b>{$conf_nom}</b>&nbsp;=&nbsp;<input type=\"text\" size=\"50\" maxlength=\"200\" name=\"tab_new_values[{$conf_nom}]\" value=\"{$conf_valeur}\"><br>";
            } elseif ($conf_type == "boolean") {
                echo "<b>{$conf_nom}</b>&nbsp;=&nbsp;<select name=\"tab_new_values[{$conf_nom}]\">";
                echo "<option value=\"TRUE\"";
                if ($conf_valeur == "TRUE") {
                    echo "selected";
                }
                echo ">TRUE</option>";
                echo "<option value=\"FALSE\"";
                if ($conf_valeur == "FALSE") {
                    echo "selected";
                }
                echo ">FALSE</option>";
                echo "</select><br>";
            } elseif (substr($conf_type, 0, 4) == "enum") {
                echo "<b>{$conf_nom}</b>&nbsp;=&nbsp;<select name=\"tab_new_values[{$conf_nom}]\">";
                $options = explode("/", substr(strstr($conf_type, '='), 1));
                for ($i = 0; $i < count($options); $i++) {
                    echo "<option value=\"" . $options[$i] . "\"";
                    if ($conf_valeur == $options[$i]) {
                        echo "selected";
                    }
                    echo ">" . $options[$i] . "</option>";
                }
                echo "</select><br>";
            }
            echo "<br>";
        }
    }
    echo "</td></tr>\n";
    echo "<tr><td align=\"right\">\n";
    echo "<input type=\"submit\"  value=\"" . _('form_save_modif') . "\"><br>";
    echo "</td></tr>\n";
    /******************* GESTION DES PLUGINS V1.7 *************************/
    //rajout du formulaire de gestion des plugins : à partir de la version 1.7
    // - On détecte les plugins puis on propose de les installer
    // L'installation du plugin va lancer include/plugins/[nom_du_plugins]/plugin_install.php
    // plugin_install.php lance la création des tables supplémentaires;
    // normalement le format de nommage des tables est conges_plugin_[nom_du_plugin]. Exemple de table : conges_plugin_cet
    // il vaut mieux éviter de surcharger les tables existantes pour éviter les nombreux problèmes de compatibilité
    // lors d'un changement de version.
    // - Lorsqu'un plugin est installé, l'administrateur ou la personne autorisée pourra activer le plugin.
    // Le status qui s'affichera deviendra "activated"
    // Soit 4 statuts disponibles : not installed, installed, disable, activated
    // Correspondants à 4 fichiers dans le dossier du plugin : plugin_install.php, plugin_uninstall.php, plugin_active.php, plugin_inactive.php
    //Les statuts sont retrouvés par la table conges_plugins
    //Ensuite, les fichiers à inclure doivent être listés dans include/plugins/[nom_du_plugins]/allfilestoinclude.php
    // Ces fichiers à inclure contiennent le coeur de votre plugin.
    $my_plugins = scandir(PLUGINS_DIR);
    $plug_count = 0;
    echo "<table width=\"100%\">\n";
    echo "<tr><td>\n";
    echo "    <fieldset class=\"cal_saisie\">\n";
    echo "    <legend class=\"boxlogin\"> Plugins</legend>\n";
    foreach ($my_plugins as $my_plugin) {
        if (is_dir(PLUGINS_DIR . "/{$my_plugin}") && !preg_match("/^\\./", $my_plugin)) {
            echo "Plugin détecté : ";
            echo "<b> {$my_plugin} </b>. This plugin is installed ? :\n            <select name=tab_new_values[" . $my_plugin . "_installed]>";
            $sql_plug = "SELECT p_is_active, p_is_install FROM conges_plugins WHERE p_name = '" . $my_plugin . "';";
            $ReqLog_plug = SQL::query($sql_plug);
            if ($ReqLog_plug->num_rows != 0) {
                while ($plug = $ReqLog_plug->fetch_array()) {
                    $p_install = $plug["p_is_install"];
                    if ($p_install == '1') {
                        echo "<option selected='selected' value='1'>Y</option><option value='0'>N</option>";
                    } else {
                        echo "<option value='1'>Y</option><option selected='selected' value='0'>N</option>";
                    }
                    echo "</select>";
                    echo " ... Is activated ? : <select name=tab_new_values[" . $my_plugin . "_activated]>";
                    $p_active = $plug["p_is_active"];
                    if ($p_active == '1') {
                        echo "<option selected='selected' value='1'>Y</option><option value='0'>N</option>";
                    } else {
                        echo "<option value='1'>Y</option><option selected='selected' value='0'>N</option>";
                    }
                }
            } else {
                echo "<option value='1'>Y</option><option selected='selected' value='0'>N</option>";
                echo "</select>";
                echo " ... Is activated ? : <select name=tab_new_values[" . $my_plugin . "_activated]>";
                echo "<option value='1'>Y</option><option selected='selected' value='0'>N</option>";
            }
            echo "</select>";
            echo "<br />";
            $plug_count++;
        }
    }
    if ($plug_count == 0) {
        echo "No plugin detected.";
    }
    echo "</td></tr>\n";
    echo "<tr><td align=\"right\">\n";
    echo "<input type=\"submit\"  value=\"" . _('form_save_modif') . "\"><br>";
    echo "</td></tr>\n";
    /**********************************************************************/
    echo "</table>\n";
    echo "</form>\n";
    echo "<br><br>\n";
    affiche_bouton_retour($session);
    echo "<br><br>\n";
    bottom();
}