/
timeline_inc.php
86 lines (71 loc) · 3.39 KB
/
timeline_inc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
# MantisBT - a php based bugtracking system
# MantisBT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# MantisBT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MantisBT. If not, see <http://www.gnu.org/licenses/>.
require_once( 'core.php' );
require_api( 'timeline_api.php' );
define( 'MAX_EVENTS', 50 );
$f_days = gpc_get_int( 'days', 0 );
$f_all = gpc_get_int( 'all', 0 );
$t_max_events = $f_all ? 0 : MAX_EVENTS + 1;
$t_end_time = time() - ( $f_days * SECONDS_PER_DAY );
$t_start_time = $t_end_time - ( 7 * SECONDS_PER_DAY );
$t_events = timeline_events( $t_start_time, $t_end_time, $t_max_events );
$t_collapse_block = is_collapsed( 'timeline' );
$t_block_css = $t_collapse_block ? 'collapsed' : '';
$t_block_icon = $t_collapse_block ? 'fa-chevron-down' : 'fa-chevron-up';
?>
<div id="timeline" class="widget-box widget-color-blue2 <?php echo $t_block_css ?>">
<div class="widget-header widget-header-small">
<h4 class="widget-title lighter">
<i class="ace-icon fa fa-clock-o"></i>
<?php echo lang_get( 'timeline_title' ) ?>
</h4>
<div class="widget-toolbar">
<a data-action="collapse" href="#">
<i class="1 ace-icon fa <?php echo $t_block_icon ?> bigger-125"></i>
</a>
</div>
</div>
<div class="widget-body">
<div class="widget-toolbox">
<div class="btn-toolbar">
<?php
$t_short_date_format = config_get( 'short_date_format' );
echo '  ';
echo '<span class="label label-yellow"> ' . date( $t_short_date_format, $t_start_time ) . ' </span>';
echo ' .. ';
echo '<span class="label label-yellow"> ' . date( $t_short_date_format, $t_end_time ) . ' </span>';
echo '  ';
echo '<div class="btn-group">';
echo ' <a class="btn btn-primary btn-xs btn-white btn-round" href="my_view_page.php?days=' .
( $f_days + 7 ) . '">' . lang_get( 'prev' ) . '</a>';
$t_next_days = ( $f_days - 7 ) > 0 ? $f_days - 7 : 0;
if( $t_next_days != $f_days ) {
echo ' <a class="btn btn-primary btn-xs btn-white btn-round" href="my_view_page.php?days=' .
$t_next_days . '">' . lang_get( 'next' ) . '</a>';
}
echo '</div></div></div><div class="widget-main no-padding"><div class="profile-feed">';
echo '</div></div>';
if( !$f_all && count( $t_events ) > MAX_EVENTS ) {
$t_events = array_slice( $t_events, 0, MAX_EVENTS );
timeline_print_events( $t_events );
echo '<div class="widget-toolbox">';
echo '<div class="btn-toolbar">';
echo '<a class="btn btn-primary btn-sm btn-white btn-round" href="my_view_page.php?days=' . $f_days . '&all=1">' . lang_get( 'timeline_more' ) . '</a>';
echo '</div>';
echo '</div>';
} else {
timeline_print_events( $t_events );
}
echo '</div></div>';