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)); }
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 . '})'); }
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!'); } }
public function process() { $this->quote->clearUID(); if (!empty($_POST)) { if ($this->quote->validate($_POST)) { return $this->parseResult($this->quote->post()); } } }
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'); }
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]; }
public function process($data) { $this->quote->clearUID(); if (!empty($data)) { if ($this->quote->validate($_POST)) { $this->parseResult($this->quote->post()); return true; } } return false; }
public static function createOne($array) { $quote = new Quote(); foreach ($array as $key => $value) { $quote[$key] = $value; } $quote->calc(); //automatic save //$quote->save(); return $quote; }
public function process($data) { if (!empty($_POST)) { if ($this->quote->validate($data)) { $this->quote['completed'] = 1; $this->quote->post(); $this->quote->clearUID(); return true; } } return false; }
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')); }
public function get() { $x = Quote::all(); $data['res'] = $x; $data['res_type'] = 'quote'; return View::make('admin.result.master.quote', $data); }
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]); }
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)); }
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)); }
private function removeQuote() { if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST['quoteId'])) { Quote::removeQuote($_POST['quoteId']); } header("Location: " . URL); }
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]; } } }
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'; } }
/** * 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')); }
function __construct() { parent::__construct(); $this->view_data['core_settings'] = Setting::first(); if ($this->input->cookie('language') != "") { $language = $this->input->cookie('language'); } else { if (isset($this->view_data['language'])) { $language = $this->view_data['language']; } else { if (!empty($this->view_data['core_settings']->language)) { $language = $this->view_data['core_settings']->language; } else { $language = "english"; } } } $this->lang->load('application', $language); $this->lang->load('messages', $language); $this->lang->load('event', $language); $this->user = $this->session->userdata('user_id') ? User::find_by_id($this->session->userdata('user_id')) : FALSE; $this->client = $this->session->userdata('client_id') ? Client::find_by_id($this->session->userdata('client_id')) : FALSE; if ($this->client) { $this->theme_view = 'application_client'; } $this->view_data['datetime'] = date('Y-m-d H:i', time()); $this->view_data['sticky'] = Project::all(array('conditions' => 'sticky = 1')); $this->view_data['quotations_new'] = Quote::find_by_sql("select count(id) as amount from quotations where status='New'"); if ($this->user || $this->client) { $access = $this->user ? $this->user->access : $this->client->access; $access = explode(",", $access); if ($this->user) { $this->view_data['menu'] = Module::find('all', array('order' => 'sort asc', 'conditions' => array('id in (?) AND type = ?', $access, 'main'))); $this->view_data['widgets'] = Module::find('all', array('conditions' => array('id in (?) AND type = ?', $access, 'widget'))); } else { $this->view_data['menu'] = Module::find('all', array('order' => 'sort asc', 'conditions' => array('id in (?) AND type = ?', $access, 'client'))); } if ($this->user) { $update = User::find($this->user->id); } else { $update = Client::find($this->client->id); } $update->last_active = time(); $update->save(); if ($this->user) { $this->view_data['user_online'] = User::all(array('conditions' => array('last_active+(30 * 60) > ? AND status = ?', time(), "active"))); $this->view_data['client_online'] = Client::all(array('conditions' => array('last_active+(30 * 60) > ? AND inactive = ?', time(), "0"))); } $email = $this->user ? 'u' . $this->user->id : 'c' . $this->client->id; $this->view_data['messages_new'] = Privatemessage::find_by_sql("select count(id) as amount from privatemessages where `status`='New' AND recipient = '" . $email . "'"); $this->view_data['tickets_new'] = Ticket::find_by_sql("select count(id) as amount from tickets where `status`='New'"); } /*$this->load->database(); $sql = "select * FROM templates WHERE type='notes'"; $query = $this->db->query($sql); */ $this->view_data["note_templates"] = ""; //$query->result(); }
public function home() { $quotes = Quote::all()->toArray(); //var_dump($quotes); $quote = $quotes[rand(0, count($quotes) - 1)]; $mostviewed = Katalog::orderBy('view', 'desc')->take(9)->get(); $lastrelease = Katalog::orderBy('created_at', 'desc')->take(9)->get(); return View::make('home', compact('quote', 'mostviewed', 'lastrelease')); }
/** * Display a listing of finances * * @return Response */ public function index() { if (!Sentry::getUser()) { return Redirect::route('sessions.create'); } $timecards = Timecard::all(); $quotes = Quote::all(); $invoices = Invoice::all(); return View::make('finances.index', compact('timecards', 'quotes', 'invoices')); }
public function run() { $criteria = new CDbCriteria(); $criteria->condition = 'approvedTime'; $quote = Quote::model()->findByPk($_GET['id'], $criteria); if ($quote === null) { throw new CHttpException(404, 'Quote not found'); } $this->controller->render('quote', array('quote' => $quote)); }
function index() { $conn = $this->get_connection(); $item_factory = new WatchlistItem(); $this->items = $item_factory->find_all(array('where_clause' => "`utente` = '{$conn->escape($_COOKIE['username'])}' ", 'order_by' => sprintf('`%s` %s', $this->get_sort('isin'), $this->get_dir()), 'limit' => $this->get_limit())); if (count($this->items) > 0) { foreach ($this->items as $item) { $item->stock = new Stock(); $item->stock->find_by_id($item->isin); $quote = new Quote(); $quotes = $quote->find_all(array('where_clause' => "`isin` = '{$conn->escape($item->isin)}' ", 'order_by' => '`data` DESC, `ora` DESC', 'limit' => 1)); $item->quote = $quotes[0]; $quotes = $quote->find_by_query('SELECT `id`, `quotazione` ' . 'FROM `creso_quotazioni` ' . "WHERE `isin` = '{$conn->escape($item->isin)}' " . "AND `data` >= '{$conn->escape(date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') - 1)))}' " . 'ORDER BY `quotazione` DESC ' . 'LIMIT 1'); $item->max_quote = $quotes[0]; $quotes = $quote->find_by_query('SELECT `id`, `quotazione` ' . 'FROM `creso_quotazioni` ' . "WHERE `isin` = '{$conn->escape($item->isin)}' " . "AND `data` >= '{$conn->escape(date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') - 1)))}' " . 'ORDER BY `quotazione` ASC ' . 'LIMIT 1'); $item->min_quote = $quotes[0]; } } }
public function order_request($params = []) { $quote = Quote::read_by_params($params); if (!isset($quote['id'])) { Render::error_404(); } $order = $params; $order += $quote; $order['country'] = Util::get_countries()[$order['country']]; $order['payment'] = Util::get_payments()[$order['payment']]; if (!isset($order['po'])) { $order['po'] = ''; } $body = Template::render_doc_by_name('order-email', $order); // send order request to "WinWrap Web Primary/web.primary@winwrap.com" $linkc = 'https://www.winwrap.com/web/basic/support/admin/new_company.asp' . '?license=16' . '&company=' . urlencode($order['company']) . '&country=' . urlencode($order['country']) . '&billingaddress=' . urlencode(str_replace("\r\n", '|', $order['address'])) . '&billingname=' . urlencode($order['billing_name']) . '&billingaddr=' . urlencode($order['billing_email']) . '&billingphone=' . urlencode($order['billing_phone']) . '&name=' . urlencode($order['technical_name']) . '&addr=' . urlencode($order['technical_email']); $link = 'https://www.winwrap.com/web/basic/support/admin/new_fees.asp' . '?licenseid=' . '&company=' . urlencode($order['company']) . '&feecount=0' . '&payment=' . urlencode($order['payment']) . '&po=' . urlencode($order['po']); if (!is_null($quote['discount'])) { $link .= '&WWXX00=' . urlencode($quote['discount']) . '&WWXX00_DESC=' . urlencode($quote['discount_desc']); } $problem = false; $parts = []; foreach ($quote['items'] as $item) { $link .= '&' . $item['part'] . '=' . $item['quantity']; $part = substr($item['part'], 0, 6); if (array_search($part, $parts)) { $problem = true; } else { $parts[] = $part; } if (isset($item['override'])) { $link .= '&' . $part . '-override=' . $item['override']; } } $bodyc = '1) Click on this link to create the new company:' . "\r\n" . $linkc . "\r\n\r\n"; if ($problem) { $bodyc .= '*** the following link will not create the correct fees ***' . "\r\n"; } $bodyc .= '2) Click on this link to create the fees and invoice:' . "\r\n" . $link . "\r\n\r\n" . $body; $args = ['IP: ' . $_SERVER['REMOTE_ADDR'] . "\r\n\r\n" . 'toname' => 'WinWrap Web Primary', 'toemail' => '*****@*****.**', 'fromname' => 'WinWrap Web Primary', 'fromemail' => '*****@*****.**', 'subject' => 'WinWrap Basic Order Request', 'body' => $bodyc]; if (GoogleMail::send($args) !== true) { header('Status: 500'); return; } $status = '1/2: send to ' . $args['toemail'] . "\r\n"; //echo '<pre>' . $body . '</pre>'; exit; // send order request to puchaser $args = ['toname' => $order['billing_name'], 'toemail' => $order['billing_email'], 'fromname' => 'WinWrap Support', 'fromemail' => '*****@*****.**', 'subject' => 'WinWrap Basic Order Request', 'body' => $body]; if (GoogleMail::send($args) !== true) { header('Status: 500'); return; } $status .= '2/2: send to ' . $args['toemail']; Render::text($status); }
public function run() { $id = !empty($_GET['id']) ? $_GET['id'] : 0; $quote = Quote::model()->findByPk($id); if ($quote === null) { throw new CHttpException(404, 'Quote not found'); } $quote->delete(); Yii::app()->user->setFlash('generalMessage', 'Quote was deleted successfully.'); $this->controller->redirect(array('list')); }
public function __construct($_orid) { include '../helpers/db_new.inc.php'; $sql = 'SELECT ordate ,ortype ,brokerid ,qid ,amount ,currencyid ,price ,stoploss ,stopprice ,takeprofit ,takeprice ,amountlot ,total ,brokerrevenue ,orcomment ,parentid ,accountid FROM orders WHERE orid = :orid'; try { $stmt = $pdo->prepare($sql); $stmt->bindParam(':orid', $_orid); $stmt->execute(); } catch (PDOException $e) { $error = $e->getMessage(); $redirect = '../error.html.php'; header("Location: {$redirect}"); exit; } $row = $stmt->fetch(); if ($row) { parent::__construct($row['qid']); $this->_orid = $_orid; $this->_ordate = $row['ordate']; $this->_ortype = $row['ortype']; $this->_brokerId = $row['brokerid']; $this->_amount = $row['amount']; $this->_amountLot = $row['amountlot']; $this->_currencyId = $row['currencyid']; $this->_price = $row['price']; $this->_stopLoss = $row['stoploss']; $this->_stopPrice = $row['stopprice']; $this->_takeProfit = $row['takeprofit']; $this->_takePrice = $row['takeprice']; $this->_sumTotal = $row['total']; $this->_brokerRevenue = $row['brokerrevenue']; $this->_orcomment = $row['orcomment']; $this->_parentId = $row['parentid']; } }
public function run() { DB::table('votes')->delete(); $vote = new Vote(); $vote->vote = 1; $quote = Quote::where('title', '=', 'Test Quote')->first(); $user = User::where('username', '=', 'tjbenator')->first(); $vote->user()->associate($user); $vote->quote()->associate($quote); $vote->save(); }
public function run() { $config = new CConfiguration(Yii::app()->basePath . '/config/pager.php'); $criteria = new CDbCriteria(); $criteria->order = 'approvedTime DESC'; $criteria->condition = 'approvedTime'; $pages = new CPagination(Quote::model()->count($criteria)); $config->applyTo($pages); $pages->applyLimit($criteria); $quotes = Quote::model()->with('tags', 'author')->findAll($criteria); $this->controller->render('list', array('quotes' => $quotes, 'pages' => $pages)); }
private function getStatistics() { $staistics = array(); if ($this->controller->id == 'quote') { // Quotes total count. $staistics['totalCount'] = Quote::model()->count(); // Get number of unapproved quotes. $criteria = new CDbCriteria(); $criteria->condition = 'NOT approvedTime'; $staistics['unapprovedCount'] = Quote::model()->count($criteria); } elseif ($this->controller->id == 'tag') { $staistics['totalCount'] = Tag::model()->count(); $tags = Tag::model()->with('quotesCount')->findAll(); // Delete tags with empty quotesCount (With PHP > 5.3 e can use closure here). // TODO: Rewrite this code for PHP 5.3 when it will be avaliable. function tagsFilter($tag) { return (bool) $tag->quotesCount; } $tags = array_filter($tags, 'tagsFilter'); // Sort tags by their weights (quotesCount). function tagsSort($a, $b) { if ($a->quotesCount == $b->quotesCount) { return 0; } return $a->quotesCount > $b->quotesCount ? -1 : 1; } usort($tags, 'tagsSort'); $staistics['popularTags'] = array_slice($tags, 0, 10); } elseif ($this->controller->id == 'author') { $staistics['totalCount'] = Author::model()->count(); $authors = Author::model()->with('quotesCount')->findAll(); // Delete authors with empty quotesCount (With PHP > 5.3 e can use closure here). // TODO: Rewrite this code for PHP 5.3 when it will be avaliable. function authorsFilter($author) { return (bool) $author->quotesCount; } $authors = array_filter($authors, 'authorsFilter'); // Sort tags by their weights (quotesCount). function authorsSort($a, $b) { if ($a->quotesCount == $b->quotesCount) { return 0; } return $a->quotesCount > $b->quotesCount ? -1 : 1; } usort($authors, 'authorsSort'); $staistics['popularAuthors'] = array_slice($authors, 0, 10); } return $staistics; }
public function run($context) { $preferences = $context->preferences; $quote_count = 0; $stocks = $context->stocks; foreach ($stocks as $stock) { if (!$stock->attivo) { continue; } if ($stock->mercato != 'eurotlx' && $stock->mercato != 'tlx') { continue; } $quote = new Quote(); $quote->isin = $stock->isin; $quote->quotazione = isin2value_tlx($quote->isin, $preferences->isin_lookup_eurotlx); $quote->data = date('Y-m-d'); $quote->ora = date('H:i:s'); if (is_numeric($quote->quotazione)) { $quote->save(); $quote_count++; } } printf("%s fetched %d quotes\n", get_called_class(), $quote_count); }