Add legend on peruser view.
This commit is contained in:
parent
6d1b3c1f83
commit
e42ab9ea84
@ -287,19 +287,21 @@ if ($action == 'add')
|
||||
{
|
||||
unset($_SESSION['assignedtouser']);
|
||||
|
||||
if ($user->id != $object->ownerid) $moreparam="&usertodo=-1"; // We force to remove filter so created record is visible when going back to per user view.
|
||||
|
||||
$db->commit();
|
||||
if (! empty($backtopage))
|
||||
{
|
||||
dol_syslog("Back to ".$backtopage);
|
||||
header("Location: ".$backtopage);
|
||||
dol_syslog("Back to ".$backtopage.$moreparam);
|
||||
header("Location: ".$backtopage.$moreparam);
|
||||
}
|
||||
elseif($idaction)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/comm/action/card.php?id='.$idaction);
|
||||
header("Location: ".DOL_URL_ROOT.'/comm/action/card.php?id='.$idaction.$moreparam);
|
||||
}
|
||||
else
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/comm/action/index.php');
|
||||
header("Location: ".DOL_URL_ROOT.'/comm/action/index.php'.($moreparam?'?'.$moreparam:''));
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -566,19 +566,50 @@ echo "</tr>\n";
|
||||
$usernames = array(); //init
|
||||
$usernamesid = array();
|
||||
/* Use this to have list of users only if users have events */
|
||||
foreach ($eventarray as $daykey => $notused)
|
||||
if (! empty($conf->global->AGENDA_SHOWOWNERONLY_ONPERUSERVIEW))
|
||||
{
|
||||
// Get all assigned users for each event
|
||||
foreach ($eventarray[$daykey] as $index => $event)
|
||||
{
|
||||
$event->fetch_userassigned();
|
||||
$listofuserid=$event->userassigned;
|
||||
foreach($listofuserid as $userid => $tmp)
|
||||
{
|
||||
if (! in_array($userid, $usernamesid)) $usernamesid[$userid] = $userid;
|
||||
}
|
||||
}
|
||||
foreach ($eventarray as $daykey => $notused)
|
||||
{
|
||||
// Get all assigned users for each event
|
||||
foreach ($eventarray[$daykey] as $index => $event)
|
||||
{
|
||||
$event->fetch_userassigned();
|
||||
$listofuserid=$event->userassigned;
|
||||
foreach($listofuserid as $userid => $tmp)
|
||||
{
|
||||
if (! in_array($userid, $usernamesid)) $usernamesid[$userid] = $userid;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Use this list to have for all users */
|
||||
else
|
||||
{
|
||||
$sql = "SELECT u.rowid, u.lastname as lastname, u.firstname, u.statut, u.login, u.admin, u.entity";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ug ON u.rowid = ug.fk_user";
|
||||
$sql.= " WHERE u.entity IN (".getEntity('user').")";
|
||||
if ($usergroup > 0) $sql.= " AND ug.fk_usergroup = ".$usergroup;
|
||||
if (GETPOST("usertodo","int",3) > 0) $sql.=" AND u.rowid = ".GETPOST("usertodo","int",3);
|
||||
//print $sql;
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num)
|
||||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$usernamesid[$obj->rowid]=$obj->rowid;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else dol_print_error($db);
|
||||
}
|
||||
//var_dump($usernamesid);
|
||||
foreach($usernamesid as $id)
|
||||
{
|
||||
$tmpuser=new User($db);
|
||||
@ -608,11 +639,13 @@ else
|
||||
|
||||
// Load array of colors by type
|
||||
$colorsbytype=array();
|
||||
$sql="SELECT code, color FROM ".MAIN_DB_PREFIX."c_actioncomm";
|
||||
$labelbytype=array();
|
||||
$sql="SELECT code, color, libelle FROM ".MAIN_DB_PREFIX."c_actioncomm";
|
||||
$resql=$db->query($sql);
|
||||
while ($obj = $db->fetch_object($resql))
|
||||
{
|
||||
$colorsbytype[$obj->code]=$obj->color;
|
||||
$labelbytype[$obj->code]=$obj->libelle;
|
||||
}
|
||||
|
||||
// Loop on each user to show calendar
|
||||
@ -658,6 +691,27 @@ foreach ($usernames as $username)
|
||||
|
||||
echo "</table>\n";
|
||||
|
||||
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
{
|
||||
$langs->load("commercial");
|
||||
print '<br>'.$langs->trans("Legend").': <br>';
|
||||
foreach($colorsbytype as $code => $color)
|
||||
{
|
||||
if ($color)
|
||||
{
|
||||
print '<div style="float: left; padding: 2px; margin-right: 6px;"><div style="'.($color?'background: #'.$color.';':'').'width:16px; float: left; margin-right: 4px;"> </div>';
|
||||
print $langs->trans("Action".$code)!="Action".$code?$langs->trans("Action".$code):$labelbytype[$code];
|
||||
//print $code;
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
//$color=sprintf("%02x%02x%02x",$theme_datacolor[0][0],$theme_datacolor[0][1],$theme_datacolor[0][2]);
|
||||
print '<div style="float: left; padding: 2px; margin-right: 6px;"><div class="peruser_busy" style="width:16px; float: left; margin-right: 4px;"> </div>';
|
||||
print $langs->trans("Other");
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
// Add js code to manage click on a box
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
|
||||
@ -2365,9 +2365,9 @@ table.cal_month { border-spacing: 0px; }
|
||||
.cal_past_month { opacity: 0.6; background: #EEEEEE; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
|
||||
.cal_current_month { background: #FFFFFF; border-left: solid 1px #E0E0E0; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
|
||||
.cal_current_month_peruserleft { background: #FFFFFF; border-left: solid 3px #6C7C7B; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
|
||||
.cal_today { background: #FFFFFF; border: solid 2px #6C7C7B; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
|
||||
.cal_today_peruser { background: #FFFFFF; border-right: solid 1px #6C7C7B; border-top: solid 1px #A0A0A0; border-bottom: solid 1px #A0A0A0; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
|
||||
.cal_today_peruser_peruserleft { background: #FFFFFF; border-left: solid 3px #6C7C7B; border-top: solid 1px #A0A0A0; border-right: solid 1px #6C7C7B; border-bottom: solid 1px #A0A0A0; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
|
||||
.cal_today { background: #FFFFF0; border-left: solid 1px #E0E0E0; border-bottom: solid 1px #E0E0E0; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
|
||||
.cal_today_peruser { background: #FFFFF0; border-right: solid 1px #E0E0E0; border-bottom: solid 1px #A0A0A0; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
|
||||
.cal_today_peruser_peruserleft { background: #FFFFF0; border-left: solid 3px #6C7C7B; border-right: solid 1px #E0E0E0; border-bottom: solid 1px #A0A0A0; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
|
||||
.cal_past { }
|
||||
.cal_peruser { padding: 0px; }
|
||||
.peruser_busy { background: #CC8888; }
|
||||
|
||||
Loading…
Reference in New Issue
Block a user