示例#1
0
文件: bundles.php 项目: sbeam/cshop
    if ($ACTION == OP_EDIT) {
        $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) {