public function format($isNow, $isFuture, $delta, $unit) { $unitStr = \Lang::choice("localized-carbon::units." . $unit, $delta, array(), 'uk'); if ($isNow) { if ($isFuture) { if ($unit == "day" && $delta == 1) { $txt = "завтра"; } else { if (($unit == "year" || $unit == "hour") && $delta == 1) { $txt = "через " . " " . $unitStr; } else { $txt = "через " . $delta . " " . $unitStr; } } } else { if ($unit == "second" && $delta < 10) { $txt = 'щойно'; } else { if ($unit == "day" && $delta == 1) { $txt = "вчора"; } else { $txt = $delta . " " . $unitStr . " тому"; } } } } else { if ($isFuture) { $txt = $delta . " " . $unitStr . " потому"; } else { $txt = "за " . " " . $delta . " " . $unitStr . " до"; } } return $txt; }
public function postInvite() { $form = $this->inviteForm; $form->handleRequest(Request::instance()); if ($form->isValid()) { $data = $form->getData(); $emails = array_map('trim', explode(",", $data['emails'])); $subject = $data['subject']; $lender = Auth::user()->getLender(); $custom_message = $data['note']; $allInvites = InviteQuery::create()->filterByLender($lender)->select('email')->find(); $countInvites = 0; foreach ($emails as $email) { if (in_array($email, $allInvites->getData())) { Flash::info(\Lang::get('comments.flash.already-invited', array('email' => $email))); } else { $countInvites += 1; $this->lenderService->lenderInviteViaEmail($lender, $email, $subject, $custom_message); } } Flash::success(\Lang::choice('comments.flash.invite-success', $countInvites, array('count' => $countInvites))); return Redirect::route('lender:invite'); } return Redirect::route('lender:invite')->withForm($form); }
public function format($isNow, $isFuture, $delta, $unit) { $unitStr = \Lang::choice('localized-carbon::units.' . ($isFuture || !$isNow ? '_' : '') . $unit, $delta, array(), 'sk'); if ($isNow) { if ($isFuture) { if ($unit == 'second' && $delta < 10) { $txt = 'za chvíľu'; } else { if ($unit == 'day' && $delta == 1) { $txt = 'zajtra'; } else { $txt = 'za ' . ($delta > 1 ? $delta . ' ' : '') . $unitStr; } } } else { if ($unit == 'second' && $delta < 10) { $txt = 'pred chvíľou'; } else { if ($unit == 'day' && $delta == 1) { $txt = 'včera'; } else { $txt = 'pred ' . ($delta > 1 ? $delta . ' ' : '') . $unitStr; } } } } else { $txt = ($delta > 1 ? $delta . ' ' : '') . $unitStr; $txt .= $isFuture ? ' potom' : ' predtým'; } return $txt; }
public function format($isNow, $isFuture, $delta, $unit) { $unitStr = \Lang::choice("localized-carbon::units." . $unit, $delta, array(), 'ar'); $txt = $delta . ' ' . $unitStr; if ($isNow) { $when = $isFuture ? ' من الآن' : ' مرّت'; return $txt . $when; } return $txt .= $isFuture ? 'بعد ' : 'قبل '; }
public function format($isNow, $isFuture, $delta, $unit) { $txt = $delta . ' ' . \Lang::choice("localized-carbon::units." . $unit, $delta, array(), 'nl'); if ($isNow) { $txt .= $isFuture ? ' in de toekomst' : ' geleden'; return $txt; } $txt .= $isFuture ? ' na' : ' voor'; return $txt; }
public function format($isNow, $isFuture, $delta, $unit) { $unitStr = \Lang::choice("localized-carbon::units." . $unit, $delta, array(), 'fr'); $txt = $delta . ' ' . $unitStr; if ($isNow) { $when = $isFuture ? 'Dans ' : 'Il y a '; return $when . $txt; } return $txt .= $isFuture ? ' après' : ' avant'; }
public function format($isNow, $isFuture, $delta, $unit) { $unitStr = \Lang::choice("localized-carbon::units." . $unit, $delta, array(), 'el'); $txt = $delta . ' ' . $unitStr; if ($isNow) { $when = $isFuture ? 'από τώρα' : 'πρίν'; return $when . $txt; } return $txt .= $isFuture ? 'μετά' : ' πρίν'; }
public function format($isNow, $isFuture, $delta, $unit) { $unitStr = \Lang::choice("localized-carbon::units." . $unit, $delta, array(), 'es'); $txt = $delta . ' ' . $unitStr; if ($isNow) { $when = $isFuture ? 'En ' : 'Hace '; return $when . $txt; } return $txt .= $isFuture ? ' después' : ' antes'; }
public function format($isNow, $isFuture, $delta, $unit) { $unitStr = \Lang::choice("localized-carbon::units." . $unit, $delta, array(), 'pt'); $txt = $delta . ' ' . $unitStr; if ($isNow) { $txt .= $isFuture ? ' a partir de agora' : ' atrás'; return $txt; } $txt .= $isFuture ? ' depois' : ' antes'; return $txt; }
public function format($isNow, $isFuture, $delta, $unit) { $unitStr = \Lang::choice("localized-carbon::units." . $unit, $delta, array(), 'bg'); $txt = $delta . ' ' . $unitStr; if ($isNow) { $txt = ($isFuture ? 'след ' : 'преди ') . $txt; return $txt; } $txt .= $isFuture ? ' след това' : ' преди това'; return $txt; }
public function format($isNow, $isFuture, $delta, $unit) { $unitStr = \Lang::choice("localized-carbon::units." . $unit, $delta, array(), 'tr'); $txt = $delta . ' ' . $unitStr; if ($isNow) { $txt .= " " . ($isFuture ? 'sonra ' : 'önce '); return $txt; } $txt .= $isFuture ? ' sonrası' : ' öncesi'; return $txt; }
public function format($isNow, $isFuture, $delta, $unit) { $unitStr = \Lang::choice("localized-carbon::units." . $unit, $delta, array(), 'ja'); $txt = $delta . ' ' . $unitStr; if ($isNow) { $txt .= $isFuture ? '今' : '前'; return $txt; } $txt .= $isFuture ? '前' : '後'; return $txt; }
public function errors($key) { $errors = $this->getErorrBag(); if ($errors->has()) { $alert = "<strong>" . \Lang::choice($key, count($errors)) . "</strong>"; $html = ''; foreach ($errors->all('<p><a href="#:key">:message</a></p>') as $message) { $html .= $message; } return "<div class='alert alert-danger'>{$alert}{$html}</div>"; } }
public function getBuscador() { $provincias = new Provincia(); $areas = new AreasEmpleo(); $experiencia[0] = Lang::get("forms.sinExperiencia"); for ($i = 1; $i < 10; $i++) { $experiencia[$i] = $i . " " . Lang::choice("forms.anyo", $i); } $experiencia[10] = ">= 10 " . Lang::choice("forms.anyo", 10); $jornadas = new JornadasLaborales(); $contratos = new ContratosLaborales(); return View::make('gestor.buscador', array('contratos' => $contratos->vector(), 'jornadas' => $jornadas->vector(), 'experiencia' => $experiencia, 'areas' => $areas->vector(), 'provincias' => $provincias->arraySelect())); }
/** * Show the form for creating a new photo. * * @return \Illuminate\View\View */ public function create() { $albumArray = $this->album->all()->toArray(); $dropdown[0] = ''; if (empty($albumArray)) { $dropdown[0] = \Lang::get('gallery::gallery.none') . \Lang::choice('gallery::gallery.album', 2); } foreach ($albumArray as $album) { $dropdown[$album['album_id']] = $album['album_name']; } $data = array('type' => 'photo', 'dropdown' => $dropdown); $this->layout->content = \View::make('gallery::new', $data)->nest('form', 'gallery::forms.new-photo', $data); }
/** * Smarty {t}{/t} block plugin * * Type: block function<br> * Name: t<br> * Purpose: provides access to Laravel's translator<br> * Params: * <pre> * - _count - used for pluralization * </pre> * All other params are passed to Laravel's translator as replacements * * @param array $params parameters * @param string $content contents of the block * @param Smarty_Internal_Template $template template object * @param boolean &$repeat repeat flag * @return string content translated * @author Jakob Gahde <*****@*****.**> */ function smarty_block_t($params, $content, $template, &$repeat) { if (is_null($content)) { return; } if (array_key_exists('_count', $params)) { $count = $params['_count']; unset($params['_count']); $translated = Lang::choice($content, $count, $params); } else { $translated = Lang::get($content, $params); } return $translated; }
/** * @param array $params * @param string $content * @param Smarty_Internal_Template $smarty * @param boolean $repeat * * @return string * * @author Kovács Vince */ function smarty_block_lang($params, $content, Smarty_Internal_Template &$smarty, &$repeat) { if (is_null($content)) { return ''; } $content = trim($content); if (array_key_exists('_count', $params)) { $count = $params['_count']; unset($params['_count']); $translated = Lang::choice($content, $count, $params); } else { $translated = Lang::get($content, $params); } return $translated; }
public function updateCard(Card $card) { $inputs = ['color' => Input::get('color'), 'content' => Input::get('content'), 'comment' => Input::get('comment'), 'worker_id' => Input::get('worker_id')]; $valid = Validator::make($inputs, Card::$rules); if ($valid->passes()) { $card->color = $inputs['color']; $card->content = $inputs['content']; $card->comment = $inputs['comment']; $card->worker_id = $inputs['worker_id']; $card->save(); return Redirect::route('card.list')->with('success', Lang::choice('messages.Cards', 1) . ' ' . trans('is updated')); } else { return Redirect::back()->withErrors($valid)->withInput(); } }
public function updateRole(Role $role) { $inputs = ['name' => Input::get('name')]; $valid = Validator::make($inputs, Role::$rules); if ($valid->passes()) { $role->name = $inputs['name']; if (count($role->getDirty()) > 0) { $role->save(); return Redirect::back()->with('success', Lang::choice('messages.Roles', 1) . ' ' . trans('messages.is updated')); } else { return Redirect::back()->with('success', trans('messages.Nothing to update!')); } } else { return Redirect::back()->withErrors($valid)->withInput(); } }
function durationToHuman($minutes) { $hours = floor($minutes / 60); $minutes = $minutes % 60; $result = ''; if ($hours) { $result = $hours . Lang::choice('messages.times_hours', $hours); } if ($minutes) { if ($result) { $result .= ' '; } $result .= $minutes . Lang::choice('messages.times_minutes', $minutes); } return $result; }
public function updateAlbum(Album $album) { $inputs = ['name' => Input::get('name'), 'description' => Input::get('description'), 'user_id' => Input::get('uid')]; $valid = Validator::make($inputs, Album::$rules); if ($valid->passes()) { $album->name = $inputs['name']; $album->description = $inputs['description']; $album->user_id = $inputs['user_id']; if (count($album->getDirty()) > 0) { $album->save(); return Redirect::back()->with('success', Lang::choice('messages.Albums', 1) . ' ' . trans('messages.is updated')); } else { return Redirect::back()->with('success', trans('messages.Nothing to update')); } } else { return Redirect::back()->withErrors($valid)->withInput(); } }
public function minutesToHuman($seconds) { $minutes = $seconds / 60; $d = floor($minutes / 1440); $h = floor($minutes / 60) % 24; $m = $minutes % 60; $return = ''; if ($d > 0) { $return .= $d . ' ' . Lang::choice('check.diff.days', $d) . ' '; } if ($h > 0) { $return .= $h . ' ' . Lang::choice('check.diff.hours', $h) . ' '; } if ($m > 0) { $return .= $m . ' ' . Lang::choice('check.diff.minutes', $m); } return $return; }
public function saveUser() { $inputs = ['email' => Input::get('email'), 'username' => Input::get('username'), 'password' => Input::get('password'), 'password_confirmation' => Input::get('password_confirmation'), 'captcha' => Input::get('captcha')]; $rules = ['email' => 'required|email|unique:users', 'username' => 'required|unique:users', 'password' => 'required|min:8', 'password_confirmation' => 'required|min:8', 'captcha' => 'required | captcha']; $valid = Validator::make($inputs, $rules); if ($valid->passes()) { if ($inputs['password'] != $inputs['password_confirmation']) { return Redirect::back()->withErrors(trans('messages.PACANE')); } $user = new User(); $user->username = $inputs['username']; $user->password = Hash::make($inputs['password']); $user->email = $inputs['email']; $user->save(); return Redirect::route('user.new')->with('success', Lang::choice('messages.Users', 1) . ' ' . trans('messages.is saved')); } else { return Redirect::back()->withErrors($valid)->withInput(); } }
protected function BuildProfile($EditingWhat = null, $EditingWhich = null) { $isMe = Auth::check() && intval(Auth::id()) === $this->profile->user->id; if (!$isMe) { $EditingWhat = null; } $services = []; foreach ($this->profile->services()->take(5)->get() as $svc) { $services[$svc->name] = ''; } $requests = []; foreach ($this->profile->requests()->take(5)->get() as $req) { $requests[$req->name] = URL::action('RequestController@ShowRequest', [$req->id]); } $titleInfo = ['title_title' => $this->profile->name, 'title_image_subtitle' => $this->profile->max_rating === 0 ? trans('profile/profile.no_rating') : sprintf('%d / %d', $this->profile->rating, $this->profile->max_rating), 'title_image' => '']; $servicesList = ['theme' => 'service', 'title' => Lang::choice('shared.classes.service', 0), 'list' => $services, 'max' => '4', 'more' => '', 'right_top' => sprintf('%d %s', 0, trans('profile/profile.title.active_suffix')), 'right_bottom' => sprintf('%d %s', 0, trans('profile/profile.title.completed_suffix')), 'none' => trans('profile/profile.title.' . ($isMe ? 'my_' : '') . 'no_services')]; $requestsList = ['theme' => 'request', 'title' => Lang::choice('shared.classes.request', 0), 'list' => $requests, 'max' => '4', 'more' => '', 'right_top' => sprintf('%d %s', 0, trans('profile/profile.title.active_suffix')), 'right_bottom' => sprintf('%d %s', 0, trans('profile/profile.title.completed_suffix')), 'none' => trans('profile/profile.title.' . ($isMe ? 'my_' : '') . 'no_requests')]; return View::make('pages.profile.profile', ['profile' => $this->profile, 'edit' => $EditingWhat, 'edit_which' => $EditingWhich, 'is_me' => $isMe, 'page_title' => $this->profile->name, 'title_info' => $titleInfo, 'services_list' => $servicesList, 'requests_list' => $requestsList, 'skills' => ['test' => 5, 'foo' => 6, 'btest' => 5, 'bfoo' => 6, 'ctest' => 5, 'cfoo' => 6, 'dtest' => 5, 'dfoo' => 6]]); }
public function getHumanDate() { $txt = 'carbon.timediff.'; $isNow = true; $other = Carbon::now(); $delta = abs($other->diffInSeconds($this->created_at)); $divs = array('second' => Carbon::SECONDS_PER_MINUTE, 'minute' => Carbon::MINUTES_PER_HOUR, 'hour' => Carbon::HOURS_PER_DAY, 'day' => 30, 'month' => Carbon::MONTHS_PER_YEAR); $unit = 'year'; foreach ($divs as $divUnit => $divValue) { if ($delta < $divValue) { $unit = $divUnit; break; } $delta = floor($delta / $divValue); } if ($delta == 0) { $delta = 1; } $txt .= $unit; return Lang::choice($txt, $delta, compact('delta')); }
public function updateTodo(Todo $todo) { $inputs = ['content' => Input::get('content'), 'deadline' => Input::get('deadline'), 'priority' => Input::get('priority'), 'status' => Input::get('status'), 'user_id' => Input::get('uid'), 'author_id' => Input::get('author_uid')]; $valid = Validator::make($inputs, Todo::$rules); if ($valid->passes()) { $todo->content = $inputs['content']; $todo->deadline = $inputs['deadline']; $todo->priority = $inputs['priority']; $todo->status = $inputs['status']; $todo->user_id = $inputs['user_id']; $todo->author_id = $inputs['author_id']; if (count($todo->getDirty()) > 0) { $todo->sendNotification(self::NOTIFICATION_UPDATE_TASK); $todo->save(); return Redirect::route('todo.list')->with('success', Lang::choice('messages.Todos', 1) . ' ' . trans('messages.is updated')); } else { return Redirect::back()->with('success', trans('messages.Nothing to update')); } } else { return Redirect::back()->withErrors($valid)->withInput(); } }
public function format($isNow, $isFuture, $delta, $unit) { $unitStr = \Lang::choice("localized-carbon::units." . $unit, $delta, array(), 'ru'); if ($isNow) { if ($isFuture) { $txt = "через " . $delta . " " . $unitStr; } else { if ($unit == "second" && $delta < 10) { $txt = 'только что'; } else { $txt = $delta . " " . $unitStr . " назад"; } } } else { if ($isFuture) { $txt = "спустя " . $delta . " " . $unitStr; } else { $txt = "за " . " " . $delta . " " . $unitStr . " до"; } } return $txt; }
public static function diffForHumans($date) { $txt = 'time.timediff.'; $isNow = true; $other = Carbon::now(); $delta = abs($other->diffInSeconds($date)); // 30 days per month, 365 days per year... good enough!! $divs = array('second' => Carbon::SECONDS_PER_MINUTE, 'minute' => Carbon::MINUTES_PER_HOUR, 'hour' => Carbon::HOURS_PER_DAY, 'day' => 30, 'month' => Carbon::MONTHS_PER_YEAR); $unit = 'year'; foreach ($divs as $divUnit => $divValue) { if ($delta < $divValue) { $unit = $divUnit; break; } $delta = floor($delta / $divValue); } if ($delta == 0) { $delta = 1; } $txt .= $unit; return \Lang::choice($txt, $delta, compact('delta')); }
/** * Past time total */ public function getPastTimeAttribute() { if ($this->time_end) { $date1 = new DateTime($this->time_end); $date2 = new DateTime($this->time_start); $diff = $date2->diff($date1); $retour = false; if ($diff->h) { if ($diff->d) { $diff->h = $diff->d * 24; } $retour = $diff->h . Lang::choice('messages.times_hours', $diff->h); } if ($diff->i) { if ($retour) { $retour .= ' '; } $retour .= $diff->i . Lang::choice('messages.times_minutes', $diff->i); } return $retour; } else { return false; } }
/** * Copyright 2015 ppy Pty. Ltd. * * This file is part of osu!web. osu!web is distributed with the hope of * attracting more community contributions to the core ecosystem of osu!. * * osu!web is free software: you can redistribute it and/or modify * it under the terms of the Affero GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * osu!web is distributed WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with osu!web. If not, see <http://www.gnu.org/licenses/>. * */ function item_count($count) { return Lang::choice("common.count.item", $count, ["count" => $count]); }