to() публичный статический Метод

Generate an absolute URL to the given path.
public static to ( string $path, mixed $extra = [], boolean | null $secure = null ) : string
$path string
$extra mixed
$secure boolean | null
Результат string
 public function postPacientes($cita)
 {
     if (Request::ajax()) {
         $paciente = new Paciente();
         $search = Input::get('search');
         $limit = Input::get('limit');
         $offset = Input::get('offset');
         if (empty($search)) {
             $datos = $paciente->datos_pacientes(0, 0, $limit, $offset);
             $cantidad = Paciente::all()->count();
         } else {
             $datos = $paciente->datos_pacientes($search, 1, $limit, $offset);
             $c = DB::select("SELECT count(id) as cantidad FROM pacientes WHERE concat(`cedula`,' ',`primer_nombre`,' ',`apellido_paterno`) LIKE '%" . $search . "%'");
             $cantidad = $c[0]->cantidad;
         }
         $comilla = "'";
         $n = 1;
         $data = array();
         foreach ($datos as $pacientes) {
             $cant_citas = Cita::where('id_paciente', $pacientes->id)->count();
             if ($cita == 0) {
                 $url = '<a href=' . $comilla . URL::to('datos/citas/' . $pacientes->id) . $comilla . ' class=' . $comilla . 'btn btn-primary btn-sm' . $comilla . ' data-toggle=' . $comilla . 'tooltip' . $comilla . '  title=' . $comilla . 'Crear Cita' . $comilla . '><span class=' . $comilla . 'glyphicon glyphicon-list-alt' . $comilla . '></span> Crear Cita </a>  <a href=' . $comilla . route('datos.pacientes.edit', $pacientes->id) . $comilla . ' class=' . $comilla . 'btn btn-success btn-sm' . $comilla . ' data-toggle=' . $comilla . 'tooltip' . $comilla . '  title=' . $comilla . 'Editar Paciente' . $comilla . '><span class=' . $comilla . 'glyphicon glyphicon-pencil' . $comilla . '></span> Editar </a> <a href=' . $comilla . '#' . $comilla . ' data-id=' . $comilla . '' . $pacientes->id . '' . $comilla . ' onclick=' . $comilla . 'eliminar(' . $pacientes->id . ');' . $comilla . ' class=' . $comilla . 'btn btn-danger btn-delete btn-sm' . $comilla . ' data-toggle=' . $comilla . 'tooltip' . $comilla . ' title=' . $comilla . 'Eliminar' . $comilla . '><span class=' . $comilla . 'glyphicon glyphicon-remove' . $comilla . '></span> Eliminar </a>';
             } else {
                 $url = '<a href=' . $comilla . URL::to('datos/citas/' . $pacientes->id) . $comilla . ' class=' . $comilla . 'btn btn-primary btn-sm' . $comilla . ' data-toggle=' . $comilla . 'tooltip' . $comilla . '  title=' . $comilla . 'Crear Cita' . $comilla . '><span class=' . $comilla . 'glyphicon glyphicon-list-alt' . $comilla . '></span> Crear Cita </a>  <a href=' . $comilla . route('datos.pacientes.edit', $pacientes->id) . $comilla . ' class=' . $comilla . 'btn btn-success btn-sm' . $comilla . ' data-toggle=' . $comilla . 'tooltip' . $comilla . '  title=' . $comilla . 'Editar Paciente' . $comilla . '><span class=' . $comilla . 'glyphicon glyphicon-pencil' . $comilla . '></span> Editar Paciente </a>';
             }
             $data[] = array('num' => $n, 'name' => $pacientes->primer_nombre . ' ' . $pacientes->segundo_nombre . ' ' . $pacientes->apellido_paterno . ' ' . $pacientes->apellido_materno, 'cedula' => $pacientes->cedula, 'date' => $pacientes->fecha_nacimiento, 'cel' => $pacientes->celular, 'tel' => $pacientes->telefono, 'email' => $pacientes->email, 'cita' => $cant_citas, 'url' => $url);
             $n++;
         }
         return Response::json(array('total' => $cantidad, 'rows' => $data));
     } else {
         App::abort(403);
     }
 }
Пример #2
0
 public function cancel(WorkflowProgress $wp)
 {
     $c = Page::getByID($this->getRequestedPageID());
     $wpr = new WorkflowProgressResponse();
     $wpr->setWorkflowProgressResponseURL(\URL::to($c));
     return $wpr;
 }
 public function pdf($id)
 {
     $hashId = \Jamesy\Miscellaneous::encryptId($id);
     $pdf = new SimpleHTMLToPDF();
     $link = URL::to('email/show/' . $hashId);
     $pdf->display($link);
 }
Пример #4
0
 public function getDatatable()
 {
     $products = $this->ProductRepo->find(Input::get('sSearch'));
     return Datatable::query($products)->addColumn('checkbox', function ($model) {
         return '<input type="checkbox" name="ids[]" value="' . $model->public_id . '">';
     })->addColumn('product_key', function ($model) {
         return link_to('products/' . $model->public_id, $model->product_key);
     })->addColumn('notes', function ($model) {
         return nl2br(Str::limit($model->notes, 50));
     })->addColumn('cost', function ($model) {
         return Utils::formatMoney($model->cost, 1);
     })->addColumn('name', function ($model) {
         return nl2br($model->category_name);
     })->addColumn('dropdown', function ($model) {
         return '<div class="btn-group tr-action" style="visibility:hidden;">
             <button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
               ' . trans('texts.select') . ' <span class="caret"></span>
             </button>
             <ul class="dropdown-menu" role="menu">
             <li><a href="' . URL::to('products/' . $model->public_id) . '/edit">' . uctrans('texts.edit_product') . '</a></li>                
             <li class="divider"></li>
             <li><a href="' . URL::to('products/' . $model->public_id) . '/archive">' . uctrans('texts.delete_product') . '</a></li>
           </ul>
         </div>';
     })->make();
 }
Пример #5
0
    public function index()
    {
        $raw = new Webtools\Raw\Raw('list', false, $this);
        $raw->setTable('raw_actor');
        $raw->order('last_update', 'asc');
        $raw->unsetOptions(array());
        $raw->setTitle('Actors');
        $raw->fields(array('actor_id' => array('type' => 'hidden', 'primary_key' => true, 'column' => true), 'first_name' => array('column' => true, 'title_key' => true), 'last_name' => array('column' => true), 'last_update' => array('column' => true, 'readonly' => true, 'title' => 'Date')));
        $this->data['raw'] = $raw;
        $raw->render();
        $this->data['raw_output'] = '
		<div class="jumbotron">
		  <h1>Welcome to Raw!</h1>
		  <p>A CRUD package for Laravel inspired by the Grocery CRUD library for Codeigniter</p>
		  <p>Take a look at the examples below</p>
		</div>
		<div class="row">
			<div class="col-md-12">
				<ul class="list-group">
				  <li class="list-group-item"><a href="' . URL::to('raw_items/actors') . '">Actors</a></li>
				  <li class="list-group-item"><a href="' . URL::to('raw_items/customers') . '">Customers</a></li>
				  <li class="list-group-item"><a href="' . URL::to('raw_items/films') . '">Films</a></li>
				  <li class="list-group-item"><a href="' . URL::to('raw_items/languages') . '">Languages</a></li>
				  <li class="list-group-item"><a href="' . URL::to('raw_items/countries') . '">Countries</a></li>
				  <li class="list-group-item"><a href="' . URL::to('raw_items/rental') . '">Rentals</a></li>
				  <li class="list-group-item"><a href="' . URL::to('raw_items/payment') . '">Payment</a></li>
				</ul>
			</div>
		</div>';
        /* ADD template */
        $this->layout = View::make($this->layout, $this->data);
    }
Пример #6
0
 public function search(Entity $entity)
 {
     $this->entryList = new EntryList($entity);
     $this->entity = $entity;
     $set = $this->entity->getResultColumnSet();
     if ($set) {
         $defaultSortColumn = $set->getDefaultSortColumn();
         if ($this->request->query->has($this->entryList->getQuerySortDirectionParameter())) {
             $direction = $this->request->query->get($this->entryList->getQuerySortDirectionParameter());
         } else {
             $direction = $defaultSortColumn->getColumnDefaultSortDirection();
         }
         if ($this->request->query->has($this->entryList->getQuerySortColumnParameter())) {
             $value = $this->request->query->get($this->entryList->getQuerySortColumnParameter());
             $column = $this->entity->getResultColumnSet();
             $value = $column->getColumnByKey($value);
             if (is_object($value)) {
                 $this->entryList->sanitizedSortBy($value->getColumnKey(), $direction);
             }
         } else {
             $this->entryList->sanitizedSortBy($defaultSortColumn->getColumnKey(), $direction);
         }
         $result = new Result($this->entity->getResultColumnSet(), $this->entryList, \URL::to('/ccm/system/search/express/entries/submit', $this->entity->getID()));
         $this->result = $result;
     }
 }
Пример #7
0
 public function reset_password($reset, $id, $da_mail = 1)
 {
     $reset = Input::has('reset') ? Input::get('reset') : $reset;
     $id = Input::has('id') ? Input::get('id') : $id;
     $da_mail = Input::has('da_mail') ? Input::get('da_mail') : $da_mail;
     $new_password = Input::has('new_password') ? Input::get('new_password') : null;
     $data = array('reset' => $reset, 'id' => $id, 'da_mail' => $da_mail, 'new_password' => $new_password);
     $rules = array('reset' => 'required', 'new_password' => 'required');
     $messages = array('newPassword.required' => 'Specifica una nuova password');
     $validator = Validator::make($data, $rules, $messages);
     $user = Sentry::findUserById($id);
     if ($validator->passes()) {
         try {
             $user = Sentry::findUserById($id);
             if ($user->checkResetPasswordCode($reset)) {
                 if ($user->attemptResetPassword($reset, $new_password)) {
                     return $this->make_response($data, false, array('Password resettata con successo'), URL::to('/'));
                 } else {
                     return $this->make_response($data, true, array('Non è stato possibile resettare la password'));
                 }
             } else {
                 return $this->make_response($data, true, array('Reset code non valido'));
             }
         } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) {
             return $this->make_response($data, true, array('Utente non trovato'));
         }
     }
     if (!$da_mail) {
         $errors = $validator->messages;
         return $this->make_response($data, true, $errors);
     }
     return View::make('login_reset_password')->with('reset', $reset)->with('id', $id)->with('da_mail', $da_mail)->with('args', $this->args);
 }
Пример #8
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     // create new sitemap object
     $sitemap = App::make("sitemap");
     $today = '2014-11-01T12:30:00+02:00';
     // set cache (key (string), duration in minutes (Carbon|Datetime|int), turn on/off (boolean))
     // by default cache is disabled
     //    $sitemap->setCache('laravel.sitemap', 1);
     // add item to the sitemap (url, date, priority, freq)
     $sitemap->add(URL::to('/'), $today, '1.0', 'daily');
     $sitemap->add(URL::to('about'), $today, '0.8', 'monthly');
     $sitemap->add(URL::to('category/all'), $today, '0.8', 'monthly');
     $sitemap->add(URL::to('category/web'), $today, '0.8', 'monthly');
     $sitemap->add(URL::to('category/olm'), $today, '0.8', 'weekly');
     $sitemap->add(URL::to('category/games'), $today, '0.8', 'weekly');
     $data = Category::get_items('all', true);
     $entries = $data['json']['entries'];
     foreach ($entries as $item) {
         $o = (array) $item['entry'];
         $client_key = $o['client_key'];
         $entry_key = $o['entry_key'];
         $to = "item/" . $client_key . "/" . $entry_key;
         $sitemap->add(URL::to($to), $today, '0.9', 'weekly');
     }
     // show your sitemap (options: 'xml' (default), 'html', 'txt', 'ror-rss', 'ror-rdf')
     $sitemap->store('xml', 'sitemap');
     return $sitemap->render('xml');
 }
Пример #9
0
 public function getIndex()
 {
     $this->heads = array(array('Role', array('search' => true, 'sort' => false, 'select' => Prefs::getRole()->RoleToSelection('_id', 'rolename'))), array('Created', array('search' => true, 'sort' => true, 'date' => true)), array('Last Update', array('search' => true, 'sort' => true, 'date' => true)));
     //print $this->model->where('docFormat','picture')->get()->toJSON();
     Breadcrumbs::addCrumb('System', URL::to(strtolower($this->controller_name)));
     return parent::getIndex();
 }
Пример #10
0
 public function update()
 {
     $btn_sta = Input::get('btn_sta');
     $inputs = Input::get('check');
     $idRed = Input::get('project_id');
     switch ($btn_sta[0]) {
         case 1:
             foreach ($inputs as $key => $id) {
                 DB::table('project_logs')->where('id', $id)->delete();
             }
             Session::flash('flash_message', "Sukses Menghapus Data !!");
             break;
         case 2:
             foreach ($inputs as $key => $id) {
                 DB::table('project_logs')->where('id', $id)->update(['status' => "Done"]);
             }
             Session::flash('flash_message', "Sukses Memperbaharui Status !!");
             break;
         case 3:
             foreach ($inputs as $key => $id) {
                 DB::table('project_logs')->where('id', $id)->update(['status' => "Undone"]);
             }
             Session::flash('flash_message', "Sukses Memperbaharui Status !!");
             break;
         default:
             break;
     }
     return redirect(\URL::to('project/detail', encrypt($idRed)));
 }
Пример #11
0
 public function upload(Request $request)
 {
     if ($request->hasFile('file')) {
         $path = $this->getStorageRoot() . $request->get('directory');
         $dir = $request->get('directory');
         $filename = $request->get('filename') != '' ? $request->get('filename') : $request->file('file')->getClientOriginalName();
         $result = new \stdClass();
         $result->name = $filename;
         $result->directory = $dir;
         $result->path = '/' . $dir . '/' . $filename;
         $result->fullPath = \URL::to($dir) . '/' . $filename;
         $result->backgroundImage = "url('{$result->path}')";
         $result->active = false;
         $request->file('file')->move($path, $filename);
         // if a model has been assigne dto be updated
         if ($request->has('model')) {
             $modelData = json_decode($request->get('model'));
             $model = new $modelData->modelName();
             $model::updateOrCreate(['id' => $modelData->modelId], [$modelData->modelField => $modelData->modelValue]);
             $result->model = $model;
         }
         return response()->json($result);
     }
     return response()->json(['No image uploaded']);
 }
Пример #12
0
 public function __toString()
 {
     if (is_object($this->file)) {
         return (string) \URL::to('/download_file', $this->file->getFileID());
     }
     return '';
 }
Пример #13
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (\Auth::user()->hak_akses == 1) {
         return $next($request);
     }
     return redirect(\URL::to('error'));
 }
Пример #14
0
 public function post_upload()
 {
     // fetch input data
     $input = \Input::all();
     // create rules for validator
     $rules = array('image' => 'required|image|max:5000', 'description' => 'required|max:100');
     // validate the data with set rules
     $v = \Validator::make($input, $rules);
     if ($v->fails()) {
         // if validation fails, redirect back with relevant error messages
         return \Redirect::back()->withInput()->withErrors($v);
     } else {
         $image = \Input::file('image');
         // URL::to('/') can be changed to public_path() on a public domain
         $directory = \URL::to('/') . '/uploads/';
         $mkdir = public_path() . '/uploads/';
         // create directory if it doesn't exist
         if (!file_exists($mkdir)) {
             \File::makeDirectory($mkdir, 0775, true);
         }
         // save the filename with the path and a unique name for the file
         $filename = uniqid() . '.' . $input['image']->getClientOriginalExtension();
         // move the file to the correct path
         $upload_success = $input['image']->move($mkdir, $filename);
         $full_path = $directory . $filename;
         // store image info in the database
         \DB::table('images')->insert(['description' => \Input::get('description'), 'image' => $full_path, 'user_id' => \Auth::user()->id, 'approved' => 0, 'created_at' => \Carbon\Carbon::now()->toDateTimeString()]);
         return \Redirect::back()->withInput()->withErrors('Upload Successful!');
     }
 }
Пример #15
0
 function sendResetEmail($user)
 {
     $confirmation_code = str_random(30);
     DB::table('password_resets')->insert(array('email' => $user->email, 'token' => $confirmation_code, 'created_at' => date('Y-m-d h:i:s')));
     $link = \URL::to('system/reset-password') . '/' . $confirmation_code . "  ";
     $mail = \EX::sendEmail($user->email, $user->fullname, 'forgot_password', ['{{RESET_URL}}' => $link, '{{ USERNAME }}' => $user->fullname, '{{ NAME }}' => $user->fullname]);
 }
    public static function makeButton($package, $button = null)
    {
        if (is_string($package)) {
            $package = Packages::get($package);
        }
        $package->updated_at = \Carbon::now();
        $website = Settings::get('main');
        $paypal = $website->sandbox ? "www.sandbox.paypal" : "www.paypal";
        $payment = "";
        if ($package->renew == "none") {
            $payment .= '<form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post">
                                	<input type="hidden" name="cmd" value="_xclick">';
            $payment .= "<input type='hidden' name='amount' value='" . number_format($package->cost) . "'>";
        } else {
            $payment .= '<form name="_xclick" action="https://' . $paypal . '.com/cgi-bin/webscr" method="post"><input type="hidden" name="cmd" value="_xclick-subscriptions">';
            $payment .= '<input type="hidden" name="a3" value="' . number_format($package->cost) . '">';
            $renew = explode(" ", $package->renew);
            $payment .= '<input type="hidden" name="p3" value="' . $renew[0] . '">';
            $payment .= '<input type="hidden" name="t3" value="' . strtoupper($renew[1][0]) . '">';
            $payment .= "<input type='hidden' name='src' value='1'>";
        }
        if ($package->trial != "none") {
            $trial = explode(" ", $package->trial);
            $payment .= '<input type="hidden" name="a1" value="0">
		    	<input type="hidden" name="p1" value="' . $trial[0] . '">
		    	<input type="hidden" name="t1" value="' . strtoupper($trial[1][0]) . '">';
        }
        $email = $website->sandbox ? $website->sandbox_email : $website->paypal_email;
        $payment .= "<input type='hidden' name='no_shipping' value='1'>\n                        \t<input type='hidden' name='business' value='" . $email . "'>\n                        \t<input type='hidden' name='currency_code' value='USD'>\n                        \t<input type='hidden' name='item_name' value='" . $website->website_name . " " . $package->name . "'>\n                        \t<input type='hidden' name='item_number' value='" . $package->_id . "'>\n                        \t<input type='hidden' name='notify_url' value='" . \URL::to('ipn') . "'>\n                        \t<input type='hidden' name='custom' value='" . \Auth::user()->_id . "'>\n                        \t<input type='hidden' name='cancel_return' value='" . \URL::to('memberships') . "'>\n                        \t<input type='hidden' name='return' value='" . \URL::to('success') . "'>";
        $payment .= $button == null ? "<input type='submit' value='Upgrade Now'>" : $button;
        $payment .= "</form>";
        return $payment;
    }
Пример #17
0
 public function __construct()
 {
     $this->panelInit = new \DashboardInit();
     $this->data['panelInit'] = $this->panelInit;
     $this->data['breadcrumb']['Settings'] = \URL::to('/dashboard/languages');
     $this->data['users'] = \Auth::user();
 }
 /**
  * Default action in default controller
  */
 public function action_index()
 {
     // get acl
     $acl = Acl::instance();
     // get first allowed module
     // get modules
     $modules = Settings::factory('modules')->as_array();
     $modules = array_keys($modules);
     $module = State::instance()->get('active.module');
     if ($module !== FALSE && $module !== 'Default') {
         if ($acl->allowed($module, 'access', FALSE, $this->_website) === TRUE) {
             $url = URL::to($module, array('website' => $this->_website));
             $this->redirect($url);
             exit;
         }
     }
     // find the first allowed module & redirect
     foreach ($modules as $module) {
         if ($acl->allowed($module, 'access', FALSE, $this->_website) === TRUE) {
             $url = URL::to($module, array('website' => $this->_website));
             $this->redirect($url);
             exit;
         }
     }
 }
Пример #19
0
 public function showSuccess($message = null)
 {
     if ($message) {
         $this->markSuccess($message);
     }
     id(new \RedirectResponse(\URL::to('/login/callback/' . $this->getHandle() . '/handle_success')))->send();
 }
Пример #20
0
 public function sitemap()
 {
     // create new sitemap object
     $sitemap = \App::make('sitemap');
     $date = new \DateTime();
     // set cache key (string), duration in minutes (Carbon|Datetime|int), turn on/off (boolean)
     // by default cache is disabled
     $sitemap->setCache('laravel.sitemap', 60);
     // check if there is cached sitemap and build new only if is not
     if (!$sitemap->isCached()) {
         // add item with translations (url, date, priority, freq, images, title, translations)
         $translations = [['language' => 'en', 'url' => \URL::to('/en')], ['language' => 'zh-CN', 'url' => \URL::to('/zh-CN')], ['language' => 'zh-HK', 'url' => \URL::to('/zh-HK')]];
         $sitemap->add(\URL::to('/'), $date->format('Y-m-d') . 'T00:00:00+08:00', '1', 'weekly', [], null, $translations);
         $translations = [['language' => 'en', 'url' => \URL::to('/en/portfolio')], ['language' => 'zh-CN', 'url' => \URL::to('/zh-CN/作品集')], ['language' => 'zh-HK', 'url' => \URL::to('/zh-HK/作品集')]];
         $sitemap->add(\URL::to('/作品集'), $date->format('Y-m-d') . 'T00:00:00+08:00', '0.9', 'weekly', [], null, $translations);
         $translations = [['language' => 'en', 'url' => \URL::to('/en/freelance-HK')], ['language' => 'zh-CN', 'url' => \URL::to('/zh-CN/香港freelance')], ['language' => 'zh-HK', 'url' => \URL::to('/zh-HK/香港freelance')]];
         $sitemap->add(\URL::to('/香港freelance'), $date->format('Y-m-d') . 'T00:00:00+08:00', '0.9', 'weekly', [], null, $translations);
         $translations = [['language' => 'en', 'url' => \URL::to('/en/web-design-host-seo')], ['language' => 'zh-CN', 'url' => \URL::to('/zh-CN/网页设计-寄存-SEO')], ['language' => 'zh-HK', 'url' => \URL::to('/zh-HK/網頁設計-寄存-SEO')]];
         $sitemap->add(\URL::to('/網頁設計-寄存-SEO'), $date->format('Y-m-d') . 'T00:00:00+08:00', '0.9', 'weekly', [], null, $translations);
         $translations = [['language' => 'en', 'url' => \URL::to('/en/choose-online-partner')], ['language' => 'zh-CN', 'url' => \URL::to('/zh-CN/网站顾问')], ['language' => 'zh-HK', 'url' => \URL::to('/zh-HK/網站顧問')]];
         $sitemap->add(\URL::to('/網站顧問'), $date->format('Y-m-d') . 'T00:00:00+08:00', '0.9', 'weekly', [], null, $translations);
         $translations = [['language' => 'en', 'url' => \URL::to('/en/contact-freelance')], ['language' => 'zh-CN', 'url' => \URL::to('/zh-CN/联络freelance')], ['language' => 'zh-HK', 'url' => \URL::to('/zh-HK/聯絡freelance')]];
         $sitemap->add(\URL::to('/聯絡freelance'), $date->format('Y-m-d') . 'T00:00:00+08:00', '0.9', 'weekly', [], null, $translations);
     }
     // show your sitemap (options: 'xml' (default), 'html', 'txt', 'ror-rss', 'ror-rdf')
     return $sitemap->render('xml');
 }
Пример #21
0
 public static function url($string)
 {
     if (static::isLaravel()) {
         return \URL::to($string);
     }
     return $string;
 }
Пример #22
0
 /**
  * Build a navigation menu from an array with the following structure: <br/>
  * $navbar = array( <br/>
  *		['url'=>'url',           'textkey'=>'public.title', 'nopattern' => true ], <br/>
  *		['url'=>'url/products',  'textkey'=>'public.products.title' ], <br/>
  *		['url'=>'url/clients',   'textkey'=>'public.clients.title', 'icon' => 'fa-users' ], <br/>
  *);
  */
 public static function build(array $_menu, $_currentLocale = '', $_addItemClass = '')
 {
     $str = '';
     foreach ($_menu as $key => $option) {
         $icon = isset($option['icon']) ? '<i class="fa ' . $option['icon'] . ' fa-fw"></i> ' : '';
         if (isset($option['divider'])) {
             $str .= '<li class="divider"></li>';
         } else {
             if (isset($option['submenu'])) {
                 $requestPattern = $_currentLocale . ($option['url'] == '' ? '' : '/' . $option['url'] . '*');
                 $isActive = '';
                 $isOpenned = '';
                 if (Request::is($requestPattern)) {
                     $isActive = ' active';
                     $isOpenned = ' in';
                 }
                 $str .= '<li class="' . $_addItemClass . ' list-toggle' . $isActive . '">' . '<a class="accordion-toggle" href="#collapse-' . $key . '" data-toggle="collapse">' . $icon . trans($option['textkey']) . '</a>' . '<ul id="collapse-' . $key . '" class="collapse' . $isOpenned . '">' . self::build($option['submenu'], $_currentLocale) . '</ul>' . '</li>';
             } else {
                 $submenusPattern = isset($option['nopattern']) ? '' : '*';
                 $requestPattern = $_currentLocale . ($option['url'] == '' ? '' : '/' . $option['url'] . $submenusPattern);
                 //$requestPattern = $_currentLocale . $option['url'] . $submenusPattern;
                 $isActive = \Request::is($requestPattern) ? ' active' : '';
                 $str .= '<li class="' . $_addItemClass . $isActive . '">' . '<a href="' . \URL::to($option['url']) . '">' . $icon . trans($option['textkey']) . '</a>' . '</li>';
             }
         }
     }
     return $str;
 }
 /**
  * Testing redirect with logged in user.
  */
 public function testLoginShouldRedirectUser()
 {
     $credentials = array('email' => '*****@*****.**', 'password' => 'admin', 'csrf_token' => Session::getToken());
     $this->withInput($credentials)->requestAction('POST', 'UserController@postLogin');
     $this->requestAction('GET', 'UserController@getLogin');
     $this->assertRedirection(URL::to('/'));
 }
Пример #24
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     //Check for null name
     if (strlen($request->get('name')) == 0) {
         return [];
     }
     //Initiate searches and return object of results
     $searchable = ['App\\Person', 'App\\Character', 'App\\Weapon', 'App\\Item', 'App\\Time', 'App\\Place', 'App\\Faction'];
     foreach ($searchable as $object) {
         $components = explode('\\', $object);
         $className = strtolower($components[count($components) - 1]);
         $hits = $object::where('name', 'like', '%' . $request->get('name') . '%')->get();
         //Lets supress the HTML laden notes
         foreach ($hits as $hit) {
             unset($hit->notes);
             //set the link for the object
             $model_components = explode("\\", get_class($hit));
             $hitClass = strtolower($model_components[count($model_components) - 1]);
             if ($hitClass == 'person') {
                 $action = 'people';
             } else {
                 $action = $className . 's';
             }
             $hit->link = \URL::to($action . '/' . $hit->id);
             $results[] = $hit;
         }
     }
     return response()->json($results);
 }
Пример #25
0
 public function makeActions($data)
 {
     $delete = '<span class="del" id="' . $data['_id'] . '" ><i class="icon-trash"></i>Delete</span>';
     $edit = '<a href="' . URL::to('campaign/edit/' . $data['_id']) . '"><i class="icon-edit"></i>Update</a>';
     $actions = $edit . '<br />' . $delete;
     return $actions;
 }
Пример #26
0
 public function generateFeed()
 {
     $articles = $this->getArticles();
     $feed = Feed::make();
     // set your feed's title, description, link, pubdate and language
     $feed->title = 'cnBeta1';
     $feed->description = '一个干净、现代、开放的cnBeta';
     $feed->logo = 'http://cnbeta1.com/assets/img/cnbeta1.png';
     $feed->link = URL::to('feed');
     $feed->pubdate = $articles[0]['date'];
     $feed->lang = 'zh-cn';
     foreach ($articles as $article) {
         $articleModel = new Article($article['article_id']);
         try {
             $articleModel->load();
         } catch (Exception $ex) {
             Log::error('feed: fail to fetch article: ' . $article['article_id'] . ', error: ' . $ex->getMessage());
         }
         $content = $article['intro'];
         $content .= $articleModel->data['content'] ? $articleModel->data['content'] : '';
         // set item's title, author, url, pubdate, description and content
         $feed->add($article['title'], 'cnBeta1', URL::to($article['article_id']), $article['date'], $content, $content);
     }
     $this->data = $feed->render('atom', -1);
     $this->saveToCache();
 }
Пример #27
0
 public function doRegistration()
 {
     // Setup the validator
     $validator = Validator::make(Input::all(), array('name' => 'required', 'email' => 'required|email|unique:users,email', 'password' => 'required', 'password_confirm' => 'required|same:password', 'phone' => 'required', 'confirm' => 'required'), array('email.unique' => "The email address you entered is already registered. You can <a href='" . \URL::route('home') . "'>log in</a>, or, if you've forgotten your password, you can reset it from the <a href='" . \URL::to('password/remind') . "'>Reset Password</a> page."));
     // Validator failed
     if (!$validator->passes()) {
         // Flash the session
         Session::flash('registerMessage', "Your information couldn't be validated. Please correct the issues and try again.");
         return Redirect::route('register')->withInput()->withErrors($validator->errors());
     }
     // Make sure the confirmation number matches
     if (Input::get('confirm') != Session::get('confirmNumber')) {
         return Redirect::route('register')->with('message', "Registration failed due to incorrect anti-spam confirmation number.")->with('messageStatus', 'danger');
     }
     // Create the user
     $user = $this->user->create(Input::all());
     if ($user) {
         // Log the user in
         Auth::login($user, true);
         // Fire the registration event
         Event::fire('user.registered', array($user, Input::all()));
         return Redirect::route('home')->with('message', "Welcome to the Brian Jacobs Golf scheduler! An email has been sent with the log in information you entered during registration. If you don't see the email, make sure to check your spam folder. From the scheduler, you can book lessons with a Brian Jacobs Golf instructor and enroll in any of our programs. Get started today by booking a lesson or enrolling in a program!")->with('messageStatus', 'success');
     } else {
         return Redirect::route('register')->withInput()->with('registerMessage', "There was an error creating your account. Please try again!");
     }
 }
Пример #28
0
 public function handleRequest()
 {
     // TODO create "page not found" page
     $uri = Request::path();
     // Default version of the documentation
     $page = 'introduction';
     $versions = array("4.0", "4.1", "4.2", "4.3", "4.6", "5.0", "5.6", "5.12");
     $version = end($versions);
     // If not the root, then split the uri to find the content
     $segment1 = Request::segment(1);
     $segment2 = Request::segment(2);
     if (!empty($segment1)) {
         $version = $segment1;
         if (!empty($segment2)) {
             $page = $segment2;
         }
     }
     // Show the correct markdown contents
     $page = __DIR__ . '/docs/' . $version . '/' . $page . '.md';
     if (file_exists($page)) {
         $contents = file_get_contents($page);
         $sidebar = file_get_contents(__DIR__ . '/docs/' . $version . '/sidebar.md');
         // Transform documents
         $contents_html = Markdown::defaultTransform($contents);
         $sidebar_html = Markdown::defaultTransform($sidebar);
         // Replace url variable
         $sidebar_html = preg_replace('/{url}/mi', URL::to($version), $sidebar_html);
         return View::make('layouts.master')->with('version', $version)->with('versions', $versions)->with('sidebar', $sidebar_html)->with('content', $contents_html);
     } else {
         \App::abort(400, "The page you were looking for could not be found.");
     }
 }
Пример #29
0
 public function getPaymentCart()
 {
     $values = Session::get('payment');
     foreach ($values as $key => $value) {
         $product[$key]['name'] = $value['name'];
         $price = round((int) $value['price'] / 21270);
         $product[$key]['price'] = $price;
         $product[$key]['quantity'] = 1;
         $product[$key]['product_id'] = $value['id'];
     }
     $tmpTransaction = new TmpTransaction();
     $st = Str::random(16);
     $baseUrl = URL::to('/product/payment/return?order_id=' . $st);
     // $value[1]['name'] = "sản phẩm 1";
     // $value[1]['price'] = "20000";
     // $value[1]['quantity'] = "1";
     // $value[1]['product_id'] = "3";
     // $value[2]['name'] = "sản phẩm 2";
     // $value[2]['price'] = "20000";
     // $value[2]['quantity'] = "1";
     // $value[2]['product_id'] = "3";
     $payment = $this->makePaymentUsingPayPalCart($product, 'USD', "{$baseUrl}&success=true", "{$baseUrl}&success=false");
     $tmpTransaction->order_id = $st;
     $tmpTransaction->payment_id = $payment->getId();
     $tmpTransaction->save();
     header("Location: " . $this->getLink($payment->getLinks(), "approval_url"));
     exit;
     return "index";
 }
Пример #30
0
 public function action_index()
 {
     echo '<h3> Opauth For Laravel - v.0.2</h3>';
     echo 'You can signup with: <a href="' . URL::to('facebook') . '">Facebook</a> <br />';
     echo 'You can signup with: <a href="' . URL::to('twitter') . '">Twitter</a> <br />';
     echo '<br /> I\'m gonna test this bundle with other supported websites by Opauth.';
 }