Prepare of javascript switch of calendars
This commit is contained in:
parent
f9dbb35628
commit
04d33dee51
@ -33,11 +33,14 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php");
|
|||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/agenda.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/agenda.lib.php");
|
||||||
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT."/core/lib/project.lib.php");
|
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT."/core/lib/project.lib.php");
|
||||||
|
|
||||||
|
if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3;
|
||||||
|
|
||||||
$filter=GETPOST("filter");
|
$filter=GETPOST("filter");
|
||||||
$filtera = GETPOST("userasked","int")?GETPOST("userasked","int"):GETPOST("filtera","int");
|
$filtera = GETPOST("userasked","int")?GETPOST("userasked","int"):GETPOST("filtera","int");
|
||||||
$filtert = GETPOST("usertodo","int")?GETPOST("usertodo","int"):GETPOST("filtert","int");
|
$filtert = GETPOST("usertodo","int")?GETPOST("usertodo","int"):GETPOST("filtert","int");
|
||||||
$filterd = GETPOST("userdone","int")?GETPOST("userdone","int"):GETPOST("filterd","int");
|
$filterd = GETPOST("userdone","int")?GETPOST("userdone","int"):GETPOST("filterd","int");
|
||||||
$showbirthday = GETPOST("showbirthday","int");
|
$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
|
||||||
|
|
||||||
|
|
||||||
$sortfield = GETPOST("sortfield");
|
$sortfield = GETPOST("sortfield");
|
||||||
$sortorder = GETPOST("sortorder");
|
$sortorder = GETPOST("sortorder");
|
||||||
@ -72,7 +75,8 @@ $day=GETPOST("day","int")?GETPOST("day","int"):0;
|
|||||||
$actioncode=GETPOST("actioncode");
|
$actioncode=GETPOST("actioncode");
|
||||||
$pid=GETPOST("projectid","int")?GETPOST("projectid","int"):0;
|
$pid=GETPOST("projectid","int")?GETPOST("projectid","int"):0;
|
||||||
$status=GETPOST("status");
|
$status=GETPOST("status");
|
||||||
$maxprint=GETPOST("maxprint");
|
$maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
|
||||||
|
|
||||||
if (GETPOST('viewcal')) {
|
if (GETPOST('viewcal')) {
|
||||||
$action='show_month'; $day='';
|
$action='show_month'; $day='';
|
||||||
} // View by month
|
} // View by month
|
||||||
@ -86,7 +90,6 @@ if (GETPOST('viewday')) {
|
|||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
$langs->load("commercial");
|
$langs->load("commercial");
|
||||||
|
|
||||||
if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -127,6 +130,25 @@ $contactstatic=new Contact($db);
|
|||||||
|
|
||||||
$now=dol_now('tzref');
|
$now=dol_now('tzref');
|
||||||
|
|
||||||
|
// Define list of all external calendars
|
||||||
|
$listofextcals=array();
|
||||||
|
if (empty($conf->global->AGENDA_DISABLE_EXT) && $conf->global->AGENDA_EXT_NB > 0)
|
||||||
|
{
|
||||||
|
$i=0;
|
||||||
|
while($i < $conf->global->AGENDA_EXT_NB)
|
||||||
|
{
|
||||||
|
$i++;
|
||||||
|
$paramkey='AGENDA_EXT_SRC'.$i;
|
||||||
|
$url=$conf->global->$paramkey;
|
||||||
|
$paramkey='AGENDA_EXT_NAME'.$i;
|
||||||
|
$namecal = $conf->global->$paramkey;
|
||||||
|
$paramkey='AGENDA_EXT_COLOR'.$i;
|
||||||
|
$colorcal = $conf->global->$paramkey;
|
||||||
|
if ($url && $namecal) $listofextcals[]=array('src'=>$url,'name'=>$namecal,'color'=>$colorcal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (empty($action) || $action=='show_month')
|
if (empty($action) || $action=='show_month')
|
||||||
{
|
{
|
||||||
$prev = dol_get_prev_month($month, $year);
|
$prev = dol_get_prev_month($month, $year);
|
||||||
@ -208,7 +230,7 @@ if ($pid) $param.="&projectid=".$pid;
|
|||||||
if ($actioncode) $param.="&actioncode=".$actioncode;
|
if ($actioncode) $param.="&actioncode=".$actioncode;
|
||||||
if (GETPOST("type")) $param.="&type=".GETPOST("type");
|
if (GETPOST("type")) $param.="&type=".GETPOST("type");
|
||||||
if ($action == 'show_day' || $action == 'show_week') $param.='&action='.$action;
|
if ($action == 'show_day' || $action == 'show_week') $param.='&action='.$action;
|
||||||
if ($maxprint) $param.="&maxprint=on";
|
$param.="&maxprint=".$maxprint;
|
||||||
|
|
||||||
// Show navigation bar
|
// Show navigation bar
|
||||||
if (empty($action) || $action=='show_month')
|
if (empty($action) || $action=='show_month')
|
||||||
@ -243,29 +265,28 @@ $param.='&year='.$year.'&month='.$month.($day?'&day='.$day:'');
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$head = calendars_prepare_head('');
|
$head = calendars_prepare_head('');
|
||||||
|
|
||||||
dol_fiche_head($head, 'card', $langs->trans('Events'), 0, $picto);
|
dol_fiche_head($head, 'card', $langs->trans('Events'), 0, $picto);
|
||||||
print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid);
|
print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,$listofextcals);
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
|
$link='';
|
||||||
// Add link to show birthdays
|
// Add link to show birthdays
|
||||||
$newparam=$param; // newparam is for birthday links
|
if (empty($conf->use_javascript_ajax))
|
||||||
$newparam=preg_replace('/showbirthday=[0-1]/i','showbirthday='.(empty($showbirthday)?1:0),$newparam);
|
{
|
||||||
if (! preg_match('/showbirthday=/i',$newparam)) $newparam.='&showbirthday=1';
|
$newparam=$param; // newparam is for birthday links
|
||||||
$link='<a href="'.$_SERVER['PHP_SELF'];
|
$newparam=preg_replace('/showbirthday=[0-1]/i','showbirthday='.(empty($showbirthday)?1:0),$newparam);
|
||||||
$link.='?'.$newparam;
|
if (! preg_match('/showbirthday=/i',$newparam)) $newparam.='&showbirthday=1';
|
||||||
$link.='">';
|
$link='<a href="'.$_SERVER['PHP_SELF'];
|
||||||
if (empty($showbirthday)) $link.=$langs->trans("AgendaShowBirthdayEvents");
|
$link.='?'.$newparam;
|
||||||
else $link.=$langs->trans("AgendaHideBirthdayEvents");
|
$link.='">';
|
||||||
$link.='</a>';
|
if (empty($showbirthday)) $link.=$langs->trans("AgendaShowBirthdayEvents");
|
||||||
|
else $link.=$langs->trans("AgendaHideBirthdayEvents");
|
||||||
|
$link.='</a>';
|
||||||
|
}
|
||||||
|
|
||||||
print_fiche_titre($title,$link.' '.$nav, '');
|
print_fiche_titre($title,$link.' '.$nav, '');
|
||||||
//print '<br>';
|
|
||||||
|
|
||||||
//print_fiche_titre($link,'','');
|
|
||||||
|
|
||||||
|
|
||||||
// Get event in an array
|
// Get event in an array
|
||||||
@ -492,25 +513,6 @@ if ($showbirthday)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Exernal Calendars
|
|
||||||
$listofextcals=array();
|
|
||||||
|
|
||||||
if (empty($conf->global->AGENDA_DISABLE_EXT) && $conf->global->AGENDA_EXT_NB > 0)
|
|
||||||
{
|
|
||||||
$i=0;
|
|
||||||
while($i < $conf->global->AGENDA_EXT_NB)
|
|
||||||
{
|
|
||||||
$i++;
|
|
||||||
$paramkey='AGENDA_EXT_SRC'.$i;
|
|
||||||
$url=$conf->global->$paramkey;
|
|
||||||
$paramkey='AGENDA_EXT_NAME'.$i;
|
|
||||||
$namecal = $conf->global->$paramkey;
|
|
||||||
$paramkey='AGENDA_EXT_COLOR'.$i;
|
|
||||||
$colorcal = $conf->global->$paramkey;
|
|
||||||
if ($url && $namecal) $listofextcals[]=array('src'=>$url,'name'=>$namecal,'color'=>$colorcal);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (count($listofextcals))
|
if (count($listofextcals))
|
||||||
{
|
{
|
||||||
require_once(DOL_DOCUMENT_ROOT."/comm/action/class/ical.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/comm/action/class/ical.class.php");
|
||||||
@ -768,7 +770,7 @@ if (empty($action) || $action == 'show_month') // View by month
|
|||||||
{
|
{
|
||||||
$style='cal_other_month';
|
$style='cal_other_month';
|
||||||
echo ' <td class="'.$style.'" width="14%" valign="top" nowrap="nowrap">';
|
echo ' <td class="'.$style.'" width="14%" valign="top" nowrap="nowrap">';
|
||||||
show_day_events($db, $max_day_in_prev_month + $tmpday, $prev_month, $prev_year, $month, $style, $eventarray, $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW, $maxnbofchar, $newparam);
|
show_day_events($db, $max_day_in_prev_month + $tmpday, $prev_month, $prev_year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam);
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
}
|
}
|
||||||
/* Show days of the current month */
|
/* Show days of the current month */
|
||||||
@ -783,7 +785,7 @@ if (empty($action) || $action == 'show_month') // View by month
|
|||||||
if ($today) $style='cal_today';
|
if ($today) $style='cal_today';
|
||||||
|
|
||||||
echo ' <td class="'.$style.'" width="14%" valign="top" nowrap="nowrap">';
|
echo ' <td class="'.$style.'" width="14%" valign="top" nowrap="nowrap">';
|
||||||
show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW, $maxnbofchar, $newparam);
|
show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam);
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
}
|
}
|
||||||
/* Show days after the current month (next month) */
|
/* Show days after the current month (next month) */
|
||||||
@ -791,7 +793,7 @@ if (empty($action) || $action == 'show_month') // View by month
|
|||||||
{
|
{
|
||||||
$style='cal_other_month';
|
$style='cal_other_month';
|
||||||
echo ' <td class="'.$style.'" width="14%" valign="top" nowrap="nowrap">';
|
echo ' <td class="'.$style.'" width="14%" valign="top" nowrap="nowrap">';
|
||||||
show_day_events($db, $tmpday - $max_day_in_month, $next_month, $next_year, $month, $style, $eventarray, $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW, $maxnbofchar, $newparam);
|
show_day_events($db, $tmpday - $max_day_in_month, $next_month, $next_year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam);
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
}
|
}
|
||||||
$tmpday++;
|
$tmpday++;
|
||||||
@ -914,22 +916,20 @@ llxFooter();
|
|||||||
* @param int $monthshown Current month shown in calendar view
|
* @param int $monthshown Current month shown in calendar view
|
||||||
* @param string $style Style to use for this day
|
* @param string $style Style to use for this day
|
||||||
* @param array &$eventarray Array of events
|
* @param array &$eventarray Array of events
|
||||||
* @param int $maxPrint Nb of actions to show each day on month view (0 means non limit)
|
* @param int $maxprint Nb of actions to show each day on month view (0 means no limit)
|
||||||
* @param int $maxnbofchar Nb of characters to show for event line
|
* @param int $maxnbofchar Nb of characters to show for event line
|
||||||
* @param string $newparam Parameters on current URL
|
* @param string $newparam Parameters on current URL
|
||||||
* @param int $showinfo Add extended information (used by day view)
|
* @param int $showinfo Add extended information (used by day view)
|
||||||
* @param int $minheight Minimum height for each event. 60px by default.
|
* @param int $minheight Minimum height for each event. 60px by default.
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxPrint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60)
|
function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60)
|
||||||
{
|
{
|
||||||
global $user, $conf, $langs;
|
global $user, $conf, $langs;
|
||||||
global $filter, $filtera, $filtert, $filterd, $status;
|
global $filter, $filtera, $filtert, $filterd, $status;
|
||||||
global $theme_datacolor;
|
global $theme_datacolor;
|
||||||
global $cachethirdparties, $cachecontacts;
|
global $cachethirdparties, $cachecontacts;
|
||||||
|
|
||||||
if ($_GET["maxprint"] == 'on') $maxPrint=0; // Force to remove limits
|
|
||||||
|
|
||||||
print '<div id="dayevent_'.sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day).'" class="dayevent">'."\n";
|
print '<div id="dayevent_'.sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day).'" class="dayevent">'."\n";
|
||||||
$curtime = dol_mktime(0, 0, 0, $month, $day, $year);
|
$curtime = dol_mktime(0, 0, 0, $month, $day, $year);
|
||||||
print '<table class="nobordernopadding" width="100%">';
|
print '<table class="nobordernopadding" width="100%">';
|
||||||
@ -955,7 +955,8 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
|||||||
print '<tr height="'.$minheight.'"><td valign="top" colspan="2" nowrap="nowrap">';
|
print '<tr height="'.$minheight.'"><td valign="top" colspan="2" nowrap="nowrap">';
|
||||||
|
|
||||||
//$curtime = dol_mktime (0, 0, 0, $month, $day, $year);
|
//$curtime = dol_mktime (0, 0, 0, $month, $day, $year);
|
||||||
$i=0;
|
$i=0; $nummytasks=0; $numother=0; $numbirthday=0; $numical=0; $numicals=array();
|
||||||
|
$ymd=sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day);
|
||||||
|
|
||||||
foreach ($eventarray as $daykey => $notused)
|
foreach ($eventarray as $daykey => $notused)
|
||||||
{
|
{
|
||||||
@ -966,21 +967,22 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
|||||||
{
|
{
|
||||||
foreach ($eventarray[$daykey] as $index => $event)
|
foreach ($eventarray[$daykey] as $index => $event)
|
||||||
{
|
{
|
||||||
if ($i < $maxPrint || $maxPrint == 0)
|
if ($i < $maxprint || $maxprint == 0 || ! empty($conf->global->MAIN_JS_SWITCH_AGENDA))
|
||||||
{
|
{
|
||||||
$ponct=($event->date_start_in_calendar == $event->date_end_in_calendar);
|
$ponct=($event->date_start_in_calendar == $event->date_end_in_calendar);
|
||||||
|
|
||||||
// Define $color and $cssclass of event
|
// Define $color and $cssclass of event
|
||||||
$color=-1; $cssclass=''; $colorindex=-1;
|
$color=-1; $cssclass=''; $colorindex=-1;
|
||||||
if ($event->author->id == $user->id || $event->usertodo->id == $user->id || $event->userdone->id == $user->id) { $colorindex=1; $cssclass='family_mytasks'; }
|
if ($event->author->id == $user->id || $event->usertodo->id == $user->id || $event->userdone->id == $user->id) { $nummytasks++; $colorindex=1; $cssclass='family_mytasks'; }
|
||||||
if ($event->type_code == 'ICALEVENT') { $color=$event->icalcolor; $cssclass=($event->icalname?'family_'.dol_string_nospecial($event->icalname):'family_other'); }
|
else if ($event->type_code == 'ICALEVENT') { $numical++; $numicals[dol_string_nospecial($event->icalname)]++; $color=$event->icalcolor; $cssclass=($event->icalname?'family_'.dol_string_nospecial($event->icalname):'family_other'); }
|
||||||
if ($event->type_code == 'BIRTHDAY') { $colorindex=2; $cssclass='family_birthday'; }
|
else if ($event->type_code == 'BIRTHDAY') { $numbirthday++; $colorindex=2; $cssclass='family_birthday'; }
|
||||||
|
else { $numother++; $cssclass='family_other'; }
|
||||||
if ($color == -1) $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]);
|
if ($color == -1) $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]);
|
||||||
//print "x".$color;
|
$cssclass=$cssclass.' '.$cssclass.'_day_'.$ymd;
|
||||||
|
|
||||||
// Show rect of event
|
// Show rect of event
|
||||||
print '<div id="event_'.sprintf("%04d",$annee).sprintf("%02d",$mois).sprintf("%02d",$jour).'_'.$i.'" class="event '.$cssclass.'">';
|
print '<div id="event_'.$ymd.'_'.$i.'" class="event '.$cssclass.'">';
|
||||||
print '<table class="cal_event" style="background: #'.$color.'; -moz-border-radius:4px; " width="100%"><tr>';
|
print '<table class="cal_event" style="background: #'.$color.'; -moz-border-radius:4px;" width="100%"><tr>';
|
||||||
print '<td nowrap="nowrap">';
|
print '<td nowrap="nowrap">';
|
||||||
if ($event->type_code == 'BIRTHDAY') // It's a birthday
|
if ($event->type_code == 'BIRTHDAY') // It's a birthday
|
||||||
{
|
{
|
||||||
@ -1111,20 +1113,40 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?maxprint=on&month='.$monthshown.'&year='.$year;
|
print '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?maxprint=0&month='.$monthshown.'&year='.$year;
|
||||||
print ($status?'&status='.$status:'').($filter?'&filter='.$filter:'');
|
print ($status?'&status='.$status:'').($filter?'&filter='.$filter:'');
|
||||||
print ($filtera?'&filtera='.$filtera:'').($filtert?'&filtert='.$filtert:'').($filterd?'&filterd='.$filterd:'');
|
print ($filtera?'&filtera='.$filtera:'').($filtert?'&filtert='.$filtert:'').($filterd?'&filterd='.$filterd:'');
|
||||||
print '">'.img_picto("all","1downarrow_selected.png").' ...';
|
print '">'.img_picto("all","1downarrow_selected.png").' ...';
|
||||||
print ' +'.(count($eventarray[$daykey])-$maxPrint);
|
print ' +'.(count($eventarray[$daykey])-$maxprint);
|
||||||
print '</a>';
|
print '</a>';
|
||||||
break;
|
break;
|
||||||
//$ok=false; // To avoid to show twice the link
|
//$ok=false; // To avoid to show twice the link
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (! $i) print ' ';
|
if (! $i) print ' ';
|
||||||
|
|
||||||
|
if (! empty($conf->global->MAIN_JS_SWITCH_AGENDA) && $i > $maxprint && $maxprint)
|
||||||
|
{
|
||||||
|
print '<div id="more_'.$ymd.'">'.img_picto("all","1downarrow_selected.png").' +'.$langs->trans("More").'...</div>';
|
||||||
|
//print ' +'.(count($eventarray[$daykey])-$maxprint);
|
||||||
|
print '<script type="text/javascript">'."\n";
|
||||||
|
print 'jQuery(document).ready(function () {'."\n";
|
||||||
|
print 'jQuery("#more_'.$ymd.'").click(function() { reinit_day_'.$ymd.'(); });'."\n";
|
||||||
|
|
||||||
|
print 'function reinit_day_'.$ymd.'() {'."\n";
|
||||||
|
print 'var nb=0;'."\n";
|
||||||
|
// TODO Loop on each element of day $ymd and start to toggle once $maxprint has been reached
|
||||||
|
print 'jQuery(".family_mytasks_day_'.$ymd.'").toggle();';
|
||||||
|
print '}'."\n";
|
||||||
|
|
||||||
|
print '});'."\n";
|
||||||
|
print '</script>'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</div>'."\n";
|
print '</div>'."\n";
|
||||||
|
|||||||
@ -47,7 +47,7 @@ $filter=GETPOST("filter");
|
|||||||
$filtera = GETPOST("userasked","int")?GETPOST("userasked","int"):GETPOST("filtera","int");
|
$filtera = GETPOST("userasked","int")?GETPOST("userasked","int"):GETPOST("filtera","int");
|
||||||
$filtert = GETPOST("usertodo","int")?GETPOST("usertodo","int"):GETPOST("filtert","int");
|
$filtert = GETPOST("usertodo","int")?GETPOST("usertodo","int"):GETPOST("filtert","int");
|
||||||
$filterd = GETPOST("userdone","int")?GETPOST("userdone","int"):GETPOST("filterd","int");
|
$filterd = GETPOST("userdone","int")?GETPOST("userdone","int"):GETPOST("filterd","int");
|
||||||
$showbirthday = GETPOST("showbirthday","int");
|
$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
|
||||||
|
|
||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
@ -113,6 +113,25 @@ llxHeader('',$langs->trans("Agenda"),$help_url);
|
|||||||
|
|
||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
|
|
||||||
|
// Define list of all external calendars
|
||||||
|
$listofextcals=array();
|
||||||
|
/*if (empty($conf->global->AGENDA_DISABLE_EXT) && $conf->global->AGENDA_EXT_NB > 0)
|
||||||
|
{
|
||||||
|
$i=0;
|
||||||
|
while($i < $conf->global->AGENDA_EXT_NB)
|
||||||
|
{
|
||||||
|
$i++;
|
||||||
|
$paramkey='AGENDA_EXT_SRC'.$i;
|
||||||
|
$url=$conf->global->$paramkey;
|
||||||
|
$paramkey='AGENDA_EXT_NAME'.$i;
|
||||||
|
$namecal = $conf->global->$paramkey;
|
||||||
|
$paramkey='AGENDA_EXT_COLOR'.$i;
|
||||||
|
$colorcal = $conf->global->$paramkey;
|
||||||
|
if ($url && $namecal) $listofextcals[]=array('src'=>$url,'name'=>$namecal,'color'=>$colorcal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
$param='';
|
$param='';
|
||||||
if ($status) $param="&status=".$status;
|
if ($status) $param="&status=".$status;
|
||||||
if ($filter) $param.="&filter=".$filter;
|
if ($filter) $param.="&filter=".$filter;
|
||||||
@ -192,21 +211,24 @@ if ($resql)
|
|||||||
$head = calendars_prepare_head('');
|
$head = calendars_prepare_head('');
|
||||||
|
|
||||||
dol_fiche_head($head, 'card', $langs->trans('Events'), 0, 'list');
|
dol_fiche_head($head, 'card', $langs->trans('Events'), 0, 'list');
|
||||||
print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid);
|
print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,-1);
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
// Add link to show birthdays
|
// Add link to show birthdays
|
||||||
$link='';
|
$link='';
|
||||||
/*
|
/*
|
||||||
$newparam=$param; // newparam is for birthday links
|
if (empty($conf->use_javascript_ajax))
|
||||||
$newparam=preg_replace('/showbirthday=[0-1]/i','showbirthday='.(empty($showbirthday)?1:0),$newparam);
|
{
|
||||||
if (! preg_match('/showbirthday=/i',$newparam)) $newparam.='&showbirthday=1';
|
$newparam=$param; // newparam is for birthday links
|
||||||
$link='<a href="'.$_SERVER['PHP_SELF'];
|
$newparam=preg_replace('/showbirthday=[0-1]/i','showbirthday='.(empty($showbirthday)?1:0),$newparam);
|
||||||
$link.='?'.$newparam;
|
if (! preg_match('/showbirthday=/i',$newparam)) $newparam.='&showbirthday=1';
|
||||||
$link.='">';
|
$link='<a href="'.$_SERVER['PHP_SELF'];
|
||||||
if (empty($showbirthday)) $link.=$langs->trans("AgendaShowBirthdayEvents");
|
$link.='?'.$newparam;
|
||||||
else $link.=$langs->trans("AgendaHideBirthdayEvents");
|
$link.='">';
|
||||||
$link.='</a>';
|
if (empty($showbirthday)) $link.=$langs->trans("AgendaShowBirthdayEvents");
|
||||||
|
else $link.=$langs->trans("AgendaHideBirthdayEvents");
|
||||||
|
$link.='</a>';
|
||||||
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print_barre_liste($newtitle, $page, $_SERVER["PHP_SELF"], $param,$sortfield,$sortorder,$link,$num,0,'');
|
print_barre_liste($newtitle, $page, $_SERVER["PHP_SELF"], $param,$sortfield,$sortorder,$link,$num,0,'');
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
/**
|
/**
|
||||||
* Show filter form in agenda view
|
* Show filter form in agenda view
|
||||||
*
|
*
|
||||||
* @param string $form Form name
|
* @param Object $form Form object
|
||||||
* @param int $canedit Can edit filter fields
|
* @param int $canedit Can edit filter fields
|
||||||
* @param int $status Status
|
* @param int $status Status
|
||||||
* @param int $year Year
|
* @param int $year Year
|
||||||
@ -39,8 +39,10 @@
|
|||||||
* @param string $filterd Filter of done by user
|
* @param string $filterd Filter of done by user
|
||||||
* @param int $pid Product id
|
* @param int $pid Product id
|
||||||
* @param int $socid Third party id
|
* @param int $socid Third party id
|
||||||
|
* @param array $showextcals Array with list of external calendars, or -1 to show no legend
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
function print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid)
|
function print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,$showextcals=array())
|
||||||
{
|
{
|
||||||
global $conf,$langs,$db;
|
global $conf,$langs,$db;
|
||||||
|
|
||||||
@ -86,12 +88,12 @@ function print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirt
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php');
|
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php');
|
||||||
$htmlactions=new FormActions($db);
|
$formactions=new FormActions($db);
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td nowrap="nowrap">';
|
print '<td nowrap="nowrap">';
|
||||||
print $langs->trans("Type");
|
print $langs->trans("Type");
|
||||||
print ' </td><td nowrap="nowrap">';
|
print ' </td><td nowrap="nowrap">';
|
||||||
print $htmlactions->select_type_actions(GETPOST('actioncode'), "actioncode");
|
print $formactions->select_type_actions(GETPOST('actioncode'), "actioncode");
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,6 +120,41 @@ function print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirt
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
print img_picto($langs->trans("ViewList"),'object_list').' <input type="submit" class="button" style="width:120px" name="viewlist" value="'.$langs->trans("ViewList").'">';
|
print img_picto($langs->trans("ViewList"),'object_list').' <input type="submit" class="button" style="width:120px" name="viewlist" value="'.$langs->trans("ViewList").'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
// Legend
|
||||||
|
if ($conf->use_javascript_ajax && is_array($showextcals))
|
||||||
|
{
|
||||||
|
print '<td align="center" valign="middle" nowrap="nowrap">';
|
||||||
|
print '<script type="text/javascript">'."\n";
|
||||||
|
print 'jQuery(document).ready(function () {'."\n";
|
||||||
|
print 'jQuery("#check_mytasks").click(function() { jQuery(".family_mytasks").toggle(); jQuery(".family_other").toggle(); });'."\n";
|
||||||
|
print 'jQuery("#check_birthday").click(function() { jQuery(".family_birthday").toggle(); });'."\n";
|
||||||
|
print 'jQuery(".family_birthday").toggle();'."\n";
|
||||||
|
print '});'."\n";
|
||||||
|
print '</script>'."\n";
|
||||||
|
print '<table>';
|
||||||
|
if (! empty($conf->global->MAIN_JS_SWITCH_AGENDA))
|
||||||
|
{
|
||||||
|
if (count($showextcals) > 0)
|
||||||
|
{
|
||||||
|
print '<tr><td><input type="checkbox" id="check_mytasks" name="check_mytasks" checked="true" disabled="disabled"> '.$langs->trans("LocalAgenda").'</td></tr>';
|
||||||
|
foreach($showextcals as $val)
|
||||||
|
{
|
||||||
|
$htmlname=dol_string_nospecial($val['name']);
|
||||||
|
print '<script type="text/javascript">'."\n";
|
||||||
|
print 'jQuery(document).ready(function () {'."\n";
|
||||||
|
print 'jQuery("#check_'.$htmlname.'").click(function() { jQuery(".family_'.$htmlname.'").toggle(); });'."\n";
|
||||||
|
print '});'."\n";
|
||||||
|
print '</script>'."\n";
|
||||||
|
print '<tr><td><input type="checkbox" id="check_'.$htmlname.'" name="check_'.$htmlname.'" checked="true"> '.$val['name'].'</td></tr>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print '<tr><td><input type="checkbox" id="check_birthday" name="check_birthday checked="false"> '.$langs->trans("AgendaShowBirthdayEvents").'</td></tr>';
|
||||||
|
print '</table>';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
@ -128,7 +165,9 @@ function print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirt
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Show actions to do array
|
* Show actions to do array
|
||||||
* @param max Max nb of records
|
*
|
||||||
|
* @param int $max Max nb of records
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
function show_array_actions_to_do($max=5)
|
function show_array_actions_to_do($max=5)
|
||||||
{
|
{
|
||||||
@ -227,7 +266,9 @@ function show_array_actions_to_do($max=5)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Show last actions array
|
* Show last actions array
|
||||||
* @param max Max nb of records
|
*
|
||||||
|
* @param int $max Max nb of records
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
function show_array_last_actions_done($max=5)
|
function show_array_last_actions_done($max=5)
|
||||||
{
|
{
|
||||||
@ -314,6 +355,7 @@ function show_array_last_actions_done($max=5)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Define head array for tabs of agenda setup pages
|
* Define head array for tabs of agenda setup pages
|
||||||
|
*
|
||||||
* @return Array of head
|
* @return Array of head
|
||||||
*/
|
*/
|
||||||
function agenda_prepare_head()
|
function agenda_prepare_head()
|
||||||
|
|||||||
@ -133,7 +133,7 @@ PurgeDeleteAllFilesInDocumentsDir=Delete all files in directory <b>%s</b>. Tempo
|
|||||||
PurgeRunNow=Purge now
|
PurgeRunNow=Purge now
|
||||||
PurgeNothingToDelete=No directory or file to delete.
|
PurgeNothingToDelete=No directory or file to delete.
|
||||||
PurgeNDirectoriesDeleted=<b>%s</b> files or directories deleted.
|
PurgeNDirectoriesDeleted=<b>%s</b> files or directories deleted.
|
||||||
PurgeAuditEvents=Purge all events
|
PurgeAuditEvents=Purge all security events
|
||||||
ConfirmPurgeAuditEvents=Are you sure you want to purge all security events ? All security logs will be deleted, no other data will be removed.
|
ConfirmPurgeAuditEvents=Are you sure you want to purge all security events ? All security logs will be deleted, no other data will be removed.
|
||||||
NewBackup=New backup
|
NewBackup=New backup
|
||||||
GenerateBackup=Generate backup
|
GenerateBackup=Generate backup
|
||||||
|
|||||||
@ -6,9 +6,12 @@ Agenda= Agenda
|
|||||||
Agendas= Agendas
|
Agendas= Agendas
|
||||||
Calendar= Calendar
|
Calendar= Calendar
|
||||||
Calendars= Calendars
|
Calendars= Calendars
|
||||||
|
LocalAgenda=Local calendar
|
||||||
AffectedTo= Affected to
|
AffectedTo= Affected to
|
||||||
DoneBy= Done by
|
DoneBy= Done by
|
||||||
Events= Events
|
Events= Events
|
||||||
|
MyEvents=My events
|
||||||
|
OtherEvents=Other events
|
||||||
ListOfActions=List of events
|
ListOfActions=List of events
|
||||||
Location=Location
|
Location=Location
|
||||||
EventOnFullDay=Event on full day
|
EventOnFullDay=Event on full day
|
||||||
|
|||||||
@ -6,9 +6,12 @@ Agenda=Agenda
|
|||||||
Agendas=Agendas
|
Agendas=Agendas
|
||||||
Calendar=Calendrier
|
Calendar=Calendrier
|
||||||
Calendars=Calendriers
|
Calendars=Calendriers
|
||||||
|
LocalAgenda=Calendrier local
|
||||||
AffectedTo=Affecté à
|
AffectedTo=Affecté à
|
||||||
DoneBy=Réalisé par
|
DoneBy=Réalisé par
|
||||||
Events=Événements
|
Events=Événements
|
||||||
|
MyEvents=Mes événements
|
||||||
|
OtherEvents=Autres événements
|
||||||
ListOfActions=Liste des événements
|
ListOfActions=Liste des événements
|
||||||
EventOnFullDay=Événement sur la journée
|
EventOnFullDay=Événement sur la journée
|
||||||
Location=Lieu
|
Location=Lieu
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user