本文整理汇总了PHP中ps_DB::reset方法的典型用法代码示例。如果您正苦于以下问题:PHP ps_DB::reset方法的具体用法?PHP ps_DB::reset怎么用?PHP ps_DB::reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ps_DB
的用法示例。
在下文中一共展示了ps_DB::reset方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
/**
* Prints a drop-down list of vendor names and their ids.
*
* @param int $vendor_id
*/
function list_vendor($vendor_id = '1')
{
$db = new ps_DB();
$q = "SELECT vendor_id,vendor_name FROM #__{vm}_vendor ORDER BY vendor_name";
$db->query($q);
$db->next_record();
// If only one vendor do not show list
if ($db->num_rows() == 1) {
echo '<input type="hidden" name="vendor_id" value="' . $db->f("vendor_id") . '" />';
echo $db->f("vendor_name");
} elseif ($db->num_rows() > 1) {
$db->reset();
$array = array();
while ($db->next_record()) {
$array[$db->f("vendor_id")] = $db->f("vendor_name");
}
echo ps_html::selectList('vendor_id', $vendor_id, $array);
}
}
示例2: htmlentities
// in that case we have to pretend all remaining items belong to "Home"
$openid = $category_id;
// it could be that we are displaying e.g. mainmenu in this dtree,
// but item in usermenu is selected,
// so: for the rest of this module track if this menu contains the selected item
// Default value: first node (=baseid), but not selected
$opento = $baseid;
$opento_selected = "false";
// what do you know... the first node was selected
if ($baseid == $openid) {
$opento_selected = "true";
}
$target = "";
// create the first node, parent is always -1
$menu_htmlcode .= "{$tree}.add(\"{$baseid}\",\"-1\",\"{$basename}\",\"{$baselink}\",\"\",\"{$target}\");\n";
$db->reset();
// process each of the nodes
while ($db->next_record()) {
// get name and link (just to save space in the code later on)
$name = htmlentities($db->f("category_name"), ENT_QUOTES, vmGetCharset()) . ps_product_category::products_in_category($db->f("category_id"));
$url = $sess->url($mm_action_url . "index.php?page=shop.browse&category_id=" . $db->f("category_id"));
$menu_htmlcode .= "{$tree}.add(\"" . $db->f("category_id") . "\",\"" . $db->f("category_parent_id") . "\",\"{$name}\",\"{$url}\",\"\",\"{$target}\");\n";
// if this node is the selected node
if ($db->f("category_id") == $openid) {
$opento = $openid;
$opento_selected = "true";
}
}
$menu_htmlcode .= "document.write({$tree});\n";
$menu_htmlcode .= $openAll == "true" ? "{$tree}.openAll();\n" : "{$tree}.closeAll();\n";
$menu_htmlcode .= "{$tree}.openTo(\"{$opento}\",\"{$opento_selected}\");\n";
示例3: Array
/**
* Build a Credit Card list for each CreditCard Payment Method
* Uses JavsScript from mambojavascript: changeDynaList()
*
* @param ps_DB $db_cc
* @return string
*/
function creditcard_lists(&$db_cc)
{
global $mainframe;
if (vmIsJoomla('1.5')) {
$document = JFactory::getDocument();
$document->addScript('includes/js/joomla.javascript.js');
}
$db = new ps_DB();
$db_cc->next_record();
// Build the Credit Card lists for each CreditCard Payment Method
$script = "<script language=\"javascript\" type=\"text/javascript\">\n";
$script .= "<!--\n";
$script .= "var originalOrder = '1';\n";
$script .= "var originalPos = '" . $db_cc->f("payment_method_name") . "';\n";
$script .= "var orders = new Array();\t// array in the format [key,value,text]\n";
$i = 0;
$db_cc->reset();
while ($db_cc->next_record()) {
$accepted_creditcards = explode(",", $db_cc->f("accepted_creditcards"));
$cards = array();
foreach ($accepted_creditcards as $value) {
if (!empty($value)) {
$q = 'SELECT creditcard_code,creditcard_name FROM #__{vm}_creditcard WHERE creditcard_id=' . (int) $value;
$db->query($q);
$db->next_record();
$cards[$db->f('creditcard_code')] = shopMakeHtmlSafe($db->f('creditcard_name'));
}
}
foreach ($cards as $code => $name) {
$script .= "orders[" . $i++ . "] = new Array( '" . addslashes($db_cc->f("payment_method_name")) . "','{$code}','{$name}' );\n";
}
}
$script .= "function changeCreditCardList() { \n";
$script .= "var selected_payment = null;\n for (var i=0; i<document.adminForm.payment_method_id.length; i++)\n if (document.adminForm.payment_method_id[i].checked)\n selected_payment = document.adminForm.payment_method_id[i].id;\n";
$script .= "changeDynaList('creditcard_code',orders,selected_payment, originalPos, originalOrder);\n";
$script .= "}\n";
$script .= "//-->\n";
$script .= "</script>\n";
$script .= '<noscript>' . ps_html::selectList('creditcard_code', key($cards), $cards) . '</noscript>';
return $script;
}
示例4: vmGet
//.........这里部分代码省略.........
if ($auth["show_price_including_tax"] == 1) {
$shopper_message .= "\n---------------";
$shopper_message .= "\n";
$shopper_message .= $VM_LANG->_('PHPSHOP_ORDER_PRINT_TOTAL_TAX', false) . " = ";
$shopper_message .= $CURRENCY_DISPLAY->getFullValue($order_tax, '', $db->f('order_currency')) . "\n";
}
if ($db->f('order_tax_details')) {
$shopper_message .= str_replace('<br />', "\n", ps_checkout::show_tax_details($db->f('order_tax_details'), $db->f('order_currency')));
}
// Payment Details
$shopper_message .= "\n\n------------------------------------------------------------------------\n";
$shopper_message .= $payment_info_details_text;
// Shipping Details
if (is_object($this->_SHIPPING)) {
$shopper_message .= "\n\n------------------------------------------------------------------------\n";
$shopper_message .= $VM_LANG->_('PHPSHOP_ORDER_PRINT_SHIPPING_LBL', false) . ":\n";
$shopper_message .= $shipping_arr[1] . " (" . $shipping_arr[2] . ")";
}
// Customer Note
$shopper_message .= "\n\n------------------------------------------------------------------------\n";
$shopper_message .= "\n" . $VM_LANG->_('PHPSHOP_ORDER_PRINT_CUSTOMER_NOTE', false) . "\n";
$shopper_message .= "---------------";
$shopper_message .= "\n";
if (!empty($customer_note)) {
$shopper_message .= $customer_note . "\n";
} else {
$shopper_message .= " ./. \n";
}
$shopper_message .= "------------------------------------------------------------------------\n";
// Decode things like € => €
$shopper_message = vmHtmlEntityDecode($shopper_message);
// End of Purchase Order
// *********************
//
//END: set up text mail
/////////////////////////////////////
// Send text email
//
if (ORDER_MAIL_HTML == '0') {
$msg = $shopper_header . $shopper_message . $shopper_footer;
// Mail receipt to the shopper
vmMail($from_email, $mosConfig_fromname, $shopper_email, $shopper_subject, $msg, "");
$msg = $vendor_header . $shopper_message . $vendor_footer;
// Mail receipt to the vendor
vmMail($from_email, $mosConfig_fromname, $vendor_email, $vendor_subject, $msg, "");
} elseif (ORDER_MAIL_HTML == '1') {
$dboi->query($q_oi);
// Create Template Object
$template = vmTemplate::getInstance();
if ($order_discount > 0) {
$order_discount_lbl = $VM_LANG->_('PHPSHOP_PAYMENT_METHOD_LIST_DISCOUNT');
$order_discount_plusminus = '-';
} else {
$order_discount_lbl = $VM_LANG->_('PHPSHOP_FEE');
$order_discount_plusminus = '+';
}
if ($coupon_discount > 0) {
$coupon_discount_lbl = $VM_LANG->_('PHPSHOP_PAYMENT_METHOD_LIST_DISCOUNT');
$coupon_discount_plusminus = '-';
} else {
$coupon_discount_lbl = $VM_LANG->_('PHPSHOP_FEE');
$coupon_discount_plusminus = '+';
}
if (is_object($this->_SHIPPING)) {
$shipping_info_details = stripslashes($shipping_arr[1]) . " (" . stripslashes($shipping_arr[2]) . ")";
} else {
$shipping_info_details = ' ./. ';
}
// These are a lot of vars to import for the email confirmation
$template->set_vars(array('is_email_to_shopper' => true, 'db' => $db, 'dboi' => $dboi, 'dbbt' => $dbbt, 'dbst' => $dbst, 'ps_product' => $ps_product, 'shippingfields' => $shippingfields, 'registrationfields' => $registrationfields, 'order_id' => $order_id, 'order_discount' => $order_discount, 'order_discount_lbl' => $order_discount_lbl, 'order_discount_plusminus' => $order_discount_plusminus, 'coupon_discount' => $coupon_discount, 'coupon_discount_lbl' => $coupon_discount_lbl, 'coupon_discount_plusminus' => $coupon_discount_plusminus, 'order_date' => $VM_LANG->convert(vmFormatDate($db->f("cdate"), $VM_LANG->_('DATE_FORMAT_LC'))), 'order_status' => $order_status, 'legal_info_title' => $legal_info_title, 'legal_info_html' => $legal_info_html, 'order_link' => $shopper_order_link, 'payment_info_lbl' => $VM_LANG->_('PHPSHOP_ORDER_PRINT_PAYINFO_LBL'), 'payment_info_details' => $payment_info_details, 'shipping_info_lbl' => $VM_LANG->_('PHPSHOP_ORDER_PRINT_SHIPPING_LBL'), 'shipping_info_details' => $shipping_info_details, 'from_email' => $from_email, 'customer_note' => nl2br($customer_note), 'order_header_msg' => $shopper_header, 'order_subtotal' => $CURRENCY_DISPLAY->getFullValue($sub_total, '', $db->f('order_currency')), 'order_shipping' => $CURRENCY_DISPLAY->getFullValue($order_shipping, '', $db->f('order_currency')), 'order_tax' => $CURRENCY_DISPLAY->getFullValue($order_tax, '', $db->f('order_currency')) . ps_checkout::show_tax_details($db->f('order_tax_details'), $db->f('order_currency')), 'order_total' => $CURRENCY_DISPLAY->getFullValue($order_total, '', $db->f('order_currency'))));
$shopper_html = $template->fetch('order_emails/confirmation_email.tpl.php');
// Reset the list of order items for use in the vendor email
$dboi->reset();
// Override some vars for the vendor email, so we can use the same template
$template->set_vars(array('order_header_msg' => $vendor_header, 'order_link' => $vendor_order_link, 'is_email_to_shopper' => false));
$vendor_html = $template->fetch('order_emails/confirmation_email.tpl.php');
/*
* Add the text, html and embedded images.
* The name of the image should match exactly
* (case-sensitive) to the name in the html.
*/
$shopper_mail_Body = $shopper_html;
$shopper_mail_AltBody = $shopper_header . $shopper_message . $shopper_footer;
$vendor_mail_Body = $vendor_html;
$vendor_mail_AltBody = $vendor_header . $shopper_message . $vendor_footer;
$imagefile = pathinfo($dbv->f("vendor_full_image"));
$extension = $imagefile['extension'] == "jpg" ? "jpeg" : "jpeg";
$EmbeddedImages[] = array('path' => IMAGEPATH . "vendor/" . $dbv->f("vendor_full_image"), 'name' => "vendor_image", 'filename' => $dbv->f("vendor_full_image"), 'encoding' => "base64", 'mimetype' => "image/" . $extension);
$shopper_mail = vmMail($from_email, $mosConfig_fromname, $shopper_email, $shopper_subject, $shopper_mail_Body, $shopper_mail_AltBody, true, null, null, $EmbeddedImages);
$vendor_mail = vmMail($from_email, $mosConfig_fromname, $vendor_email, $vendor_subject, $vendor_mail_Body, $vendor_mail_AltBody, true, null, null, $EmbeddedImages, null, $shopper_email);
if (!$shopper_mail || !$vendor_mail) {
$vmLogger->debug('Something went wrong while sending the order confirmation email to ' . $from_email . ' and ' . $shopper_email);
return false;
}
//
// END: set up and send the HTML email
////////////////////////////////////////
}
return true;
}
示例5: elseif
$tpl->set('product_id', $product_id);
$buttons_header = $tpl->fetch('common/buttons.tpl.php');
$templatefile = !empty($category_id) ? $db_browse->f("category_browsepage") : CATEGORY_TEMPLATE;
if ($templatefile == 'managed') {
// automatically select the browse template with the best match for the number of products per row
$templatefile = file_exists(VM_THEMEPATH . 'templates/browse/browse_' . $products_per_row . '.php') ? 'browse_' . $products_per_row : 'browse_5';
} elseif (!file_exists(VM_THEMEPATH . 'templates/browse/' . $templatefile . '.php')) {
$templatefile = 'browse_5';
}
} else {
$templatefile = "browse_lite_pdf";
}
$tpl->set('buttons_header', $buttons_header);
$tpl->set('products_per_row', $products_per_row);
$tpl->set('templatefile', $templatefile);
$db_browse->reset();
$products = array();
$counter = 0;
/*** Start printing out all products (in that category) ***/
while ($db_browse->next_record()) {
// If it is item get parent:
$product_parent_id = $db_browse->f("product_parent_id");
if ($product_parent_id != 0) {
$dbp->query("SELECT product_full_image,product_thumb_image,product_name,product_s_desc FROM #__{vm}_product WHERE product_id='{$product_parent_id}'");
$dbp->next_record();
}
// Set the flypage for this product based on the category.
// If no flypage is set then use the default as set in virtuemart.cfg.php
$flypage = $db_browse->sf("category_flypage");
if (empty($flypage)) {
$flypage = FLYPAGE;
示例6: while
/**
* mails the Download-ID to the customer
* or deletes the Download-ID from the product_downloads table
*
* @param array $d
* @return boolean
*/
function mail_download_id(&$d)
{
global $sess, $VM_LANG, $vmLogger;
$url = URL . "index.php?option=com_virtuemart&page=shop.downloads&Itemid=" . $sess->getShopItemid();
$db = new ps_DB();
$db->query('SELECT order_status FROM #__{vm}_orders WHERE order_id=' . (int) $d['order_id']);
$db->next_record();
if (in_array($db->f("order_status"), array(ENABLE_DOWNLOAD_STATUS, 'S'))) {
$dbw = new ps_DB();
$q = "SELECT order_id,user_id,download_id,file_name FROM #__{vm}_product_download WHERE";
$q .= " order_id = '" . (int) $d["order_id"] . "'";
$dbw->query($q);
$dbw->next_record();
$userid = $dbw->f("user_id");
$download_id = $dbw->f("download_id");
$datei = $dbw->f("file_name");
$dbw->reset();
if ($download_id) {
$dbv = new ps_DB();
$q = "SELECT * FROM #__{vm}_vendor WHERE vendor_id='1'";
$dbv->query($q);
$dbv->next_record();
$db = new ps_DB();
$q = "SELECT first_name,last_name, user_email FROM #__{vm}_user_info WHERE user_id = '{$userid}' AND address_type='BT'";
$db->query($q);
$db->next_record();
$message = $VM_LANG->_('HI', false) . ' ' . $db->f("first_name") . ($db->f("middle_name") ? ' ' . $db->f("middle_name") : '') . ' ' . $db->f("last_name") . ",\n\n";
$message .= $VM_LANG->_('PHPSHOP_DOWNLOADS_SEND_MSG_1', false) . ".\n";
$message .= $VM_LANG->_('PHPSHOP_DOWNLOADS_SEND_MSG_2', false) . "\n\n";
while ($dbw->next_record()) {
$message .= basename($dbw->f("file_name")) . ": " . $dbw->f("download_id") . "\n{$url}&download_id=" . $dbw->f("download_id") . "\n\n";
}
$message .= $VM_LANG->_('PHPSHOP_DOWNLOADS_SEND_MSG_3', false) . DOWNLOAD_MAX . "\n";
$expire = DOWNLOAD_EXPIRE / 60 / 60 / 24;
$message .= str_replace("{expire}", $expire, $VM_LANG->_('PHPSHOP_DOWNLOADS_SEND_MSG_4', false));
$message .= "\n\n____________________________________________________________\n";
$message .= $VM_LANG->_('PHPSHOP_DOWNLOADS_SEND_MSG_5', false) . "\n";
$message .= $dbv->f("vendor_name") . " \n" . URL . "\n\n" . $dbv->f("contact_email") . "\n";
$message .= "____________________________________________________________\n";
$message .= $VM_LANG->_('PHPSHOP_DOWNLOADS_SEND_MSG_6', false) . $dbv->f("vendor_name");
$mail_Body = $message;
$mail_Subject = $VM_LANG->_('PHPSHOP_DOWNLOADS_SEND_SUBJ', false);
$from = $dbv->f("contact_email") ? $dbv->f("contact_email") : $GLOBALS['mosConfig_mailfrom'];
$result = vmMail($from, $dbv->f("vendor_name"), $db->f("user_email"), $mail_Subject, $mail_Body, '');
if ($result) {
$vmLogger->info($VM_LANG->_('PHPSHOP_DOWNLOADS_SEND_MSG', false) . " " . $db->f("first_name") . " " . $db->f("last_name") . " " . $db->f("user_email"));
} else {
$vmLogger->warning($VM_LANG->_('PHPSHOP_DOWNLOADS_ERR_SEND', false) . " " . $db->f("first_name") . " " . $db->f("last_name") . ", " . $db->f("user_email"));
}
}
} elseif (in_array(vmGet($d, 'order_status'), array(DISABLE_DOWNLOAD_STATUS, 'X', 'R'))) {
$q = "DELETE FROM #__{vm}_product_download WHERE order_id=" . (int) $d["order_id"];
$db->query($q);
$db->next_record();
}
return true;
}
示例7: elseif
/**
* Prints a drop-down list of manufacturer names and their ids.
*
* @param int $manufacturer_id
*/
function list_manufacturer($manufacturer_id = '0')
{
$db = new ps_DB();
$q = "SELECT manufacturer_id as id,mf_name as name FROM #__{vm}_manufacturer ORDER BY mf_name";
$db->query($q);
$db->next_record();
// If only one vendor do not show list
if ($db->num_rows() == 1) {
echo '<input type="hidden" name="manufacturer_id" value="' . $db->f("id") . '" />';
echo $db->f("name");
} elseif ($db->num_rows() > 1) {
$db->reset();
$array = array();
while ($db->next_record()) {
$array[$db->f("id")] = $db->f("name");
}
$code = ps_html::selectList('manufacturer_id', $manufacturer_id, $array) . "<br />\n";
echo $code;
} else {
echo '<input type="hidden" name="manufacturer_id" value="1" />Please create at least one Manufacturer!!';
}
}
示例8:
//echo $dbpl->f("week_number")."-".$weekNum."<br/>";
} else {
if ($dbpl->f("order_date") == $db->f("order_date")) {
$showLine = 1;
}
}
if ($showLine == 1) {
//end CT
echo "<tr bgcolor=\"#ffffff\">\n";
echo "<td>" . $i++ . "</td>\n";
echo '<td align="left">' . $dbpl->f("product_name") . " (" . $dbpl->f("product_sku") . ")</td>\n";
echo '<td align="left">' . $dbpl->f("items_sold") . "</td>\n";
echo "</tr>\n";
}
$has_next = $dbpl->next_record();
}
$dbpl->reset();
?>
<tr><td colspan="3"><hr width="85%"></td></tr>
</table>
</td><td> </td>
</tr>
<?php
}
// END product listing
}
?>
</table>
<!-- end output of report -->
<!-- END body -->
示例9: getFilesForProduct
/**
* Returns an array holding all the files and images of the specified product
* $files['files'] holds all files as objects
* $files['images'] holds all images as objects
* $files['product_id] holds the product_id of the child or parent that holds files as objects
* Query has to be done twice, because parent could old either/or files/images. Must allow inheritance of both
* @param unknown_type $pid
* @return unknown
*/
function getFilesForProduct($pid)
{
$db = new ps_DB();
$files['images'] = array();
$files['files'] = array();
// Query for images if child doesn't have them check for parents
$db->query("SELECT * FROM `#__{vm}_product_files` WHERE `file_product_id`=" . intval($pid) . " AND `file_is_image`=1 AND `file_published`=1");
if (!$db->next_record()) {
$db->query("SELECT product_parent_id FROM #__{vm}_product WHERE product_id=" . intval($pid));
$db->query("SELECT * FROM `#__{vm}_product_files` WHERE `file_product_id`=" . $db->f("product_parent_id") . " AND `file_is_image`=1 AND `file_published`=1");
}
$db->reset();
while ($db->next_record()) {
$files['images'][] = $db->get_row();
}
// Query for files if child doesn't have them check for parent
$files['product_id'] = intval($pid);
$db->query("SELECT * FROM `#__{vm}_product_files` WHERE `file_product_id`=" . intval($pid) . " AND `file_is_image`=0 AND `file_published`=1");
if (!$db->next_record()) {
$db->query("SELECT product_parent_id FROM #__{vm}_product WHERE product_id='{$pid}'");
// Parent has files so set files['product_id'] to parent id
$files['product_id'] = intval($db->f("product_parent_id"));
$db->query("SELECT * FROM `#__{vm}_product_files` WHERE `file_product_id`=" . $db->f("product_parent_id") . " AND `file_is_image`=0 AND `file_published`=1");
}
$db->reset();
while ($db->next_record()) {
$files['files'][] = $db->get_row();
}
return $files;
}