-
Notifications
You must be signed in to change notification settings - Fork 8
/
summary.php
162 lines (143 loc) · 5.49 KB
/
summary.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<?php
$title='Summary';
include_once 'header.inc.php';
$values=array();
//SQL Code
//get # space contexts
$res = query("countspacecontexts",$values);
$numbercontexts=(is_array($res[0]))?(int) $res[0]['COUNT(*)']:0;
//count active items
$values['type'] = "a";
$values['isSomeday'] = "n";
$values['childfilterquery'] = " WHERE ".sqlparts("typefilter",$values)
." AND ".sqlparts("issomeday",$values)
." AND ".sqlparts("activeitems",$values)
." AND ".sqlparts("pendingitems",$values);
$values['filterquery'] = " WHERE ".sqlparts("liveparents",$values);
//get # nextactions
$res = query("countnextactions",$values);
$actionsdue=$nextactionsdue=array('-1'=>0,'0'=>0,'1'=>0,'2'=>0,'3'=>0,'4'=>0);
if (is_array($res))
foreach ($res as $line) {
$nextactionsdue[$line['duecategory']]=$line['nnextactions'];
$actionsdue[$line['duecategory']]=$line['nactions'];
}
$numbernextactions=array_sum($nextactionsdue);
$numberactions=array_sum($actionsdue);
// get and count active projects
$values['type']= "p";
$values['isSomeday'] = "n";
$stem = " WHERE ".sqlparts("typefilter",$values)
." AND ".sqlparts("activeitems",$values)
." AND ".sqlparts("pendingitems",$values);
$values['filterquery'] = $stem." AND ".sqlparts("issomeday",$values);
$pres = query("getitems",$values);
$numberprojects=($pres)?count($pres):0;
//get and count someday projects
$values['isSomeday'] = "y";
$values['filterquery'] = $stem." AND ".sqlparts("issomeday",$values);
$sm = query("getitems",$values);
$numbersomeday=($sm)?count($sm):0;
// count inbox items
$values=array('type'=>'i');
$values['filterquery']=' WHERE '.sqlparts('typefilter',$values)
.' AND '.sqlparts('pendingitems',$values);
$result = query("counttype",$values);
$inboxcount= ($result) ? $result[0]['cnt'] : 0;
gtd_handleEvent(_GTD_ON_DATA,$pagename);
/*----------------------------------------------------------------
display page
*/
echo '<h4>Today is '.date($_SESSION['config']['datemask']).'. (Week '.date("W").'/52 & Day '.date("z").'/'.(365+date("L")).')</h4>'."\n";
echo "<div class='reportsection'>\n";
if($numbernextactions==1) {
$verb='is';
$plural='';
} else {
$verb='are';
$plural='s';
}
$space1=" in $numbercontexts <a href='reportContext.php'>Spatial Context"
.(($numbercontexts==1)?'':'s') . "</a>";
if ($_SESSION['config']["contextsummary"]) {
$space2='';
} else {
$space2=$space1;
$space1='';
}
echo "<p>There $verb $numbernextactions"
," <a href='listItems.php?type=a&nextonly=true'>Next Action$plural</a> pending$space1, of which <span"
,($nextactionsdue['2']==0)?'>' : " class='due'>"
,($nextactionsdue['2']==1)?'1 action is':"{$nextactionsdue['2']} actions are"
," due today</span>, <span"
,($nextactionsdue['3']==0)?'>' : " class='overdue'>"
,($nextactionsdue['3']==1)?'1 is':"{$nextactionsdue['3']} are"
," now overdue</span>, and <span"
,($nextactionsdue['1']==0)?'>' : " class='comingdue'>"
,($nextactionsdue['1']==1)?"1 has its deadline":"{$nextactionsdue['1']} have deadlines"
," in the coming 7 days</span>. Altogether, there "
,($numberactions==1)?'is 1':"are $numberactions"
," <a href='listItems.php?type=a'>Action"
,($numberactions==1)?'':'s'
,"</a>$space2, \n"
,($inboxcount)?"and <a href='listItems.php?type=i'>$inboxcount inbox item(s)</a>":'and no inbox items'
,".</p>\n";
echo "</div>\n<div class='reportsection'>\n";
$numdue=0;
$numoverdue=0;
for ($i=0; $i<$numberprojects;$i++) {
if (empty($pres[$i]['deadline'])) {
// do nothing
} elseif ($pres[$i]['deadline'] < date("Y-m-d")) {
$pres[$i]['td.class']='celloverdue';
$pres[$i]['td.title']='Project overdue';
$numoverdue++;
} elseif ($pres[$i]['deadline'] === date("Y-m-d")) {
$pres[$i]['td.class']='celldue';
$pres[$i]['td.title']='Project due for completion today';
$numdue++;
}
}
echo '<p>';
if($numberprojects==1){
echo 'There is 1 active <a href="listItems.php?type=p">Project</a>'
,($numdue) ?", which is <span class='due'>due today</span>":''
,($numoverdue)?", which is <span class='overdue'>overdue</span>" :'';
}else{
echo "There are $numberprojects active <a href='listItems.php?type=p'>Projects</a>"
," with <span"
,($numdue)?" class='due'>":'>'
,"$numdue due today</span> and <span"
,($numoverdue)?" class='overdue'>":'>'
,"$numoverdue overdue</span>";
}
echo ".</p>\n";
if($numberprojects) {
echo "<table summary='table of projects'><tbody>\n"
,columnedTable(3,$pres)
,"</tbody></table>\n";
}
echo "</div>\n";
echo "<div class='reportsection'>\n";
if($numbersomeday==1){
echo '<p>There is 1 <a href="listItems.php?type=p&someday=true">Someday/Maybe</a>.</p>'."\n";
}else{
echo '<p>There are ' .$numbersomeday.' <a href="listItems.php?type=p&someday=true">Someday/Maybes</a>.</p>'."\n";
}
if($numbersomeday) {
echo "<table summary='table of someday/maybe items'><tbody>\n"
,columnedTable(3,$sm)
,"</tbody></table>\n";
}
echo "</div>\n";
if ( $_SESSION['config']['showTreeInSummary'] ) {
echo "<div class='reportsection'>\n";
$_REQUEST['addonid']="tree";
$_REQUEST['url']="maketree.inc.php";
if ( !array_key_exists('showfrom', $_GET ) ) $_GET['showfrom']="p";
if ( !array_key_exists( 'showto',$_GET ) ) $_GET['showto']="p";
include 'addon.php';
echo "</div>\n";
}
include_once 'footer.inc.php';
?>