public function updateDepartmentAction(request $request) { // Get the ID variable from the request $id = $request->get('id'); // Create a new Department entity $department = new Department(); $em = $this->getDoctrine()->getManager(); // Find a department by the ID sent in by the request $department = $em->getRepository('AppBundle:Department')->find($id); // Only edit if it is a SUPER_ADMIN if ($this->get('security.context')->isGranted('ROLE_SUPER_ADMIN')) { // Create the form $form = $this->createForm(new CreateDepartmentType(), $department); // Handle the form $form->handleRequest($request); if ($form->isValid()) { $em->persist($department); $em->flush(); return $this->redirect($this->generateUrl('departmentadmin_show')); } return $this->render('department_admin/create_department.html.twig', array('department' => $department, 'form' => $form->createView())); } else { return $this->redirect($this->generateUrl('departmentadmin_show')); } }
public function update($id, request $request) { $apikeys = ApiKeys::find($id); $apikeys->imei = $request->input('imei'); $apikeys->save(); return redirect()->intended('clients'); }
/** * Initiate the dispacther processes * * @param request */ public function Process(request $request) { $request->Process(); // init this $this->Initiate(); // create new controller $c = $request->controller->GetInstance(); // set request as a property in controller $c->request = $request; // set view object $c->view = new \zinux\kernel\view\baseView($request); // set layout object $c->layout = new \zinux\kernel\layout\baseLayout($c->view); $c->view->layout = $c->layout; // init controller $c->Initiate(); // call the action method $c->request->action->InvokeAction($c); // render : layout ~> view $c->layout->Render(); // dispose controller $c->Dispose(); // dispose this $this->Dispose(); }
public function upload(request $request) { // getting all of the post data $file = $request->file('file'); // setting up rules // $rules = array('image' => 'required',); //mimes:jpeg,bmp,png and for max size max:10000 // doing the validation, passing post data, rules and the messages // $validator = Validator::make($file, $rules); //if ($validator->fails()) { // send back to the page with the input data and errors // return Redirect::to('upload')->withInput()->withErrors($validator); //} //else { // checking file is valid. if ($file->isValid()) { $destinationPath = 'assets/img/spelers'; // upload path $extension = $file->getClientOriginalExtension(); // getting image extension $fileName = $file->getClientOriginalName(); //.'.'.$extension ; //rand(11111,99999).'.'.$extension; // renameing image $file->move($destinationPath, $fileName); // uploading file to given path // sending back with message //Session::flash('success', 'Upload successfully'); //return Redirect::to('upload'); } /*else { // sending back with error message. Session::flash('error', 'uploaded file is not valid'); return Redirect::to('upload'); }*/ // } }
public function validateMerchantOtp(request $request) { $apiKey = $request->only('api_key'); $validator = Validator::make($apiKey, ['api_key' => 'required']); if ($validator->fails()) { $response = response()->json(['response_code' => 'ERR_IAK', 'messages' => 'Invalid Api Key'], 403); return $response; } $role = Role::find(2); $key = Config::get('custom.JWTkey'); $decoded = JWT::decode($apiKey['api_key'], $key, array('HS256')); if ($decoded->type != 'merchant') { return $response = response()->json(['response_code' => 'ERR_IAK', 'messages' => 'Invalid Api Key'], 403); } $user = User::find($decoded->sub); // check the current user if (empty($user) || !$user->hasRole(['merchant']) || !$user->status) { return $response = response()->json(['response_code' => 'ERR_IAK', 'messages' => 'Invalid Api Key'], 403); } $user_id = $user->id; $input = $request->only('otp'); $matchThese = ['user_id' => $user_id, 'code' => $input['otp']]; $sms = UserSmsCode::where($matchThese)->first(); if ($sms == '' || empty($sms)) { return response()->json(['response_code' => 'RES_IOG', 'messages' => 'Invalid OTP Given'], 422); } $sms->status = true; $sms->save(); $user->is_mobile_verified = true; $user->save(); return response()->json(['response_code' => 'RES_MV', 'messages' => 'Mobile Verified']); }
/** * @return array */ public function load() { $request = new request(self::teams_steam_url, array('start_at_team_id' => $this->get_team_id(), 'teams_requested' => $this->get_teams_requested())); $teams_info = $request->send(); if (is_null($teams_info)) { return null; } $teams = array(); if (isset($teams_info->teams)) { $teams_info = (array) $teams_info->teams; $teams_info = $teams_info['team']; foreach ($teams_info as $team_info) { $team_info = (array) $team_info; $team = new team(); $fields = array_keys($team_info); foreach ($fields as $field) { // I hope, that API-response will be changed and players_ids, leagues_ids will become arrays if (preg_match('/^player_\\d+_account_id$/', $field)) { $team->add_player_id($team_info[$field]); continue; } if (preg_match('/^league_id_\\d+$/', $field)) { $team->add_league_id($team_info[$field]); continue; } $team->set($field, (string) $team_info[$field]); } $teams[$team->get('team_id')] = $team; } return $teams; } }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index(request $request) { // $folder = $request->get('folder'); $data = $this->manager->folderInfo($folder); return view('admin.upload.index', $data); }
/** * @return array */ public function load() { $request = new request(self::steam_matches_url, $this->_get_data_array()); $xml = $request->send(); if (is_null($xml)) { return null; } $matches = array(); if (isset($xml->matches)) { $this->_total_results = $xml->total_results; foreach ($xml->matches as $m_matches) { foreach ($m_matches as $m) { $match = new match(); $match->set_array((array) $m); foreach ($m->players as $players) { foreach ($players as $player) { $slot = new slot(); $slot->set_array((array) $player); $match->add_slot($slot); } } $matches[$match->get('match_id')] = $match; } } } return $matches; }
/** * Store Emails for updates in the future * * @return Response */ public function store(request $request) { $email = new Email(); $email->email = $request->input('email'); $email->save(); return redirect()->back(); }
function __construct() { $request = new request(); if ($request->checkReq()) { $this->bearer = $_SERVER['HTTP_BEARER']; } }
public function updatePoint($id, request $request) { $hairstyles = hairstyles::find($id); $hairstyles->Xpoint = $request->input('Xpoint'); $hairstyles->Ypoint = $request->input('Ypoint'); $hairstyles->save(); return redirect()->intended('hairstyles/edit/' . $id); }
public function update($id, request $request) { $categories = Categories::find($id); $categories->name = $request->input('name'); $categories->description = $request->input('description'); $categories->save(); return redirect()->intended('categories'); }
/** * @param int $ugcid * @return object | null */ public function load($ugcid = null) { if (!is_null($ugcid)) { $this->_ugcid = $ugcid; } $request = new request(self::steam_ugc_url, array('appid' => 570, 'ugcid' => $this->_ugcid)); return $request->send(); }
public function load() { $request = new request(self::leagues_prize_pool_steam_url, array('leagueid' => $this->get_league_id())); $prize_pool = $request->send(); if (is_null($prize_pool)) { return null; } return (array) $prize_pool; }
public function indexAction(request $request) { $searchTerm = $request->query->get('q'); $identifyRepository = $this->getDoctrine()->getRepository('URSearchBundle:Identify'); $categories = $identifyRepository->findCategoryDistributionFor($searchTerm); $identifiers = $identifyRepository->findAllWithNameLike($searchTerm); $request->getSession()->set('last_search', $searchTerm); return $this->render('URSearchBundle:Default:search.html.twig', array('categories' => $categories, 'results' => $identifiers)); }
function __construct() { /* Checking request to the server and token values Setting headers for each request */ $request = new request(); $request->checkReq(true, true); }
function getRequestByVacancyId() { $elmId = $_POST['elmId']; $this->load->model('Request'); $request = new request(); $array = $request->getAllRequestByVacancy($elmId); $data["requests"] = $array; return $data; }
public function updatesousFamilleAction(request $request, $idSousFamille) { $em = $this->getDoctrine()->getManager(); $sousFamille = $em->getRepository('ICAdministrationBundle:SousFamille')->find($idSousFamille); $sousFamille->setNom($request->get('nom')); $em->persist($sousFamille); $em->flush(); return $this->redirectToRoute('ic_administration_affichage_sous_famille'); }
public function login(request $request) { $input = $request->all(); if (Auth::attempt(['email' => $input['email'], 'password' => $input['password']])) { return Redirect::route('home'); } else { return Redirect::route('home')->with('loginFail', ['fail']); } }
public function showPost($slug, request $request) { $post = Post::whereSlug($slug)->firstOrFail(); $tag = $request->get('tag'); if ($tag) { $tag = Tag::whereTag($tag)->firstOrFail(); } return view($post->layout, compact('post', 'tag', 'slug')); }
public function searchAction(request $request) { $term = $request->get('query'); $repository = $this->getDoctrine()->getManager()->getRepository('BFUserBundle:User'); $array = $repository->findUserLike($term); //making the array for the plugin $response = new Response(json_encode($array)); $response->headers->set('Content-Type', 'application/json'); return $response; }
function __construct() { parent::__construct(false); /* Checking request to the server and token values Setting headers for each request */ $request = new request(); $request->checkReq(false); }
/** * Load match info by match_id */ public function load() { $request = new request(self::steam_match_url, array('match_id' => $this->get_match_id())); $match_info = $request->send(); if (is_null($match_info)) { return null; } $match = new match(); $players = array(); foreach ($match_info->players->player as $key => $player) { $players[] = $player; } $data = (array) $match_info; unset($data['players']); $data['start_time'] = date('Y-m-d H:i:s', $data['start_time']); $data['radiant_win'] = $data['radiant_win'] == 'true' ? '1' : '0'; $match->set_array($data); // slots info foreach ($players as $player) { $data = (array) $player; $data['match_id'] = $this->get_match_id(); $slot = new slot(); $slot->set_array($data); // additional_units if (isset($data['additional_units'])) { $slot->set_additional_unit_items((array) $data['additional_units']->unit); } // abilities if (isset($data['ability_upgrades'])) { $d = (array) $data['ability_upgrades']; $abilities_upgrade = $d['ability']; if (!is_array($abilities_upgrade)) { $abilities_upgrade = array($abilities_upgrade); } foreach ($abilities_upgrade as $k => $v) { $abilities_upgrade[$k] = (array) $abilities_upgrade[$k]; } $slot->set_abilities_upgrade($abilities_upgrade); } $match->add_slot($slot); } if (isset($match_info->picks_bans)) { $picks_bans = (array) $match_info->picks_bans; foreach ($picks_bans['pick_ban'] as $k => $v) { $picks_bans['pick_ban'][$k] = (array) $v; if ($picks_bans['pick_ban'][$k]['is_pick'] == 'false') { $picks_bans['pick_ban'][$k]['is_pick'] = '0'; } else { $picks_bans['pick_ban'][$k]['is_pick'] = '1'; } } $match->set_all_pick_bans($picks_bans['pick_ban']); } return $match; }
public function update($id, request $request) { $frames = Frames::find($id); $image = $frames->image; $file = $request->file('image'); if (!empty($file)) { $destinationPath = 'uploads/frames'; // upload path $fileName = $request->file('image')->getClientOriginalName(); // renameing image $request->file('image')->move($destinationPath, $fileName); // uploading file to given path } else { $fileName = $image; } $requests = array('name' => $request->get('name'), 'description' => $request->get('description'), 'image_layout' => $request->file('image_layout'), 'image_background' => $request->file('image_background'), 'image_foreground' => $request->file('image_foreground'), 'image_preview' => $request->file('image_preview')); $files = array('image_layout' => $request->file('image_layout'), 'image_background' => $request->file('image_background'), 'image_foreground' => $request->file('image_foreground'), 'image_preview' => $request->file('image_preview')); $rules = array('name' => 'required'); $validator = Validator::make($requests, $rules); if ($validator->fails()) { // send back to the page with the input data and errors return Redirect::to('frame')->withInput()->withErrors($validator); } else { $filenames = array('image_layout' => $frames->image_layout, 'image_background' => $frames->image_background, 'image_foreground' => $frames->image_foreground, 'image_preview' => $frames->image_preview); foreach ($files as $fieldname => $file) { if (!empty($file)) { // checking file is valid. if ($file->isValid()) { $destinationPath = 'uploads/frames'; // upload path $extension = $file->getClientOriginalExtension(); // getting image extension $fileName = rand(11111, 99999) . '.' . $extension; // renameing image //$fileName = $request->file('image')->getClientOriginalName(); // renameing image $file->move($destinationPath, $fileName); // uploading file to given path $filenames[$fieldname] = $fileName; } else { // sending back with error message. Session::flash('error', 'uploaded file is not valid'); return Redirect::to('frame'); } } } $frames->name = $request->input('name'); $frames->description = $request->input('description'); $frames->image_layout = $filenames['image_layout']; $frames->image_background = $filenames['image_background']; $frames->image_foreground = $filenames['image_foreground']; $frames->image_preview = $filenames['image_preview']; $frames->save(); return redirect()->intended('frames'); } }
public function produitFiniAutreAction(request $request) { $formProduitFiniLecteur = $request->get('formProduitFiniLecteur'); if (!empty($formProduitFiniLecteur)) { $nbLecteur = $this->getDoctrine()->getManager()->getRepository('ICAffichageBundle:LecteurAutre')->countLecteur($formProduitFiniLecteur); } else { $nbLecteur = $this->getDoctrine()->getManager()->getRepository('ICAffichageBundle:LecteurAutre')->countLecteur(0); } $autres = $this->getDoctrine()->getManager()->getRepository('ICAffichageBundle:Autre')->findAll(); return $this->render('ICAffichageBundle:produitFini:autre.html.twig', array('partie' => 'affichage', 'lecteur' => $nbLecteur, 'autres' => $autres)); }
function __construct() { /* Checking request to the server and token values Setting headers for each request */ $request = new request(); if ($request->checkReq(true, false, true)) { $this->bearer = $_SERVER['HTTP_BEARER']; } }
/** * @Route("/api/subscribe", name="site_subscribe") */ public function subscribeAction(request $request) { $em = $this->getDoctrine()->getManager(); $name = $request->get('name'); $mail = $request->get('mail'); $subscriber = new Subscriber(); $subscriber->setName($name)->setMail($mail); $em->persist($subscriber); $em->flush(); $request->getSession()->getFlashBag()->add('success', 'Dank u voor het inschrijven voor de nieuwsletter.'); return new response(); }
public function affichageMatierePremiereAction(request $request) { $em = $this->getDoctrine()->getManager(); //Partie Recherche et trie des composants if ('POST' == $request->getMethod()) { //recheche basique par composant $listComposant = $em->getRepository('ICAdministrationBundle:Composant')->getStockByCritere($request->get('formComposantInterne')); } else { $listComposant = $em->getRepository('ICAdministrationBundle:Composant')->getStockByCritere(0); } $formComposant = $this->createForm(new AddComposantType($this->generateUrl('ic_administration_mp_add'))); return $this->render('ICAdministrationBundle:MP:affichage.html.twig', array('partie' => 'Administration', 'form' => $formComposant->createView(), 'composants' => $listComposant)); }
function getUserinfo($idUser, $type) { $tmpquery = "WHERE mem.id = '{$idUser}'"; $detailUser = new request(); $detailUser->openMembers($tmpquery); if ($type == "from") { $this->From = $detailUser->mem_email_work[0]; $this->FromName = $detailUser->mem_name[0]; } if ($type == "to") { $this->AddAddress($detailUser->mem_email_work[0], $detailUser->mem_name[0]); } }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index(request $request) { DB::enableQueryLog(); $imei = $request->input('imei'); $api = $request->input('api'); $client = ApiKeys::where('api', $api)->where('imei', $imei)->count(); if ($client > 0) { $jsonArray = ["api" => true, "message" => ""]; } else { $jsonArray = ["api" => false, "message" => "Client not registered."]; } return response()->json($jsonArray); }