This repository has been archived by the owner on Jan 3, 2023. It is now read-only.
forked from sjsrey/gtd-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisplayItems.inc.php
163 lines (161 loc) · 7.36 KB
/
displayItems.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
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
163
<thead>
<tr><th class='hidden col-id'>id</th>
<?php foreach ($dispArray as $key=>$val)
echo '<th class="col-',$key
,($show[$key])?'':' hidden'
,'">',$val,"</th>\n";
?>
</tr>
</thead>
<?php if (!empty($tfoot)) echo $tfoot; ?>
<tbody>
<?php
$showclass=array();
$localRef= (empty($maintableReferrer)) ? '' : ("&referrer=".rawurlencode($maintableReferrer));
foreach ($dispArray as $key=>$val)
$showclass[$key]=($show[$key])?'':' hidden';
foreach ($maintable as $row) {
echo '<tr'
,(!empty($row['row.class']))?" class='{$row['row.class']}' ":''
,">\n";
echo "<td class='hidden col-id'><input type='hidden' name='id' value='{$row['itemId']}' />{$row['itemId']}</td>";
foreach ($dispArray as $key=>$val) {
echo '<td class="col-',$key
,(empty($row[$key.'.class']))?'':' '.$row[$key.'.class']
,$showclass[$key],'"'
,(empty($row[$key.'.title']))?'':(' title="'.$row[$key.'.title'].'"')
,'>';
switch ($key) {
case 'assignType':
echo "<a href='assignType.php?itemId={$row['itemId']}";
if (!empty($afterTypeChange))
echo "&referrer=$afterTypeChange";
elseif (!empty($referrer))
echo "&referrer=$referrer";
echo "'>Process</a>";
break;
case 'category':
if (!empty($row[$key.'Id']))
echo "<a href='listItems.php?categoryId=",$row[$key.'Id'],"' title='Show all in this category'>{$row[$key]}</a>";
else
echo ' ';
break;
case 'checkbox':
if (!empty($row['checkboxname']))
echo "<input name='{$row['checkboxname']}' value='{$row['checkboxvalue']}' type='checkbox'"
,(empty($row['checkboxchecked'])) ? '' : " checked='checked' "
,(empty($row['checkboxdisabled'])) ? '' : " disabled='disabled' "
,"/>";
break;
case 'context':
if ($row[$key]=='')
echo ' ';
else
echo "<a href='reportContext.php#c",$row[$key.'Id'],"' title='Go to the ",$row[$key]," context report'>{$row[$key]}</a>";
break;
case 'dateCreated': // flows through to case 'tickledate' deliberately
case 'dateCompleted': // flows through to case 'tickledate' deliberately
case 'tickledate':
if ($row[$key]) echo date($_SESSION['config']['datemask'],$row[$key]);
break;
case 'desiredOutcome': // flows through to case 'description' deliberately
case 'shortdesc': // flows through to case 'description' deliberately
case 'shortoutcome': // flows through to case 'description' deliberately
case 'description':
echo trimTaggedString($row[$key],$trimlength);
break;
case 'flags':
if ($row[$key]==='')
echo ' ';
else
echo "<a class='noNextAction' title='"
,($row[$key]==='noNA')?
"No next action - click to assign one' href='itemReport.php?itemId="
:("No children - click to create one' href='item.php?type=".$row['childtype'].'&parentId=')
,$row['itemId'],"'>!"
,($row[$key]==='noChild')?'!':' '
,"</a>";
break;
case 'lastModified':
if ($row[$key]) echo date($_SESSION['config']['datemask'].' H:i:s',$row[$key]);
break;
case 'NA':
if ($row[$key]!==null)
echo "<input name='isNAs[]' value='{$row['itemId']}'"
,"type='",(empty($dispArray[$key.'.type']))?'checkbox':'radio',"'"
,($row[$key])?" checked='checked' ":''
,(empty($row['NAdisabled'])) ? '' : " disabled='disabled' "
,' />';
break;
case 'parent':
if (empty($row[$key.'Id']))
echo ' ';
else {
$out='';
$brk='';
$pids=explode(',',$row['parentId']);
$pnames=explode($_SESSION['config']['separator'],$row['ptitle']);
foreach ($pids as $pkey=>$pid) {
echo "$brk<a href='itemReport.php?itemId=$pid' title='View report'>"
,makeclean($pnames[$pkey])
,"</a> ";
$brk="<br>\n";
}
}
break;
// for case:shortdesc and case:shortoutcome, see case:description, above
case 'spatialcontext':
if ($row[$key]=='')
echo ' ';
else
echo "<a href='listItems.php?contextId=",$row[$key.'Id'],"' title='List all items in this spatial context'>{$row[$key]}</a>";
break;
case 'tags':
if (empty($row[$key])) break;
$tags=explode(',',$row[$key]);
$sep='';
foreach ($tags as $tag) {
echo "$sep<a href='listItems.php?tags=$tag'>$tag</a>";
$sep=', ';
}
break;
case 'timeframe':
if (!empty($row[$key.'Id']))
echo "<a href='reportContext.php#c{$row['contextId']}t{$row['timeframeId']}' title='Go to the context report'>{$row[$key]}</a>";
else
echo ' ';
break;
case 'title':
$cleaned=makeclean($row[$key]);
if ($row['itemId']===null || (isset($row['type']) && $row['type']==='i')) {
echo $cleaned;
} else {
if ($row['itemId'][0]!=='0')
echo "<a href='itemReport.php?itemId={$row['itemId']}'>"
,"<img src='themes/{$_SESSION['theme']}/report.gif' class='noprint' alt='Report' title='View Report' /></a>";
echo "<a href='item.php?itemId={$row['itemId']}$localRef'>"
,"<img src='themes/{$_SESSION['theme']}/edit.gif' class='noprint' alt='Edit ' title='Edit' /></a>"
,"<a "
,(empty($row['NA']))?'':"class='nextactionlink'"
," title='"
,(empty($row['doreport']))?"Edit' href='item":"View Report' href='itemReport"
,".php?itemId={$row['itemId']}$localRef'>$cleaned</a>";
}
break;
case 'type':
if (empty($row[$key]))
echo "<a href='assignType.php?itemId={$row['itemId']}'>Set type</a>";
elseif (isset($row['isSomeday']) && $row['isSomeday']==='y')
echo 'Someday';
else
echo getTypes($row[$key]);
break;
default:
echo $row[$key];
break;
}
echo "</td>\n";
}
echo "</tr>\n";
} ?>
</tbody>