本文整理汇总了PHP中get_langs函数的典型用法代码示例。如果您正苦于以下问题:PHP get_langs函数的具体用法?PHP get_langs怎么用?PHP get_langs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_langs函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: update
public function update($id, $args)
{
$langs = get_langs();
if ($this->valid($args, $this->rules())) {
$page = $this->findItem($id);
$page->image = get_path($args['image']);
$page->post_status = $args['post_status'];
$page->template = $args['template'];
if (!$page->update()) {
throw new ExcuteException('save_error', 'Không lưu được');
}
$syncs = [];
foreach ($langs as $lang) {
$code = $args[$lang->code];
$page_title = $code['post_title'];
$slug = $code['slug'];
$slug = trim($slug) == '' ? toSlug($page_title) : toSlug($slug);
$page_desc = ['post_title' => $page_title, 'slug' => $slug, 'post_content' => $code['post_content'], 'post_excerpt' => $code['post_excerpt']];
$syncs[$lang->id] = $page_desc;
}
$page->langs()->sync($syncs);
} else {
throw new ValidationException('Error Validation', 'Điền đầy đủ các thông tin!');
}
}
开发者ID:JamesNguyen9x,项目名称:vatc,代码行数:25,代码来源:PageRepository.php
示例2: getAll
protected function getAll($group_id)
{
$langs = get_langs();
$results = [];
foreach ($langs as $lang) {
$results[$lang->code] = DB::table($this->table)->join($this->tbdesc, $this->table . '.id', '=', $this->tbdesc . '.menu_id')->where($this->tbdesc . '.lang_id', $lang->id)->where($this->table . '.group_id', $group_id)->select($this->tbdesc . '.*', $this->table . '.*')->orderBy('order')->get();
}
return $results;
}
开发者ID:JamesNguyen9x,项目名称:vatc,代码行数:9,代码来源:Menu.php
示例3: update
public function update($id, $request)
{
if ($this->valid($request->all(), $this->rules())) {
foreach (get_langs() as $lang) {
$datalang = $request->get($lang->code);
$status = $this->model->where('status_id', $id)->where('lang_id', $lang->id)->first();
$status->name = $datalang['name'];
$status->update();
}
} else {
throw new ValidateException($this->getError());
}
}
开发者ID:huudo,项目名称:bds1,代码行数:13,代码来源:StatusRepository.php
示例4: update
public function update(Request $request)
{
$langs = get_langs();
foreach ($langs as $lang) {
$datas = $request->input($lang->code);
foreach ($datas as $key => $value) {
$value = is_array($value) ? serialize($value) : $value;
$args = ['lang_id' => $lang->id, 'key' => $key, 'value' => $value];
$cond = Setting::where('key', $key)->where('lang_id', $lang->id);
if ($cond->count() > 0) {
$cond->update(['value' => $value]);
} else {
$meta = new Setting();
$meta->lang_id = $lang->id;
$meta->key = $key;
$meta->value = $value;
$meta->save();
}
}
}
return redirect()->back()->with('Mess', 'Cập nhật thành công');
}
开发者ID:JamesNguyen9x,项目名称:vatc,代码行数:22,代码来源:SettingController.php
示例5: update
public function update($id, $args)
{
$langs = get_langs();
if ($this->valid($args, $this->rules())) {
$web = $this->findItem($id);
$web->image = $args['image'];
$web->domain = $args['domain'];
$web->color = $args['color'];
$web->order = $args['order'];
if (!$web->save()) {
throw new NullException('Not save', $this->getError());
}
$syncs = [];
foreach ($langs as $lang) {
$datacode = $args[$lang->code];
$web_desc = ['name' => $datacode['name'], 'slug' => toSlug($datacode['name']), 'description' => $datacode['description']];
$syncs[$lang->id] = $web_desc;
}
$web->langs()->sync($syncs);
} else {
throw new ValidationException('Vui lòng điền đầy đủ các trường!', $this->getError());
}
}
开发者ID:JamesNguyen9x,项目名称:vatc,代码行数:23,代码来源:SiteRepository.php
示例6: lang_select
function lang_select($onChange = False, $ConfigLang = '')
{
if (!$ConfigLang) {
$ConfigLang = get_var('ConfigLang', array('POST', 'COOKIE'));
}
$select = '<select name="ConfigLang"' . ($onChange ? ' onChange="this.form.submit();"' : '') . '>' . "\n";
$languages = get_langs();
usort($languages, create_function('$a,$b', 'return strcmp(@$a[\'descr\'],@$b[\'descr\']);'));
foreach ($languages as $data) {
if ($data['available'] && !empty($data['lang'])) {
$selected = '';
$short = substr($data['lang'], 0, 2);
if ($short == $ConfigLang || empty($ConfigLang) && $short == substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2)) {
$selected = ' selected';
}
$select .= '<option value="' . $data['lang'] . '"' . $selected . '>' . $data['descr'] . '</option>' . "\n";
}
}
$select .= '</select>' . "\n";
return $select;
}
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:21,代码来源:functions.inc.php
示例7: update
public function update($id, $request, $multilang = true)
{
if ($this->valid($request->all(), $this->rules())) {
$country = $this->find($id);
if ($request->has('parent')) {
$country->parent = $request->get('parent');
}
$country->status = $request->get('status');
if ($request->has('icon')) {
$country->icon = $request->get('icon');
}
if ($request->has('visa_1')) {
$country->visa_1 = $request->get('visa_1');
}
if ($request->has('visa_2')) {
$country->visa_2 = $request->get('visa_2');
}
$country->update();
$syncs = [];
foreach (get_langs() as $lang) {
$langdata = $request->get($lang->code);
$name = $langdata['name'];
$country_desc = ['name' => $name, 'slug' => toSlug($name)];
$syncs[$lang->id] = $country_desc;
}
$country->langs()->sync($syncs);
} else {
throw new ValidateException($this->getError());
}
}
开发者ID:huudo,项目名称:bds1,代码行数:30,代码来源:CountryRepository.php
示例8: update
public function update($id, $request)
{
if ($this->valid($request->all(), $this->rules())) {
$room = $this->find($id);
$room->image = get_path($request->get('image'));
$room->status = $request->get('status');
$room->type_id = $request->get('type_id');
$room->hotel_id = $request->get('hotel_id');
// $room->price = $request->get('price');
$room->num_adult = $request->get('num_adult');
$room->square = $request->get('square');
$room->room_view = $request->get('room_view');
$room->add_bed = $request->get('add_bed');
if ($request->has('image_ids')) {
$room->images = serialize($request->get('image_ids'));
}
$room->price_1 = $request->get('price_1');
$room->price_2 = $request->get('price_2');
$room->price_3 = $request->get('price_3');
$room->point_1 = strtotime(str_replace('/', '-', $request->get('point_1')));
$room->point_2 = strtotime(str_replace('/', '-', $request->get('point_2')));
$room->update();
$sync_langs = [];
foreach (get_langs() as $lang) {
$datalang = $request->get($lang->code);
$name = $datalang['name'];
$room_desc = ['name' => $name, 'slug' => toSlug($name), 'content' => $datalang['content']];
$sync_langs[$lang->id] = $room_desc;
}
$room->langs()->sync($sync_langs);
$room->convenients()->detach();
if ($request->has('cats')) {
$room->convenients()->attach($request->get('cats'));
}
} else {
throw new ValidateException($this->getError());
}
}
开发者ID:huudo,项目名称:bds1,代码行数:38,代码来源:RoomRepository.php
示例9: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update($id, Request $request)
{
$langs = get_langs();
$data = $request->all();
DB::beginTransaction();
try {
$tour = Tourcat::find($id);
$level = 0;
if ($data['parent'] == 0) {
$parent_id = $this->ID_ROOT;
} else {
$parent_id = DB::table('tour_cat')->where('id', $data['parent'])->select('parent_id')->get();
$parent_id = $parent_id[0]->parent_id;
if ($parent_id >= $this->ID_ROOT) {
$i = 0;
$st = '_' . number_format($parent_id, 0, '', '');
while (substr($st, $level * 2, 2) != '00') {
$level++;
}
$level--;
}
}
$child_offset = number_format(pow($this->ID_BASE, $this->ID_MAX_LEVEL - ($level + 1)), 0, '', '');
$next_level = number_format($parent_id + pow($this->ID_BASE, $this->ID_MAX_LEVEL - $level), 0, '', '');
$row_child = DB::table('tour_cat')->where('parent_id', '>', $parent_id)->where('parent_id', '<', $next_level)->get();
$new_id = number_format($parent_id + $child_offset, 0, '', '');
for ($i = 1; $i < $this->ID_BASE; $i++) {
$found = false;
if ($row_child) {
foreach ($row_child as $row) {
if ($row->parent_id == $new_id) {
$found = true;
break;
}
}
}
if ($found) {
$new_id = number_format($new_id + $child_offset, 0, '', '');
}
}
$tour->parent_id = $new_id;
$tour->user_id = auth()->user()->id;
$tour->update();
$syncs = [];
foreach ($langs as $lang) {
$code = $request->input($lang->code);
$slug = trim($code['slug']) == '' ? toSlug($code['name']) : toSlug($code['slug']);
$tour_lang = ['name' => $code['name'], 'slug' => $slug];
$syncs[$lang->id] = $tour_lang;
}
$tour->langs()->sync($syncs);
} catch (Exception $e) {
DB::rollBack();
return redirect()->back()->withInput()->with('errorMess', 'Có lỗi xảy ra!');
}
DB::commit();
return redirect()->route('admin.tour-cat.index')->with('Mess', 'Cập nhật thành công');
}
开发者ID:huudo,项目名称:bds1,代码行数:64,代码来源:TourcatController.php
示例10: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update($tour, Request $request)
{
$langs = get_langs();
$data = $request->all();
DB::beginTransaction();
try {
$tour->value = $data['value'];
$tour->choice = $data['choice'];
$tour->option = $data['option'];
//
$tour->update();
$syncs = [];
foreach ($langs as $lang) {
$code = $request->input($lang->code);
$name = $code['name'];
$com_lang = ['name' => $name];
$syncs[$lang->id] = $com_lang;
}
$tour->langs()->sync($syncs);
} catch (Exception $e) {
DB::rollBack();
return redirect()->back()->withInput()->with('errorMess', 'Có lỗi xảy ra!');
}
DB::commit();
return redirect()->route('admin.services.index')->with('Mess', 'Cập nhật thành công');
}
开发者ID:JamesNguyen9x,项目名称:vatc,代码行数:32,代码来源:ServicesController.php
示例11: array
$smarty->setTemplateDir(System_Settings::getSmarty_template());
$smarty->setCompileDir(System_Settings::getSmarty_compile_dir());
$smarty->setCacheDir(System_Settings::getSmarty_cached_dir());
$smarty->debugging = System_Settings::getSmarty_debugging();
$smarty->caching = false;
$smarty->cache_lifetime = 0;
// Подключение функций.
require_once DOC . 'functions/functions_list.php';
// Подключение функций для щаблонов
require_once DOC . 'functions/smarty.functions.php';
$langs = array();
$langs_array = array();
// Список языков.
if (defined('MULTILANG') && MULTILANG == 1) {
// Получаем список доступных языков
$langs = get_langs();
for ($i = 0; $i < count($langs); $i++) {
$langs_array[$langs[$i]['alias']] = $langs[$i]['id'];
}
}
// Определение текущего языка.
if (Text::get_get('lang')) {
// Поиск языка в массиве языков..
for ($i = 0; $i < count($langs); $i++) {
if (Text::get_get('lang') == $langs[$i]['alias']) {
// Назначение языка.
$current_lang = Text::get_get('lang');
break;
}
}
// Проверка языка.
开发者ID:klimjr,项目名称:cms,代码行数:31,代码来源:index.php
示例12: update
public function update($id, $args)
{
$langs = get_langs();
$cat = $this->findItem($id);
$cat->parent = $args['parent'];
$cat->order = $args['order'];
if (isset($args['image'])) {
$cat->image = get_path($args['image']);
}
if (!$cat->update()) {
throw new NullException('Not save', $this->getError());
}
$syncs = [];
foreach ($langs as $lang) {
$datacode = $args[$lang->code];
$name = $datacode['name'];
$slug = $datacode['slug'];
$cat_desc = ['name' => $name, 'slug' => trim($slug) == '' ? toSlug($name) : toSlug($slug), 'description' => $datacode['desc']];
$syncs[$lang->id] = $cat_desc;
}
$cat->langs()->sync($syncs);
}
开发者ID:JamesNguyen9x,项目名称:vatc,代码行数:22,代码来源:CatRepository.php
示例13: __construct
public function __construct($model)
{
$this->model = $model;
$this->langs = get_langs();
}
开发者ID:JamesNguyen9x,项目名称:vatc,代码行数:5,代码来源:SlRepository.php
示例14: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update($id, Request $request)
{
$hour_from = "10:00";
$langs = get_langs();
$data = $request->all();
DB::beginTransaction();
try {
$tour = Tour::findOrFail($id);
if ($data['start_date'] != null) {
$time_from = $this->convert_datetime($data['start_date'], $hour_from);
} else {
$time_from = time();
}
$tour->start_date = $time_from;
$tour->start_id = $data['start'][0];
$tour->price_company = $data['price_company'];
$tour->price = $data['price'];
$tour->image_url = parse_url($data['image'])['path'];
$tour->days = $data['days'];
$tour->nights = $data['nights'];
$tour->code = $data['code'];
$tour->price_child = $data['price_child'];
$tour->price_baby = $data['price_baby'];
$tour->price_single = $data['price_single'];
$tour->user_id = auth()->user()->id;
//
$tour->update();
$syncs = [];
foreach ($langs as $lang) {
$code = $request->input($lang->code);
$name = $code['name'];
$keyword = mb_strtolower($this->convertUnicode($name));
$com_lang = ['name' => $name, 'schedule' => $code['schedule'], 'detail' => $code['detail'], 'notice' => $code['notice'], 'desc' => $code['desc'], 'keyword' => $keyword];
$syncs[$lang->id] = $com_lang;
}
$tour->langs()->sync($syncs);
if (isset($data['cats'])) {
$tour->tour_cat()->sync($data['cats']);
}
if (isset($data['end'])) {
$tour->tour_place()->sync($data['end']);
}
} catch (Exception $e) {
DB::rollBack();
return redirect()->back()->withInput()->with('errorMess', 'Có lỗi xảy ra!');
}
DB::commit();
return redirect()->route('admin.tours.index')->with('Mess', 'Cập nhật thành công');
}
开发者ID:huudo,项目名称:bds1,代码行数:55,代码来源:ToursController.php
示例15: update
public function update($id, $request)
{
$menu = $this->find($id);
$menu->status = $request->get('status');
if ($request->has('parent')) {
$menu->parent = $request->get('parent');
}
$menu->icon = $request->get('icon');
$menu->type = $request->get('type');
$menu->type_id = $request->get('type_id');
$menu->update();
$syncs = [];
if ($request->get('type') == 'custom') {
foreach (get_langs() as $lang) {
$datalang = $request->get($lang->code);
$menu_desc = ['name' => $datalang['name'], 'link' => $datalang['link']];
$syncs[$lang->id] = $menu_desc;
}
} else {
foreach (get_langs() as $lang) {
$datalang = $request->get($lang->code);
$type_id = $request->get('type_id');
switch ($request->get('type')) {
case 'page':
$pagerepo = new PageRepository(new Page());
$page = $pagerepo->get_with_lang($type_id, $lang->code);
$link = get_path(route('page.show', ['id' => $type_id, 'slug' => $page->lang->slug]));
$name = trim($datalang['name']) == '' ? $page->lang->name : $datalang['name'];
break;
case 'cat':
$catrepo = new TaxRepository(new Tax());
$cat = $catrepo->get_with_lang($type_id, $lang->code);
$link = get_path(route('cat.show', ['id' => $type_id, 'slug' => $cat->lang->slug]));
$name = trim($datalang['name']) == '' ? $cat->lang->name : $datalang['name'];
break;
case 'services':
$services = new ServicesRepository(new Service());
$ser = $services->get_with_lang($type_id, $lang->code);
$link = get_path(route('services.show', ['id' => $type_id, 'slug' => $ser->lang->slug]));
$name = trim($datalang['name']) == '' ? $ser->lang->name : $datalang['name'];
break;
default:
$link = '';
$name = '';
break;
}
$menu_desc = ['name' => $name, 'link' => $link];
$syncs[$lang->id] = $menu_desc;
}
}
$menu->langs()->sync($syncs);
}
开发者ID:huudo,项目名称:bds1,代码行数:52,代码来源:MenuRepository.php
示例16: update
public function update($id, $args)
{
$langs = get_langs();
if ($this->valid($args, $this->rules())) {
$menu = $this->findItem($id);
$menu->group_id = $args['group_id'];
$parent = $args['parent'];
$menu->parent = $parent == '' ? 0 : $parent;
$menu->status = $args['status'];
$menu->order = $args['order'];
$menu->open_type = $args['open_type'];
$menu->icon = $args['icon'];
$link_type = $args['link_type'];
$link = $args['link'];
$menu->type = $link_type;
$menu->item_id = $link;
if (!$menu->update()) {
throw new NullException('Not save', $this->getError());
}
$syncs = [];
foreach ($langs as $lang) {
$datacode = $args[$lang->code];
switch ($link_type) {
case 'cat':
$cat = Category::find($link)->langs()->where('code', $lang->code)->first(['cat_desc.slug']);
$menu_link = get_path(route('cat.view', [$link, $cat->slug]));
break;
case 'post':
$post = Post::find($link)->langs()->where('code', $lang->code)->first(['post_desc.slug']);
$menu_link = get_path(route('post.view', [$link, $post->slug]));
break;
case 'page':
$page = Post::find($link)->langs()->where('code', $lang->code)->first(['post_desc.slug']);
$menu_link = get_path(route('page.view', [$link, $page->slug]));
break;
case 'custom':
$menu_link = $link;
break;
default:
$menu_link = '';
break;
}
$menu_desc = ['name' => $datacode['name'], 'link' => $menu_link];
$syncs[$lang->id] = $menu_desc;
}
$menu->langs()->sync($syncs);
} else {
throw new ValidationException('Vui lòng điền đầy đủ các trường!', $this->getError());
}
}
开发者ID:JamesNguyen9x,项目名称:vatc,代码行数:50,代码来源:MenuRepository.php
示例17: update
public function update($id, $request)
{
if ($this->valid($request->all(), $this->rules())) {
$hotel = $this->find($id);
$hotel->image = get_path($request->get('image'));
$hotel->status = $request->get('status');
$hotel->star = $request->get('star');
$hotel->province_id = $request->get('province_id');
$hotel->hotline = $request->get('hotline');
$hotel->phone = $request->get('phone');
$hotel->email = $request->get('email');
$hotel->fax = $request->get('fax');
$hotel->build_year = $request->get('build_year');
$hotel->num_floor = $request->get('num_floor');
$hotel->num_room = $request->get('num_room');
$hotel->time_arrival = $request->get('time_arrival');
$hotel->time_departure = $request->get('time_departure');
if ($request->has('image_ids')) {
$hotel->images = serialize($request->get('image_ids'));
}
$hotel->update();
$sync_langs = [];
foreach (get_langs() as $lang) {
$datalang = $request->get($lang->code);
$name = $datalang['name'];
$slug = $datalang['slug'];
$hotel_desc = ['name' => $name, 'slug' => trim($slug) == '' ? toSlug($name) : toSlug($slug), 'note' => $datalang['note'], 'rule' => $datalang['rule'], 'content' => $datalang['content'], 'address' => $datalang['address']];
$sync_langs[$lang->id] = $hotel_desc;
}
$hotel->langs()->sync($sync_langs);
$hotel->convenients()->detach();
if ($request->has('cats')) {
$hotel->convenients()->attach($request->get('cats'));
}
// $hotel->cats()->detach();
// if ($request->has('cats')) {
// $hotel->cats()->attach($request->get('cats'));
// }
// if ($request->has('newtags')) {
// $newtags = $request->get('newtags');
// foreach ($newtags as $tag) {
// $newtag = new $this->tax;
// $newtag->type = 'tag';
// $newtag->dfname = $tag;
// $newtag->dfslug = toSlug($tag);
// $newtag->save();
// $hotel->tags()->attach($newtag->id);
// }
// }
// if ($request->has('availtags')) {
// $hotel->tags()->attach($request->get('availtags'));
// }
} else {
throw new ValidateException($this->getError());
}
}
开发者ID:huudo,项目名称:bds1,代码行数:56,代码来源:HotelRepository.php
示例18: update
public function update($id, $request)
{
$page = $this->find($id);
authorize_other('edit_pages', 'edit_others_pages', $page->author_id);
if ($this->valid($request->all(), $this->rules())) {
$page->image = get_path($request->get('image'));
$page->status = $request->get('status');
$page->author_id = auth()->user()->id;
if ($request->has('template')) {
$page->template = $request->get('template');
}
$page->update();
$sync_langs = [];
foreach (get_langs() as $lang) {
$datalang = $request->get($lang->code);
$name = $datalang['name'];
$slug = $datalang['slug'];
$page_desc = ['name' => $name, 'slug' => trim($slug) == '' ? toSlug($name) : toSlug($slug), 'excerpt' => $datalang['excerpt'], 'content' => $datalang['content']];
$sync_langs[$lang->id] = $page_desc;
}
$page->langs()->sync($sync_langs);
} else {
throw new ValidateException($this->getError());
}
}
开发者ID:huudo,项目名称:bds1,代码行数:25,代码来源:PageRepository.php
示例19: update_option
public function update_option($request)
{
$valid = Validator::make($request->all(), ['key' => 'required']);
if ($valid->fails()) {
throw new ValidateException($valid->errors());
}
$check = $request->get('haslang');
if ((int) $check == 1) {
foreach (get_langs() as $lang) {
return $this->option->where('key', $request->get('key'))->where('lang_id', $lang->id)->update(['value' => $request->get($lang->code)['value']]);
}
} else {
return $this->option->where('key', $request->get('key'))->update(['value' => $request->get('value')]);
}
}
开发者ID:huudo,项目名称:bds1,代码行数:15,代码来源:Option.php
示例20: update
public function update($id, $request)
{
if ($this->valid($request->all())) {
$slide = $this->find($id);
$slide->link = $request->get('link');
$slide->image = get_path($request->get('image'));
$slide->open_type = $request->get('open_type');
$slide->order = $request->get('order');
$slide->status = $request->get('status');
$slide->group_id = $request->get('group_id');
$slide->update();
$syncs = [];
foreach (get_langs() as $lang) {
$datalang = $request->get($lang->code);
$slide_desc = ['name' => $datalang['name'], 'description' => $datalang['description']];
$syncs[$lang->id] = $slide_desc;
}
$slide->langs()->sync($syncs);
} else {
throw new ValidateException($this->getError());
}
}
开发者ID:huudo,项目名称:bds1,代码行数:22,代码来源:SlideRepository.php
注:本文中的get_langs函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论