public function createParent() { $input = Input::all(); if (Input::hasFile('profilepic')) { $input['profilepic'] = $this->filestore(Input::file('profilepic')); } $input['dob'] = date('Y-m-d H:i:s', strtotime(Input::get('dob'))); $input['collegeid'] = Session::get('user')->collegeid; $input['collegename'] = Admin::where('collegeid', '=', Session::get('user')->collegeid)->first()->collegename; //$input['collegeid']="dummy"; //$input['collegename']="dummy"; $user = new User(); $user->email = $input['email']; $user->password = Hash::make($input['password']); $user->collegeid = $input['collegeid']; $user->flag = 3; $user->save(); $input['loginid'] = $user->id; $removed = array('_token', 'password', 'cpassword'); foreach ($removed as $k) { unset($input[$k]); } Parent::saveFormData($input); return $input; }
/** * Determine the current rendering mode. * * @return string */ public function determineMode() { if (TL_MODE == 'FE') { $user = $this->resolveBackendUser(); if ($user) { if ($this->input->get('theme_plus_compile_assets')) { return RenderMode::PRE_COMPILE; } elseif ($user->themePlusDesignerMode) { return RenderMode::DESIGN; } } return RenderMode::LIVE; } throw new \RuntimeException('Render mode can only determined in FE mode'); }
public static function getRelatorioOperacoes() { Excel::create('Planilha de Controle da Farmacia - Ocorrencias', function ($excel) { $excel->sheet('Ref. ', function ($sheet) { $sheet->mergeCells('A1:J5'); $sheet->setHeight(1, 50); $sheet->row(1, function ($row) { $row->setFontFamily('Arial'); $row->setFontSize(20); }); $sheet->cell('A1', function ($cell) { $cell->setAlignment('center'); }); $sheet->getStyle('D')->getAlignment()->setWrapText(true); $sheet->row(1, array('Frizelo Frigorificos Ltda.')); $periodo = explode('-', Input::get('periodo')); $a = []; foreach (Ocorrencia::whereBetween('data_hora', $periodo)->get() as $val) { $a[] = ['Nome' => $val->colaborador->nome, 'Setor' => !empty($val->colaborador->setor->descricao) ? $val->colaborador->setor->descricao : null, 'Data' => $val->data_hora, 'Queixa' => empty($val->queixa->descricao) ? null : $val->queixa->descricao, 'Descrição / Motivo' => $val->relato . ' - ' . $val->diagnostico, 'Conduta / Destino' => $val->conduta . ' - ' . $val->destino]; } $sheet->setAutoFilter('A6:J6'); $sheet->setOrientation('landscape'); $sheet->fromArray($a, null, 'A6', true); }); })->export('xls'); }
/** * เรียกใช้งาน Class แบบสามารถเรียกได้ครั้งเดียวเท่านั้น * * @param array $config ค่ากำหนดของ แอพพลิเคชั่น * @return Singleton */ public function __construct() { /* display error */ if (defined('DEBUG') && DEBUG === true) { /* ขณะออกแบบ แสดง error และ warning ของ PHP */ ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(-1); } else { /* ขณะใช้งานจริง */ error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT); } /* config */ self::$cfg = \Config::create(); /* charset default UTF-8 */ ini_set('default_charset', self::$char_set); if (extension_loaded('mbstring')) { mb_internal_encoding(self::$char_set); } /* inint Input */ Input::normalizeRequest(); // template ที่กำลังใช้งานอยู่ Template::inint(Input::get($_GET, 'skin', self::$cfg->skin)); /* time zone default Thailand */ @date_default_timezone_set(self::$cfg->timezone); }
public function postIndex() { if (\Auth::attempt(array('email' => \Input::get('email'), 'password' => \Input::get('password')))) { return \Redirect::intended('/'); } return \Redirect::to('/?errors=true'); }
/** * Generate the content element */ public function compile() { global $container; /** @var SubscriptionManager $subscriptionManager */ $subscriptionManager = $container['avisota.subscription']; /** @var EventDispatcher $eventDispatcher */ $eventDispatcher = $container['event-dispatcher']; $token = (array) \Input::get('token'); if (count($token)) { $subscriptions = $subscriptionManager->confirmByToken($token); \Session::getInstance()->set('AVISOTA_LAST_SUBSCRIPTIONS', $subscriptions); if ($this->avisota_activation_confirmation_page) { $event = new GetPageDetailsEvent($this->avisota_activation_confirmation_page); $eventDispatcher->dispatch(ContaoEvents::CONTROLLER_GET_PAGE_DETAILS, $event); $event = new GenerateFrontendUrlEvent($event->getPageDetails()); $eventDispatcher->dispatch(ContaoEvents::CONTROLLER_GENERATE_FRONTEND_URL, $event); $event = new RedirectEvent($event->getUrl()); $eventDispatcher->dispatch(ContaoEvents::CONTROLLER_REDIRECT, $event); } $this->Template->confirmed = $subscriptions; } else { if ($this->avisota_activation_redirect_page) { $event = new GetPageDetailsEvent($this->avisota_activation_redirect_page); $eventDispatcher->dispatch(ContaoEvents::CONTROLLER_GET_PAGE_DETAILS, $event); $event = new GenerateFrontendUrlEvent($event->getPageDetails()); $eventDispatcher->dispatch(ContaoEvents::CONTROLLER_GENERATE_FRONTEND_URL, $event); $event = new RedirectEvent($event->getUrl()); $eventDispatcher->dispatch(ContaoEvents::CONTROLLER_REDIRECT, $event); } } }
public function postDelete() { $id = Input::get('id'); $delpro = Program::find($id); $delpro->delete(); return 1; }
/** * Upload the file and store * the file path in the DB. */ public function store() { // Rules $rules = array('name' => 'required', 'file' => 'required|max:20000'); $messages = array('max' => 'Please make sure the file size is not larger then 20MB'); // Create validation $validator = Validator::make(Input::all(), $rules, $messages); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } $directory = "uploads/files/"; // Before anything let's make sure a file was uploaded if (Input::hasFile('file') && Request::file('file')->isValid()) { $current_file = Input::file('file'); $filename = Auth::id() . '_' . $current_file->getClientOriginalName(); $current_file->move($directory, $filename); $file = new Upload(); $file->user_id = Auth::id(); $file->project_id = Input::get('project_id'); $file->name = Input::get('name'); $file->path = $directory . $filename; $file->save(); return Redirect::back(); } $upload = new Upload(); $upload->user_id = Auth::id(); $upload->project_id = Input::get('project_id'); $upload->name = Input::get('name'); $upload->path = $directory . $filename; $upload->save(); return Redirect::back(); }
/** * Redirect to an internal page * @param object */ public function generate($objPage) { // Forward to the jumpTo or first published page if ($objPage->jumpTo) { $objNextPage = \PageModel::findPublishedById($objPage->jumpTo); } else { $objNextPage = \PageModel::findFirstPublishedRegularByPid($objPage->id); } // Forward page does not exist if ($objNextPage === null) { header('HTTP/1.1 404 Not Found'); $this->log('Forward page ID "' . $objPage->jumpTo . '" does not exist', 'PageForward generate()', TL_ERROR); die('Forward page not found'); } $strGet = ''; // Add $_GET parameters if (is_array($_GET) && !empty($_GET)) { foreach (array_keys($_GET) as $key) { if ($GLOBALS['TL_CONFIG']['disableAlias'] && $key == 'id') { continue; } if ($GLOBALS['TL_CONFIG']['addLanguageToUrl'] && $key == 'language') { continue; } $strGet .= '/' . $key . '/' . \Input::get($key); } } $this->redirect($this->generateFrontendUrl($objNextPage->row(), $strGet), $objPage->redirect == 'temporary' ? 302 : 301); }
function store() { $rules = array('icao' => 'alpha_num|required', 'iata' => 'alpha_num', 'name' => 'required', 'city' => 'required', 'lat' => 'required|numeric', 'lon' => 'required|numeric', 'elevation' => 'required|numeric', 'country_id' => 'required|exists:countries,id', 'website' => 'url'); $validator = Validator::make(Input::all(), $rules); if ($validator->fails()) { Messages::error($validator->messages()->all()); return Redirect::back()->withInput(); } if (is_null($airport = Airport::whereIcao(Input::get('icao'))->whereNew(true)->first())) { $airport = new Airport(); $airport->icao = Input::get('icao'); $airport->name = Input::get('name'); $airport->new = true; $airport->save(); } Diff::compare($airport, Input::all(), function ($key, $value, $model) { $change = new AirportChange(); $change->airport_id = $model->id; $change->user_id = Auth::id(); $change->key = $key; $change->value = $value; $change->save(); }, ['name', 'iata', 'city', 'country_id', 'lat', 'lon', 'elevation', 'website']); Messages::success('Thank you for your submission. We will check whether all information is correct and soon this airport might be available.'); return Redirect::back(); }
function showCaret($field) { if (Input::get('orderby') == $field) { return 'asc'; } return 'desc'; }
/** * Mendapatkan Semua Stockproducthistory * @return mixed */ public function all() { $page = \Input::get('page'); $limit = \Input::get('limit', 1); $start = \Input::get('start', 1); if (Input::has('stock_id')) { $stockId = Input::get('stock_id'); return $this->getHistoryStockById($stockId, $limit, $start, $page); } /*Mesti ada Stock Id*/ return Response::json(['success' => true, 'error' => true, 'reason' => 'No Parameter Stock Id'], 200); // ->setCallback(\Input::get('callback')); // $stockproducthistory = $this->stockproducthistory // ->orderBy('id', 'DESC') // ->skip($start) // ->take($limit) // ->get()->toArray(); // $total = $this->stockproducthistory // ->all()->count(); // // $stockproducthistorys = array( // 'success' => true, // 'results' => $stockproducthistory, // 'total' => $total // ); // // return Response::json($stockproducthistorys) // ->setCallback(\Input::get('callback')); }
public static function user() { if (self::$user !== false) { return self::$user; } FacebookSession::setDefaultApplication(\Config::get('fb-auth::config.facebook_app_id'), \Config::get('fb-auth::config.facebook_secret')); $token = \Input::get('accessToken'); if (!$token) { $token = \Request::header('FB-Access-Token'); } if (!$token) { self::$user = null; return null; } $session = new FacebookSession($token); try { $me = (new FacebookRequest($session, 'GET', '/me'))->execute()->getGraphObject(GraphUser::className()); self::$user = \User::from_fb($me); } catch (FacebookAuthorizationException $e) { self::$user = null; } catch (FacebookRequestException $e) { self::$user = null; } catch (\Exception $e) { self::$user = null; } return self::$user; }
/** * Compile the view */ protected function compile() { if (!$this->getConfigAttribute('plain')) { if ($this->getConfigAttribute('table') === true) { $this->setConfigAttribute('table', $this->definition->getName()); } if ($this->getConfigAttribute('id') === true) { $this->setConfigAttribute('id', \Input::get('id')); } $strHref = \Environment::get('script') . '?do=' . \Input::get('do'); if ($this->view->getHref() != '') { $strHref .= '&' . $this->view->getHref(); } $this->setConfigAttribute('rt', \RequestToken::get()); $attributes = array(); if ($this->getConfigAttribute('id')) { $attributes[] = 'id'; } if ($this->getConfigAttribute('table')) { $attributes[] = 'table'; } $attributes[] = 'rt'; $strHref .= '&' . $this->buildHref($attributes); $this->view->setHref($strHref); } }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { $lskill = new Lskill(); // skill Model 内容 $lskill->name_jp = Input::get('name_jp'); $lskill->name_en = Input::get('name_en'); $lskill->name_cn = Input::get('name_cn'); $lskill->desc_jp = Input::get('desc_jp'); $lskill->desc_en = Input::get('desc_en'); $lskill->desc_cn = Input::get('desc_cn'); $lskill->race = Input::get('race'); $lskill->attr = Input::get('attr'); $lskill->job = Input::get('job'); $lskill->power = Input::get('power'); $lskill->power_type = Input::get('power_type'); $lskill->admin_memo = Input::get('admin_memo'); // 原则上做成时非公开 $lskill->open = false; // $lskill->update_datetime = now(); if ($lskill->save()) { return Redirect::to('skill'); } else { return Redirect::back()->withInput()->withErrors('保存失败!'); } }
function do_save() { $ids = Input::get('ids'); $customer_first_name = Input::get('customer_first_name'); $customer_last_name = Input::get('customer_last_name'); $customer_company = Input::get('customer_company'); $customer_address = Input::get('customer_address'); $customer_town = Input::get('customer_town'); $customer_country = Input::get('customer_country'); $customer_email = Input::get('customer_email'); $customer_phone = Input::get('customer_phone'); $customer_datebirth = Input::get('customer_datebirth'); $customer_password = Input::get('password'); if ($customer_password != "") { $save['customer_password'] = $customer_password; } $save['customer_first_name'] = $customer_first_name; $save['customer_last_name'] = $customer_last_name; $save['customer_company'] = $customer_company; $save['customer_address'] = $customer_address; $save['customer_town'] = $customer_town; $save['customer_country'] = $customer_country; $save['customer_email'] = $customer_email; $save['customer_phone'] = $customer_phone; $save['customer_datebirth'] = $customer_datebirth; $this->customer->edit($ids, $save); Session::flash('notip', '<div class="alert alert-success">Profile telah diupdate</div>'); return Redirect::to('/member/' . $ids); }
public function carian() { $tarikh = Carbon::parse(\Input::get('tarikh')); $bil = 1; $laporans = Laporan::latest('tarikh')->where('tarikh', 'like', $tarikh . '%')->where('user', Auth::user()->username)->latest('tarikh')->get(); return View('members.technician.carian', compact('bil', 'laporans', 'tarikh')); }
public function login($id = null) { $user = $this->user; $this->data['user']['name'] = $user->data()->user; Config::set('html.title', 'Авторизация'); Config::set('html.description.val', 'На этой странице можно залогиниться'); //$user = new User(); $salt = uniqid(); if (!Session::exists(Config::get('session.token_name'))) { Token::generate(); } if (Input::exists()) { if (Token::check(Input::get('token'))) { $validate = new VALIDATE(); $validation = $validate->check($_POST, array('user' => array('required' => true), 'password' => array('required' => true))); if ($validate->passed()) { $remember = Input::get('remember') === 'on' ? true : false; $login = $user->login(Input::get('user'), Input::get('password'), null); if ($login) { Redirect::to('/'); } else { echo '<p>Sorry, logging in failed</p>'; } } else { foreach ($validation->errors() as $error) { //echo $error, '<br/>'; $this->data['validate_errors'][] = $error; } } } } //$this->data['id']=$id; //$this->data['name']=Input::get('name'); $this->view('user/login'); }
public function postSignIn() { $email = Input::get('email'); $password = Input::get('password'); $remember = Input::get('remember_me'); $validation = new SeatUserValidator(); if ($validation->passes()) { // Check if we got a username or email for auth $identifier = filter_var(Input::get('email'), FILTER_VALIDATE_EMAIL) ? 'email' : 'username'; // Attempt authentication using a email address if (Auth::attempt(array($identifier => $email, 'password' => $password), $remember ? true : false)) { // If authentication passed, check out if the // account is activated. If it is not, we // just logout again. if (Auth::User()->activated) { return Redirect::back()->withInput(); } else { // Inactive account means we will not keep this session // logged in. Auth::logout(); // Return the session back with the error. We are ok with // revealing that the account is not active as the // credentials were correct. return Redirect::back()->withInput()->withErrors('This account is not active. Please ensure that you clicked the activation link in the registration email. '); } } else { return Redirect::back()->withErrors('Authentication failure'); } } return Redirect::back()->withErrors($validation->errors); }
public function showForm() { if ($blog = Input::get('blog')) { return Redirect::to('/' . $blog); } $this->layout->content = View::make('main'); }
public function login_post() { if (!Request::ajax()) { App::abort('401'); } $data = array('status' => 'success', 'message' => ''); try { // Set login credentials $credentials = array('email' => Input::get('email'), 'password' => Input::get('password')); $remember = Input::get('remember') ? Input::get('remember') : false; // Try to authenticate the user $user = Sentry::authenticate($credentials, $remember); $data['status'] = 'success'; $data['message'] = 'Login Success. Redirecting'; } catch (Cartalyst\Sentry\Users\LoginRequiredException $e) { $data['status'] = 'error'; $data['message'] = 'Login field is required.'; } catch (Cartalyst\Sentry\Users\PasswordRequiredException $e) { $data['status'] = 'error'; $data['message'] = 'Password field is required.'; } catch (Cartalyst\Sentry\Users\WrongPasswordException $e) { $data['status'] = 'error'; $data['message'] = 'Wrong password, try again.'; } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) { $data['status'] = 'error'; $data['message'] = 'User was not found.'; } catch (Cartalyst\Sentry\Users\UserNotActivatedException $e) { $data['status'] = 'error'; $data['message'] = 'User is not activated.'; } $response = Response::make(json_encode($data), 200); $response->header('Content-Type', 'text/json'); return $response; }
public function registrarProfesor() { $new_profesor = new Profesor(); $new_profesor->num_empleado = Input::get("num_empleado"); $new_profesor->password = Input::get("password"); $new_profesor->email = Input::get("email"); $new_datos_profesor = new DatosProfesor(); $new_datos_profesor->nombre = Input::get("nombre"); $new_datos_profesor->apellido_paterno = Input::get("apellido_paterno"); $new_datos_profesor->apellido_materno = Input::get("apellido_materno"); $new_datos_profesor->sexo = Input::get("sexo"); $new_datos_profesor->celular = Input::get("celular"); // Pequeño hack. Primero lo ponemos como archivo para validarlo, después le asignamos la ruta real para guardarlo $new_datos_profesor->ruta = Input::file('cv'); if ($new_profesor->validate()) { if ($new_datos_profesor->validate()) { $nombreCV = Input::get("nombre") . "_" . Input::get("apellido_paterno") . "_" . Input::get("apellido_materno") . "_CV.pdf"; //CHECAR PORQUE NO SE CREA EL PUTO CV!!! Input::file('cv')->move("CVs", $nombreCV); $new_datos_profesor->ruta = "/CVs/" . $nombreCV; //Ahora si, guardamos todo después de haberlo validado $new_profesor->save(); $new_datos_profesor->profesor()->associate($new_profesor); // Forzamos Save porque sabemos que no validará ruta como un string, sino como un file $new_datos_profesor->forceSave(); return Redirect::to('/'); } else { return Redirect::route('registro')->withErrors($new_datos_profesor->errors())->withInput(); } } else { $new_datos_profesor->validate(); $erroresValidaciones = array_merge_recursive($new_profesor->errors()->toArray(), $new_datos_profesor->errors()->toArray()); return Redirect::route('registro')->withErrors($erroresValidaciones)->withInput(); } }
public function getIndex() { if ($this->access['is_view'] == 0) { return Redirect::to('')->with('message', SiteHelpers::alert('error', ' Your are not allowed to access the page ')); } // Filter sort and order for query $sort = !is_null(Input::get('sort')) ? Input::get('sort') : ''; $order = !is_null(Input::get('order')) ? Input::get('order') : 'asc'; // End Filter sort and order for query // Filter Search for query $filter = !is_null(Input::get('search')) ? $this->buildSearch() : ''; // End Filter Search for query $page = Input::get('page', 1); $params = array('page' => $page, 'limit' => !is_null(Input::get('rows')) ? filter_var(Input::get('rows'), FILTER_VALIDATE_INT) : static::$per_page, 'sort' => $sort, 'order' => $order, 'params' => $filter, 'global' => isset($this->access['is_global']) ? $this->access['is_global'] : 0); // Get Query $results = $this->model->getRows($params); // Build pagination setting $page = $page >= 1 && filter_var($page, FILTER_VALIDATE_INT) !== false ? $page : 1; $pagination = Paginator::make($results['rows'], $results['total'], $params['limit']); $this->data['rowData'] = $results['rows']; // Build Pagination $this->data['pagination'] = $pagination; // Build pager number and append current param GET $this->data['pager'] = $this->injectPaginate(); // Row grid Number $this->data['i'] = $page * $params['limit'] - $params['limit']; // Grid Configuration $this->data['tableGrid'] = $this->info['config']['grid']; $this->data['tableForm'] = $this->info['config']['forms']; $this->data['colspan'] = SiteHelpers::viewColSpan($this->info['config']['grid']); // Group users permission $this->data['access'] = $this->access; // Render into template $this->layout->nest('content', 'rinvoices.index', $this->data)->with('menus', SiteHelpers::menus()); }
public function postNew() { $validation = new Validators\SeatUserRegisterValidator(); if ($validation->passes()) { // Let's register a user. $user = new \User(); $user->email = Input::get('email'); $user->username = Input::get('username'); $user->password = Hash::make(Input::get('password')); $user->tsid = Input::get('tsid'); $user->activation_code = str_random(24); $user->activated = 1; $user->save(); // Prepare data to be sent along with the email. These // are accessed by their keys in the email template $data = array('activation_code' => $user->activation_code); // Send the email with the activation link Mail::send('emails.auth.register', $data, function ($message) { $message->to(Input::get('email'), 'New SeAT User')->subject('SeAT Account Confirmation'); }); // And were done. Redirect to the login again return Redirect::action('SessionController@getSignIn')->with('success', 'Successfully registered a new account. Please check your email for the activation link.'); } else { return Redirect::back()->withInput()->withErrors($validation->errors); } }
public function faqSend() { $question = new Question(); $input = Input::all(); $captcha_string = Input::get('g-recaptcha-response'); $captcha_response = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret=6LcCwgATAAAAAKaXhPJOGPTBwX-n2-PPLZ7iupKj&response=' . $captcha_string); $captcha_json = json_decode($captcha_response); if ($captcha_json->success) { $rules = ["sujetQuestion" => "required", "mail" => "required|email", "contenuQuestion" => "required"]; $messages = ["required" => ":attribute est requis pour l'envoi d'une question", "email" => "L'adresse email précisée n'est pas valide"]; $validator = Validator::make(Input::all(), $rules, $messages); if ($validator->fails()) { $messages = $validator->messages(); Session::flash('flash_msg', "Certains champs spécifiés sont incorrects."); Session::flash('flash_type', "fail"); return Redirect::to(URL::previous())->withErrors($validator); } else { $question->fill($input)->save(); Session::flash('flash_msg', "Votre question nous est bien parvenue. Nous vous répondrons sous peu."); Session::flash('flash_type', "success"); return Redirect::to(URL::previous()); } } else { Session::flash('flash_msg', "Champ de vérification incorrect ou non coché."); Session::flash('flash_type', "fail"); return Redirect::to(URL::previous()); } }
public function dologin() { $rules = array('username' => 'required', 'password' => 'required'); $message = array('required' => 'Data :attribute harus diisi', 'min' => 'Data :attribute minimal diisi :min karakter'); $validator = Validator::make(Input::all(), $rules, $message); if ($validator->fails()) { return Redirect::to('/')->withErrors($validator)->withInput(Input::except('password')); } else { $data = array('username' => Input::get('username'), 'password' => Input::get('password')); if (Auth::attempt($data)) { $data = DB::table('user')->select('user_id', 'level_user', 'username')->where('username', '=', Input::get('username'))->first(); //print_r($data); //echo $data->id_users; Session::put('user_id', $data->user_id); Session::put('level', $data->level_user); Session::put('username', $data->username); //print_r(Session::all()); return Redirect::to("/admin/beranda"); } else { Session::flash('messages', ' <div class="alert alert-danger alert-dismissable" > <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <strong>Peringatan...</strong><br> Username dan password belum terdaftar pada sistem ! </div> '); return Redirect::to('/')->withInput(Input::except('password')); } } }
/** * Generate the module */ protected function compile() { // Also check owner (see #126) if (($objOrder = Order::findOneBy('uniqid', (string) \Input::get('uid'))) === null || FE_USER_LOGGED_IN === true && $objOrder->member > 0 && \FrontendUser::getInstance()->id != $objOrder->member) { $this->Template = new \Isotope\Template('mod_message'); $this->Template->type = 'error'; $this->Template->message = $GLOBALS['TL_LANG']['ERR']['orderNotFound']; return; } // Order belongs to a member but not logged in if (TL_MODE == 'FE' && $this->iso_loginRequired && $objOrder->member > 0 && FE_USER_LOGGED_IN !== true) { global $objPage; $objHandler = new $GLOBALS['TL_PTY']['error_403'](); $objHandler->generate($objPage->id); exit; } Isotope::setConfig($objOrder->getRelated('config_id')); $objTemplate = new \Isotope\Template($this->iso_collectionTpl); $objTemplate->linkProducts = true; $objOrder->addToTemplate($objTemplate, array('gallery' => $this->iso_gallery, 'sorting' => $objOrder->getItemsSortingCallable($this->iso_orderCollectionBy))); $this->Template->collection = $objOrder; $this->Template->products = $objTemplate->parse(); $this->Template->info = deserialize($objOrder->checkout_info, true); $this->Template->date = Format::date($objOrder->locked); $this->Template->time = Format::time($objOrder->locked); $this->Template->datim = Format::datim($objOrder->locked); $this->Template->orderDetailsHeadline = sprintf($GLOBALS['TL_LANG']['MSC']['orderDetailsHeadline'], $objOrder->document_number, $this->Template->datim); $this->Template->orderStatus = sprintf($GLOBALS['TL_LANG']['MSC']['orderStatusHeadline'], $objOrder->getStatusLabel()); $this->Template->orderStatusKey = $objOrder->getStatusAlias(); }
public function doLogin() { // validate the info, create rules for the inputs $rules = array('email' => 'required|email', 'password' => 'required|alphaNum|min:3'); // run the validation rules on the inputs from the form $validator = Validator::make(Input::all(), $rules); // if the validator fails, redirect back to the form if ($validator->fails()) { return Redirect::to('login')->withErrors($validator)->withInput(Input::except('password')); // send back the input (not the password) so that we can repopulate the form } else { // create our user data for the authentication $userdata = array('email' => Input::get('email'), 'password' => Input::get('password')); // attempt to do the login if (Auth::attempt($userdata)) { // validation successful! // redirect them to the secure section or whatever // return Redirect::to('secure'); // for now we'll just echo success (even though echoing in a controller is bad) echo 'SUCCESS!'; } else { // validation not successful, send back to form return Redirect::to('login'); } } }
public function store() { $validator = Validator::make($data = Input::all(), Employee::$rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } /* Employee */ if (Input::has('createEmployee')) { Employee::create($data); } $message = "登録しました。"; if (Input::has('deleteEmployee')) { $e = Employee::where('name', Input::get('name'))->first(); Employee::destroy($e->id); $message = "削除しました。"; if (Input::has('selectedEmployee')) { Input::replace(array('selectedEmployee', '')); } } if (Input::has('updateEmployee')) { $validator_for_update = Validator::make($data = Input::all(), Employee::$update_rules); if ($validator_for_update->fails()) { return Redirect::back()->withErrors($validator_for_update)->withInput(); } $e = Employee::where('name', Input::get('name'))->first(); Employee::destroy($e->id); $data['name'] = $data['new_name']; Employee::create($data); $message = "更新しました。"; } return Redirect::route('employees.index')->with('message', $message); }
/** * Run the controller and parse the template */ public function run() { $this->Template = new BackendTemplate('be_picker'); $this->Template->main = ''; // Ajax request if ($_POST && Environment::get('isAjaxRequest')) { $this->objAjax = new Ajax(Input::post('action')); $this->objAjax->executePreActions(); } $strTable = Input::get('table'); $strField = Input::get('field'); $this->loadDataContainer($strTable); $objDca = new DC_Table($strTable); // AJAX request if ($_POST && Environment::get('isAjaxRequest')) { $this->objAjax->executePostActions($objDca); } $objFileTree = new $GLOBALS['BE_FFL']['fileSelector'](array('strId' => $strField, 'strTable' => $strTable, 'strField' => $strField, 'strName' => $strField, 'varValue' => explode(',', Input::get('value'))), $objDca); $this->Template->main = $objFileTree->generate(); $this->Template->theme = $this->getTheme(); $this->Template->base = Environment::get('base'); $this->Template->language = $GLOBALS['TL_LANGUAGE']; $this->Template->title = specialchars($GLOBALS['TL_LANG']['MSC']['filepicker']); $this->Template->headline = $GLOBALS['TL_LANG']['MSC']['ppHeadline']; $this->Template->charset = $GLOBALS['TL_CONFIG']['characterSet']; $this->Template->options = $this->createPageList(); $this->Template->expandNode = $GLOBALS['TL_LANG']['MSC']['expandNode']; $this->Template->collapseNode = $GLOBALS['TL_LANG']['MSC']['collapseNode']; $this->Template->loadingData = $GLOBALS['TL_LANG']['MSC']['loadingData']; $this->Template->search = $GLOBALS['TL_LANG']['MSC']['search']; $this->Template->action = ampersand(Environment::get('request')); $this->Template->value = $this->Session->get('file_selector_search'); $GLOBALS['TL_CONFIG']['debugMode'] = false; $this->Template->output(); }