-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlists.php
134 lines (115 loc) · 3.93 KB
/
lists.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
<?php
/*
firefox has global setting
about:config > dom.popup_maximum
default 20, set to 50 or 100
*/
include_once('header.php');
require_once("headerDB.inc.php");
// get active visions
$values['type']= "v";
$values['isSomeday'] = "n";
$stem = " WHERE ".sqlparts("typefilter",$config,$values)
." AND ".sqlparts("activeitems",$config,$values);
$values['filterquery'] = $stem." AND ".sqlparts("issomeday",$config,$values);
$vres = query("getitems",$config,$values,$sort);
// get someday lists
$sdays = array();
$listMena = array();
$values = array();
$values['qId'] = 1000;
$lists = query('lookupqualities',$config,$values,$sort);
if (count($lists) > 0 && is_array($lists)) {
foreach ((array) $lists as $l) {
if ($l['value'] == 'y') {
$sdays[] = $l;
}
}
}
// get and list CLs and lists
foreach ((array) $vres as $visn) {
$values = array();
$values['parentId'] = $visn['itemId'];
$values['type'] = 'c';
$clists = query("getchildlists",$config,$values,$sort);
$values['type'] = 'l';
$lists = query("getchildlists",$config,$values,$sort);
if (!empty($lists) && is_array($lists) && count($lists) > 0 && !empty($clists) && is_array($clists) && count($clists) > 0) {
$lists = array_merge($clists,$lists);
} elseif (!empty($clists) && is_array($clists) && count($clists) > 0) {
$lists = $clists;
}
if (!empty($lists) && is_array($lists) && count($lists) > 0) {
foreach ((array) $lists as $list) {
// if someday list, continue
foreach ((array) $sdays as $s) {
if (
$s['visId'] == $visn['itemId'] &&
$s['itemId'] == $list['listId'] &&
$s['itemType'] == $list['type']
) continue 2;
}
// exclude lists without priorities unless all (unprioritised) requested
if (!isset($_GET['unprioritised'])) {
if ($list['type'] == 'c') $check = 'check';
else $check = '';
$values['queryTable'] = $check . 'listitems';
$values['queryKey'] = $check . 'listId';
$values['queryValue'] = $list['listId'];
$priorities = query("priorityselectbox",$config,$values,$sort);
if (count($priorities) == 1) continue 1;
}
// otherwise, add to menu
// get list details
$values['listId'] = $list['listId'];
$values['type'] = $list['type'];
if ($list['type'] == 'c') { $qry = "selectchecklist"; } else { $qry = "selectlist"; }
$listN = query($qry,$config,$values,$sort);
$listNarr = array(
'listId' => $list['listId'],
'type' => $list['type'],
'title' => makeclean($listN[0]['title'] . ($list['type'] == 'c' ? ' .CL' : ' .LIST')),
'sortBy' => substr($listN[0]['sortBy'], 0, 2)
);
$listMena[] = $listNarr;
}
}
}
// sort order for lists
function sortBys ($a, $b) {
return $a['sortBy'] - $b['sortBy'];
}
usort($listMena, 'sortBys');
#echo '<pre>';var_dump($listMena);die;
?>
<html>
<body onload="pertinent()">
<script>
function pertinent() {
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
var windows = [
<?php
$comma = '';
foreach ($listMena as $l) {
echo $comma. "'reportLists.php?listId={$l['listId']}&type={$l['type']}'";
$comma = ',';
}
?>
,'reportLists.php?listId=1&type=c' // first/current window
];
var arrayLength = windows.length;
async function display() {
for (var i = 0; i < arrayLength - 1; i++) { // skip the last array item
window.open(windows[i]);
await sleep(200); // avoid windows from not opening due to server restrictions
}
window.location.assign(windows[i]); // first/current window
}
display();
return true;
}
</script>
</body>
</html>