Updating explain.php
authorRobert Sesek <rsesek@bluestatic.org>
Fri, 22 Aug 2008 22:14:53 +0000 (18:14 -0400)
committerRobert Sesek <rsesek@bluestatic.org>
Fri, 22 Aug 2008 22:14:53 +0000 (18:14 -0400)
explain.php
templates/explain_product.tpl

index ebe272cc00e4d6007783790e622afba091df5c15..265b7e4f98b44a40574db337277c03322ef83a3f 100644 (file)
@@ -67,47 +67,59 @@ if ($_REQUEST['do'] == 'products')
        // global versions
        if (is_array($versions['0']))
        {
-               foreach ($versions['0'] AS $version)
+               foreach ($versions['0'] as $version)
                {
-                       $left = $version['version'];
-                       $right = null;
-                       eval('$globalversions .= "' . $template->fetch('explain_row') . '";');
+                       $tpl = new BSTemplate('explain_row');
+                       $tpl->vars = array(
+                               'left'          => $version['version'],
+                       );
+                       $globalversions .= $tpl->evaluate()->getTemplate();
                }
        }
        
-       foreach ($products AS $product)
+       foreach ($products as $product)
        {
-               $left = $product['title'];
-               $right = $product['description'];
-               $trextra = ' class="altcolor"';
-               eval('$productlist .= "' . $template->fetch('explain_row') . '";');
+               $tpl = new BSTemplate('explain_row');
+               $tpl->vars = array(
+                       'left'          => $product['title'],
+                       'right'         => $product['description'],
+                       'trextra'       => ' class="altcolor"'
+               );
+               $productlist .= $tpl->evaluate()->getTemplate();
                
                if (is_array($components["$product[productid]"]))
                {
-                       foreach ($components["$product[productid]"] AS $component)
+                       foreach ($components["$product[productid]"] as $component)
                        {
-                               $left = '&nbsp; &rsaquo; &nbsp; ' . $component['title'];
-                               $right = $component['description'];
-                               $trextra = '';
-                               eval('$productlist .= "' . $template->fetch('explain_row') . '";');
+                               $tpl = new BSTemplate('explain_row');
+                               $tpl->vars = array(
+                                       'left'          => '&nbsp; &rsaquo; &nbsp; ' . $component['title'],
+                                       'right'         => $component['description'],
+                               );
+                               $productlist .= $tpl->evaluate()->getTemplate();
                        }
                }
        }
        
-       eval('$template->flush("' . $template->fetch('explain_product') . '");');
+       $tpl = new BSTemplate('explain_product');
+       $tpl->vars = array(
+               'globalversions'        => $globalversions,
+               'productlist'           => $productlist
+       );
+       $tpl->evaluate()->flush();
 }
 
 // ###################################################################
 
 if ($_REQUEST['do'] == 'automations')
 {
-       $fields_fetch = $bugsys->db->query("
+       $fields_fetch = $db->query("
                SELECT bugfield.*, MAX(permission.mask) AS mask
                FROM " . TABLE_PREFIX . "bugfield AS bugfield
                LEFT JOIN " . TABLE_PREFIX . "bugfieldpermission AS permission
                        ON (bugfield.fieldid = permission.fieldid)
                WHERE (permission.mask = 2 OR permission.mask = 1)
-               AND permission.usergroupid IN ({bugdar::$userinfo['usergroupid']}" . (sizeof(bugdar::$userinfo['groupids']) != 0 ? ',' . implode(',', bugdar::$userinfo['groupids']) : '') . ")
+               AND permission.usergroupid IN (" . bugdar::$userinfo['usergroupid'] . (sizeof(bugdar::$userinfo['groupids']) != 0 ? ',' . implode(',', bugdar::$userinfo['groupids']) : '') . ")
                GROUP BY (bugfield.fieldid)
        ");
        foreach ($fields_fetch as $field)
@@ -117,23 +129,27 @@ if ($_REQUEST['do'] == 'automations')
        
        if (is_array(bugdar::$datastore['automation']))
        {
-               foreach (bugdar::$datastore['automation'] AS $automation)
+               foreach (bugdar::$datastore['automation'] as $automation)
                {
                        $automation['fieldchanges'] = unserialize($automation['fieldchanges']);
                        
-                       $left = $automation['name'];
-                       $right = $automation['description'];
-                       $trextra = ' class="listinghead"';
-                       
-                       eval('$automations .= "' . $template->fetch('explain_row') . '";');
+                       $tpl = new BSTemplate('explain_row');
+                       $tpl->vars = array(
+                               'left'          => $automation['name'],
+                               'right'         => $automation['description'],
+                               'trextra'       => ' class="listinghead"'
+                       );
+                       $automations .= $tpl->evaluate()->getTemplate();
                        
                        if ($automation['comment'])
                        {
-                               $left = T('Add Comment');
-                               $right = $automation['comment'];
-                               $trextra = ' class="altcolor"';
-                               
-                               eval('$automations .= "' . $template->fetch('explain_row') . '";');
+                               $tpl = new BSTemplate('explain_row');
+                               $tpl->vars = array(
+                                       'left'          => T('Add Comment'),
+                                       'right'         => $automation['comment'],
+                                       'trextra'       => ' class="altcolor"'
+                               );
+                               $automations .= $tpl->evaluate()->getTemplate();
                        }
                        
                        $trextra = '';
@@ -142,9 +158,12 @@ if ($_REQUEST['do'] == 'automations')
                        {
                                foreach ($automation['fieldchanges']['builtin'] AS $name => $value)
                                {
-                                       $left = $name;
-                                       $right = bugdar::$datastore["$left"]["$value"]["$left"];
-                                       eval('$automations .= "' . $template->fetch('explain_row') . '";');
+                                       $tpl = new BSTemplate('explain_row');
+                                       $tpl->vars = array(
+                                               'left'          => $name,
+                                               'right'         => bugdar::$datastore["$name"]["$value"]["$name"],
+                                       );
+                                       $automations .= $tpl->evaluate()->getTemplate();
                                }
                        }
                        
@@ -157,15 +176,20 @@ if ($_REQUEST['do'] == 'automations')
                                                continue;
                                        }
                                        
-                                       $left = $fields["$id"]['name'] . ' ' . sprintf(T('(Custom #%1$d, type: %2$s)'), $id, $fields["$id"]['type']);
-                                       $right = $value;
-                                       eval('$automations .= "' . $template->fetch('explain_row') . '";');
+                                       $tpl = new BSTemplate('explain_row');
+                                       $tpl->vars = array(
+                                               'left'          => $fields["$id"]['name'] . ' ' . sprintf(T('(Custom #%1$d, type: %2$s)'), $id, $fields["$id"]['type']),
+                                               'right'         => $value,
+                                       );
+                                       $automations .= $tpl->evaluate()->getTemplate();
                                }
                        }
                }
        }
        
-       eval('$template->flush("' . $template->fetch('explain_automation') . '");');
+       $tpl = new BSTemplate('explain_automation');
+       $tpl->vars = array('automations' => $automations);
+       $tpl->evaluate()->flush();
 }
 
 /*=====================================================================*\
index c16a459efcd88304053565d5a92a5a3703816582..7bc71f412f7c5c1385941573197b3e58e775ba4a 100644 (file)
@@ -27,7 +27,7 @@
 
 <table class="table">
 <tr class="listinghead">
-       <td colspan="2">{@"Products (components are in white)"}</td>
+       <td colspan="2"><%-T("Products (components are in white)")%></td>
 </tr>
 <%- $productlist %>
 </table>