r1194: Lots of changes to get the internals of the rename to work
[bugdar.git] / explain.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar [#]version[#]
5 || # Copyright ©2002-[#]year[#] Blue Static
6 || #
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
10 || #
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 || # more details.
15 || #
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
21
22 $fetchtemplates = array(
23 'explain_product',
24 'explain_automation',
25 'explain_row'
26 );
27
28 define('SVN', '$Id$');
29
30 $focus['showreport'] = 'focus';
31
32 require_once('./global.php');
33
34 // ###################################################################
35
36 if (empty($_REQUEST['do']))
37 {
38 $_REQUEST['do'] = 'products';
39 }
40
41 // ###################################################################
42
43 if ($_REQUEST['do'] == 'products')
44 {
45 foreach ($bugsys->datastore['product'] AS $product)
46 {
47 if ($product['componentmother'])
48 {
49 $components["$product[componentmother]"]["$product[productid]"] = $product;
50 }
51 else
52 {
53 $products["$product[productid]"] = $product;
54 }
55 }
56
57 foreach ($bugsys->datastore['version'] AS $version)
58 {
59 $versions["$version[productid]"]["$version[versionid]"] = $version;
60 }
61
62 // global versions
63 if (is_array($versions['0']))
64 {
65 foreach ($versions['0'] AS $version)
66 {
67 $left = $version['version'];
68 $right = null;
69 eval('$globalversions .= "' . $template->fetch('explain_row') . '";');
70 }
71 }
72
73 foreach ($products AS $product)
74 {
75 $left = $product['title'];
76 $right = $product['description'];
77 $trextra = ' style="background-color: ' . $stylevar['alt_color'] . '"';
78 eval('$productlist .= "' . $template->fetch('explain_row') . '";');
79
80 foreach ($components["$product[productid]"] AS $component)
81 {
82 $left = '&nbsp; &rsaquo; &nbsp; ' . $component['title'];
83 $right = $component['description'];
84 $trextra = '';
85 eval('$productlist .= "' . $template->fetch('explain_row') . '";');
86 }
87 }
88
89 eval('$template->flush("' . $template->fetch('explain_product') . '");');
90 }
91
92 // ###################################################################
93
94 if ($_REQUEST['do'] == 'automations')
95 {
96 $fields_fetch = $bugsys->db->query("
97 SELECT bugfield.*, permission.mask
98 FROM " . TABLE_PREFIX . "bugfield AS bugfield
99 LEFT JOIN " . TABLE_PREFIX . "bugfieldpermission AS permission
100 ON (bugfield.fieldid = permission.fieldid)
101 WHERE (permission.mask = 2 OR permission.mask = 1)
102 AND permission.usergroupid = {$bugsys->userinfo['usergroupid']}"
103 );
104 while ($field = $bugsys->db->fetch_array($fields_fetch))
105 {
106 $fields["$field[fieldid]"] = $field;
107 }
108
109 if (is_array($bugsys->datastore['automation']))
110 {
111 foreach ($bugsys->datastore['automation'] AS $automation)
112 {
113 $automation['fieldchanges'] = unserialize($automation['fieldchanges']);
114
115 $left = $automation['name'];
116 $right = $automation['description'];
117 $trextra = ' class="listinghead"';
118
119 eval('$automations .= "' . $template->fetch('explain_row') . '";');
120
121 if ($automation['comment'])
122 {
123 $left = _('Add Comment');
124 $right = $automation['comment'];
125 $trextra = ' style="background-color: ' . $stylevar['alt_color'] . '"';
126
127 eval('$automations .= "' . $template->fetch('explain_row') . '";');
128 }
129
130 $trextra = '';
131
132 if (is_array($automation['fieldchanges']['builtin']))
133 {
134 foreach ($automation['fieldchanges']['builtin'] AS $name => $value)
135 {
136 $left = $name;
137 $right = $bugsys->datastore["$left"]["$value"]["$left"];
138 eval('$automations .= "' . $template->fetch('explain_row') . '";');
139 }
140 }
141
142 if (is_array($automation['fieldchanges']['custom']))
143 {
144 foreach ($automation['fieldchanges']['custom'] AS $id => $value)
145 {
146 if (!$fields["$id"])
147 {
148 continue;
149 }
150
151 $left = $fields["$id"]['name'] . ' ' . sprintf(_('(Custom #%1$d, type: %2$s)'), $id, $fields["$id"]['type']);
152 $right = $value;
153 eval('$automations .= "' . $template->fetch('explain_row') . '";');
154 }
155 }
156 }
157 }
158
159 eval('$template->flush("' . $template->fetch('explain_automation') . '");');
160 }
161
162 /*=====================================================================*\
163 || ###################################################################
164 || # $HeadURL$
165 || # $Id$
166 || ###################################################################
167 \*=====================================================================*/
168 ?>