Exemple #1
0
 $numrows = $res->numRows();
 if ($numrows) {
     for ($ptr = $offset; $range == 0 or $offset + $range > $ptr; $ptr++) {
         if (!($row = $res->fetchRow(DB_FETCHMODE_ASSOC, $ptr))) {
             break;
         }
         if (!empty($row['is_anon'])) {
             $row['perms'] = 'anon';
         }
         $vals = array();
         foreach ($cols as $k) {
             $vals[] = $row[$k];
         }
         $vals[] = $row['num_orders'];
         $link = sprintf('%s?%s=%d', $_SERVER['PHP_SELF'], $reqIdKey, $row['id']);
         $table->addRow($vals, '', false, $link);
     }
 }
 $pager = new res_pager($offset, $range, $numrows, 0, 26);
 $smarty->assign('pager', $pager);
 /** create filter form **/
 $colmap = $user->get_colmap();
 $filt = new filter_form('GET');
 $filt->left_td_style = '';
 $filt->field_prefix = '';
 $filt->add_element('hdr1', array('<b>Filter by::</b>', 'heading'));
 if (isset($colmap['perms'])) {
     $filt->add_element('hdr1', array('Permissions:', 'heading'));
     $filt->add_element('f_perms', array('', 'select', null));
 }
 $filt->add_element('hdr2', array('email:', 'heading'));
Exemple #2
0
    $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';
            $link = sprintf('%s?op_edit=%d', $_SERVER['PHP_SELF'], $row['id']);
            unset($row['id']);
            $table->addRow(array_values($row), $class, true, $link);
        }
    }
    $pager = new res_pager($offset, $rows_per_page, $bundle->numRows);
    $smarty->assign('pager', $pager);
}
/*}}}*/
/* decide which tab to show based on GET param 'win' */
$tabs = array('product', 'inventory', 'media', 'options');
if ($ACTION == OP_EDIT && isset($_GET['win']) && in_array($_GET['win'], $tabs)) {
    $tab = $_GET['win'];
} else {
    $tab = $tabs[0];
}
##############################################################################
# output template
Exemple #3
0
        $method_title = $vals['zone_name'];
        $fex->add_element('id', array('hid id', 'hidden', $req_id));
        // important
    } else {
        $method_title = 'ADD NEW ZONE';
    }
    $form = $fex->get_struct();
} else {
    /** or a fu_HTML_Table showing all coupons TODO paging ***********************************/
    $table = new fu_HTML_Table(array('width' => '100%'));
    $table->setAutoGrow(true);
    $table->setAutoFill("&mdash;");
    $have_zones = false;
    if ($rows = $sm->get_avail_zones()) {
        $have_zones = true;
        $table->addRow(array('Zone Name'), 'TH');
        foreach ($rows as $row) {
            $class = 'controlListingRow';
            $link = sprintf('%s?op_edit=%d', $_SERVER['PHP_SELF'], $row['id']);
            unset($row['id']);
            $table->addRow(array_values($row), $class, true, $link);
        }
    }
}
##############################################################################
# output template
##############################################################################
$smarty->display('control/header.tpl');
?>

Exemple #4
0
                /* special hack for colorpickers - show a block of color */
                if (isset($colmap[$k][1]) and $colmap[$k][1] == 'colorpicker') {
                    $row[$k] = sprintf('<span style="width: 12px; height: 12px; border: 2px solid black; background-color: %s">&nbsp;&nbsp;&nbsp;</span>&nbsp;%s', $row[$k], $row[$k]);
                }
                if (isset($row[$k]) or $row[$k] == NULL) {
                    $vals[] = $row[$k];
                    //
                } else {
                    // some sort of misconfig
                    $vals[] = '';
                    trigger_error("column '{$k}' was not found in query result", E_USER_NOTICE);
                }
            }
            // store.edit.php?nid=444
            $link = sprintf('%s?op_edit=%s&class=%s', $_SERVER['PHP_SELF'], urlencode($row[$dbc->get_pk_col()]), $class);
            $table->addRow($vals, '', null, $link);
        }
    }
    $numrows = $dbc->numRows;
}
##############################################################################
# output template
##############################################################################
$smarty->assign('pagetitle', strtolower($ACTION));
// make a nice title
$smarty->display('control/header.tpl');
?>


<div id="controlW1">
Exemple #5
0
    $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('&nbsp;'), '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);
    }
    $numrows = $res->numRows();
Exemple #6
0
} else {
    /** list all manufacturers 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('sName' => 'Name', 'product_count' => '#Products');
    $table->addSortRow($header_row, null, null, 'TH', null);
    $table->addCol(array('Edit/Del'), 'align="center"', 'th');
    $sql = "SELECT m.id, m.sName, COUNT(p.id) AS product_count\n            FROM  manufacturers m LEFT JOIN products p ON (p.manufacturerid = m.id) \n            GROUP BY (m.id)\n            ORDER BY sName";
    $res = $pdb->query($sql);
    while ($row = $res->fetchRow()) {
        $vals = array($row['sName']);
        // store.edit.php?nid=444
        $vals[] = sprintf('<a href="store.edit.list.php?mfr=%d">%d</a>', $row['id'], $row['product_count']);
        $vals[] = sprintf('<a href="store.manufacturers.php?mfr=%d" class="buttonEditItem">&raquo;</a>', $row['id']);
        $table->addRow($vals);
    }
    $numrows = $res->numRows();
}
##############################################################################
# output template
##############################################################################
include 'templates/control/header.php';
include "control.header.php";
?>


<div align="center" style="margin: 10px">

<? if ($ACTION) { ?>
    <div style="text-align: left; width: 600px">
Exemple #7
0
$ptrlimit = $range + $offset < $numrows ? $range + $offset : $numrows;
for ($ptr = $offset; $ptr < $ptrlimit; $ptr++) {
    if (!($row = $res->fetchRow(DB_FETCHMODE_ASSOC, $ptr))) {
        break;
    }
    /** fetch all the categories this product is in and put the names in array $cats */
    $cats = array();
    $res_cats =& $pdb->execute($sth_cats, array($row['id']));
    while ($cat_row = $res_cats->fetchRow(DB_FETCHMODE_ORDERED)) {
        $cats[] = $cat_row[0];
    }
    $res_cats->free();
    $vals = array($row['title'], join(',', $cats), $row['mfr'], $row['sku'], $row['is_active'] ? 'Y' : 'N', $row['order_weight'], empty($row['feature_rank']) ? '-' : $row['feature_rank']);
    // store.edit.php?nid=444
    $link = sprintf('store.edit.php?productid=%d', $row['id']);
    $table->addRow($vals, '', true, $link);
}
$pager = new res_pager($offset, $range, $numrows, 0, 21);
$smarty->assign('pager', $pager);
##############################################################################
$smarty->display('control/header.tpl');
?>

<div align="center" style="margin: 10px">
<div style="width: 600px; border: 1px solid black; padding: 4px">


<? if (isset($_GET['info'])) { ?>
    <div class="indicator">
      <?php 
echo htmlentities(base64_decode($_GET['info']));
Exemple #8
0
    if ($dbc->get_table_name() == 'ccom_content') {
        $where = "page_id = '{$page_id}'";
    } elseif ($dbc->parent_id_col) {
        $where = $dbc->parent_id_col . "= '{$page_parent_id}'";
    }
    $cols = array_keys($header_row);
    array_push($cols, 'id');
    if ($rows = $dbc->fetch_any($cols, 0, 0, $table_ordercol, $where, $order_dir)) {
        foreach ($rows as $row) {
            $link = sprintf('%s?%s&op_edit=%d', $_SERVER['PHP_SELF'], $base_get_vars, $row['id']);
            $cells = array();
            foreach (array_keys($header_row) as $k) {
                $cells[] = strlen($row[$k]) < 129 ? $row[$k] : substr(htmlspecialchars($row[$k]), 0, 128) . '...';
                // TODO html??
            }
            $table->addRow($cells, '', true, $link);
        }
    }
    $numrows = $dbc->numRows;
}
$smarty->assign('pagetitle', join(' :: ', array_keys($crumbs)));
$smarty->assign('breadcrumb', $crumbs);
$smarty->assign('suppress_control_nav', $dbc->suppress_control_nav);
/* #########################################################################
 * display the listing or the form */
$smarty->display('control/header.tpl');
?>

<div style="margin: 10px;">

<? 
Exemple #9
0
        $fex->elem_vals = $vals;
        $method_title = $vals['name'];
        $curr_basis = $vals['basis'];
        $fex->add_element('id', array('hid id', 'hidden', $req_id));
        // important
        $rbasis = $sm->fetch_basises($req_id);
    } else {
        $method_title = 'ADD NEW METHOD';
    }
    $form = $fex->get_struct();
}
/** or a fu_HTML_Table showing all coupons TODO paging ***********************************/
$table = new fu_HTML_Table(array('width' => '100%'));
$table->setAutoGrow(true);
$table->setAutoFill("&mdash;");
$table->addRow(array('Method', 'Basis', 'Zone'), 'TH');
if ($rows = $sm->fetch_method_list()) {
    $have_zones = true;
    foreach ($rows as $row) {
        $class = isset($req_id) && $row['id'] == $req_id ? 'controlListingRowSelected' : 'controlListingRow';
        $link = sprintf('%s?op_edit=%d', $_SERVER['PHP_SELF'], $row['id']);
        unset($row['id']);
        $table->addRow(array_values($row), $class, true, $link);
    }
}
##############################################################################
# output template
##############################################################################
$smarty->display('control/header.tpl');
?>
Exemple #10
0
$sep = strpos($_SERVER['REQUEST_URI'], '?') === false ? '?' : '&';
$csv_link = $_SERVER['REQUEST_URI'] . $sep . 'op_csv';
foreach ($report as $row) {
    $vals = array();
    $link = null;
    if (isset($link_fmt)) {
        $args = array();
        foreach ($link_vals as $v) {
            $args[] = $row[$v];
        }
        $link = vsprintf($link_fmt, $args);
    }
    foreach (array_keys($header_row) as $k) {
        $vals[] = $row[$k];
    }
    $table->addRow($vals, null, !empty($link), $link);
}
$numrows = $prod->numRows;
$pager = new res_pager($offset, $range, $numrows);
$smarty->assign('pager', $pager);
$produx = array('' => '[ANY]') + $prod->get_product_list('title');
$filt = new filter_form('GET');
$filt->left_td_style = '';
$filt->field_prefix = '';
$filt->add_element('hdr1', array('<b>Filter by::</b> Product:', 'heading'));
$filt->add_element('pid', array('', 'select', $produx));
$filt->add_element('hdr2', array('Category:', 'heading'));
$filt->add_element('cat', array('', 'select', $prod->get_product_category_options(true)));
$filt->add_element('op_filter', array('GO', 'submit'));
##############################################################################
# output template
Exemple #11
0
        /* we got orders. add to $table object */
        foreach ($orders as $o) {
            $name = !empty($o['cust_name']) ? $o['cust_name'] : $o['first_name'] . ' ' . $o['last_name'];
            if (!empty($o['company'])) {
                $name .= " [{$o['company']}]";
            }
            $email = !empty($o['email']) ? $o['email'] : $o['anon_email'];
            $vals = array($o['id'], $o['order_token'], "{$name} &lt;{$email}&gt;", $o['perms'], $order->statuses[$o['orders_status']], date('d M Y', strtotime($o['order_create_date'])), $o['amt_quoted'], $o['ship_date']);
            $link = sprintf('%s?%s=%s', $_SERVER['PHP_SELF'], $reqIdKey, $o['order_token']);
            $class = '';
            if (isset($order_list_colors[$o['orders_status']])) {
                $table->bgcolor_alts = $order_list_colors[$o['orders_status']];
            } else {
                $table->bgcolor_alts = $order_list_colors[0];
            }
            $table->addRow(array_values($vals), $class, false, $link);
        }
        $pager = new res_pager($offset, $range, $order->numRows, 0, 26);
        $smarty->assign('pager', $pager);
        $sep = strpos($_SERVER['REQUEST_URI'], '?') === false ? '?' : '&';
        $csv_link = $_SERVER['REQUEST_URI'] . $sep . 'op_csv';
    }
    $pagetitle = 'ORDERS';
}
if (isset($_GET['info'])) {
    $msg = base64_decode($_GET['info']);
}
$smarty->assign('pagetitle', $pagetitle);
##############################################################################
# output template
##############################################################################
Exemple #12
0
}
if (!$ACTION) {
    $table = new fu_HTML_Table(array('width' => '90%', 'align' => 'center'));
    $header_row = array('name' => 'Name', 'url' => 'URL', 'is_active' => 'Active?');
    $table->addSortRow($header_row);
    $numrows = 0;
    if ($downloads = $download->fetch_by_product_id($productid)) {
        foreach ($downloads as $row) {
            $vals = array();
            $row['url'] = sprintf('<a href="%s">%s</a>', $row['url'], $row['url']);
            foreach (array_keys($header_row) as $k) {
                $vals[] = $row[$k];
            }
            // store.edit.php?nid=444
            $link = sprintf('%s?op_edit=%d&pid=%d', $_SERVER['PHP_SELF'], $row['id'], $productid);
            $table->addRow($vals, null, true, $link);
        }
        $numrows = count($downloads);
    }
}
/** build form **/
$fex->js_src_inline = true;
$fex->add_element('op', array($ACTION, 'submit', null, null, 1));
$fex->add_element('cm_products_id', array('id', 'hidden', $productid, 1));
/** **/
if ($ACTION == OP_EDIT) {
    $download->set_id($thisid);
    $fex->add_element('op_kill', array(OP_KILL, 'submit', null, null, 'onclick="return confirm(\'Are you sure?\')"'));
    $fex->add_element('id', array('', 'hidden'));
    $fex->set_elem_value($download->fetch());
}
Exemple #13
0
        /* add a new "column" pointing to the tax collected, if any  */
        if ($row['tax_total']) {
            $taxkey = preg_replace('/\\W+/', '_', $row['tax_method']);
            $row['tax_' . $taxkey] = $row['tax_total'];
        }
        if (isset($order_list_colors[$row['orders_status']])) {
            $table->bgcolor_alts = $order_list_colors[$row['orders_status']];
        } else {
            $table->bgcolor_alts = $order_list_colors[0];
        }
        $row['orders_status'] = $cmOrder->statuses[$row['orders_status']];
    }
    foreach (array_keys($header_row) as $k) {
        $vals[] = isset($row[$k]) ? $row[$k] : null;
    }
    $table->addRow($vals, null, !empty($link), $link);
}
$table->bgcolor_alts = $order_list_colors[0];
$numrows = $res->numRows();
if ($ACTION == OP_ORDERS_PRODUCTS) {
    /* add two rows for the sums of order totals and product counts */
    foreach (array('table_sums' => 'SALE TOTAL:', 'product_counts' => '#sold', 'num_orders' => '#orders') as $var => $label) {
        $vals = array();
        foreach (array_keys($header_row) as $k) {
            $vals[] = isset(${$var}[$k]) ? ${$var}[$k] : null;
        }
        $vals[0] = $label;
        $table->addRow($vals, 'tfoot');
    }
}
if (isset($_GET['op_csv'])) {