]> src.bluestatic.org Git - bugdar.git/blob - explain.php
r1406: Moving the rest of the email body texts (from class_notification.php) to templates
[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 if (!is_array($bugsys->datastore['product']))
46 {
47 $message->error(_('There are no products set up.'));
48 }
49
50 foreach ($bugsys->datastore['product'] AS $product)
51 {
52 if ($product['parentid'])
53 {
54 $components["$product[componentmother]"]["$product[productid]"] = $product;
55 }
56 else
57 {
58 $products["$product[productid]"] = $product;
59 }
60 }
61
62 foreach ($bugsys->datastore['version'] AS $version)
63 {
64 $versions["$version[productid]"]["$version[versionid]"] = $version;
65 }
66
67 // global versions
68 if (is_array($versions['0']))
69 {
70 foreach ($versions['0'] AS $version)
71 {
72 $left = $version['version'];
73 $right = null;
74 eval('$globalversions .= "' . $template->fetch('explain_row') . '";');
75 }
76 }
77
78 foreach ($products AS $product)
79 {
80 $left = $product['title'];
81 $right = $product['description'];
82 $trextra = ' style="background-color: ' . $stylevar['alt_color'] . '"';
83 eval('$productlist .= "' . $template->fetch('explain_row') . '";');
84
85 if (is_array($components["$product[productid]"]))
86 {
87 foreach ($components["$product[productid]"] AS $component)
88 {
89 $left = '&nbsp; &rsaquo; &nbsp; ' . $component['title'];
90 $right = $component['description'];
91 $trextra = '';
92 eval('$productlist .= "' . $template->fetch('explain_row') . '";');
93 }
94 }
95 }
96
97 eval('$template->flush("' . $template->fetch('explain_product') . '");');
98 }
99
100 // ###################################################################
101
102 if ($_REQUEST['do'] == 'automations')
103 {
104 $fields_fetch = $bugsys->db->query("
105 SELECT bugfield.*, permission.mask
106 FROM " . TABLE_PREFIX . "bugfield AS bugfield
107 LEFT JOIN " . TABLE_PREFIX . "bugfieldpermission AS permission
108 ON (bugfield.fieldid = permission.fieldid)
109 WHERE (permission.mask = 2 OR permission.mask = 1)
110 AND permission.usergroupid = {$bugsys->userinfo['usergroupid']}"
111 );
112 while ($field = $bugsys->db->fetch_array($fields_fetch))
113 {
114 $fields["$field[fieldid]"] = $field;
115 }
116
117 if (is_array($bugsys->datastore['automation']))
118 {
119 foreach ($bugsys->datastore['automation'] AS $automation)
120 {
121 $automation['fieldchanges'] = unserialize($automation['fieldchanges']);
122
123 $left = $automation['name'];
124 $right = $automation['description'];
125 $trextra = ' class="listinghead"';
126
127 eval('$automations .= "' . $template->fetch('explain_row') . '";');
128
129 if ($automation['comment'])
130 {
131 $left = _('Add Comment');
132 $right = $automation['comment'];
133 $trextra = ' style="background-color: ' . $stylevar['alt_color'] . '"';
134
135 eval('$automations .= "' . $template->fetch('explain_row') . '";');
136 }
137
138 $trextra = '';
139
140 if (is_array($automation['fieldchanges']['builtin']))
141 {
142 foreach ($automation['fieldchanges']['builtin'] AS $name => $value)
143 {
144 $left = $name;
145 $right = $bugsys->datastore["$left"]["$value"]["$left"];
146 eval('$automations .= "' . $template->fetch('explain_row') . '";');
147 }
148 }
149
150 if (is_array($automation['fieldchanges']['custom']))
151 {
152 foreach ($automation['fieldchanges']['custom'] AS $id => $value)
153 {
154 if (!$fields["$id"])
155 {
156 continue;
157 }
158
159 $left = $fields["$id"]['name'] . ' ' . sprintf(_('(Custom #%1$d, type: %2$s)'), $id, $fields["$id"]['type']);
160 $right = $value;
161 eval('$automations .= "' . $template->fetch('explain_row') . '";');
162 }
163 }
164 }
165 }
166
167 eval('$template->flush("' . $template->fetch('explain_automation') . '");');
168 }
169
170 /*=====================================================================*\
171 || ###################################################################
172 || # $HeadURL$
173 || # $Id$
174 || ###################################################################
175 \*=====================================================================*/
176 ?>