*
* http://virtuemart.net
*/
require_once CLASSPATH . "pageNavigation.class.php";
require_once CLASSPATH . "htmlTools.class.php";
global $ps_product_type;
$q = "SELECT * FROM #__{vm}_product_type ";
/*    $q .= "WHERE #__{vm}_category_xref.category_parent_id='";
$q .= $category_id . "' AND ";
$q .= "#__{vm}_category.category_id=#__{vm}_category_xref.category_child_id ";
$q .= "AND #__{vm}_category.vendor_id = $ps_vendor_id ";*/
$q .= "ORDER BY product_type_list_order asc ";
$db->query($q);
$num_rows = $db->num_rows();
// Create the Page Navigation
$pageNav = new vmPageNav($num_rows, $limitstart, $limit);
$q .= "LIMIT {$pageNav->limitstart}, {$pageNav->limit}";
$db->query($q);
// Create the List Object with page navigation
$listObj = new listFactory($pageNav);
// print out the search field and a list heading
$listObj->writeSearchHeader($VM_LANG->_('PHPSHOP_PRODUCT_TYPE_LIST_LBL'), IMAGEURL . "ps_image/categories.gif", $modulename, "product_type_list");
// start the list table
$listObj->startTable();
// these are the columns in the table
$columns = array("#" => "width=\"20\"", "<input type=\"checkbox\" name=\"toggle\" value=\"\" onclick=\"checkAll(" . $num_rows . ")\" />" => "width=\"20\"", $VM_LANG->_('PHPSHOP_PRODUCT_TYPE_FORM_NAME') => 'width="25%"', $VM_LANG->_('PHPSHOP_PRODUCT_TYPE_FORM_DESCRIPTION') => 'width="30%"', $VM_LANG->_('PHPSHOP_PRODUCT_TYPE_FORM_PARAMETERS') => 'width="15%"', $VM_LANG->_('PHPSHOP_PRODUCTS_LBL') => 'width="15%"', $VM_LANG->_('PHPSHOP_PRODUCT_LIST_PUBLISH') => 'width="5%"', $VM_LANG->_('PHPSHOP_MODULE_LIST_ORDER') => 'width="5%"', $VM_LANG->_('E_REMOVE') => "width=\"5%\"");
$listObj->writeTableHeader($columns);
$i = 0;
while ($db->next_record()) {
    $product_count = $ps_product_type->product_count($db->f("product_type_id"));
    $parameter_count = $ps_product_type->parameter_count($db->f("product_type_id"));
$q = '';
if (!empty($keyword)) {
    $where[] = "(group_name LIKE '%{$keyword}%' )";
}
if (!empty($where)) {
    $q = ' WHERE ' . implode(' AND ', $where);
}
$count = "SELECT count(*) as num_rows FROM " . $usergroup->_table_name . $q;
$list = "SELECT * FROM " . $usergroup->_table_name . $q;
$list .= "\nORDER BY group_level, group_name";
$list .= "\nLIMIT {$limitstart}, " . $limit;
$db->query($count);
$db->next_record();
$num_rows = $db->f("num_rows");
// Create the Page Navigation
$pageNav = new vmPageNav($num_rows, $limitstart, $limit);
// Create the List Object with page navigation
$listObj = new listFactory($pageNav);
// print out the search field and a list heading
$listObj->writeSearchHeader($VM_LANG->_('VM_USERGROUP_LIST_LBL'), VM_THEMEURL . 'images/administration/dashboard/shoppers.png', "admin", "usergroup_list");
// start the list table
$listObj->startTable();
// these are the columns in the table
$columns = array("#" => "", "<input type=\"checkbox\" name=\"toggle\" value=\"\" onclick=\"checkAll(" . $num_rows . ")\" />" => "", $VM_LANG->_('VM_USERGROUP_NAME') => "width=\"40%\"", $VM_LANG->_('VM_USERGROUP_LEVEL') => "width=\"20%\"", $VM_LANG->_('E_REMOVE') => "width=\"5%\"");
$listObj->writeTableHeader($columns);
$db->query($list);
$i = 0;
while ($db->next_record()) {
    $listObj->newRow();
    // The row number
    $listObj->addCell($pageNav->rowNumber($i));
*/
mm_showMyFileName(__FILE__);
global $ps_product_category;
require_once CLASSPATH . "pageNavigation.class.php";
require_once CLASSPATH . "htmlTools.class.php";
$categories = ps_product_category::getCategoryTreeArray(false, $keyword);
// Get array of category objects
$result = ps_product_category::sortCategoryTreeArray($categories);
$nrows = $size = sizeOf($categories);
// Category count
$id_list = $result['id_list'];
$row_list = $result['row_list'];
$depth_list = $result['depth_list'];
$categories = $result['category_tmp'];
// Create the Page Navigation
$pageNav = new vmPageNav($nrows, $limitstart, $limit);
for ($n = $pageNav->limitstart; $n < $nrows; $n++) {
    @$levelcounter[$categories[$row_list[$n]]["category_parent_id"]]++;
}
// Create the List Object with page navigation
$listObj = new listFactory($pageNav);
// print out the search field and a list heading
$listObj->writeSearchHeader($VM_LANG->_('PHPSHOP_CATEGORY_LIST_LBL'), VM_THEMEURL . 'images/administration/dashboard/categories.png', $modulename, "product_category_list");
// start the list table
$listObj->startTable();
// these are the columns in the table
$columns = array("#" => "width=\"20\"", "<input type=\"checkbox\" name=\"toggle\" value=\"\" onclick=\"checkAll(" . $pageNav->limit . ")\" />" => "width=\"20\"", $VM_LANG->_('PHPSHOP_CATEGORY_FORM_NAME') => 'width="25%"', $VM_LANG->_('PHPSHOP_CATEGORY_FORM_DESCRIPTION') => 'width="30%"', $VM_LANG->_('PHPSHOP_PRODUCTS_LBL') => 'width="10%"', $VM_LANG->_('PHPSHOP_PRODUCT_LIST_PUBLISH') => 'width="5%"', $VM_LANG->_('PHPSHOP_MODULE_LIST_ORDER') => 'width="7%"', vmCommonHTML::getSaveOrderButton(min($nrows - $pageNav->limitstart, $pageNav->limit)) => 'width="8%"', $VM_LANG->_('E_REMOVE') => "width=\"5%\"", 'Id' => '');
$listObj->writeTableHeader($columns);
$ibg = 0;
if ($pageNav->limit < $nrows) {
    if ($pageNav->limitstart + $pageNav->limit < $nrows) {