task #10885: Start work
This commit is contained in:
parent
7f49af4b15
commit
8aa59c94ad
@ -69,13 +69,14 @@ $action=GETPOST('action','alpha');
|
|||||||
//$year=GETPOST("year");
|
//$year=GETPOST("year");
|
||||||
$year=GETPOST("year","int")?GETPOST("year","int"):date("Y");
|
$year=GETPOST("year","int")?GETPOST("year","int"):date("Y");
|
||||||
$month=GETPOST("month","int")?GETPOST("month","int"):date("m");
|
$month=GETPOST("month","int")?GETPOST("month","int"):date("m");
|
||||||
|
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
|
||||||
$day=GETPOST("day","int")?GETPOST("day","int"):0;
|
$day=GETPOST("day","int")?GETPOST("day","int"):0;
|
||||||
$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=GETPOST("maxprint");
|
||||||
|
|
||||||
if (GETPOST('viewcal')) { $action='show_month'; $day=''; } // View by month
|
if (GETPOST('viewcal')) { $action='show_month'; $day=''; } // View by month
|
||||||
if (GETPOST('viewweek')) { $action='show_week'; $week=date("W"); } // View by week
|
if (GETPOST('viewweek')) { $action='show_week'; $week=date("W"); $day=date("d");} // View by week
|
||||||
if (GETPOST('viewday')) { $action='show_day'; $day=date("d"); } // View by day
|
if (GETPOST('viewday')) { $action='show_day'; $day=date("d"); } // View by day
|
||||||
|
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
@ -181,7 +182,7 @@ if ($socid) $param.="&socid=".$socid;
|
|||||||
if ($showbirthday) $param.="&showbirthday=1";
|
if ($showbirthday) $param.="&showbirthday=1";
|
||||||
if ($pid) $param.="&projectid=".$pid;
|
if ($pid) $param.="&projectid=".$pid;
|
||||||
if (GETPOST("type")) $param.="&type=".GETPOST("type");
|
if (GETPOST("type")) $param.="&type=".GETPOST("type");
|
||||||
if ($action == 'show_day') $param.='&action='.$action;
|
if ($action == 'show_day' || $action == 'show_week') $param.='&action='.$action;
|
||||||
if ($maxprint) $param.="&maxprint=on";
|
if ($maxprint) $param.="&maxprint=on";
|
||||||
|
|
||||||
// Show navigation bar
|
// Show navigation bar
|
||||||
@ -194,7 +195,10 @@ if (empty($action) || $action=='show_month')
|
|||||||
}
|
}
|
||||||
if ($action=='show_week')
|
if ($action=='show_week')
|
||||||
{
|
{
|
||||||
|
$nav ="<a href=\"?year=".$prev_year."&month=".$prev_month."&week=".$prev_week."&day=".$prev_day."&region=".$region.$param."\">".img_previous($langs->trans("Previous"))."</a>\n";
|
||||||
|
$nav.=" <span id=\"month_name\">".dol_print_date(dol_mktime(0,0,0,$month,1,$year),"%Y").", ".$langs->trans("Week")." ".$week;
|
||||||
|
$nav.=" </span>\n";
|
||||||
|
$nav.="<a href=\"?year=".$next_year."&month=".$next_month."&week=".$next_week."&day=".$next_day."&region=".$region.$param."\">".img_next($langs->trans("Next"))."</a>\n";
|
||||||
}
|
}
|
||||||
if ($action=='show_day')
|
if ($action=='show_day')
|
||||||
{
|
{
|
||||||
@ -516,7 +520,7 @@ if (empty($action) || $action == 'show_month') // View by month
|
|||||||
}
|
}
|
||||||
echo "</table>\n";
|
echo "</table>\n";
|
||||||
}
|
}
|
||||||
elseif ($action == 'show_week') // View by day
|
elseif ($action == 'show_week') // View by week
|
||||||
{
|
{
|
||||||
print $langs->trans("FeatureNotYetAvailable"); //Work in progress...
|
print $langs->trans("FeatureNotYetAvailable"); //Work in progress...
|
||||||
}
|
}
|
||||||
@ -571,7 +575,6 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
|||||||
if ($_GET["maxprint"] == 'on') $maxPrint=0; // Force to remove limits
|
if ($_GET["maxprint"] == 'on') $maxPrint=0; // Force to remove limits
|
||||||
|
|
||||||
$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%">';
|
||||||
print '<tr style="background: #EEEEEE"><td align="left" nowrap="nowrap">';
|
print '<tr style="background: #EEEEEE"><td align="left" nowrap="nowrap">';
|
||||||
print '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?';
|
print '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?';
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2008 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2008 Regis Houssin <regis@dolibarr.fr>
|
||||||
|
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -198,6 +199,51 @@ function dol_get_next_month($month, $year)
|
|||||||
return array('year' => $next_year, 'month' => $next_month);
|
return array('year' => $next_year, 'month' => $next_month);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Return previous week
|
||||||
|
* @param week Week
|
||||||
|
* @param year Year
|
||||||
|
* @return array Previous year,month,week
|
||||||
|
*/
|
||||||
|
function dol_get_prev_week($week, $year)
|
||||||
|
{
|
||||||
|
if ($week == 1)
|
||||||
|
{
|
||||||
|
$prev_week = 52;
|
||||||
|
$prev_month = 12;
|
||||||
|
$prev_year = $year - 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$prev_week = $week-1;
|
||||||
|
$str_tmp = str_pad($prev_week, 2, 0, STR_PAD_LEFT);
|
||||||
|
$prev_month = date('n', strtotime($year.'-W'.$str_tmp));
|
||||||
|
$prev_year = $year;
|
||||||
|
}
|
||||||
|
return array('year' => $prev_year, 'month'=>$prev_month, 'week' => $prev_week);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Return next week
|
||||||
|
* @param week Week
|
||||||
|
* @param year Year
|
||||||
|
* @return array Next year,month,week
|
||||||
|
*/
|
||||||
|
function dol_get_next_week($week, $year)
|
||||||
|
{
|
||||||
|
if ($week == 52)
|
||||||
|
{
|
||||||
|
$next_week = 1;
|
||||||
|
$next_month = 1;
|
||||||
|
$next_year = $year + 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$next_week = $week + 1;
|
||||||
|
$str_tmp = str_pad($next_week, 2, 0, STR_PAD_LEFT);
|
||||||
|
$next_month = date('n', strtotime($year.'-W'.$str_tmp));
|
||||||
|
$next_year = $year;
|
||||||
|
}
|
||||||
|
return array('year' => $next_year, 'month'=>$next_month, 'week' => $next_week);
|
||||||
|
}
|
||||||
|
|
||||||
/** Return GMT time for first day of a month or year
|
/** Return GMT time for first day of a month or year
|
||||||
* @param year Year
|
* @param year Year
|
||||||
@ -238,6 +284,72 @@ function dol_get_last_day($year,$month=12,$gm=false)
|
|||||||
return $datelim;
|
return $datelim;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Return first day of week for a week
|
||||||
|
* @param day Day
|
||||||
|
* @param month Month
|
||||||
|
* @param gm False = Return date to compare with server TZ, True to compare with GM date.
|
||||||
|
* @return Timestamp Date for first day of week
|
||||||
|
*/
|
||||||
|
function dol_get_first_day_of_week($day,$month,$year,$gm=false)
|
||||||
|
{
|
||||||
|
$date=dol_mktime(0,0,0,$month,$day,$year,$gm);
|
||||||
|
|
||||||
|
if (isset($conf->global->MAIN_START_WEEK))
|
||||||
|
{
|
||||||
|
if ($conf->global->MAIN_START_WEEK==1)
|
||||||
|
{
|
||||||
|
$getdate = getdate($date);
|
||||||
|
|
||||||
|
// How many days ahead monday are we?
|
||||||
|
switch ( $getdate['wday'] )
|
||||||
|
{
|
||||||
|
case 0: // we are on sunday
|
||||||
|
$days = 6;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default: // any other day
|
||||||
|
$days = $getdate['wday']-1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$seconds = $days*24*60*60;
|
||||||
|
$monday = date($getdate[0])-$seconds;
|
||||||
|
|
||||||
|
return $monday;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$getdate = getdate($date);
|
||||||
|
// substact as many days as days ahead sunday we are
|
||||||
|
$seconds = $getdate['wday']*24*60*60;
|
||||||
|
$sunday = date($getdate[0])-$seconds;
|
||||||
|
|
||||||
|
return $sunday;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$getdate = getdate($date);
|
||||||
|
|
||||||
|
// How many days ahead monday are we?
|
||||||
|
switch ( $getdate['wday'] )
|
||||||
|
{
|
||||||
|
case 0: // we are on sunday
|
||||||
|
$days = 6;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default: // any other day
|
||||||
|
$days = $getdate['wday']-1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$seconds = $days*24*60*60;
|
||||||
|
$monday = date($getdate[0])-$seconds;
|
||||||
|
|
||||||
|
return $monday;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fonction retournant le nombre de jour fieries samedis et dimanches entre 2 dates entrees en timestamp
|
* Fonction retournant le nombre de jour fieries samedis et dimanches entre 2 dates entrees en timestamp
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user