本文整理汇总了PHP中Quote::read方法的典型用法代码示例。如果您正苦于以下问题:PHP Quote::read方法的具体用法?PHP Quote::read怎么用?PHP Quote::read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Quote
的用法示例。
在下文中一共展示了Quote::read方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reset_quote_cabinets
/**
* add method
*
* @return void
*/
public function reset_quote_cabinets($quote_id)
{
$quote_cabinets = array();
App::import("Model", "QuoteManager.Quote");
$quote_model = new Quote();
$quote = $quote_model->read(null, $quote_id);
$drawer = $this->request['data']['Global']['drawer'];
$drawer_slide = $this->request['data']['Global']['drawer_slide'];
$delivery = $this->request['data']['Global']['delivery'];
$installation = $this->request['data']['Global']['installation'];
$is_interior_melamine = $this->request['data']['Global']['is_interior_melamine'];
$quote['Quote']['drawer'] = $drawer;
$quote['Quote']['drawer_slide'] = $drawer_slide;
$quote['Quote']['delivery'] = $delivery;
$quote['Quote']['installation'] = $installation;
$quote['Quote']['is_interior_melamine'] = $is_interior_melamine;
$quote_model->save($quote);
$this->CabinetOrder->deleteAll(array('quote_id' => $quote_id));
if (isset($this->request['data']['CabinetOrder']) && is_array($this->request['data']['CabinetOrder']) && !empty($this->request['data']['CabinetOrder'])) {
foreach ($this->request['data']['CabinetOrder'] as $cabinet) {
if ($cabinet['temporary']) {
continue;
// skip the not saved one
}
if ($cabinet['temporary_delete']) {
unset($cabinet['temporary_delete']);
}
$cabinet['quote_id'] = $quote_id;
switch ($cabinet['resource_type']) {
case 'cabinet':
$resource_id = $cabinet['resource_id'];
// $resource_type = $cabinet['resource_type'];
$cabinet_color = $cabinet['cabinet_color'];
$material_id = $cabinet['material_id'];
$door_id = $cabinet['door_id'];
$door_color = $cabinet['door_color'];
$quote_cabinets[] = $cabinet + array('quote_id' => $quote_id);
break;
case 'custom_panel':
case 'custom_door':
$cabinet['resource_id'] = '0';
$quote_cabinets[] = $cabinet;
break;
default:
$quote_cabinets[] = $cabinet;
break;
}
}
$this->CabinetOrder->saveAll($quote_cabinets);
}
$this->redirect(FULL_BASE_URL . $this->webroot . 'quote_manager/quotes/detail/' . $quote_id . '#quote-detail');
}
示例2: redir
}
if (!isset($params[1])) {
redir();
}
$page_number = isset($params[2]) ? (int) $params[2] < 1 ? 1 : (int) $params[2] : 1;
$string = urldecode($params[1]);
$search = new Search();
$search->criteria = $string;
$search->page = $page_number;
$search->show_hidden = $session->level != 'anonymous';
$search->read();
$session->search = htmlspecialchars($string);
if (!$search->results) {
if ($search->page_size * ($search->page - 1) < $search->count) {
$html->do_sysmsg(_('Page not found'), null, 404);
} else {
$html->do_sysmsg(_('No quotes found'), _('There are no quotes matching your criteria.'), 404);
}
} else {
$html->do_header(sprintf(_('Search results for "%s"'), htmlspecialchars($string)));
$pager = $html->do_pages($search->page + 1, ceil($search->count / $search->page_size), sprintf('%ssearch/%s/%%d', $settings->base_url, str_replace('%', '%%', urlencode($string))), 4);
$quote = new Quote();
$odd = true;
foreach ($search->results as $this_quote) {
$quote->read($this_quote);
$quote->output($odd);
$odd = !$odd;
}
$html->output .= $pager;
$html->do_footer();
}
示例3: getTotalAmount
function getTotalAmount($id = null)
{
App::import("Model", "QuoteManager.Quote");
$q_model = new Quote();
$quote = $q_model->read(null, $id);
$total_quote_price = 0;
$total_quote_price_cabinet = 0;
$total_quote_price_installation = 0;
$total_quote_price_discount = 0;
$cabinets = array();
if ($quote['CabinetOrder'] && is_array($quote['CabinetOrder'])) {
App::import("Model", "Inventory.Cabinet");
App::import("Model", "Inventory.Item");
foreach ($quote['CabinetOrder'] as $cabinet_order) {
$cabinet = new Cabinet();
$item_model = new Item();
$resource_detail = array('Resource' => array('name' => '', 'description' => ''));
switch ($cabinet_order['resource_type']) {
case 'cabinet':
$resource_detail = $cabinet->find('first', array('conditions' => array('id' => $cabinet_order['resource_id'])));
$resource_detail['Resource']['name'] = $resource_detail['Cabinet']['name'];
$resource_detail['Resource']['description'] = $resource_detail['Cabinet']['description'];
$cabinets[] = $resource_detail;
break;
case 'item':
$resource_detail = $item_model->find('first', array('conditions' => array('Item.id' => $cabinet_order['resource_id'])));
$resource_detail['Resource']['name'] = $resource_detail['Cabinet'][0]['name'];
$resource_detail['Resource']['description'] = $resource_detail['Cabinet'][0]['description'];
$cabinets[] = $resource_detail;
break;
default:
break;
}
$sub_total = $cabinet_order['total_cost'];
$total_quote_price_cabinet += $sub_total;
}
}
if ($quote['Quote']['installation'] == 'We Installed' && !empty($cabinets) && is_array($cabinets)) {
$installation_summery_list = array();
foreach ($cabinets as $cabinet) {
if (!empty($cabinet['CabinetInstallation']) && is_array($cabinet['CabinetInstallation'])) {
foreach ($cabinet['CabinetInstallation'] as $installation) {
if (isset($installation_summery_list[$installation['name']]['quantity'])) {
$installation_summery_list[$installation['name']]['quantity']++;
} else {
$installation_summery_list[$installation['name']]['name'] = $installation['name'];
$installation_summery_list[$installation['name']]['price_unit'] = $installation['price_unit'];
$installation_summery_list[$installation['name']]['price'] = $installation['price'];
$installation_summery_list[$installation['name']]['quantity'] = 1;
}
}
}
}
if (!empty($installation_summery_list)) {
foreach ($installation_summery_list as $installation) {
$sub_total = $installation['price'] * $installation['quantity'];
$total_quote_price_installation += $sub_total;
}
}
}
$total_quote_price = $total_quote_price_cabinet + $total_quote_price_installation;
if ($quote['Quote']['delivery'] == '5 – 10 Weeks Delivery') {
$total_quote_price_discount = $total_quote_price * 0.25;
// 25% discount for late delivery
}
$total_quote_price -= $total_quote_price_discount;
return $total_quote_price;
}
示例4: switch
break;
case 'misc':
required_post(array('misc_action'));
switch ($_POST['misc_action']) {
case 'approve_all':
$quotes = $db->get_results('SELECT permaid FROM quotes WHERE status = \'pending\' AND db = :db', array(array(':db', $settings->db, PDO::PARAM_STR)));
if (!$quotes) {
die('no_pending_quotes');
break;
}
require classes_dir . 'quote.php';
echo 'Approving: ';
foreach ($quotes as $quoteid) {
$quote = new Quote();
$quote->permaid = $quoteid['permaid'];
if (!$quote->read()) {
continue;
}
printf('%s ', $quote->permaid);
$push->hit(sprintf(_('New quote: %s - %s'), $quote->permalink, $quote->excerpt));
$quote->status = 'approved';
$quote->save(false);
unset($quote);
}
break;
case 'privacy_login':
$db->query('UPDATE sites SET privacy_level = 2 WHERE db = :db', array(array(':db', $settings->db, PDO::PARAM_STR)));
break;
case 'privacy_hide_all':
$db->query('UPDATE sites SET privacy_level = 1 WHERE db = :db', array(array(':db', $settings->db, PDO::PARAM_STR)));
break;
示例5: sanitize
sanitize($quote);
$quotes[] = $quote;
}
out(array('results' => array('success' => 1, 'data' => $quotes, 'count' => $search->count)));
} else {
out(array('results' => array('success' => 1, 'error' => 'no_quotes_found', 'count' => 0)));
}
break;
case 'delete':
required_post(array('permaid'));
if (check_key() === null) {
out(array('results' => array('success' => 0, 'error' => 'access_denied')));
}
$quote = new Quote();
$quote->permaid = $_POST['permaid'];
if ($quote->read()) {
$quote->status = 'deleted';
$quote->save(false);
$session->log(sprintf('JSON API delete successful: %s - %s', $quote->permaid, $params[1]));
out(array('results' => array('success' => 1)));
}
out(array('results' => array('success' => 0, 'error' => 'no_such_quote')));
break;
case 'topic':
required_post(array('topic'));
if (check_key() === null) {
out(array('results' => array('success' => 0, 'error' => 'access_denied')));
}
$returna = $db->query('INSERT INTO topics (timestamp, nick, text, db, ip, user_agent)
VALUES (:timestamp, :nick, :text, :db, :ip, :user_agent)', array(array(':timestamp', time(), PDO::PARAM_INT), array(':nick', isset($_POST['nick']) ? $_POST['nick'] : '', PDO::PARAM_STR), array(':text', $_POST['topic'], PDO::PARAM_STR), array(':db', $settings->db, PDO::PARAM_STR), array(':ip', $session->ip, PDO::PARAM_STR), array(':user_agent', isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '', PDO::PARAM_STR)));
$returnb = $db->query('UPDATE sites SET topic_text = :topic_text, topic_nick = :topic_nick WHERE db = :db', array(array(':topic_text', $_POST['topic'], PDO::PARAM_STR), array(':topic_nick', isset($_POST['nick']) ? $_POST['nick'] : '', PDO::PARAM_STR), array(':db', $settings->db, PDO::PARAM_STR)));
示例6: foreach
<div class="container white">
<div class="content left">
<table class="data">
<thead>
<th>Date</th>
<th>Expires</th>
<th>Company</th>
<th>Contact/Email/Key</th>
<th>Items</th>
<th>Views</th>
</thead>
<tbody>
<?php
$quotes = Quote::read(['*'], FALSE, ['created > CURRENT_DATE - INTERVAL 2 MONTH'], 'created DESC');
foreach ($quotes as $quote) {
$expiration = Util2::future_date(substr($quote['created'], 0, 10), 60);
$items = QuoteItem::read_items($quote['id']);
$views = QuoteView::read_views($quote['id']);
$item_details = [];
foreach ($items as $item) {
$item_details[] = $item['quantity'] . ' ' . $item['part'];
}
$view_details = [];
foreach ($views as $view) {
$view_details[] = $view['created'] . ' ' . $view['ip'];
}
echo '<tr>';
echo '<td>' . htmlspecialchars($quote['created']) . '</td>';
echo '<td>' . htmlspecialchars($expiration) . '</td>';
echo '<td>' . htmlspecialchars($quote['company']) . '</td>';
echo '<td>' . htmlspecialchars($quote['technical_name']) . '<br/>';
示例7: or
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
require classes_dir . 'quote.php';
if (isset($params[0]) && strlen($params[0]) == 4) {
$quote = new Quote();
$quote->permaid = $params[0];
} else {
$html->do_sysmsg(_('Page not found'), null, 404);
}
if (!$quote->read() || $session->level == 'anonymous' && $quote->status != 'approved' || $quote->status == 'deleted') {
$html->do_sysmsg(_('Page not found'), null, 404);
}
if (isset($params[1]) && $params[1] == $quote->password) {
$quote->forceshow = true;
} elseif (isset($params[1]) && $params[1] != $quote->password) {
redir(sprintf('%s%s', $settings->base_url, $quote->permaid));
}
$html->do_header(sprintf(_('Quote #%s'), $quote->permaid));
$quote->output();
$html->do_footer();