示例#1
0
        if ($product_count) {
            $confirm_msg = "There are {$product_count} products that are associated with this manufacturer. You cannot delete the manufacturer until all these products have been removed or reassigned";
            $fex->add_element('op_kill', array(OP_KILL, 'submit', null, null, 'onclick="alert(\'' . $confirm_msg . '\'); return false"'));
        } else {
            $confirm_msg = 'This will remove this manufacturer from the site permanently. Are you sure?';
            $fex->add_element('op_kill', array(OP_KILL, 'submit', null, null, 'onclick="return confirm(\'' . $confirm_msg . '\')"'));
        }
    }
} 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';
示例#2
0
    $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();
}