public function getUsers(Request $request) { $yetkiler = Role::all(); $count = $request->get('count'); $page = $request->get('page'); $filters = $request->get('filter'); $sorting = $request->get('sorting'); $results = new User(); if (is_array($filters)) { foreach ($filters as $key => $filter) { $results = $results->where($key, 'like', "%" . urldecode($filter) . "%"); } } if (is_array($sorting)) { foreach ($sorting as $key => $sort) { $results = $results->orderBy($key, $sort); } } else { $results = $results->orderBy('id', 'desc'); } if ($request->has('count') && $request->has('page')) { $results = $results->skip($count * ($page - 1))->take($count); } $results = $results->get(); $filter_yetkiler = Role::select('id', 'display_name as title')->get(); return array('results' => $results, 'inlineCount' => User::count(), 'yetkiler' => $yetkiler, 'filter_yetkiler' => $filter_yetkiler); }
public function index() { $post = array('alert' => ''); Model::load('admincp/comments'); if ($match = Uri::match('\\/comments\\/(\\w+)')) { if (method_exists("controlComments", $match[1])) { $method = $match[1]; $this->{$method}(); die; } } $curPage = 0; if ($match = Uri::match('\\/page\\/(\\d+)')) { $curPage = $match[1]; } if (Request::has('btnAction')) { actionProcess(); } if (Request::has('btnSearch')) { filterProcess(); } else { $post['pages'] = Misc::genSmallPage('admincp/comments', $curPage); $filterPending = ''; if (Uri::has('\\/status\\/pending')) { $filterPending = " AND c.status='0' "; } $post['theList'] = Comments::get(array('limitShow' => 20, 'limitPage' => $curPage, 'query' => "select c.*,p.title from " . Database::getPrefix() . "post p," . Database::getPrefix() . "comments c where c.postid=p.postid order by c.commentid desc", 'cacheTime' => 1)); } System::setTitle('Comments list - ' . ADMINCP_TITLE); View::make('admincp/head'); self::makeContents('commentsList', $post); View::make('admincp/footer'); }
public function index() { $dataAccess = new ClientMng(); //$clients = $dataAccess->getClientsFromUsers(); $request = Request::create('/api/clients', 'GET'); $response = Route::dispatch($request); $obj = json_decode($response->content(), true); $clients = $obj["data"]; if (\Request::has('search')) { $query = \Request::get('search'); $results = $dataAccess->search($query); if (count($results) < 1) { $results = $dataAccess->searchRaw($query); } return \View::make('clientlist')->with('clients', $results); } //$obj2 = $obj["data"]; // foreach($obj as $i) // { // //echo $i[1]["firstName"]; // //echo print_r($i); // array_push($obj2, $i); // } //echo $response; //echo print_r($obj2); //echo $clients[0]["id"]; //echo $response->content(); //echo print_r($obj2); return \View::make('clientlist')->with('clients', $clients); }
public function getResult($id = 'x') { $printed = \Request::get('printed'); $slctd_samples = \Request::has("samples") ? \Request::get("samples") : []; $slctd_samples_str = is_array($slctd_samples) ? implode(',', $slctd_samples) : "{$slctd_samples}"; $sql = "SELECT s.*, p.artNumber,p.otherID, p.gender, p.dateOfBirth,\n\t\t\t\tGROUP_CONCAT(ph.phone SEPARATOR ',') AS phone, f.facility, d.district, h.hub AS hub_name, \n\t\t\t\tGROUP_CONCAT(res_r.Result, '|||', res_r.created SEPARATOR '::') AS roche_result,\n\t\t\t\tGROUP_CONCAT(res_a.result, '|||', res_a.created SEPARATOR '::') AS abbott_result,\n\t\t\t\tGROUP_CONCAT(res_o.result, '|||', res_o.created SEPARATOR '::') AS override_result,\n\t\t\t\tlog_s.id AS repeated, v.outcome AS verify_outcome, reason.appendix AS rejection_reason,\n\t\t\t\tu.signaturePATH, wk.machineType, fctr.factor, sw.sampleID, sw.worksheetID\n\t\t\t\tFROM vl_samples AS s\n\t\t\t\tLEFT JOIN vl_facilities AS f ON s.facilityID=f.id\n\t\t\t\tLEFT JOIN vl_districts AS d ON f.districtID=d.id\n\t\t\t\tLEFT JOIN vl_hubs AS h ON f.hubID=h.id\n\t\t\t\tLEFT JOIN vl_patients As p ON s.patientID=p.id\n\t\t\t\tLEFT JOIN vl_patients_phone As ph ON p.id = ph.patientID\n\t\t\t\tLEFT JOIN vl_samples_verify AS v ON s.id=v.sampleID\t\t\t\t\n\t\t\t\tLEFT JOIN vl_appendix_samplerejectionreason AS reason ON v.outcomeReasonsID=reason.id\n\t\t\t\tLEFT JOIN vl_samples_worksheet AS sw ON s.id=sw.sampleID\n\t\t\t\tLEFT JOIN vl_samples_worksheetcredentials AS wk ON sw.worksheetID=wk.id\n\t\t\t\tLEFT JOIN vl_results_roche AS res_r ON s.vlSampleID = res_r.SampleID\n\t\t\t\tLEFT JOIN vl_results_abbott AS res_a ON s.vlSampleID = res_a.SampleID\n\t\t\t\tLEFT JOIN vl_results_override AS res_o ON s.vlSampleID = res_o.sampleID\n\t\t\t\tLEFT JOIN vl_logs_samplerepeats AS log_s ON s.id = log_s.sampleID\n\t\t\t\tLEFT JOIN vl_users AS u ON wk.createdby = u.email\n\t\t\t\tLEFT JOIN vl_results_multiplicationfactor AS fctr ON wk.id=fctr.worksheetID\n\t\t\t\tWHERE\n\t\t\t\t"; if ($id == 'x' and count($slctd_samples) == 0) { return "Please select atleast one"; } $sql .= $id != 'x' ? " s.id={$id} LIMIT 1" : " s.id IN ({$slctd_samples_str}) GROUP BY s.id"; $vldbresult = \DB::connection('live_db')->select($sql); if (\Request::has('pdf')) { $s_arr = $id != 'x' ? [$id] : explode(",", $slctd_samples_str); $sql = "INSERT INTO vl_facility_downloads (sample_id, downloaded_by, downloaded_on) VALUES"; foreach ($s_arr as $smpl) { $sql .= "({$smpl}, '" . \Auth::user()->email . "', '" . date('Y-m-d H:i:s') . "'),"; } $sql = trim($sql, ','); \DB::connection('live_db')->unprepared($sql); $pdf = \PDF::loadView('results.pdfresults', compact("vldbresult")); return $pdf->download('vl_results_' . session('facility') . '.pdf'); //return \PDF::loadFile('http://www.github.com')->inline('github.pdf'); } return view('results.result', compact("vldbresult", "printed")); }
/** * Check if specified element exists in a request. * * @param $name * * @return bool */ function rqHas($name) { if (Request::has($name)) { return true; } return false; }
public function process(Request $request) { // Ajax-validation is only possible, if the _formID was submitted (automatically done by the FormBuilder). if (\Request::has('_formID')) { // The FormBuilder should have saved the requestObject this form uses inside the session. // We check, if it is there, and can continue only, if it is. $sessionKeyForRequestObject = 'htmlBuilder.formBuilder.requestObjects.' . \Request::input('_formID'); if (Session::has($sessionKeyForRequestObject)) { // Normally we assume a successful submission and return just an empty JSON-array. $returnCode = 200; $return = []; // We instantiate the requestObject. $formRequest = FormBuilderTools::getRequestObject(Session::get($sessionKeyForRequestObject)); // We instantiate a controller with the submitted request-data // and the rules and messages from the requestObject. $validator = Validator::make(\Request::all(), $formRequest->rules(), $formRequest->messages()); // Perform validation, extract error-messages for all fields on failure, put them inside a $return['errors']-array, and return status code 422. if ($validator->fails()) { $errors = []; foreach (array_dot(\Request::all()) as $fieldName => $fieldValue) { $fieldErrors = FormBuilderTools::extractErrorsForField($fieldName, $validator->errors()->getMessages(), \Request::all()); if (count($fieldErrors) > 0) { $errors[FormBuilderTools::convertArrayFieldDotNotation2HtmlName($fieldName)] = $fieldErrors; } } $return['errors'] = $errors; $returnCode = 422; } return new JsonResponse($return, $returnCode); } } }
public function index() { Cache::loadPage('', 30); $inputData = array(); $postid = 0; Model::loadWithPath('post', System::getThemePath() . 'model/'); if (!($match = Uri::match('post\\/(.*?)\\.html$'))) { Redirect::to('404page'); } $friendly_url = addslashes($match[1]); $loadData = Post::get(array('cacheTime' => 30, 'where' => "where friendly_url='{$friendly_url}'")); if (!isset($loadData[0]['postid'])) { Redirect::to('404page'); } $inputData = $loadData[0]; if (Request::has('btnComment')) { try { sendComment($loadData[0]['postid']); $inputData['commentAlert'] = '<div class="alert alert-success">Send comment success.</div>'; } catch (Exception $e) { $inputData['commentAlert'] = '<div class="alert alert-warning">' . $e->getMessage() . '</div>'; } } $postid = $loadData[0]['postid']; $listTag = PostTags::renderToLink($postid); $inputData['listTag'] = $listTag; $inputData['listComments'] = Comments::get(array('where' => "where postid='{$postid}' AND status='1'", 'orderby' => "order by postid desc")); Post::upView($postid); System::setTitle(ucfirst($loadData[0]['title'])); $keywords = isset($loadData[0]['keywords'][4]) ? $loadData[0]['keywords'] : System::getKeywords(); System::setKeywords($keywords); self::makeContent('post', $inputData); Cache::savePage(); }
public function index() { $books = Book::with('Author')->where(function ($query) { $min_price = \Request::has('min_price') ? \Request::get('min_price') : null; $max_price = \Request::has('max_price') ? \Request::get('max_price') : null; $authors = \Request::has('authors') ? \Request::get('authors') : []; if (isset($min_price)) { $query->where('price', '>=', $min_price); } if (isset($max_price)) { $query->where('price', '<=', $max_price); } if (isset($authors)) { $query->where(function ($q) { $input_authors = \Request::has('authors') ? \Request::get('authors') : []; // $books_all = \App\Book::with('Author')->get(); //перебираем все чекнутые боксы foreach ($input_authors as $input_author) { // автор == выборка из авторов где Ид = чекнутому боксу. Первый $author = \App\Author::with('books')->where('id', '=', $input_author)->first(); // выборка внутри выбранного автора по книгам foreach ($author->books as $author_book) { //запрос Айди книги == айди книг у этого автора $q->orWhere('id', '=', $author_book->id); } } }); } })->paginate(2); $authors_list = \App\Author::all(); return view('books.list', compact('books', 'authors_list')); }
public function save() { $name = $this->name(); if (!\Request::has($name)) { \Request::merge([$name => 0]); } parent::save(); }
public function save() { $name = $this->name(); if (\Request::has($name)) { \Request::merge(array($name => password_hash($this->value(), PASSWORD_BCRYPT))); parent::save(); } }
public function check(JSnapCommander $jsnap) { if (\Request::has('checkHostname')) { $result = $jsnap->snapCheck(\Request::get('checkHostname')); return ['error' => 0, 'result' => $result]; } return ['error' => 1, 'html' => 'Must designate a hostname, presnap, and postsnap']; }
/** * @param Request $request * * @return Response */ public function searchAction(Request $req) { $typeFilter = $req->get('type'); $tagsFilter = $req->get('tags'); if ($req->has('q') || $typeFilter || $tagsFilter) { $solarium = new SolariumClient('localhost:8080'); $select = $solarium->createSelect(); // filter by type if ($typeFilter) { $filterQueryTerm = sprintf('type:%s', $select->getHelper()->escapeTerm($typeFilter)); $filterQuery = $select->createFilterQuery('type')->setQuery($filterQueryTerm); $select->addFilterQuery($filterQuery); } // filter by tags if ($tagsFilter) { $tags = array(); foreach ((array) $tagsFilter as $tag) { $tags[] = $select->getHelper()->escapeTerm($tag); } $filterQueryTerm = sprintf('tags:(%s)', implode(' AND ', $tags)); $filterQuery = $select->createFilterQuery('tags')->setQuery($filterQueryTerm); $select->addFilterQuery($filterQuery); } if ($req->has('q')) { $escapedQuery = $select->getHelper()->escapeTerm($req->get('q')); $select->setQuery($escapedQuery); } $paginator = new Pagerfanta(new SolariumAdapter($solarium, $select)); $paginator->setMaxPerPage(15); $paginator->setCurrentPage($req->get('page', 1), false, true); if ($req->isXmlHttpRequest()) { try { return $this->render('ProductBundle:Search:list.html.twig', array('products' => $paginator->getResults(), 'noLayout' => true)); } catch (\Twig_Error_Runtime $e) { if (!$e->getPrevious() instanceof \Solarium_Client_HttpException) { throw $e; } return new JsonResponse(array('status' => 'error', 'message' => 'Could not connect to the search server'), 500); } } else { return $this->render('ProductBundle:Search:search.html.twig', array('products' => $paginator->getResults())); } } return $this->render('ProductBundle:Search:search.html.twig', array('noLayout' => $req->isXmlHttpRequest())); }
/** * Display a listing of the resource. * * @return Response */ public function getIndex() { $links = Link::sort()->get(); if (\Request::has('key')) { $key = \Request::input('key'); $links = Link::where('title', 'like', '%' . $key . '%')->sort()->get(); } return view('admin.link.index', compact('links')); }
/** * Display a listing of the resource. * * @return Response */ public function getIndex() { $feedbacks = FeedBack::paginate(15); if (\Request::has('key')) { $key = \Request::input('key'); $feedbacks = FeedBack::where('title', 'like', '%' . $key . '%')->paginate(15); } return view('admin.feedback.index', compact('feedbacks')); }
public function destroy(Post $post) { if (\Request::has('id')) { Post::destroy(\Request::input('id')); return ['result' => true]; } $post->delete(); return redirect('dash/post')->with('message', 'Post was delete success.'); }
public function delete(JSnapCommander $jsnap) { if (\Request::has('deleteHostname') && \Request::has('deleteTime')) { $result = $jsnap->deleteSnapshot(\Request::get('deleteHostname'), \Request::get('deleteTime')); dd($result); return ['error' => 0, 'result' => $result]; } return ['error' => 1, 'html' => 'Must designate a hostname and a snap time to delete']; }
public function destroy(Page $page) { if (\Request::has('id')) { Page::destroy(\Request::input('id')); return ['result' => true]; } $page->delete(); return redirect('dash/page')->with('message', 'Page was delete success.'); }
/** * Display a listing of the resource. * * @return Response */ public function getIndex() { $users = User::paginate(15); if (\Request::has('key')) { $key = \Request::input('key'); $users = User::where('name', 'like', '%' . $key . '%')->paginate(15); } return view('admin.user.index', compact('users')); }
/** * Display a listing of the resource. * * @return Response */ public function getIndex($type) { $articles = Article::group($type)->paginate(15); $nodes = \App\Node::top()->where('content_type', $type)->get(); if (\Request::has('key')) { $key = \Request::input('key'); $articles = Article::where('title', 'like', '%' . $key . '%')->paginate(15); } return view('admin.article.index', compact('articles', 'nodes')); }
/** * */ public function index() { if (\Request::has('bssidName')) { $q_bssidName = trim(\Request::get('bssidName')); $bssids = \App\Bssid::where('bssidName', $q_bssidName)->paginate(10); } else { $bssids = \App\Bssid::where('bssidName', '<>', '')->paginate(10); } return view('bssids.index', compact('bssids')); }
/** * Display a listing of the resource. * * @return Response */ public function index() { if (Input::has('search')) { $query = Input::get('search'); $chats = Chat::where('message', 'LIKE', "%{$query}%")->orderBy('created_at', 'DESC')->paginate(50); } else { $chats = Chat::orderBy('created_at', 'DESC')->paginate(50); } return view('chat.index')->withChats($chats); }
public function __construct(Request $request) { $this->time = date('Y-m-d H:i:s', time()); $this->error = $this->getErrorList(); $lang = ''; if ($request->has('lang')) { $lang = $request->input('lang'); $lang = trim($lang); } $this->lang = 'en' == $lang ? $lang : 'zh'; }
public function index() { if ($match = Uri::match('\\/jsonCategory')) { $keyword = String::encode(Request::get('keyword', '')); $loadData = Categories::get(array('where' => "where title LIKE '%{$keyword}%'", 'orderby' => 'order by title asc')); $total = count($loadData); $li = ''; for ($i = 0; $i < $total; $i++) { $li .= '<li><span data-method="category" data-id="' . $loadData[$i]['catid'] . '" >' . $loadData[$i]['title'] . '</span></li>'; } echo $li; die; } $post = array('alert' => ''); Model::load('admincp/categories'); $curPage = 0; if ($match = Uri::match('\\/page\\/(\\d+)')) { $curPage = $match[1]; } if (Request::has('btnAction')) { actionProcess(); } if (Request::has('btnAdd')) { try { insertProcess(); $post['alert'] = '<div class="alert alert-success">Add new category success.</div>'; } catch (Exception $e) { $post['alert'] = '<div class="alert alert-warning">' . $e->getMessage() . '</div>'; } } if (Request::has('btnSave')) { $match = Uri::match('\\/edit\\/(\\d+)'); try { updateProcess($match[1]); $post['alert'] = '<div class="alert alert-success">Update category success.</div>'; } catch (Exception $e) { $post['alert'] = '<div class="alert alert-warning">' . $e->getMessage() . '</div>'; } } if (Request::has('btnSearch')) { filterProcess(); } else { $post['pages'] = Misc::genSmallPage('admincp/categories', $curPage); $post['theList'] = Categories::get(array('limitShow' => 20, 'limitPage' => $curPage, 'orderby' => 'order by catid desc', 'cache' => 'no')); } if ($match = Uri::match('\\/edit\\/(\\d+)')) { $loadData = Categories::get(array('where' => "where catid='" . $match[1] . "'", 'cache' => 'no')); $post['edit'] = $loadData[0]; } System::setTitle('Categories list - ' . ADMINCP_TITLE); View::make('admincp/head'); self::makeContents('categoriesList', $post); View::make('admincp/footer'); }
/** * Display a listing of the resource. * * @return Response */ public function getIndex() { $ads = Ad::paginate(15); if (\Request::has('key')) { $key = \Request::input('key'); if (!empty($key)) { $ads = Ad::where('title', 'like', '%' . $key . '%')->paginate(15); } } return view('admin.ad.index', compact('ads')); }
public function deleteRehab($id) { $data = $id; if (\Request::has('solitary')) { return $this->handleSolitaryDelete($data); } if (\Request::has('hard-labour')) { return $this->handleHardLabourDelete($data); } return redirect()->back(); }
/** * Check for discount code. * @param Request $request * @return bool */ public function checkDiscount($request) { $codes = $this->tax->all(); foreach ($codes as $code) { if ($request->has('discount') && $request->input('discount') !== $code->code) { return true; } else { return false; } } }
/** * Returns paginated list of items, checks if filter used * @return array Permissions */ protected function getData() { if (\Request::has('search_value')) { $value = \Request::get('search_value'); $permissions = Permission::where('name', 'LIKE', '%' . $value . '%')->orWhere('slug', 'LIKE', '%' . $value . '%')->orWhere('description', 'LIKE', '%' . $value . '%')->orderBy('name')->paginate(config('watchtower.pagination.permissions', 15)); session()->flash('search_value', $value); } else { $permissions = Permission::orderBy('name')->paginate(config('watchtower.pagination.permissions', 15)); session()->forget('search_value'); } return $permissions; }
public function snapshot(JSnapCommander $jsnap) { if (\Request::has('snapHostname')) { $snapshot = $jsnap->snapShot(\Request::get('snapHostname')); if ($snapshot['error'] === 0) { return ['error' => 0, 'html' => 'Snapshot successful', 'snapID' => $snapshot['snapID']]; } else { return ['error' => 1, 'html' => $snapshot['html']]; } } return ['error' => 1, 'html' => 'Must designate a hostname to snapshot']; }
/** * Show listing of snippets * GET /snippets */ public function getIndex() { $perPage = Config::get('site.snippetsPerPage'); if (Request::has('q') and Request::get('q') !== '') { $snippets = $this->snippet->byPage($perPage, false, e(Request::get('q'))); } else { $snippets = $this->snippet->byPage($perPage); } $tags = $this->tag->all(); $topSnippetContributors = $this->user->getTopSnippetContributors(); return View::make('snippets.index', compact('snippets', 'tags', 'topSnippetContributors')); }
public function edit($id, $extra = array()) { $vara = \App\Product::find($id); $flokkar = \App\Category::lists('title', 'id')->toArray(); $flokkar[0] = ' - Enginn flokkur - '; $extra['flokkar'] = $flokkar; $extra['selectedFlokkurId'] = $vara->{$vara->parent_key} ?: 0; if (!$extra['selectedFlokkurId']) { $extra['selectedFlokkurId'] = \Request::has('parent_id') ? \Request::get('parent_id') : 0; } return parent::edit($id, $extra); }