}
$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));
    // The Checkbox
    $listObj->addCell(vmCommonHTML::idBox($i, $db->f("group_id"), false, "group_id"));
    if (in_array($db->f('group_name'), $usergroup->_protected_groups)) {
        $tmp_cell = $db->f("group_name");
    } else {
        $tmp_cell = "<a href=\"" . $sess->url($_SERVER['PHP_SELF'] . "?page=admin.usergroup_form&limitstart={$limitstart}&keyword=" . urlencode($keyword) . "&group_id=" . $db->f("group_id")) . "\">";
Ejemplo n.º 2
0
 /**
  * Shows the list of the orders of a user in the account mainenance section
  *
  * @param string $order_status Filter by order status (A=all, C=confirmed, P=pending,...)
  * @param int $secure Restrict the order list to a specific user id (=1) or not (=0)?
  */
 function list_order($order_status = 'A', $secure = 0)
 {
     global $VM_LANG, $CURRENCY_DISPLAY, $sess, $limit, $limitstart, $keyword, $mm_action_url;
     $ps_vendor_id = $_SESSION["ps_vendor_id"];
     $auth = $_SESSION['auth'];
     require_once CLASSPATH . 'ps_order_status.php';
     require_once CLASSPATH . 'htmlTools.class.php';
     require_once CLASSPATH . 'pageNavigation.class.php';
     $db = new ps_DB();
     $dbs = new ps_DB();
     $listfields = 'o.order_id,o.cdate,order_total,o.order_status,order_currency';
     $countfields = 'count(*) as num_rows';
     $count = "SELECT {$countfields} FROM #__{vm}_orders o ";
     $list = "SELECT DISTINCT {$listfields} FROM #__{vm}_orders o ";
     $q = "WHERE o.vendor_id='{$ps_vendor_id}' ";
     if ($order_status != "A") {
         $q .= "AND order_status='{$order_status}' ";
     }
     if ($secure) {
         $q .= "AND user_id='" . $auth["user_id"] . "' ";
     }
     if (!empty($keyword)) {
         $count .= ', #__{vm}_order_item oi ';
         $list .= ', #__{vm}_order_item oi ';
         $q .= "AND (order_item_sku LIKE '%" . $keyword . "%' ";
         $q .= "OR order_number LIKE '%" . $keyword . "%' ";
         $q .= "OR o.order_id=" . (int) $keyword . ' ';
         $q .= "OR order_item_name LIKE '%" . $keyword . "%') ";
         $q .= "AND oi.order_id=o.order_id ";
     }
     $q .= "ORDER BY o.cdate DESC";
     $count .= $q;
     $db->query($count);
     $db->next_record();
     $num_rows = $db->f('num_rows');
     if ($num_rows == 0) {
         echo "<span style=\"font-style:italic;\">" . $VM_LANG->_('PHPSHOP_ACC_NO_ORDERS') . "</span>\n";
         return;
     }
     $pageNav = new vmPageNav($num_rows, $limitstart, $limit);
     $list .= $q .= " LIMIT " . $pageNav->limitstart . ", {$limit} ";
     $db->query($list);
     $listObj = new listFactory($pageNav);
     if ($num_rows > 0) {
         // print out the search field and a list heading
         $listObj->writeSearchHeader('', '', 'account', 'index');
     }
     // start the list table
     $listObj->startTable();
     $listObj->writeTableHeader(3);
     while ($db->next_record()) {
         $order_status = ps_order_status::getOrderStatusName($db->f("order_status"));
         $listObj->newRow();
         $tmp_cell = "<a href=\"" . $sess->url($mm_action_url . "index.php?page=account.order_details&order_id=" . $db->f("order_id")) . "\">\n";
         $tmp_cell .= "<img src=\"" . IMAGEURL . "ps_image/goto.png\" height=\"32\" width=\"32\" align=\"middle\" border=\"0\" alt=\"" . $VM_LANG->_('PHPSHOP_ORDER_LINK') . "\" />&nbsp;" . $VM_LANG->_('PHPSHOP_VIEW') . "</a><br />";
         $listObj->addCell($tmp_cell);
         $tmp_cell = "<strong>" . $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_DATE') . ":</strong> " . vmFormatDate($db->f("cdate"), "%d. %B %Y");
         $tmp_cell .= "<br /><strong>" . $VM_LANG->_('PHPSHOP_ORDER_PRINT_TOTAL') . ":</strong> " . $CURRENCY_DISPLAY->getFullValue($db->f("order_total"), '', $db->f('order_currency'));
         $listObj->addCell($tmp_cell);
         $tmp_cell = "<strong>" . $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_STATUS') . ":</strong> " . $order_status;
         $tmp_cell .= "<br /><strong>" . $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_NUMBER') . ":</strong> " . sprintf("%08d", $db->f("order_id"));
         $listObj->addCell($tmp_cell);
     }
     $listObj->writeTable();
     $listObj->endTable();
     if ($num_rows > 0) {
         $listObj->writeFooter($keyword, '&Itemid=' . $sess->getShopItemid());
     }
 }