NEW color in action list
This commit is contained in:
parent
bec9181d3f
commit
1414f72794
@ -53,6 +53,9 @@ $type = 'action';
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$error = 0;
|
||||
$errors = array();
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
$reg = array();
|
||||
@ -109,7 +112,36 @@ if ($action == 'set') {
|
||||
} else {
|
||||
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
||||
}
|
||||
} elseif ($action == 'specimen') { // For orders
|
||||
|
||||
} elseif ($action == 'setcolors') {
|
||||
$event_color = preg_replace('/[^0-9a-f#]/i', '', (string) GETPOST('event_past_color', 'alphanohtml'));
|
||||
$res = dolibarr_set_const($db, 'AGENDA_EVENT_PAST_COLOR', $event_color, 'chaine', 0, '', $conf->entity);
|
||||
if (!$res > 0) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
|
||||
$event_color = preg_replace('/[^0-9a-f#]/i', '', (string) GETPOST('event_progress_color', 'alphanohtml'));
|
||||
$res = dolibarr_set_const($db, 'AGENDA_EVENT_PROGRESS_COLOR', $event_color, 'chaine', 0, '', $conf->entity);
|
||||
if (!$res > 0) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
|
||||
$event_color = preg_replace('/[^0-9a-f#]/i', '', (string) GETPOST('event_future_color', 'alphanohtml'));
|
||||
$res = dolibarr_set_const($db, 'AGENDA_EVENT_FUTURE_COLOR', $event_color, 'chaine', 0, '', $conf->entity);
|
||||
if (!$res > 0) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
setEventMessages('', $errors, 'errors');
|
||||
} else {
|
||||
setEventMessage($langs->trans('SetupSaved'));
|
||||
}
|
||||
}
|
||||
elseif ($action == 'specimen') { // For orders
|
||||
$modele = GETPOST('module', 'alpha');
|
||||
|
||||
$commande = new CommandeFournisseur($db);
|
||||
@ -192,9 +224,10 @@ print dol_get_fiche_head($head, 'other', $langs->trans("Agenda"), -1, 'action');
|
||||
|
||||
|
||||
/*
|
||||
* Documents models for supplier orders
|
||||
* Miscellaneous
|
||||
*/
|
||||
|
||||
print load_fiche_titre($langs->trans('Miscellaneous'), '', '');
|
||||
|
||||
// Define array def of models
|
||||
$def = array();
|
||||
@ -394,7 +427,54 @@ print '</td></tr>'."\n";
|
||||
|
||||
print '</table>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
print $form->buttonsSaveCancel("Save", '');
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
/*
|
||||
* User interface (colors)
|
||||
*/
|
||||
|
||||
print load_fiche_titre($langs->trans('UserInterface'), '', '');
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
$formother = new FormOther($db);
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" name="form_colors">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="setcolors">';
|
||||
|
||||
print '<table class="noborder allwidth">'."\n";
|
||||
print '<tr class="liste_titre">'."\n";
|
||||
print '<td>'.$langs->trans("Parameters").'</td>'."\n";
|
||||
print '<td class="center"> </td>'."\n";
|
||||
print '<td class="right">'.$langs->trans("Value").'</td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
// AGENDA_EVENT_PAST_COLOR
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans('AGENDA_EVENT_PAST_COLOR').'</td>'."\n";
|
||||
print '<td class="center"> </td>'."\n";
|
||||
print '<td class="right">'."\n";
|
||||
print $formother->selectColor($conf->global->AGENDA_EVENT_PAST_COLOR, 'event_past_color');
|
||||
print '</td></tr>'."\n";
|
||||
// AGENDA_EVENT_PROGRESS_COLOR
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans('AGENDA_EVENT_PROGRESS_COLOR').'</td>'."\n";
|
||||
print '<td class="center"> </td>'."\n";
|
||||
print '<td class="right">'."\n";
|
||||
print $formother->selectColor($conf->global->AGENDA_EVENT_PROGRESS_COLOR, 'event_progress_color');
|
||||
print '</td></tr>'."\n";
|
||||
// AGENDA_EVENT_FUTURE_COLOR
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans('AGENDA_EVENT_FUTURE_COLOR').'</td>'."\n";
|
||||
print '<td class="center"> </td>'."\n";
|
||||
print '<td class="right">'."\n";
|
||||
print $formother->selectColor($conf->global->AGENDA_EVENT_FUTURE_COLOR, 'event_future_color');
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
print '</table>';
|
||||
|
||||
print $form->buttonsSaveCancel("Save", '');
|
||||
|
||||
@ -402,6 +482,8 @@ print '</form>';
|
||||
|
||||
print "<br>";
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@ -889,6 +889,7 @@ $i = 0;
|
||||
//$savnbfield = $totalarray['nbfield'];
|
||||
//$totalarray['nbfield'] = 0;
|
||||
$imaxinloop = ($limit ? min($num, $limit) : $num);
|
||||
$today_start_date_time = dol_now();
|
||||
while ($i < $imaxinloop) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if (empty($obj)) {
|
||||
@ -923,7 +924,36 @@ while ($i < $imaxinloop) {
|
||||
$actionstatic->fetchResources();
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
// get event color
|
||||
$event_color = '';
|
||||
$event_more_class = '';
|
||||
$event_start_date_time = $actionstatic->datep;
|
||||
if ($obj->fulldayevent) {
|
||||
$today_start_date_time = dol_mktime(0, 0, 0, date('m', $today_start_date_time), date('d', $today_start_date_time), date('Y', $today_start_date_time));
|
||||
}
|
||||
if ($event_start_date_time > $today_start_date_time) {
|
||||
// future event
|
||||
$event_color = $conf->global->AGENDA_EVENT_FUTURE_COLOR;
|
||||
$event_more_class = 'event-future';
|
||||
} else {
|
||||
// check event end date
|
||||
$event_end_date_time = $db->jdate($obj->dp2);
|
||||
if ($event_end_date_time != null && $event_end_date_time < $today_start_date_time) {
|
||||
// past event
|
||||
$event_color = $conf->global->AGENDA_EVENT_PAST_COLOR;
|
||||
$event_more_class = 'event-past';
|
||||
} elseif ($event_end_date_time == null && $event_start_date_time < $today_start_date_time) {
|
||||
// past event
|
||||
$event_color = $conf->global->AGENDA_EVENT_PAST_COLOR;
|
||||
$event_more_class = 'event-past';
|
||||
} else {
|
||||
// today event
|
||||
$event_color = $conf->global->AGENDA_EVENT_PROGRESS_COLOR;
|
||||
$event_more_class = 'event-progress';
|
||||
}
|
||||
}
|
||||
|
||||
print '<tr class="oddeven' . ($event_more_class != '' ? ' '.$event_more_class : '') . '"' . ($event_color != '' ? ' style="background: #'.$event_color.';"' : '') . '>';
|
||||
|
||||
// Ref
|
||||
if (!empty($arrayfields['a.id']['checked'])) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user