Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
f08ffc66
Commit
f08ffc66
authored
Aug 29, 2008
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Add sladame patch to add view of day.
parent
bd20a88b
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
htdocs/comm/action/index.php
+151
-101
151 additions, 101 deletions
htdocs/comm/action/index.php
with
151 additions
and
101 deletions
htdocs/comm/action/index.php
+
151
−
101
View file @
f08ffc66
...
...
@@ -141,7 +141,7 @@ if ($_GET["type"]) $param.="&type=".$_REQUEST["type"];
// Show navigation bar
$nav
=
"<a href=
\"
?year="
.
$prev_year
.
"&month="
.
$prev_month
.
"&region="
.
$region
.
$param
.
"
\"
>"
.
img_previous
(
$langs
->
trans
(
"Previous"
))
.
"</a>
\n
"
;
$nav
.
=
" <span id=
\"
month_name
\"
>"
.
dolibarr_print_date
(
dolibarr_mktime
(
0
,
0
,
0
,
$month
,
1
,
$year
),
"%b"
);
$nav
.
=
"
$year
"
;
$nav
.
=
"
"
.
$year
;
$nav
.
=
" </span>
\n
"
;
$nav
.
=
"<a href=
\"
?year="
.
$next_year
.
"&month="
.
$next_month
.
"&region="
.
$region
.
$param
.
"
\"
>"
.
img_next
(
$langs
->
trans
(
"Next"
))
.
"</a>
\n
"
;
...
...
@@ -202,6 +202,11 @@ $sql.= ' a.percent,';
$sql
.
=
' a.fk_user_author,a.fk_user_action,a.fk_user_done'
;
$sql
.
=
' FROM '
.
MAIN_DB_PREFIX
.
'actioncomm as a'
;
$sql
.
=
' WHERE 1=1'
;
if
(
$_GET
[
"action"
]
==
'show_day'
)
{
$sql
.
=
' AND datep BETWEEN '
.
$db
->
idate
(
dolibarr_mktime
(
0
,
0
,
0
,
$month
,
$_GET
[
"day"
],
$year
));
$sql
.
=
' AND '
.
$db
->
idate
(
dolibarr_mktime
(
23
,
59
,
59
,
$month
,
$_GET
[
"day"
],
$year
));
}
if
(
$filtera
>
0
||
$filtert
>
0
||
$filterd
>
0
)
{
$sql
.
=
" AND ("
;
...
...
@@ -212,6 +217,7 @@ if ($filtera > 0 || $filtert > 0 || $filterd > 0)
}
if
(
$status
==
'done'
)
{
$sql
.
=
" AND a.percent = 100"
;
}
if
(
$status
==
'todo'
)
{
$sql
.
=
" AND a.percent < 100"
;
}
$sql
.
=
' ORDER BY datep'
;
// \TODO Add filters on dates
//print $sql;
...
...
@@ -236,6 +242,8 @@ if ($resql)
$action
->
userdone
->
id
=
$obj
->
fk_user_done
;
// Defined date_start_in_calendar and date_end_in_calendar property
// They are date start and end of action but modified to not be outside
// calendar view.
if
(
$action
->
percentage
<=
0
)
{
$action
->
date_start_in_calendar
=
$action
->
datep
;
...
...
@@ -248,20 +256,20 @@ if ($resql)
if
(
$action
->
datef
!=
''
&&
$action
->
datef
>=
$action
->
datep
)
$action
->
date_end_in_calendar
=
$action
->
datef
;
else
$action
->
date_end_in_calendar
=
$action
->
datep
;
}
// Define ponctu
e
l property
// Define ponctu
a
l property
if
(
$action
->
date_start_in_calendar
==
$action
->
date_end_in_calendar
)
{
$action
->
ponctuel
=
1
;
}
// Add an entry in actionarray for each day
// \TODO
$daycursor
=
$action
->
date_start_in_calendar
;
$annee
=
date
(
'Y'
,
$daycursor
);
$mois
=
date
(
'm'
,
$daycursor
);
$jour
=
date
(
'd'
,
$daycursor
);
$daykey
=
dolibarr_mktime
(
0
,
0
,
0
,
$mois
,
$jour
,
$annee
);
$loop
=
true
;
$daykey
=
dolibarr_mktime
(
0
,
0
,
0
,
$mois
,
$jour
,
$annee
);
do
{
$actionarray
[
$daykey
][]
=
$action
;
...
...
@@ -285,6 +293,8 @@ if (is_readable($color_file))
}
if
(
!
is_array
(
$theme_datacolor
))
$theme_datacolor
=
array
(
array
(
120
,
130
,
150
),
array
(
200
,
160
,
180
),
array
(
190
,
190
,
220
));
if
(
$_GET
[
"action"
]
!=
'show_day'
)
{
echo
'<table width="100%" class="nocellnopadd">'
;
echo
' <tr class="liste_titre">'
;
echo
' <td align="center">'
.
$langs
->
trans
(
"Monday"
)
.
"</td>
\n
"
;
...
...
@@ -295,7 +305,6 @@ echo ' <td align="center">'.$langs->trans("Friday")."</td>\n";
echo
' <td align="center">'
.
$langs
->
trans
(
"Saturday"
)
.
"</td>
\n
"
;
echo
' <td align="center">'
.
$langs
->
trans
(
"Sunday"
)
.
"</td>
\n
"
;
echo
" </tr>
\n
"
;
for
(
$iter_week
=
0
;
$iter_week
<
6
;
$iter_week
++
)
{
echo
" <tr>
\n
"
;
...
...
@@ -307,7 +316,7 @@ for($iter_week = 0; $iter_week < 6 ; $iter_week++)
{
$style
=
'cal_other_month'
;
echo
' <td class="'
.
$style
.
'" width="14%" valign="top" nowrap="nowrap">'
;
show_day_events
(
$db
,
$max_day_in_prev_month
+
$day
,
$prev_month
,
$prev_year
,
$style
,
$actionarray
);
show_day_events
(
$db
,
$max_day_in_prev_month
+
$day
,
$prev_month
,
$prev_year
,
$style
,
$actionarray
,
3
);
echo
" </td>
\n
"
;
}
/* Show days of the current month */
...
...
@@ -323,7 +332,7 @@ for($iter_week = 0; $iter_week < 6 ; $iter_week++)
$style
=
'cal_current_month'
;
echo
' <td class="'
.
$style
.
'" width="14%" valign="top" nowrap="nowrap">'
;
show_day_events
(
$db
,
$day
,
$month
,
$year
,
$style
,
$actionarray
);
show_day_events
(
$db
,
$day
,
$month
,
$year
,
$style
,
$actionarray
,
3
);
echo
" </td>
\n
"
;
}
/* Show days after the current month (next month) */
...
...
@@ -331,7 +340,7 @@ for($iter_week = 0; $iter_week < 6 ; $iter_week++)
{
$style
=
'cal_other_month'
;
echo
' <td class="'
.
$style
.
'" width="14%" valign="top" nowrap="nowrap">'
;
show_day_events
(
$db
,
$day
-
$max_day_in_month
,
$next_month
,
$next_year
,
$style
,
$actionarray
);
show_day_events
(
$db
,
$day
-
$max_day_in_month
,
$next_month
,
$next_year
,
$style
,
$actionarray
,
3
);
echo
"</td>
\n
"
;
}
$day
++
;
...
...
@@ -339,6 +348,25 @@ for($iter_week = 0; $iter_week < 6 ; $iter_week++)
echo
" </tr>
\n
"
;
}
echo
"</table>
\n
"
;
}
else
{
$style
=
'cal_current_month'
;
$timestamp
=
dolibarr_mktime
(
12
,
0
,
0
,
$month
,
$_GET
[
"day"
],
$year
);
$arraytimestamp
=
adodb_getdate
(
dolibarr_mktime
(
12
,
0
,
0
,
$month
,
$_GET
[
"day"
],
$year
));
$dayname
=
array
(
'0'
=>
'Sunday'
,
'1'
=>
'Monday'
,
'2'
=>
'Tuesday'
,
'3'
=>
'Wednesday'
,
'4'
=>
'Thursday'
,
'5'
=>
'Friday'
,
'6'
=>
'Saturday'
);
echo
'<table width="100%" class="nocellnopadd">'
;
echo
' <tr class="liste_titre">'
;
echo
' <td align="center">'
.
$langs
->
trans
(
$dayname
[
$arraytimestamp
[
'wday'
]])
.
"</td>
\n
"
;
echo
" </tr>
\n
"
;
echo
" <tr>
\n
"
;
echo
' <td class="'
.
$style
.
'" width="14%" valign="top" nowrap="nowrap">'
;
show_day_events
(
$db
,
$_GET
[
"day"
],
$month
,
$year
,
$style
,
$actionarray
);
echo
"</td>
\n
"
;
echo
" </tr>
\n
"
;
echo
'</table>'
;
}
$db
->
close
();
...
...
@@ -346,20 +374,31 @@ $db->close();
llxFooter
(
'$Date$ - $Revision$'
);
/** \brief Show event of a particular day
/**
* \brief Show event of a particular day
*
* @param unknown_type $db Database handler
* @param unknown_type $day Day
* @param unknown_type $month Month
* @param unknown_type $year Year
* @param unknown_type $style Style to use for this day
* @param unknown_type $actionarray Array of actions
* @param unknown_type $maxPrint Nb of actions to show each day on month view
*/
function
show_day_events
(
$db
,
$day
,
$month
,
$year
,
$style
,
$actionarray
)
function
show_day_events
(
$db
,
$day
,
$month
,
$year
,
$style
,
$actionarray
,
$maxPrint
=-
1
)
{
global
$user
,
$conf
,
$langs
;
global
$filtera
,
$filtert
,
$filted
;
global
$theme_datacolor
;
if
(
$_GET
[
"action"
]
==
'maxPrint'
)
{
$maxPrint
=-
1
;
}
$curtime
=
dolibarr_mktime
(
0
,
0
,
0
,
$month
,
$day
,
$year
);
print
'<table class="nobordernopadding" width="100%">'
;
print
'<tr style="background: #EEEEEE"><td align="left" nowrap="nowrap">'
;
print
dolibarr_print_date
(
$curtime
,
'%a %d'
);
print
'<a href="'
.
DOL_URL_ROOT
.
'/comm/action/index.php?action=show_day&day='
.
str_pad
(
$day
,
2
,
"0"
,
STR_PAD_LEFT
)
.
'&month='
.
$month
.
'&year='
.
$year
.
'">'
.
dolibarr_print_date
(
$curtime
,
'%a %d'
)
.
'</a>'
;
print
'</td><td align="right" nowrap="nowrap">'
;
print
'<a href="'
.
DOL_URL_ROOT
.
'/comm/action/fiche.php?action=create&datep='
.
sprintf
(
"%04d%02d%02d"
,
$year
,
$month
,
$day
)
.
'">'
;
print
img_picto
(
$langs
->
trans
(
"NewAction"
),
'edit_add.png'
);
...
...
@@ -369,6 +408,8 @@ function show_day_events($db, $day, $month, $year, $style, $actionarray)
//$curtime = dolibarr_mktime (0, 0, 0, $month, $day, $year);
$i
=
0
;
$ok
=
true
;
foreach
(
$actionarray
as
$daykey
=>
$notused
)
{
$annee
=
date
(
'Y'
,
$daykey
);
...
...
@@ -377,6 +418,9 @@ function show_day_events($db, $day, $month, $year, $style, $actionarray)
if
(
$day
==
$jour
&&
$month
==
$mois
&&
$year
==
$annee
)
{
foreach
(
$actionarray
[
$daykey
]
as
$index
=>
$action
)
{
if
(
$i
<
$maxPrint
||
$maxPrint
==
-
1
)
{
$ponct
=
(
$action
->
date_start_in_calendar
==
$action
->
date_end_in_calendar
);
// Show rect of event
...
...
@@ -424,6 +468,12 @@ function show_day_events($db, $day, $month, $year, $style, $actionarray)
print
'</td></tr></table>'
;
$i
++
;
}
else
if
(
$ok
)
{
print
'<a href="'
.
DOL_URL_ROOT
.
'/comm/action/index.php?action=maxPrint&month='
.
$month
.
'&year='
.
$year
.
'">'
.
img_picto
(
"all"
,
"1downarrow_selected.png"
)
.
'</a>'
;
$ok
=
false
;
}
}
}
}
if
(
!
$i
)
print
' '
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment