public function mostrarInfo($url) { $lang = Idioma::where('codigo', App::getLocale())->where('estado', 'A')->first(); $item_lang = Item::join('item_lang', 'item_lang.item_id', '=', 'item.id')->where('item_lang.lang_id', $lang->id)->where('item_lang.url', $url)->first(); //Me quedo con el item, buscando por url //$item = Item::where('url', $url)->first(); $item = Item::find($item_lang->item_id); $this->array_view['item'] = $item; return View::make($this->folder_name . '.' . $this->project_name . '-ver', $this->array_view); }
public function vistaEditar($id) { //Me quedo con la categoria, buscando por id //$categoria = Categoria::find($id); $lang = Idioma::where('codigo', App::getLocale())->where('estado', 'A')->first(); $categoria = Categoria::join('categoria_lang', 'categoria_lang.categoria_id', '=', 'categoria.id')->where('categoria_lang.lang_id', $lang->id)->where('categoria_lang.estado', 'A')->where('categoria.id', $id)->first(); $categorias = Categoria::where('estado', 'A')->where('id', '<>', $id)->get(); $this->array_view['categoria'] = $categoria; $this->array_view['categorias'] = $categorias; if ($categoria) { return View::make($this->folder_name . '.editar', $this->array_view); } else { $this->array_view['texto'] = Lang::get('controllers.error_carga_pagina'); return View::make($this->project_name . '-error', $this->array_view); } }
/** * Action used to set the application locale. * */ public function setLocale() { $mLocale = Request::segment(2, Config::get('app.locale')); // Get parameter from URL. if (in_array($mLocale, Config::get('app.languages'))) { App::setLocale($mLocale); Session::put('locale', $mLocale); Cookie::forever('locale', $mLocale); } if (Request::segment(3) == 'M' && is_numeric(Request::segment(4))) { $menu_id = Request::segment(4); $lang = Idioma::where('codigo', App::getLocale())->where('estado', 'A')->first(); $menu = Menu::join('menu_lang', 'menu_lang.menu_id', '=', 'menu.id')->where('menu_lang.lang_id', $lang->id)->where('menu_lang.estado', 'A')->where('menu_lang.menu_id', $menu_id)->first(); return Redirect::to($this->array_view['prefijo'] . '/' . $menu->url); } elseif (Request::segment(3) == 'PC' && is_numeric(Request::segment(4))) { $item_id = Request::segment(4); $lang = Idioma::where('codigo', App::getLocale())->where('estado', 'A')->first(); $item = $item_lang = Item::join('item_lang', 'item_lang.item_id', '=', 'item.id')->where('item_lang.lang_id', $lang->id)->where('item_lang.item_id', $item_id)->first(); return Redirect::to($this->array_view['prefijo'] . '/portfolio_completo/' . $item->url); } else { return Redirect::back(); } }
public function lang() { $lang = Idioma::where('codigo', App::getLocale())->where('estado', 'A')->first(); $texto = Texto::join('texto_lang', 'texto_lang.texto_id', '=', 'texto.id')->where('texto_lang.lang_id', $lang->id)->where('texto.id', $this->id)->first(); if (is_null($texto)) { echo "Por null"; $lang = Idioma::where('codigo', 'es')->where('estado', 'A')->first(); $texto = Texto::join('texto_lang', 'texto_lang.texto_id', '=', 'texto.id')->where('texto_lang.lang_id', $lang->id)->where('texto.id', $this->id)->first(); } return $texto; }
public function lang() { $lang = Idioma::where('codigo', App::getLocale())->where('estado', 'A')->first(); $categoria = Categoria::join('categoria_lang', 'categoria_lang.categoria_id', '=', 'categoria.id')->where('categoria_lang.lang_id', $lang->id)->where('categoria_lang.estado', 'A')->where('categoria.id', $this->id)->first(); if (is_null($categoria)) { echo "Por null"; $lang = Idioma::where('codigo', 'es')->where('estado', 'A')->first(); $categoria = Categoria::join('categoria_lang', 'categoria_lang.categoria_id', '=', 'categoria.id')->where('categoria_lang.lang_id', $lang->id)->where('categoria_lang.estado', 'A')->where('categoria.id', $this->id)->first(); } return $categoria; }
public function lang() { $lang = Idioma::where('codigo', App::getLocale())->where('estado', 'A')->first(); $muestra = Muestra::join('muestra_lang', 'muestra_lang.muestra_id', '=', 'muestra.id')->where('muestra_lang.lang_id', $lang->id)->where('muestra.id', $this->id)->first(); if (is_null($muestra)) { echo "Por null"; $lang = Idioma::where('codigo', 'es')->where('estado', 'A')->first(); $muestra = Muestra::join('muestra_lang', 'muestra_lang.muestra_id', '=', 'muestra.id')->where('muestra_lang.lang_id', $lang->id)->where('muestra.id', $this->id)->first(); } return $muestra; }
public function lang() { $lang = Idioma::where('codigo', App::getLocale())->where('estado', 'A')->first(); $imagen = Imagen::join('imagen_lang', 'imagen_lang.imagen_id', '=', 'imagen.id')->where('imagen_lang.lang_id', $lang->id)->where('imagen_lang.estado', 'A')->where('imagen.id', $this->id)->first(); if (is_null($imagen)) { echo "Por null"; $lang = Idioma::where('codigo', 'es')->where('estado', 'A')->first(); $imagen = Imagen::join('imagen_lang', 'imagen_lang.imagen_id', '=', 'imagen.id')->where('imagen_lang.lang_id', $lang->id)->where('imagen_lang.estado', 'A')->where('imagen.id', $this->id)->first(); } return $imagen; }
public function pasarItemsIdioma() { $idiomas = Idioma::where('estado', 'A')->get(); $items_sin_idioma = Item::where('estado', 'A')->whereNotIn('id', function ($q) { $q->select('item_id')->from('item_lang')->where('estado', 'A'); })->orderBy('id', 'ASC')->get(); foreach ($items_sin_idioma as $item_sin) { echo "ID: " . $item_sin->id . "<br>"; echo "Titulo: " . $item_sin->titulo . "<br>"; echo "Descripcion: " . $item_sin->descripcion . "<br>"; echo "URL: " . $item_sin->url . "<br><br>"; $datos_lang = array('titulo' => $item_sin->titulo, 'descripcion' => $item_sin->descripcion, 'url' => $item_sin->url, 'estado' => 'A', 'fecha_carga' => date("Y-m-d H:i:s"), 'usuario_id_carga' => 1); foreach ($idiomas as $idioma) { /* if ($idioma->codigo != Config::get('app.locale')) { $datos_lang['url'] = $idioma->codigo . "/" . $datos_lang['url']; } * */ $item_sin->idiomas()->attach($idioma->id, $datos_lang); } } $imagenes_sin_idioma = Imagen::where('estado', 'A')->whereNotIn('id', function ($q) { $q->select('imagen_id')->from('imagen_lang')->where('estado', 'A'); })->orderBy('id', 'ASC')->get(); /* echo "CANTIDAD IMG: " . count($imagenes_sin_idioma); foreach ($imagenes_sin_idioma as $img_sin) { $datos_lang = array( 'epigrafe' => $img_sin->epigrafe, 'estado' => 'A', 'fecha_carga' => date("Y-m-d H:i:s"), 'usuario_id_carga' => 1 ); echo "ID IMG: " . $img_sin->id . "<br>"; foreach ($idiomas as $idioma) { echo "ID IDIOMA: " . $idioma->id . "<br>"; $img_sin->idiomas()->attach($idioma->id, $datos_lang); echo "PASO <br>"; } } echo "LISTO"; * */ $productos_sin_idioma = Producto::whereIn('item_id', function ($p) { $p->select('id')->from('item')->where('estado', 'A'); })->whereNotIn('id', function ($q) { $q->select('producto_id')->from('producto_lang'); })->orderBy('id', 'ASC')->get(); echo "CANT PROD: " . count($productos_sin_idioma); foreach ($productos_sin_idioma as $prod_sin) { echo "ID: " . $prod_sin->id . "<br>"; echo "Cuerpo: " . $prod_sin->cuerpo . "<br><br>"; $datos_lang = array('cuerpo' => $prod_sin->cuerpo); foreach ($idiomas as $idioma) { $prod_sin->idiomas()->attach($idioma->id, $datos_lang); } } }
public function lang() { $lang = Idioma::where('codigo', App::getLocale())->where('estado', 'A')->first(); $menu = Menu::join('menu_lang', 'menu_lang.menu_id', '=', 'menu.id')->where('menu_lang.lang_id', $lang->id)->where('menu_lang.estado', 'A')->where('menu.id', $this->id)->first(); if (is_null($menu)) { echo "Por null"; $lang = Idioma::where('codigo', 'es')->where('estado', 'A')->first(); $menu = Menu::join('menu_lang', 'menu_lang.menu_id', '=', 'menu.id')->where('menu_lang.lang_id', $lang->id)->where('menu_lang.estado', 'A')->where('menu.id', $this->id)->first(); } return $menu; }
public function vistaEditar($id) { $lang = Idioma::where('codigo', App::getLocale())->where('estado', 'A')->first(); $menu = Menu::join('menu_lang', 'menu_lang.menu_id', '=', 'menu.id')->where('menu_lang.lang_id', $lang->id)->where('menu_lang.estado', 'A')->where('menu.id', $id)->first(); if ($menu) { $this->array_view['menu'] = $menu; return View::make($this->folder_name . '.editar', $this->array_view); } else { $this->array_view['texto'] = Lang::get('controllers.error_carga_pagina'); //return View::make($this->project_name . '-error', $this->array_view); return Redirect::to('/'); } }
public function lang() { $lang = Idioma::where('codigo', App::getLocale())->where('estado', 'A')->first(); $portfolio_completo = PortfolioCompleto::join('portfolio_completo_lang', 'portfolio_completo_lang.portfolio_completo_id', '=', 'portfolio_completo.id')->where('portfolio_completo_lang.lang_id', $lang->id)->where('portfolio_completo.id', $this->id)->first(); if (is_null($portfolio_completo)) { echo "Por null"; $lang = Idioma::where('codigo', 'es')->where('estado', 'A')->first(); $portfolio_completo = PortfolioCompleto::join('portfolio_completo_lang', 'portfolio_completo_lang.portfolio_completo_id', '=', 'portfolio_completo.id')->where('portfolio_completo_lang.lang_id', $lang->id)->where('portfolio_completo.id', $this->id)->first(); } return $portfolio_completo; }
public function lang() { $lang = Idioma::where('codigo', App::getLocale())->where('estado', 'A')->first(); $seccion = Seccion::join('seccion_lang', 'seccion_lang.seccion_id', '=', 'seccion.id')->where('seccion_lang.lang_id', $lang->id)->where('seccion_lang.estado', 'A')->where('seccion.id', $this->id)->first(); if (is_null($seccion)) { echo "Por null"; $lang = Idioma::where('codigo', 'es')->where('estado', 'A')->first(); $seccion = Seccion::join('seccion_lang', 'seccion_lang.seccion_id', '=', 'seccion.id')->where('seccion_lang.lang_id', $lang->id)->where('seccion_lang.estado', 'A')->where('seccion.id', $this->id)->first(); } return $seccion; }
<div class="clear"></div> </div> </div> <div class="clear"></div> <!-- <div class="content-box-header"> <h3 style="cursor: s-resize; ">Seo noticia</h3> <ul class="content-box-tabs"> <?php $idiomas = new Idioma(); $idiomas->where('activo', true)->get(); foreach ($idiomas->all as $idioma) { ?> <li><a href="#seo_<?php echo $idioma->codigo; ?> " class="<?php echo $idioma->codigo == 'es' ? 'default-tab current' : ''; ?> "><img height="24" src="<?php echo site_url('images/idiomas/' . $idioma->codigo); ?> .png" /></a></li> <?php } ?>
public function lang() { $lang = Idioma::where('codigo', App::getLocale())->where('estado', 'A')->first(); $html = TextoHtml::join('html_lang', 'html_lang.html_id', '=', 'html.id')->where('html_lang.lang_id', $lang->id)->where('html.id', $this->id)->first(); if (is_null($html)) { echo "Por null"; $lang = Idioma::where('codigo', 'es')->where('estado', 'A')->first(); $html = TextoHtml::join('html_lang', 'html_lang.html_id', '=', 'html.id')->where('html_lang.lang_id', $lang->id)->where('html.id', $this->id)->first(); } return $html; }