public function process() { $results = $this->collector->get(); $functions = $this->config->get_functions(); foreach ($results as $result) { if (!isset($functions[$result['function']])) { continue; } $function_data = $functions[$result['function']]; if (isset($this->handlers[$function_data['type']])) { $this->handlers[$function_data['type']]->add($result); } } }
public function showMain() { $page = $this->node; $tree = Collector::get('root'); $subTree = Tree::getSubTree($tree, $page); $blocks = null; if ($subTree) { $blocks = $subTree->children; } foreach ($blocks as $index => $block) { $blocks[$block->slug] = $block; unset($blocks[$index]); } $allRates = Cache::tags('rates')->rememberForever('rates_' . App::getLocale(), function () { return Rates::orderPriority()->get(); }); $rates = array(); foreach ($allRates as $i => $rate) { if ($rate['type'] == 1) { $rates['departments'][] = $rate; } else { $rates['cards'][$rate['name_card']][] = $rate; } } $calculatorCredit = new CashCalculator(); // fixme: //$calculatorCredit->setMonthlyIncome(Settings::get('monthly_income_default', 0)); $calculatorCredit->setCreditAmount(Settings::get('credit_amount_default', 100000)); $calculatorCredit->setTerm(Settings::get('term_default', 3)); $calculationsCredit = $calculatorCredit->calculate(); return View::make('index', compact('page', 'blocks', 'rates', 'calculationsCredit')); }
public function showRisksManagement() { $page = $this->node; $tree = Collector::get('root'); $subTree = Tree::getSubTree($tree, $page); $risks = null; if ($subTree) { $risks = $subTree->children; } return View::make('investor.risks', compact('page', 'risks')); }
public function showSingle() { $page = $this->node; $tree = Collector::get('root'); $subTree = Tree::getSubTree($tree, $page); $blocks = null; if ($subTree) { $blocks = $subTree->children; } return View::make('small-business.single', compact('page', 'blocks')); }
public function showIndex() { $page = $this->node; $sliderItems = Cache::tags('slider_items')->rememberForever('corporate_business_slider_' . App::getLocale(), function () { return SliderItem::corporateBusiness()->active()->get(); }); $products = Cache::tags('j_tree')->rememberForever('corporate_business_products_' . App::getLocale(), function () use($page) { return $page->immediateDescendants()->where('is_active', 'like', '%' . App::getLocale() . '%')->get(); }); $partnership = null; foreach ($products as $index => $product) { if ($product->slug == 'partnership') { $partnership = $product; unset($products[$index]); } } $news = Cache::tags('news')->rememberForever('corporate_business_news_' . App::getLocale(), function () use($page) { return News::active()->byCatalog(Collector::get('idNewsCatalog'))->byCategories(Collector::get('idCorporateBusinessCategory'))->desc()->get(); }); return View::make('corporate-business.index', compact('page', 'sliderItems', 'products', 'partnership', 'news')); }
public function __construct() { $this->settings = Collector::get('calculatorsSettings')['deposit']; $this->setPercent($this->settings['percent']); $this->setPercentMilitary($this->settings['percent_military']); $this->setDepositIds(Tree::getDepositsCompared()); }
$cities = Cache::tags('cities')->rememberForever('cities_' . App::getLocale(), function () { return City::active()->get(); }); $shops = Cache::tags('shops')->rememberForever('shops_' . App::getLocale(), function () { return Shop::active()->get(); }); $products = Cache::tags('products')->rememberForever('products_' . App::getLocale(), function () { return Product::active()->get(); }); $view->with('cities', $cities)->with('shops', $shops)->with('products', $products); }); View::composer('partials.calculators.cards', function ($view) { $programs = Cache::tags('j_tree', 'cards_programs')->rememberForever('privates_cards_programs_' . App::getLocale(), function () { return CardProgram::active()->get(); }); $cards = Cache::tags('j_tree', 'cards')->rememberForever('privates_cards_' . App::getLocale(), function () { $cardsCatalog = Tree::find(Collector::get('idCardsCatalog')); return $cardsCatalog->immediateDescendants()->with('cardsPrograms')->active()->get(); }); $view->with('programs', $programs)->with('cards', $cards); }); View::composer('partials.calculators.want_multiply', function ($view) { $calculatorDeposit = new DepositCalculator(); $calculatorDeposit->setDepositAmount(Settings::get('deposit_amount_default', 100000)); $calculatorDeposit->setTerm(Settings::get('term_default', 3)); $calculatorDeposit->setMonthlyInstallment(0); $calculatorDeposit->setCurrency('uah'); $calculatorDeposit->setIsMain(true); $calculations = $calculatorDeposit->calculate(); $view->with('calculations', $calculations); });
public function showTransfer() { $page = $this->node; $tree = Collector::get('root'); $subTree = Tree::getSubTree($tree, $page); $blocks = null; if ($subTree) { $blocks = $subTree->children; } return View::make('private-persons.transfers.single', compact('page', 'blocks')); }
public function __construct() { $this->settings = Collector::get('calculatorsSettings')['consumer']; $this->setPercent($this->settings['percent']); }
public function showCreditRepay() { $page = $this->node; $tree = Collector::get('root'); $subTree = Tree::getSubTree($tree, $page); $blocks = null; if ($subTree) { $blocks = $subTree->children; } return View::make('about.credit_repay', compact('page', 'blocks')); }
/** * Get a header * * {@inheritdoc} * * @see DataCollection::get() * @param string $key The key of the header to return * @param mixed $default_val The default value of the header if it contains no value * @return mixed */ public function get($key, $default_val = null) { $key = $this->normalizeKey($key); return parent::get($key, $default_val); }
public function doDepositCalculation() { App::setLocale(Cookie::get('locale', 'ru')); $isMain = intval(Input::get('is_main')); $depositAmount = intval(trim(Input::get('deposit_amount'))); $term = intval(trim(Input::get('term'))); $monthlyInstallment = intval(trim(Input::get('monthly_installment'))); $currency = trim(Input::get('currency')); $interestPaymentType = trim(Input::get('interest_payment_type')); $interestPaymentPercent = trim(Input::get('interest_payment_percent')); if (!$depositAmount || !$term || !$currency) { return Response::json(array('status' => false)); } $calculator = new DepositCalculator(); $calculator->setDepositAmount($depositAmount); $calculator->setTerm($term); $calculator->setMonthlyInstallment($monthlyInstallment); $calculator->setCurrency($currency); $viewTemplate = 'partials.calculators.partials.deposit_table_main'; $sliderHtml = ''; if (!$isMain) { $calculator->setInterestPaymentType($interestPaymentType); $calculator->setInterestPaymentPercent($interestPaymentPercent); $calculator->setIsMain(false); $viewTemplate = 'partials.calculators.partials.deposit_table'; } $calculations = $calculator->calculate(); if (!$isMain) { $depositsIds = Tree::getDepositsCompared(); $depositsCatalog = Cache::tags('j_tree')->rememberForever('deposits_catalog_' . App::getLocale(), function () { return Tree::find(Collector::get('idDepositsCatalog')); }); $deposits = Cache::tags('j_tree')->rememberForever('deposits_products_' . App::getLocale(), function () use($depositsCatalog) { return $depositsCatalog->children()->get(); }); $deposits = Tree::filterDepositsByIds($deposits, $depositsIds); $allDeposits = Cache::tags('deposits')->rememberForever('deposits_' . App::getLocale(), function () { return Deposit::all(); }); $depositOptionsGroups = Deposit::prepareData($allDeposits); $sliderHtml = View::make('private-persons.deposits.partials.deposits_slider', compact('deposits', 'depositOptionsGroups', 'calculations'))->render(); } $html = View::make($viewTemplate, compact('result', 'currency', 'calculations'))->render(); $firstDepositData = array(); if ($calculations) { $firstDepositData = array_values($calculations)[0]; } return Response::json(array('status' => true, 'html' => $html, 'slider_html' => $sliderHtml, 'currency' => isset($calculations['currency']) ? $calculations['currency'] : '', 'result' => isset($calculations['sum']) ? $calculations['sum'] : '', 'sum' => $firstDepositData['sum'])); }
public function __construct() { $this->settings = Collector::get('calculatorsSettings')['cash']; // todo: set calculator specific settings }