]>
src.bluestatic.org Git - bugdar.git/blob - explain.php
2 /*=====================================================================*\
3 || ###################################################################
5 || # Copyright (c)2004-2009 Blue Static
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 2 of the License.
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
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 \*=====================================================================*/
22 $fetchtemplates = array(
29 $focus['showreport'] = 'focus';
31 require_once('./global.php');
33 // ###################################################################
35 if (empty($_REQUEST['do']))
37 $_REQUEST['do'] = 'products';
40 // ###################################################################
42 if ($_REQUEST['do'] == 'products')
44 if (!is_array(bugdar
::$datastore['product']))
46 $message->error(T('There are no products set up.'));
49 foreach (bugdar
::$datastore['product'] AS $product)
51 if ($product['parentid'])
53 $components["$product[componentmother]"]["$product[productid]"] = $product;
57 $products["$product[productid]"] = $product;
61 foreach (bugdar
::$datastore['version'] AS $version)
63 $versions["$version[productid]"]["$version[versionid]"] = $version;
67 if (is_array($versions['0']))
69 foreach ($versions['0'] as $version)
71 $tpl = new BSTemplate('explain_row');
73 'left' => $version['version'],
75 $globalversions .= $tpl->evaluate()->getTemplate();
79 foreach ($products as $product)
81 $tpl = new BSTemplate('explain_row');
83 'left' => $product['title'],
84 'right' => $product['description'],
85 'trextra' => ' class="altcolor"'
87 $productlist .= $tpl->evaluate()->getTemplate();
89 if (is_array($components["$product[productid]"]))
91 foreach ($components["$product[productid]"] as $component)
93 $tpl = new BSTemplate('explain_row');
95 'left' => ' › ' . $component['title'],
96 'right' => $component['description'],
98 $productlist .= $tpl->evaluate()->getTemplate();
103 $tpl = new BSTemplate('explain_product');
105 'globalversions' => $globalversions,
106 'productlist' => $productlist
108 $tpl->evaluate()->flush();
111 // ###################################################################
113 if ($_REQUEST['do'] == 'automations')
115 $fields_fetch = $db->query("
116 SELECT bugfield.*, MAX(permission.mask) AS mask
117 FROM " . TABLE_PREFIX
. "bugfield AS bugfield
118 LEFT JOIN " . TABLE_PREFIX
. "bugfieldpermission AS permission
119 ON (bugfield.fieldid = permission.fieldid)
120 WHERE (permission.mask = 2 OR permission.mask = 1)
121 AND permission.usergroupid IN (" . bugdar
::$userinfo['usergroupid'] . (sizeof(bugdar
::$userinfo['groupids']) != 0 ? ',' . implode(',', bugdar
::$userinfo['groupids']) : '') . ")
122 GROUP BY (bugfield.fieldid)
124 foreach ($fields_fetch as $field)
126 $fields["$field[fieldid]"] = $field;
129 if (is_array(bugdar
::$datastore['automation']))
131 foreach (bugdar
::$datastore['automation'] as $automation)
133 $automation['fieldchanges'] = unserialize($automation['fieldchanges']);
135 $tpl = new BSTemplate('explain_row');
137 'left' => $automation['name'],
138 'right' => $automation['description'],
139 'trextra' => ' class="listinghead"'
141 $automations .= $tpl->evaluate()->getTemplate();
143 if ($automation['comment'])
145 $tpl = new BSTemplate('explain_row');
147 'left' => T('Add Comment'),
148 'right' => $automation['comment'],
149 'trextra' => ' class="altcolor"'
151 $automations .= $tpl->evaluate()->getTemplate();
156 if (is_array($automation['fieldchanges']['builtin']))
158 foreach ($automation['fieldchanges']['builtin'] AS $name => $value)
160 $tpl = new BSTemplate('explain_row');
163 'right' => bugdar
::$datastore["$name"]["$value"]["$name"],
165 $automations .= $tpl->evaluate()->getTemplate();
169 if (is_array($automation['fieldchanges']['custom']))
171 foreach ($automation['fieldchanges']['custom'] AS $id => $value)
178 $tpl = new BSTemplate('explain_row');
180 'left' => $fields["$id"]['name'] . ' ' . sprintf(T('(Custom #%1$d, type: %2$s)'), $id, $fields["$id"]['type']),
183 $automations .= $tpl->evaluate()->getTemplate();
189 $tpl = new BSTemplate('explain_automation');
190 $tpl->vars
= array('automations' => $automations);
191 $tpl->evaluate()->flush();