Ejemplo n.º 1
0
 /**
  * Display the specified resource.
  * GET /menus/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $menus = Menu::all();
     $menu = Menu::find($id);
     // dd($menu);
     return View::make('menus.index', compact('menus', 'menu'));
 }
Ejemplo n.º 2
0
 /**
  * Function which actially fetch the data from the database
  * @param object $options
  * @return nested array of menu nodes.
  */
 private function _fetch($options = array())
 {
     App::import('Model', 'Cakemenu.Menu');
     $menu = new Menu();
     if (isset($options['subtree'])) {
         $parent = true;
         if (isset($options['subtree']['parent'])) {
             $parent = $options['subtree']['parent'];
             unset($options['subtree']['parent']);
         }
         $subtree = $menu->find('first', array('conditions' => $options['subtree']));
         if ($subtree != false) {
             if ($parent == true) {
                 $conditions = array('Menu.lft >=' => $subtree['Menu']['lft'], 'Menu.rght <=' => $subtree['Menu']['rght']);
             } else {
                 $conditions = array('Menu.lft >' => $subtree['Menu']['lft'], 'Menu.rght <' => $subtree['Menu']['rght']);
             }
             if (isset($options['conditions'])) {
                 $options['conditions'] = am($options['conditions'], $conditions);
             } else {
                 $options['conditions'] = $conditions;
             }
         }
         unset($options['subtree']);
     }
     $nodes = $menu->find('threaded', am(array('order' => 'Menu.lft ASC'), $options));
     return $nodes;
 }
Ejemplo n.º 3
0
 /**
  * 获取成功的订单
  * @return [type] [description]
  */
 public function getSuccess()
 {
     $data = array('main' => url('/'), 'announce' => url('/announce'), 'category' => url('/category'), 'deliver' => url('/deliver'), 'good' => url('/good'), 'map' => url('/map'), 'shop_info' => url('/shop_info'), 'success' => url('/success'), 'widge_success' => array());
     $shop_id = Auth::user()->shop_id;
     $orders = Order::where('shop_id', $shop_id)->where('state_of_shop', 3)->get();
     $data['widge_success']['deal_count'] = count($orders);
     $data['widge_success']['deal'] = array();
     $shop = Shop::find($shop_id);
     foreach ($orders as $order) {
         $comment = CommentOrder::where('order_id', $order->id)->get();
         $one = array('deal_id' => $order->id, 'deal_statue' => $order->state, 'same_again' => '##', 'deal_again' => '##', 'shop_name' => $shop->name, 'deal_number' => $order->number, 'deal_time' => date('Y-m-d', $order->ordertime), 'deal_phone' => $shop->linktel, 'deliver_address' => $order->receive_address, 'deliver_phone' => $order->receive_phone, 'deliver_remark' => $order->beta, 'deal_speed' => isset($comment[0]) ? $comment[0]->speed : 0, 'deal_satisfied' => isset($comment[0]) ? $comment[0]->value : 0, 'good' => array(), 'others' => array(array('item_name' => '不知道', 'item_value' => '-5', 'item_amount' => '1', 'item_total' => '0')));
         $one['total'] = $order->total;
         $menu_ids = array_count_values(explode(',', $order->order_menus));
         foreach ($menu_ids as $menu_id => $amount) {
             $menuComment = CommentMenu::where('order_id', $order->id)->where('menu_id', $menu_id)->get();
             $menu = Menu::find($menu_id);
             //var_dump($menuComment);
             $onemenu = array('goods_id' => $menu_id, 'goods_name' => $menu->title, 'goods_value' => $menu->price, 'goods_amount' => $amount, 'goods_total' => $amount * $menu->price, 'good_atisfied' => isset($menuComment[0]) ? $menuComment[0]->value : 0);
             array_push($one['good'], $onemenu);
         }
         array_push($data['widge_success']['deal'], $one);
     }
     return View::make("template.success.success")->with($data);
     //var_dump($data);
 }
Ejemplo n.º 4
0
 /**
  * 主界面
  */
 public function index()
 {
     if (Auth::check()) {
         $cartkey = Auth::user()->front_uid;
     } else {
         $cartkey = $this->getIP();
     }
     $key = 'laravel:user:'******':cart';
     $shop_id = Redis::lrange($key, 0, 0);
     $ids = array_count_values(Redis::lrange($key, 1, -1));
     $shop = Shop::find($shop_id[0]);
     $cart_list = array();
     $cart_amount = 0;
     // 商品总价格
     $i = 0;
     foreach ($ids as $id => $amount) {
         $good = Menu::find($id);
         $cart_list[$i] = array('good_name' => $good->title, 'good_id' => $id, 'good_price' => $good->price, 'good_amount' => $amount, 'good_total' => $good->price * $amount);
         $cart_amount += $cart_list[$i]['good_total'];
         $i++;
     }
     $output = array('userbar' => $this->getUserBar(), 'deliver_place' => Session::get('deliver_place'), 'deliver_tel' => Session::get('deliver_tel'), 'deliver_name' => Session::get('deliver_name'), 'deliver_time' => array('08:00', '09:00', '10:12', '12:30'), 'data' => array('user_name' => '注释用户名', 'shop_path' => '', 'shop_id' => $shop->id, 'shop_logo' => $shop->pic, 'shop_name' => $shop->name, 'shop_href' => url('shop/' . $shop->id), 'shop_type' => $shop->type, 'cart_list' => $cart_list, 'cart_amount' => $cart_amount, 'deliver_place' => Session::get('deliver_place'), 'deliver_time' => array('08:00', '09:00', '10:12', '12:30'), 'pay_method' => array('0' => array('is_default' => 0, 'method_name' => '在线支付'))), 'pay_status' => '付款信息');
     //var_dump($output);
     return View::make("template.order.order")->with($output);
 }
 public function vistaOrdenar($menu_id)
 {
     $menu = Menu::find($menu_id);
     $this->array_view['secciones'] = $menu->seccionesConItems();
     $this->array_view['menu'] = $menu;
     return View::make($this->folder_name . '.lista-por-menu', $this->array_view);
 }
Ejemplo n.º 6
0
 public function showAction()
 {
     $post = Post::findFirst();
     $this->view->title = $post->title;
     $this->view->post = $post;
     $this->view->menu = Menu::find();
     $this->view->show_navigation = true;
 }
Ejemplo n.º 7
0
 public function showAction()
 {
     $post = Post::findFirst();
     $this->view->setVar("title", $post->title);
     $this->view->setVar("post", $post);
     $this->view->setVar("menu", Menu::find());
     $this->view->setVar("show_navigation", true);
 }
Ejemplo n.º 8
0
 public function Order($idStand, $idMenu)
 {
     $bindedMenu = Menu::find($idMenu);
     $username = Session::get('user');
     $userLoggedIn = User::where('username', $username)->first();
     $data = array('bindedMenu' => $bindedMenu, 'user' => $userLoggedIn, 'idStand' => $idStand);
     return View::make('order', $data);
 }
Ejemplo n.º 9
0
 public function post_add()
 {
     $link = new Link();
     $link->name = Input::get('name');
     $link->parent = Input::get('parent');
     $menu = Menu::find(Input::get('menu_id'));
     $menu->links()->insert($link);
     return Redirect::to_action('admin.menus@all', array($menu->id))->with('flash', true)->with('flash_type', 'success')->with('flash_msg', 'New link created successfully.');
 }
Ejemplo n.º 10
0
 public function update()
 {
     $input = Request::all();
     $menu = Menu::find($input['_id']);
     $menu->menu = $input['menu_nombre'];
     $menu->url = $input['menu_url'];
     $menu->padre_id = $input['menu_padre_id'];
     $menu->save();
     return view('menu.verMenu')->with('menu', $menu)->with('edited', true);
 }
Ejemplo n.º 11
0
 function index_delete()
 {
     // $data=$this->post();
     $post_data = file_get_contents("php://input");
     $post_data = json_decode($post_data, true);
     var_dump($post_data);
     die;
     $menu = Menu::find($data['id']);
     $menu->active = 0;
     $menu->save();
     $this->response($menu);
 }
 public function postDelete()
 {
     $id = Input::get('delete_id');
     // Find all items with the parent_id of this one and reset the parent_id to zero
     $items = Menu::where('parent_id', $id)->get()->each(function ($item) {
         $item->parent_id = 0;
         $item->save();
     });
     // Find and delete the item that the user requested to be deleted
     $item = Menu::find($id);
     $item->delete();
     return Redirect::to('admin/menu');
 }
Ejemplo n.º 13
0
 public function generatemenucontrol()
 {
     $menu = Menu::find(Input::get("idmenu"));
     $menu->name = Input::get("menuname");
     $menu->save();
     foreach (Input::get("arraydata") as $value) {
         $menuitem = MenuItem::find($value["id"]);
         $menuitem->parent = $value["parent"];
         $menuitem->sort = $value["sort"];
         $menuitem->depth = $value["depth"];
         $menuitem->save();
     }
     echo json_encode(array("resp" => 1));
 }
 public function consultaContacto()
 {
     $data = Input::all();
     Input::flashOnly('nombre', 'email', 'telefono', 'consulta');
     $reglas = array('email' => array('required', 'email'), 'nombre' => array('required'));
     $validator = Validator::make($data, $reglas);
     if ($validator->fails()) {
         $messages = $validator->messages();
         if ($messages->has('nombre')) {
             $mensaje = $messages->first('nombre');
         } elseif ($messages->has('email')) {
             $mensaje = $messages->first('email');
         } else {
             $mensaje = Lang::get('controllers.cliente.datos_consulta_contacto_incorrectos');
         }
         return Redirect::to('/contacto')->with('mensaje', $mensaje)->with('error', true)->withInput();
     } else {
         $this->array_view['data'] = $data;
         Mail::send('emails.consulta-contacto', $this->array_view, function ($message) use($data) {
             $message->from($data['email'], $data['nombre'])->to('*****@*****.**')->subject('Consulta');
         });
         if (count(Mail::failures()) > 0) {
             $mensaje = Lang::get('controllers.cliente.consulta_no_enviada');
         } else {
             $data['nombre_apellido'] = $data['nombre'];
             Cliente::agregar($data);
             $mensaje = Lang::get('controllers.cliente.consulta_enviada');
         }
         if (isset($data['continue']) && $data['continue'] != "") {
             switch ($data['continue']) {
                 case "contacto":
                     return Redirect::to('contacto')->with('mensaje', $mensaje);
                     break;
                 case "menu":
                     $menu = Menu::find($data['menu_id']);
                     return Redirect::to('/' . $menu->url)->with('mensaje', $mensaje);
                     break;
             }
         }
         return Redirect::to("/")->with('mensaje', $mensaje);
         //return View::make('producto.editar', $this->array_view);
     }
 }
Ejemplo n.º 15
0
 public function postEditMenu($id)
 {
     /* validate input */
     $validator = Validator::make(Input::all(), array("menu_date" => "required|date_format:Y-m-d", "dishes" => "required", "recommendation" => "required"));
     /* if validated */
     if ($validator->passes()) {
         /* get input */
         $menu = Menu::find($id);
         $menu->menu_date = Input::get("menu_date");
         $menu->dishes()->sync(Input::get('dishes'));
         $menu->save();
         $recommendation = Menu::find($id)->recommendation;
         $recommendation->recommendation = Input::get("recommendation");
         $recommendation->save();
         return Redirect::to("admin/menu/edit_menu/{$id}")->with('message', 'Menu edited!');
     } else {
         return Redirect::to("admin/menu/edit_menu/{$id}")->withErrors($validator);
     }
     // end validation
 }
 public function order()
 {
     $menu_item_order = json_decode(Input::get('order'));
     $post_categories = Menu::all();
     $order = 1;
     foreach ($menu_item_order as $menu_level_1) {
         $level1 = Menu::find($menu_level_1->id);
         if ($level1->id) {
             $level1->order = $order;
             $level1->parent_id = NULL;
             $level1->save();
             $order += 1;
         }
         if (isset($menu_level_1->children)) {
             $children_level_1 = $menu_level_1->children;
             foreach ($children_level_1 as $menu_level_2) {
                 $level2 = Menu::find($menu_level_2->id);
                 if ($level2->id) {
                     $level2->order = $order;
                     $level2->parent_id = $level1->id;
                     $level2->save();
                     $order += 1;
                 }
                 if (isset($menu_level_2->children)) {
                     $children_level_2 = $menu_level_2->children;
                     foreach ($children_level_2 as $menu_level_3) {
                         $level3 = Menu::find($menu_level_3->id);
                         if ($level3->id) {
                             $level3->order = $order;
                             $level3->parent_id = $level2->id;
                             $level3->save();
                             $order += 1;
                         }
                     }
                 }
             }
         }
     }
     return 1;
 }
Ejemplo n.º 17
0
		$submenu->setIdMenu($_POST['id_menu']);
		$submenu->setVer($_POST['ver']);
		$submenu->setLink($_POST['link']);
		$submenu->insert();
		$id_menu=$submenu->findLast();
		$permiso->setId($id_menu[0]['id']);
		$permiso->setIdMenu($id_menu[0]['id_menu']);
		$permiso->insertPermisoMenu();
	}

	if ($_GET['op']=='delete') {
		$submenu->delete($_GET['id']);
		$permiso->deletePermisoMenu($_GET['id']);
	}

	$m = $menu->find($_GET['id']);

?>
<!DOCTYPE html>
<html>
<head>
	<?php 
head_html();
?>
	<script type="text/javascript">
		var nameTable='submenu';
	</script>
	<style type="text/css">
		body {padding-top: 1em; padding-bottom: 1em; overflow: auto;}
	</style>
</head>
 public function generatemenu()
 {
     $menu = new MenuItem();
     $getall = $menu->getall(1);
     $menu = array('items' => array(), 'parents' => array());
     foreach ($getall as $key => $items) {
         $menu['items'][$items['id']] = $items->toArray();
         $menu['parents'][$items['parent']][] = $items->id;
     }
     $items = $this->buildMenu(0, $menu);
     $menufind = Menu::find(Input::get("id"));
     $widget = new Widget();
     $widgetbymenu = $widget->getWidgetByMenu(Input::get("id"));
     if ($widgetbymenu->count()) {
         $widget = Widget::find($widgetbymenu[0]->id);
     }
     $widget->name = $menufind->name;
     $widget->id_component = Input::get("id");
     $widget->description = $this->generarmenu($items);
     $widget->save();
 }
Ejemplo n.º 19
0
 /**
  * 获取某个菜单的详情
  *
  * 对应API
  * 请求类型:POST
  * @return array 执行状态
  */
 public function getMenu()
 {
     $menu_id = Input::get('menu_id');
     return Menu::find($menu_id);
 }
Ejemplo n.º 20
0
 public function getUserBarCart()
 {
     if (Auth::check()) {
         $cartkey = Auth::user()->front_uid;
     } else {
         $cartkey = $this->getIP();
     }
     $key = 'laravel:user:'******':cart';
     if ($shop_id = Redis::lindex($key, 0)) {
         $data['successs'] = 'true';
         $data['state'] = 200;
         $data['errMsg'] = '';
         $data['no'] = 0;
         $shop = Shop::find($shop_id);
         $data['data']['url'] = 'shop/' . $shop_id;
         $data['data']['shop_name'] = $shop->name;
         $data['data']['all_value'] = 0;
         $data['data']['state'] = $shop->state == 0 ? 0 : 1;
         if ($shop->state == 1) {
             $data['data']['state_msg'] = '店铺打烊了';
         } elseif ($shop->state == 2) {
             $data['data']['state_msg'] = '店铺太忙了';
         } else {
             $data['data']['state_msg'] = '';
         }
         $ids = array_count_values(Redis::lrange($key, 1, -1));
         $data['data']['goods'] = array();
         foreach ($ids as $id => $count) {
             $menu = Menu::find($id);
             $value = $menu->price * $count;
             $data['data']['all_value'] += $value;
             array_push($data['data']['goods'], array('good_name' => $menu->title, 'good_value' => $value, 'good_count' => $count));
         }
         return Response::json($data);
     } else {
         return array('success' => 'false', 'state' => 200, 'errMsg' => '', 'no' => 0, 'data' => array());
     }
 }
Ejemplo n.º 21
0
 public function postMenuHome()
 {
     if (isset($_POST['title']) && isset($_POST['id'])) {
         if ($_POST['id'] == "" && !empty($_POST['id'])) {
         } else {
             $id = $_POST['id'];
             $menu = \Menu::find($id);
             $postcheck = \Menu::where("parent_id", "=", $id)->get();
             if ($postcheck->count() >= 1) {
                 foreach ($postcheck as $sub) {
                     $sub->delete();
                 }
             }
             $menu->delete();
             echo "Menu Item Deleted";
         }
         $menupos = \Menupo::find(1);
         $menupos->menu_jsondata = \Input::get("val");
         $menupos->save();
         //echo (property_exists($data[2],"children"));//$data[2]->children);
         if ($menupos->save()) {
             echo 1;
         }
         exit;
     }
     $pages = \DB::table("posts")->where("type", "page")->get();
     $data = array();
     $data = json_decode(\Input::get("val"));
     $jjack = "";
     $mpos = 0;
     foreach ($data as $dat) {
         $post_id = $dat->post;
         $sort_order = $mpos;
         $menu_type = "mainmenu";
         $title = $dat->title;
         property_exists($dat, "children") ? $isparent = 1 : ($isparent = 0);
         if (property_exists($dat, "id")) {
             $menu = \Menu::find($dat->id);
         } else {
             $menu = new \Menu();
         }
         $menu->post_id = $post_id;
         $menu->sort_order = $sort_order;
         $menu->menu_type = $menu_type;
         $menu->title = $title;
         $menu->link = $dat->link;
         $menu->has_child = $isparent;
         $menu->position = 0;
         $menu->save();
         $jjack .= $menu->id . ",";
         if (property_exists($dat, "children")) {
             //1st level submenu
             $menu_type = "submenu1";
             $mcpos = 0;
             foreach ($dat->children as $child1) {
                 $post_id = $child1->post;
                 $sort_order = $mcpos;
                 $parent_id = $menu->id;
                 $title = $child1->title;
                 property_exists($child1, "children") ? $isparent = 1 : ($isparent = 0);
                 if (property_exists($child1, "id")) {
                     $submenu1 = \Menu::find($child1->id);
                 } else {
                     $submenu1 = new \Menu();
                 }
                 $submenu1->parent_id = $parent_id;
                 $submenu1->menu_type = $menu_type;
                 $submenu1->post_id = $post_id;
                 $submenu1->sort_order = $sort_order;
                 $submenu1->position = 1;
                 $submenu1->link = $child1->link;
                 $submenu1->has_child = $isparent;
                 $submenu1->title = $title;
                 $submenu1->save();
                 if (property_exists($submenu1, "children")) {
                     // second level menu
                     $mccpos = 0;
                     $menu_type = "submenu2";
                     foreach ($submenu1->children as $child2) {
                         $post_id = $child2->id;
                         $title = $child2->title;
                         $sort_order = $mccpos;
                         property_exists($child2, "children") ? $isparent = 1 : ($isparent = 0);
                         $parent_id = $submenu1->id;
                         if (property_exists($child2, "id")) {
                             $submenu1 = \Menu::find($child2->id);
                         } else {
                             $submenu1 = new \Menu();
                         }
                         $submenu1->parent_id = $parent_id;
                         $submenu1->menu_type = $menu_type;
                         $submenu1->post_id = $post_id;
                         $submenu1->title = $title;
                         $submenu1->has_child = $isparent;
                         $submenu1->position = 1;
                         $submenu1->link = $child2->link;
                         $submenu1->sort_order = $sort_order;
                         $submenu1->save();
                         $mccpos++;
                     }
                 }
                 $mcpos++;
             }
         }
         $mpos++;
     }
     $menupos = \Menupo::find(1) ? \Menupo::find(1) : new \Menupo();
     $menupos->menu_jsondata = \Input::get("val");
     $menupos->save();
     //echo (property_exists($data[2],"children"));//$data[2]->children);
     if ($menupos->save()) {
         echo 1;
     }
     //print_r($pages);
 }
Ejemplo n.º 22
0
 private function takeFaMenu($pmenu)
 {
     //$result=array();
     $menuModel = new Menu();
     $pnqmenu = $menuModel->find('id =  :id', array(':id' => $pmenu['pid']))->attributes;
     if ($pnqmenu) {
         return $pnqmenu;
     }
 }
Ejemplo n.º 23
0
 /**
  * Changed the specified resource from storage.
  * POST /menu/cambiarestado
  *
  * @return Response
  */
 public function postCambiarestado()
 {
     if (Request::ajax()) {
         $menu = Menu::find(Input::get('id'));
         $menu->estado = Input::get('estado');
         $menu->usuario_updated_at = Auth::user()->id;
         $menu->save();
         if (Input::get('estado') == 0) {
             //actualizando a estado 0 segun
             DB::table('opciones')->where('menu_id', Input::get('id'))->update(array('estado' => 0, 'usuario_updated_at' => Auth::user()->id));
         }
         return Response::json(array('rst' => 1, 'msj' => 'Registro actualizado correctamente'));
     }
 }
Ejemplo n.º 24
0
 /**
  * 未评论页面
  */
 public function Uncomment()
 {
     $orders = Order::where('state', 4)->get();
     $data['userbar'] = $this->userBar();
     $data['sidebar'] = $this->sideBar();
     $data['uncomment']['deal_count'] = count($orders);
     $data['uncomment']['deal'] = array();
     foreach ($orders as $order) {
         $shop = Shop::find($order->shop_id);
         $one = array();
         $one['shop_id'] = $order->shop_id;
         $one['deal_id'] = $order->id;
         $one['deal_statue'] = $order->state;
         $one['same_again'] = '##';
         $one['deal_is_return'] = '##';
         // 是否能退单
         $one['deal_return'] = '##';
         // 退单链接
         $one['deal_is_pre'] = $order->is_pre;
         // 是否是预定单
         $one['deal_pre_time'] = $order->arrivetime;
         // 送餐时间
         $one['deal_again'] = '##';
         // 商品的地址
         $one['shop_name'] = $shop->name;
         // 商店的名称
         $one['deal_number'] = $order->id;
         // 订单号,先用订单ID代替
         $one['deal_time'] = $order->ordertime;
         //订单时间
         $one['deal_phone'] = $shop->linktel;
         //餐厅电话
         $one['deliver_address'] = $order->receive_address;
         //订单送往地址
         $one['deliver_phone'] = $order->receive_phone;
         $one['deliver_remark'] = $order->beta;
         //订单备注
         $one['deal_speed'] = 0;
         // 送餐速度,0没有评价1不满意2一般般3满意
         $one['deal_satisfied'] = '';
         $one['good'] = array();
         $menus = array_count_values(explode(',', $order->order_menus));
         foreach ($menus as $menu_id => $count) {
             $good = Menu::find($menu_id);
             array_push($one['good'], array('goods_id' => $good->id, 'goods_name' => $good->title, 'goods_value' => $good->price, 'goods_amount' => $count, 'goods_total' => $good->price * $count, 'good_atisfied' => '##'));
         }
         // others表示其他费用
         $one['others'] = array(array('item_name' => '', 'item_value' => '', 'item_amount' => '', 'item_total' => ''));
         $one['total'] = $order->total;
         array_push($data['uncomment']['deal'], $one);
     }
     return View::make("template.personal.personal_uncomment")->with($data);
 }
Ejemplo n.º 25
0
 /**
  * 获取店铺所有的评价,不分页
  */
 public function getShopComments($shop_id)
 {
     $data = array();
     $comments = Shop::find($shop_id)->comments;
     foreach ($comments as $comment) {
         $one = array();
         $menu = Menu::find($comment->menu_id);
         $user = FrontUser::find($comment->front_uid);
         $one['good_name'] = $menu->title;
         $one['user_name'] = $user->nickname;
         $one['time'] = $comment->time;
         $one['content'] = $comment->content;
         $one['good_price'] = $menu->price;
         #TODO:这里的评分居然是以图片形式的。。。
         $one['star_url'] = 'http://static11.elemecdn.com/forward/dist/img/restaurant/rst-sprites.b35686d3.png';
         array_push($data, $one);
     }
     return $data;
 }
Ejemplo n.º 26
0
 public function consultaContacto()
 {
     $data = Input::all();
     $this->array_view['data'] = $data;
     Mail::send('emails.consulta-contacto', $this->array_view, function ($message) use($data) {
         $message->from($data['email'], $data['nombre'])->to('*****@*****.**')->subject('Consulta');
     });
     if (count(Mail::failures()) > 0) {
         $mensaje = 'El mail no pudo enviarse.';
     } else {
         $mensaje = 'El mail se envió correctamente';
     }
     if (isset($data['continue']) && $data['continue'] != "") {
         switch ($data['continue']) {
             case "contacto":
                 return Redirect::to('contacto')->with('mensaje', $mensaje);
                 break;
             case "menu":
                 $menu = Menu::find($data['menu_id']);
                 return Redirect::to('/' . $menu->url)->with('mensaje', $mensaje);
                 break;
         }
     }
     return Redirect::to("/")->with('mensaje', $mensaje);
     //return View::make('producto.editar', $this->array_view);
 }
Ejemplo n.º 27
0
    <div class="container-fluid">
        <div class="navbar-header">
            <a class="navbar-brand" href="#">Prueba Arterisk</a>
        </div>
        <div>
            <ul class="nav navbar-nav">
                @foreach ($items as $item)
                <li class="{{ URL::route($item->ruta) === URL::current() ? 'active' : '' }}">{{ HTML::linkRoute($item->ruta, $item->etiqueta) }}</li>
                @endforeach
            </ul>
            <ul class="nav navbar-nav navbar-right">
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{ Auth::user()->username }} <span class="caret"></span></a>
                    <ul class="dropdown-menu">
                        <?php 
$itemsDerecha = Menu::find(2)->itemsMenu()->join('permiso', 'item_menu.permiso_id', '=', 'permiso.id')->where('permiso.perfil_id', '=', Auth::user()->perfil_id)->get();
?>
                        @foreach ($itemsDerecha as $item2)
                        <li class="{{ URL::route($item->ruta) === URL::current() ? 'active' : '' }}">{{ HTML::linkRoute($item2->ruta, $item2->etiqueta) }}</li>
                        @endforeach
                        <li class="{{ URL::route('logout') === URL::current() ? 'active' : '' }}">{{ HTML::linkRoute('logout', 'Cerrar sesión') }}</li>
                    </ul>
                </li>
            </ul>
        </div>
    </div>
</nav>
@endif
<div class="container">
    @yield('content')
</div>
Ejemplo n.º 28
0
 public function deleteMenu($id)
 {
     $arrReturn = ['status' => 'error', 'message' => 'There is something wrong. Please refresh and try again.'];
     $menu = Menu::find($id);
     if (!is_null($menu)) {
         $name = $menu->name;
         $type = $menu->type;
         if (Permission::can($this->layout->admin, "menus{$type}_delete_all")) {
             self::deleteRecursiveMenu($menu->id, $menu);
             $arrReturn['status'] = 'success';
             $arrReturn['message'] = "<b>{$name}</b> menu has been deleted.";
             if ($menu->destroy($menu->id)) {
                 if ($type == 'backend') {
                     $sidebar = Menu::getCache(['sidebar' => true]);
                     $arrReturn['sidebar'] = $sidebar;
                 }
             }
         } else {
             $arrReturn['message'] = 'You do not have permission to delete menu.';
         }
     }
     $response = Response::json($arrReturn);
     $response->header('Content-Type', 'application/json');
     return $response;
 }
Ejemplo n.º 29
0
 public function create2($id)
 {
     $menu = Menu::where('tipe', Sentry::getUser()->last_name)->get();
     $menus = Menu::find($id);
     $date = \Carbon\Carbon::now();
     $thn = date('Y');
     $tgl = new DateTime(date('Y-m-d'));
     $limit = Setting::first();
     $limitdtstart = new DateTime($limit->startdayreg);
     $limitdtend = new DateTime($limit->enddayreg);
     $limitstart = $limitdtstart->diff($tgl)->format('%R%a');
     $limitend = $limitdtend->diff($tgl)->format('%R%a');
     $contest = Contest::where('nocontest', $menus->menu)->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', $thn)->count();
     // dd($limitend);
     if ($limitstart < 0) {
         return Redirect::route('user.contests.index')->with('errorMessage', trans('Pendaftaran Lomba Belum Dibuka.'));
     }
     if ($limitend > 0) {
         return Redirect::route('user.contests.index')->with('errorMessage', trans('Pendaftaran Lomba Sudah Ditutup.'));
     }
     if ($contest < 2) {
         return View::make('contests.create')->withTitle('Estafet')->with('menu', $menu)->with('menus', $menus);
     } else {
         if ($menus->menu == 'Lari Estafet pa' and $contest < 8) {
             return View::make('contests.create')->withTitle('Estafet')->with('menu', $menu)->with('menus', $menus);
         } else {
             if ($menus->menu == 'Lari Estafet pi' and $contest < 8) {
                 return View::make('contests.create')->withTitle('Estafet')->with('menu', $menu)->with('menus', $menus);
             } else {
                 return Redirect::route('user.contests.index')->with('errorMessage', trans('Lomba sudah penuh.'));
             }
         }
     }
 }
Ejemplo n.º 30
0
 public function delete($id)
 {
     $menu = Menu::find($id);
     foreach ($menu->roles()->getResults() as $role) {
         $menu->roles()->detach($role->id);
     }
     $menu->softDeletes();
     // redirect
     Session::flash('message', 'Successfully deleted the menu!');
     return Redirect::to('admin/menu');
 }