|
| 1 | +<?php |
| 2 | +/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net> |
| 3 | + * Copyright (C) 2020 SuperAdmin |
| 4 | + * |
| 5 | + * This program is free software: you can redistribute it and/or modify |
| 6 | + * it under the terms of the GNU General Public License as published by |
| 7 | + * the Free Software Foundation, either version 3 of the License, or |
| 8 | + * (at your option) any later version. |
| 9 | + * |
| 10 | + * This program is distributed in the hope that it will be useful, |
| 11 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | + * GNU General Public License for more details. |
| 14 | + * |
| 15 | + * You should have received a copy of the GNU General Public License |
| 16 | + * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 17 | + */ |
| 18 | + |
| 19 | +/** |
| 20 | + * \file doliproject/admin/about.php |
| 21 | + * \ingroup doliproject |
| 22 | + * \brief About page of module Doliproject. |
| 23 | + */ |
| 24 | + |
| 25 | +// Load Dolibarr environment |
| 26 | +$res = 0; |
| 27 | +// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) |
| 28 | +if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; |
| 29 | +// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME |
| 30 | +$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; |
| 31 | +while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } |
| 32 | +if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; |
| 33 | +if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; |
| 34 | +// Try main.inc.php using relative path |
| 35 | +if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; |
| 36 | +if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; |
| 37 | +if (!$res) die("Include of main fails"); |
| 38 | + |
| 39 | +// Libraries |
| 40 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; |
| 41 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
| 42 | +require_once DOL_DOCUMENT_ROOT . "/core/class/html.formother.class.php"; |
| 43 | +require_once DOL_DOCUMENT_ROOT . "/core/class/html.formprojet.class.php"; |
| 44 | + |
| 45 | +require_once '../lib/doliproject.lib.php'; |
| 46 | + |
| 47 | +// Translations |
| 48 | +$langs->loadLangs(array("errors", "admin", "doliproject@doliproject")); |
| 49 | + |
| 50 | +// Access control |
| 51 | +if (!$user->admin) accessforbidden(); |
| 52 | + |
| 53 | +// Parameters |
| 54 | +$action = GETPOST('action', 'alpha'); |
| 55 | +$backtopage = GETPOST('backtopage', 'alpha'); |
| 56 | + |
| 57 | + |
| 58 | +/* |
| 59 | + * Actions |
| 60 | + */ |
| 61 | + |
| 62 | +if (($action == 'update' && ! GETPOST("cancel", 'alpha')) || ($action == 'updateedit')) { |
| 63 | + $HRProject = GETPOST('HRProject', 'none'); |
| 64 | + $HRProject = preg_split('/_/', $HRProject); |
| 65 | + |
| 66 | + dolibarr_set_const($db, "DOLIPROJECT_HR_PROJECT", $HRProject[0], 'integer', 0, '', $conf->entity); |
| 67 | + setEventMessages($langs->transnoentities('TicketProjectUpdated'), array()); |
| 68 | + |
| 69 | + if ($action != 'updateedit' && ! $error) { |
| 70 | + header("Location: " . $_SERVER["PHP_SELF"]); |
| 71 | + exit; |
| 72 | + } |
| 73 | +} |
| 74 | + |
| 75 | +if ($action == 'updateThemeColor') { |
| 76 | + $val = (implode(',', (colorStringToArray(GETPOST('DOLIPROJECT_EXCEEDED_TIME_SPENT_COLOR'), array())))); |
| 77 | + if ($val == '') { |
| 78 | + dolibarr_del_const($db, 'DOLIPROJECT_EXCEEDED_TIME_SPENT_COLOR', $conf->entity); |
| 79 | + } else { |
| 80 | + dolibarr_set_const($db, 'DOLIPROJECT_EXCEEDED_TIME_SPENT_COLOR', $val, 'chaine', 0, '', $conf->entity); |
| 81 | + } |
| 82 | + |
| 83 | + $val = (implode(',', (colorStringToArray(GETPOST('DOLIPROJECT_NOT_EXCEEDED_TIME_SPENT_COLOR'), array())))); |
| 84 | + if ($val == '') { |
| 85 | + dolibarr_del_const($db, 'DOLIPROJECT_NOT_EXCEEDED_TIME_SPENT_COLOR', $conf->entity); |
| 86 | + } else { |
| 87 | + dolibarr_set_const($db, 'DOLIPROJECT_NOT_EXCEEDED_TIME_SPENT_COLOR', $val, 'chaine', 0, '', $conf->entity); |
| 88 | + } |
| 89 | + |
| 90 | + $val = (implode(',', (colorStringToArray(GETPOST('DOLIPROJECT_PERFECT_TIME_SPENT_COLOR'), array())))); |
| 91 | + if ($val == '') { |
| 92 | + dolibarr_del_const($db, 'DOLIPROJECT_PERFECT_TIME_SPENT_COLOR', $conf->entity); |
| 93 | + } else { |
| 94 | + dolibarr_set_const($db, 'DOLIPROJECT_PERFECT_TIME_SPENT_COLOR', $val, 'chaine', 0, '', $conf->entity); |
| 95 | + } |
| 96 | +} |
| 97 | + |
| 98 | +/* |
| 99 | + * View |
| 100 | + */ |
| 101 | + |
| 102 | +$form = new Form($db); |
| 103 | +$formother = new FormOther($db); |
| 104 | +if ( ! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } |
| 105 | + |
| 106 | +$page_name = "DoliprojectAbout"; |
| 107 | +llxHeader('', $langs->trans($page_name)); |
| 108 | + |
| 109 | +// Subheader |
| 110 | +$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>'; |
| 111 | + |
| 112 | +print load_fiche_titre($langs->trans($page_name), $linkback, 'object_doliproject@doliproject'); |
| 113 | + |
| 114 | +// Configuration header |
| 115 | +$head = doliprojectAdminPrepareHead(); |
| 116 | +dol_fiche_head($head, 'projecttasks', '', -1, 'doliproject@doliproject'); |
| 117 | +dol_get_fiche_head($head, 'projecttasks', '', -1, 'doliproject@doliproject'); |
| 118 | + |
| 119 | +// Project |
| 120 | +print load_fiche_titre($langs->transnoentities("HRProject"), '', ''); |
| 121 | + |
| 122 | +print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '" name="project_form">'; |
| 123 | +print '<input type="hidden" name="token" value="' . newToken() . '">'; |
| 124 | +print '<input type="hidden" name="action" value="update">'; |
| 125 | +print '<table class="noborder centpercent editmode">'; |
| 126 | +print '<tr class="liste_titre">'; |
| 127 | +print '<td>' . $langs->transnoentities("Name") . '</td>'; |
| 128 | +print '<td>' . $langs->transnoentities("SelectProject") . '</td>'; |
| 129 | +print '<td>' . $langs->transnoentities("Action") . '</td>'; |
| 130 | +print '</tr>'; |
| 131 | + |
| 132 | +if ( ! empty($conf->projet->enabled)) { |
| 133 | + $langs->load("projects"); |
| 134 | + print '<tr class="oddeven"><td><label for="TSProject">' . $langs->transnoentities("HRProject") . '</label></td><td>'; |
| 135 | + $numprojet = $formproject->select_projects(0, $conf->global->DOLIPROJECT_HR_PROJECT, 'HRProject', 0, 0, 0, 0, 0, 0, 0, '', 0, 0, 'maxwidth500'); |
| 136 | + print ' <a href="' . DOL_URL_ROOT . '/projet/card.php?&action=create&status=1&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?action=create') . '"><span class="fa fa-plus-circle valignmiddle" title="' . $langs->transnoentities("AddProject") . '"></span></a>'; |
| 137 | + print '<td><input type="submit" class="button" name="save" value="' . $langs->transnoentities("Save") . '">'; |
| 138 | + print '</td></tr>'; |
| 139 | +} |
| 140 | + |
| 141 | +print '</table>'; |
| 142 | +print '</form>'; |
| 143 | + |
| 144 | +//Time spent |
| 145 | +print load_fiche_titre($langs->transnoentities("TimeSpent"), '', ''); |
| 146 | + |
| 147 | +print '<table class="noborder centpercent editmode">'; |
| 148 | + |
| 149 | +print '<tr class="liste_titre">'; |
| 150 | +print '<td>' . $langs->transnoentities("Parameters") . '</td>'; |
| 151 | +print '<td class="center">' . $langs->transnoentities("Status") . '</td>'; |
| 152 | +print '<td class="center">' . $langs->transnoentities("Action") . '</td>'; |
| 153 | +print '<td class="center">' . $langs->transnoentities("ShortInfo") . '</td>'; |
| 154 | +print '</tr>'; |
| 155 | + |
| 156 | +print '<tr class="oddeven"><td>' . $langs->transnoentities("SpendMoreTimeThanPlanned") . '</td>'; |
| 157 | +print '<td class="center">'; |
| 158 | +print ajax_constantonoff('DOLIPROJECT_SPEND_MORE_TIME_THAN_PLANNED'); |
| 159 | +print '</td>'; |
| 160 | +print '<td class="center">'; |
| 161 | +print ''; |
| 162 | +print '</td>'; |
| 163 | +print '<td class="center">'; |
| 164 | +print $form->textwithpicto('', $langs->transnoentities("SpendMoreTimeThanPlannedHelp"), 1, 'help'); |
| 165 | +print '</td>'; |
| 166 | +print '</tr>'; |
| 167 | + |
| 168 | +print '</table>'; |
| 169 | + |
| 170 | +//Theme dasboard time spent |
| 171 | +print load_fiche_titre($langs->transnoentities("ThemeDashboardTimeSpent"), '', ''); |
| 172 | + |
| 173 | +print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '" name="color_form">'; |
| 174 | +print '<input type="hidden" name="token" value="' . newToken() . '">'; |
| 175 | +print '<input type="hidden" name="action" value="updateThemeColor">'; |
| 176 | +print '<table class="noborder centpercent editmode">'; |
| 177 | + |
| 178 | +print '<tr class="liste_titre">'; |
| 179 | +print '<td>' . $langs->transnoentities("Parameters") . '</td>'; |
| 180 | +print '<td class="center">' . $langs->transnoentities("Value") . '</td>'; |
| 181 | +print '</tr>'; |
| 182 | + |
| 183 | +print '<tr class="oddeven">'; |
| 184 | +print '<td>'.$langs->trans("ExceededTimeSpentColor").'</td>'; |
| 185 | +print '<td>'; |
| 186 | +print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->DOLIPROJECT_EXCEEDED_TIME_SPENT_COLOR) ? $conf->global->DOLIPROJECT_EXCEEDED_TIME_SPENT_COLOR : ''), array()), ''), 'DOLIPROJECT_EXCEEDED_TIME_SPENT_COLOR', '', 1, '', '', 'doliprojectexceededtimespentcolor'); |
| 187 | +print '<span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong>#FF0000</strong>'; |
| 188 | +print '</td>'; |
| 189 | +print '</tr>'; |
| 190 | + |
| 191 | +print '<tr class="oddeven">'; |
| 192 | +print '<td>'.$langs->trans("NotExceededTimeSpentColor").'</td>'; |
| 193 | +print '<td>'; |
| 194 | +print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->DOLIPROJECT_NOT_EXCEEDED_TIME_SPENT_COLOR) ? $conf->global->DOLIPROJECT_NOT_EXCEEDED_TIME_SPENT_COLOR : ''), array()), ''), 'DOLIPROJECT_NOT_EXCEEDED_TIME_SPENT_COLOR', '', 1, '', '', 'doliprojectnotexceededtimespentcolor'); |
| 195 | +print '<span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong>#FFA500</strong>'; |
| 196 | +print '</td>'; |
| 197 | +print '</tr>'; |
| 198 | + |
| 199 | +print '<tr class="oddeven">'; |
| 200 | +print '<td>'.$langs->trans("PerfectTimeSpentColor").'</td>'; |
| 201 | +print '<td>'; |
| 202 | +print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->DOLIPROJECT_PERFECT_TIME_SPENT_COLOR) ? $conf->global->DOLIPROJECT_PERFECT_TIME_SPENT_COLOR : ''), array()), ''), 'DOLIPROJECT_PERFECT_TIME_SPENT_COLOR', '', 1, '', '', 'doliprojectperfecttimespentcolor'); |
| 203 | +print '<span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong>#008000</strong>'; |
| 204 | +print '</td>'; |
| 205 | +print '</tr>'; |
| 206 | + |
| 207 | +print '</table>'; |
| 208 | + |
| 209 | +print '<div class="center">'; |
| 210 | +print '<input class="button button-save reposition" type="submit" name="submit" value="' . $langs->trans("Save") . '">'; |
| 211 | +print '</div>'; |
| 212 | + |
| 213 | +print '</form>'; |
| 214 | + |
| 215 | +// Page end |
| 216 | +llxFooter(); |
| 217 | +$db->close(); |
0 commit comments