public function test_getQueryParams() { //$actual=array ( 'site' => 'dummy', 'page' => 'testkit/', 'basepage' => 'testkit', 'slug' => array ( 0 => 'testkit', 1 => '', ), 'query' => array ( 'comp' => 'testcase', 'src' => '/srcspace/www/devlogiks/tests/helpers/test_helpers_urltools.php', 'category' => '22ffa003527fc7b4cfddb491cbfb1804', ), ); $result = getQueryParams(); $actual = ['site' => SITENAME, 'page' => PAGE, 'basepage' => 'test1', 'slug' => ['test2'], 'query' => false]; $this->assertEquals($actual, $result); }
public function calculate() { $transaction = array(); $fundsAvail = false; //make sure source account has sufficient funds switch (getAccountType($this->srcAccount['type'], true)) { //cash accounts case 'asset': if ($this->srcAccount['balance'] > $this->transAmount) { $fundsAvail = true; } break; //credit accounts //credit accounts case 'revolving': if ($this->srcAccount['credit_limit'] - $this->srcAccount['balance'] > $this->transAmount) { $fundsAvail = true; } break; } if ($fundsAvail) { //debit transaction amount from source account $transaction['srcAccount']['balance'] = $this->srcAcount['balance'] - $this->transAmount; //get account type switch (getAccountType($this->transAccount['type'], true)) { case 'expense': //debit transaction amount from transaction account $transaction['transAccount']['balance'] = $this->transAccount['balance'] - $this->transAmount; //update transaction account due date $transaction['transAccount']['due_date'] = date('Y-m-d', strtotime($this->transAccount['due_date'], getFrequencyOffest($this->transAccount['repeat']))); break; case 'asset': case 'installment': case 'credit': case 'revolving': //credit transaction amount to transaction account $transaction['transAccount']['balance'] = $this->transAccount['balance'] + $this->transAmount; break; } } foreach ($transaction as $array => $account) { $errors = array(); $query = "UPDATE accounts SET "; $count = 0; foreach ($account as $key => $value) { if ($count < count($account)) { $query .= $key . ' = ?, '; } else { $query .= $key . ' = ? '; } ++$count; } $params = getQueryParams($account); $query .= "WHERE ID = " . $account['ID']; $queryData[$array]['query'] = $query; $queryData[$array]['params'] = $params; } $transaction['transaction'] = array('transaction_account' => $this->transAccount['ID'], 'transaction_source' => $this->srcAccount['ID'], 'transaction_amount' => $this->transAccount, 'transaction_date' => $this->transDate, 'transaction_memo' => $this->transMemo, 'user' => $_SESSION['user_id']); $query = 'INSERT INTO transactions ( '; $count = 0; foreach ($transactions as $key => $value) { if ($count < count($transaction)) { $params .= $key . ', '; $vars .= '?, '; } else { $params .= $key; $vars .= '?'; } } $query .= $params . ' ) VALUES ( ' . $vars . ' )'; $params = getQueryParams($transaction); $queryData['transaction']['query'] = $query; $queryData['transaction']['params'] = $params; if ($result = processQuery($queryData, false)) { //An errors has occured if (isset($result['errors'])) { $transaction['errors'] = $result['errors']; return $transaction; } $_SESSION['transaction'] = $transaction; } return $transaction; }
function getQuerySingleParam($name) { //Funkcjapobiera pojedyñczy parametr z adresu www $qparams = getQueryParams(); if (isset($qparams[$name])) { return $qparams[$name]; } return NULL; }
/** * Remove the specified resource from storage. * * @param Request $request * @param int $id * * @return Response */ public function destroy(Request $request, $id) { if ($this->post->delete($id)) { return redirect()->route('post.index', getQueryParams($request->fullUrl()))->with('success', 'Post successfully deleted!'); } return redirect('post')->with('error', 'Error deleting Post !'); }
@extends('layouts.post_layout') <?php $create_route = ['post.store'] + getQueryParams(request()->fullUrl()); ?> @section('content') {!! Form::open(['route' => $create_route,'class' => 'form-horizontal post-form', 'novalidate' => 'novalidate', 'files' => true]) !!} @include('post.form') <div class="form-group"> <div class="row col-sm-3"> {!! Form::submit('Create', ['class' => 'btn btn-primary form-control']) !!} </div> </div> {!! Form::close() !!} @endsection
?> </h1> <!-- #endregion --> <!-- #region Sekcja wpisów --> <div class="large-8 column entrys"> <!-- #region POZOSTAŁE WPISY --> <!-- #region Settings --> <?php /* * Filtrowanie danych. Proces ten zaorągla wyniki wyszukiwania. * getQueryParams zwraca tablicę zawierającą wszystkie parametry wyszukiwania z linku. */ $query_params = getQueryParams(); if (isset($query_params['search'])) { $query_params['post_title_like'] = $query_params['search']; unset($query_params['search']); } $loop = new WP_Query($query_params); ?> <!-- #endregion --> <!-- #region Wypisywaie wpisów --> <?php if ($loop->have_posts()) { ?> <?php while ($loop->have_posts()) {