本文整理汇总了PHP中Quote类的典型用法代码示例。如果您正苦于以下问题:PHP Quote类的具体用法?PHP Quote怎么用?PHP Quote使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Quote类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$form = new AddQuoteForm();
if (!empty($_POST['AddQuoteForm']) && is_array($_POST['AddQuoteForm'])) {
$form->attributes = $_POST['AddQuoteForm'];
if ($form->validate()) {
$quote = new Quote();
$quote->textEn = $form->textEn;
$quote->textRu = $form->textRu;
$quote->authorId = 0;
$quote->notes = $form->author . ' : ' . $form->notes;
if ($quote->save()) {
/*
* Send emaiil with notification to admin.
*/
$email = Yii::app()->email;
$email->type = 'text/plain';
$email->to = Yii::app()->params['adminEmail'];
$email->subject = 'New quote request.';
$email->message = $this->controller->renderPartial('_emailAdd', array('quote' => $quote), true);
$email->send();
$this->controller->redirect(array('addThanks'));
}
}
}
$this->controller->render('add', array('form' => $form));
}
示例2: quotazione
function quotazione()
{
$conn = $this->get_connection();
$quote = new Quote();
$quotes = $quote->find_all(array('where_clause' => "`isin` = '{$conn->escape($_GET['isin'])}' ", 'order_by' => '`data` DESC, `ora` DESC ', 'limit' => 1));
$quotazione = $quotes[0]->quotazione;
die('({quotazione:' . $quotazione . '})');
}
示例3: getUnvote
public function getUnvote(Quote $quote)
{
$vuser = $quote->voted()->whereUserId(Auth::user()->id)->first();
if ($vuser) {
$quote->voted()->detach(Auth::user());
$quote->updateVoteConfidence();
return Redirect::route('quote', array($quote->id))->withErrors('You have removed your vote!');
}
}
示例4: add
public function add()
{
$quote = new Quote();
$quote->user_id = $this->session->userdata('id');
$quote->text = $this->input->post('body');
$quote->author = $this->input->post('author');
$quote->save();
header('Location: /quotes');
}
示例5: for_range_and_order
public static function for_range_and_order($isin, $date_from, $date_to, $order_by, $sort_dir)
{
$conn = Db::get_connection();
$quote = new Quote();
$quotes = $quote->find_by_query('SELECT `id`, `quotazione` ' . 'FROM `creso_quotazioni` ' . "WHERE `isin` = '{$conn->escape($isin)}' " . "AND `data` > '{$conn->escape($date_from)}' " . "AND `data` < '{$conn->escape($date_to)}' " . "ORDER BY `{$conn->escape($order_by)}` {$conn->escape(strtoupper($sort_dir))} " . 'LIMIT 1');
// print_r($quotes);
Db::close_connection($conn);
return $quotes[0];
}
示例6: createOne
public static function createOne($array)
{
$quote = new Quote();
foreach ($array as $key => $value) {
$quote[$key] = $value;
}
$quote->calc();
//automatic save
//$quote->save();
return $quote;
}
示例7: index
public function index()
{
App::import('Model', 'QuoteManager.Quote');
$quoteModel = new Quote();
$quoteDataList = $quoteModel->find('all', array('fields' => array('quote_number', 'status'), 'conditions' => array('Quote.vid' => null, 'Quote.created_by' => $this->loginUser['id'])));
App::import('Model', 'WorkOrderManager.WorkOrder');
$workOrderModel = new WorkOrder();
$workOrderDataList = $workOrderModel->find('all', array('fields' => array('work_order_number', 'status'), 'conditions' => array('WorkOrder.created_by' => $this->loginUser['id'])));
App::import('Model', 'PurchaseOrderManager.PurchaseOrder');
$purchaseOrderModel = new PurchaseOrder();
$purchaseOrderDataList = $purchaseOrderModel->find('all', array('fields' => array('purchase_order_num', 'received'), 'conditions' => array('PurchaseOrder.created_by' => $this->loginUser['id'])));
$this->set(compact('quoteDataList', 'workOrderDataList', 'purchaseOrderDataList'));
}
示例8: get
public function get()
{
$x = Quote::all();
$data['res'] = $x;
$data['res_type'] = 'quote';
return View::make('admin.result.master.quote', $data);
}
示例9: getMain
public function getMain()
{
$moderatequotes = Quote::orderBy('id', 'desc')->whereStatus(0);
$quotes = Auth::user()->quotes()->orderBy('id', 'desc')->paginate(Config::get('settings.per_page'));
$this->layout->title = 'Dashboard';
$this->layout->nest('content', 'user.dashboard.main', ['quotes' => $quotes, 'moderatequotes' => $moderatequotes]);
}
示例10: run
public function run()
{
$session = Yii::app()->session;
$config = new CConfiguration(Yii::app()->basePath . '/config/pager.php');
$cookies = Yii::app()->request->cookies;
// If referrer is not our controller delete search parameters from session.
if (strpos(Yii::app()->request->urlReferrer, '/quote/list') === false) {
unset($session['search']);
}
if (!empty($_POST['search']) && is_array($_POST['search'])) {
$search = $_POST['search'];
$session['search'] = $search;
} else {
if (!empty($session['search'])) {
$search = $session['search'];
} else {
$search = array('text' => '', 'authorId' => 0, 'approved' => 'all');
}
}
$criteria = new CDbCriteria();
$criteria->condition = '(textRu LIKE :text OR textEn LIKE :text) ' . ($search['authorId'] ? 'AND authorId = :authorId ' : '') . ($search['approved'] == 'approved' ? 'AND approvedTime ' : '') . ($search['approved'] == 'unApproved' ? 'AND (approvedTime IS NULL OR approvedTime = 0) ' : '');
$criteria->params = array(':text' => "%{$search['text']}%") + ($search['authorId'] ? array(':authorId' => $search['authorId']) : array());
$criteria->order = 'Quote.id DESC';
$pages = new CPagination(Quote::model()->count($criteria));
$config->applyTo($pages);
$pages->applyLimit($criteria);
$quotes = Quote::model()->with('tags', 'author')->findAll($criteria);
$showSearchForm = !empty($cookies['showSearchForm']) && $cookies['showSearchForm']->value ? true : false;
$criteria = new CDbCriteria();
$criteria->order = 'name';
$authors = Author::model()->findAll($criteria);
$this->controller->render('list', array('quotes' => $quotes, 'pages' => $pages, 'authors' => $authors, 'search' => $search, 'showSearchForm' => $showSearchForm));
}
示例11: run
public function run()
{
$config = new CConfiguration(Yii::app()->basePath . '/config/pager.php');
$form = new SearchForm();
// If referrer is not our action delete search parameters from session.
if (strpos(Yii::app()->request->urlReferrer, '/site/search') === false) {
Yii::app()->session->remove('siteSearch');
} else {
if (!empty(Yii::app()->session['SearchForm'])) {
$siteSearch = Yii::app()->session['SearchForm'];
$form->text = $siteSearch['text'];
$form->authorId = $siteSearch['authorId'];
}
}
if (!empty($_POST['SearchForm']) && is_array($_POST['SearchForm'])) {
$form->attributes = $_POST['SearchForm'];
Yii::app()->session['SearchForm'] = array('text' => $form->text, 'authorId' => $form->authorId);
}
$criteria = new CDbCriteria();
$criteria->order = 'approvedTime DESC';
$criteria->condition = 'approvedTime AND (textRu LIKE :text OR textEn LIKE :text) ' . ($form->authorId ? 'AND (authorId LIKE :authorId)' : '');
$criteria->params = array(':text' => "%{$form->text}%") + ($form->authorId ? array(':authorId' => $form->authorId) : array());
$pages = new CPagination(Quote::model()->count($criteria));
$config->applyTo($pages);
$pages->applyLimit($criteria);
$quotes = Quote::model()->with('tags')->findAll($criteria);
$criteria = new CDbCriteria();
$criteria->order = 'name';
$authors = Author::model()->findAll($criteria);
$this->controller->render('search', array('quotes' => $quotes, 'pages' => $pages, 'form' => $form, 'authors' => $authors));
}
示例12: removeQuote
private function removeQuote()
{
if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST['quoteId'])) {
Quote::removeQuote($_POST['quoteId']);
}
header("Location: " . URL);
}
示例13: index
function index()
{
$conn = $this->get_connection();
$dividend_factory = new Dividend();
//set_default_dir('up');
$this->dividends = $dividend_factory->find_by_query('SELECT `creso_dividendi`.`id`, `creso_dividendi`.`stacco`, `creso_dividendi`.`importo`, `creso_dividendi`.`isin`, `creso_titoli`.`title` ' . 'FROM `creso_dividendi` ' . 'LEFT JOIN `creso_titoli` ON `creso_dividendi`.`isin` = `creso_titoli`.`isin` ' . "WHERE 1 " . (!empty($_REQUEST['mercato']) ? "AND `mercato` = '{$conn->escape($_REQUEST['mercato'])}' " : '') . (!empty($_REQUEST['tipo']) ? "AND `tipo` = '{$conn->escape($_REQUEST['tipo'])}' " : '') . (!empty($_REQUEST['from']) ? "AND `stacco` >= '{$conn->escape($_REQUEST['from'])}' " : '') . (!empty($_REQUEST['to']) ? "AND `stacco` <= '{$conn->escape($_REQUEST['to'])}' " : '') . 'ORDER BY ' . sprintf('`%s` %s ', $this->get_sort('stacco'), $this->get_dir()) . "LIMIT {$conn->escape($this->get_start())}, {$conn->escape($this->get_limit())}");
if (count($this->dividends) > 0) {
foreach ($this->dividends as $dividend) {
$dividend->stock = new Stock();
$dividend->stock->find_by_id($dividend->isin);
$quote = new Quote();
$quotes = $quote->find_all(array('where_clause' => "`isin` = '{$conn->escape($dividend->isin)}' ", 'order_by' => '`data` DESC, `ora` DESC', 'limit' => 1));
$dividend->quote = $quotes[0];
}
}
}
示例14: index
function index()
{
if ($_POST) {
unset($_POST['send']);
$_POST = array_map('htmlspecialchars', $_POST);
$_POST['status'] = "New";
$_POST['date'] = date("Y-m-d H:i", time());
$item = Quote::create($_POST);
if (!$item) {
$this->session->set_flashdata('message', 'error:' . $this->lang->line('quotation_create_error'));
} else {
$this->load->helper('notification');
$this->session->set_flashdata('message', 'success:' . $this->lang->line('quotation_create_success'));
$admins = User::find('all', array('conditions' => array('admin = ? AND status = ?', '1', 'active')));
foreach ($admins as &$value) {
send_notification($value->email, $this->lang->line('application_notification_quotation_subject'), $this->lang->line('application_notification_quotation'));
}
}
redirect('quotation');
} else {
$this->theme_view = 'fullpage';
$this->view_data['form_action'] = 'quotation';
$this->content_view = 'quotation/_main';
}
}
示例15: detail
/**
* view method
*
* @param string $id
* @return void
*/
public function detail($id = null, $modal = null)
{
$this->layoutOpt['left_nav_selected'] = "view_customer";
$this->Customer->id = $id;
if (!$this->Customer->exists()) {
throw new NotFoundException(__('Invalid customer'));
}
//$this->set('customer', $this->Customer->read(null, $id));
$customer = $this->Customer->read(null, $id);
App::uses("CustomerSalesRepresentetives", "CustomerManager.Model");
$sales = new CustomerSalesRepresentetives();
$sales_representatives = $sales->find("all", array("conditions" => array("CustomerSalesRepresentetives.customer_id" => $id)));
App::uses("Quote", "QuoteManager.Model");
$quote = new Quote();
$quotes = $quote->find("all", array("conditions" => array("Quote.vid" => null, 'Quote.customer_id' => $id)));
$this->set(compact('customer', 'modal', 'sales_representatives', 'quotes'));
}