Пример #1
0
    if ($orders = $user->fetch_order_history()) {
        $table = new fu_HTML_Table(array("width" => "820"));
        $table->setAutoGrow(true);
        $table->setAutoFill("-");
        $table->addRow(array('Order Number', 'Ship name', 'Status', 'Date', 'Amt Quoted'), 'header', false);
        foreach ($orders as $o) {
            $vals = array($o['order_token'], $o['shipping_name'], $o['status'], date('d M Y', strtotime($o['order_create_date'])), $o['amt_quoted']);
            $link = sprintf('store.orders.php?tok=%s', $o['order_token']);
            $table->addRow($vals, '', false, $link);
        }
    }
} else {
    /** list all cm_categories in one big ass dump using HTML_Table **/
    $table = new fu_HTML_Table(array("width" => "600"));
    $table->setAutoGrow(true);
    $table->setAutoFill("n/a");
    $header_row = array();
    if (!isset($user->control_header_cols)) {
        $cols = array('cust_name', 'last_name', 'first_name', 'company', 'email', 'perms');
        foreach ($cols as $k) {
            if (!empty($user->colmap[$k])) {
                $header_row[$k] = $user->colmap[$k][0];
            }
        }
    } else {
        $header_row =& $user->control_header_cols;
        $cols = array_keys($user->control_header_cols);
    }
    if (isset($_GET['by']) and (in_array($_GET['by'], $cols) or $_GET['by'] == 'num_orders')) {
        $orderby = $_GET['by'];
    } else {
Пример #2
0
        $bundle->set_id($req_id);
        $vals = $bundle->fetch();
        $fex->elem_vals = $vals;
        $method_title = $vals['title'];
        $fex->add_element('id', array('hid id', 'hidden', $req_id));
        // important
        $confirm_msg = 'This will remove this item from the site permanently. Are you sure?';
        $fex->add_element('op_kill', array('REMOVE', 'submit', null, array('class' => 'ccomKillSwitch'), "onclick=\"return confirm('{$confirm_msg}')\""));
    } else {
        $method_title = 'ADD NEW ZONE';
    }
    $form = $fex->get_struct();
} else {
    $table = new fu_HTML_Table(array('width' => '100%'));
    $table->setAutoGrow(true);
    $table->setAutoFill("—");
    $header_row = array('title' => 'Bundle Name', 'base_price' => 'Base', 'qty_inventory' => 'On hand');
    $table_ordercol = isset($_GET['by']) ? $_GET['by'] : 'title';
    $order_dir = (!isset($_GET['dir']) or $_GET['dir'] == 'A') ? 'ASC' : 'DESC';
    /** decide on which result page to show **/
    $bundle->set_range($rows_per_page);
    $offset = isset($_GET['page']) ? $rows_per_page * $_GET['page'] - 1 : 0;
    $bundle->set_offset($offset);
    /** **/
    $have_table = false;
    $cols = array_merge(array('id'), array_keys($header_row));
    if ($rows = $bundle->fetch_any($cols, 0, 0, $table_ordercol, null, $order_dir)) {
        $have_table = true;
        $table->addSortRow($header_row, $table_ordercol, null, 'TH', '', $order_dir);
        foreach ($rows as $row) {
            $class = 'controlListingRow';
Пример #3
0
    $fex->add_element($colmap);
    $fex->add_element('op', array($ACTION, 'submit', null, null, 1));
    $fex->add_element('nid', array('id', 'hidden', $productid, null));
    $fex->set_element_opts('colorways_id', cshopUtils::get_all_colors($pdb, true));
    if ($ACTION == OP_EDIT) {
        $sql = sprintf("SELECT colorways_id, order_weight, class, filename_large AS upfile\n                        FROM {$tablename} WHERE id = %d", $reqid);
        $row = $pdb->getRow($sql);
        $fex->elem_vals = $row;
        $fex->add_element('reqid', array('reqid', 'hidden', $reqid, null));
        $fex->add_element('op_kill', array(OP_KILL, 'submit', null, null, 'onclick="return confirm(\'Are you sure?\')"'));
    }
} else {
    /** list all cm_categories in one big ass dump using HTML_Table **/
    $table = new fu_HTML_Table(array('width' => '90%', 'align' => 'center'));
    $table->setAutoGrow(true);
    $table->setAutoFill("-");
    $header_row = array('class' => 'Class', 'filename_fmt' => 'File Name', 'colorname' => 'Colorway', 'order_weight' => 'weight');
    $table->addRow(array_values($header_row), null, 'TH');
    $table->addCol(array(' '), 'align="center"', 'th');
    $sql = sprintf("SELECT pi.id, pi.class, pi.order_weight, system_location, filename_large, filename_thumb, dims_thumb, cw.name AS colorname\n                    FROM cm_product_images pi \n                        LEFT JOIN cm_colorways cw ON (cw.id = colorways_id)\n                    WHERE cm_products_id = %d\n                    ORDER BY pi.order_weight, cw.name", $productid);
    $res = $pdb->query($sql);
    while ($row = $res->fetchRow()) {
        $vals = array();
        $row['filename_fmt'] = strlen($row['filename_large']) > 30 ? substr($row['filename_large'], 0, 27) . '...' : $row['filename_large'];
        foreach (array_keys($header_row) as $k) {
            $vals[] = $row[$k];
        }
        // store.edit.php?nid=444
        $vals[] = sprintf('<img src="%s/%s" %s alt="" />', $row['system_location'], $row['filename_thumb'], $row['dims_thumb']);
        $link = sprintf('%s?op_edit=%d&nid=%d', $_SERVER['PHP_SELF'], $row['id'], $productid);
        $table->addRow($vals, null, true, $link);