Ejemplo n.º 1
0
 /**
  * @param $id
  *
  * @return bool
  */
 public function hasChildItems($id)
 {
     $count = $this->menu->where('parent_id', $id)->where('is_published', 1)->where('lang', $this->getLang())->get()->count();
     if ($count === 0) {
         return false;
     }
     return true;
 }
Ejemplo n.º 2
0
 function index()
 {
     $menus = new Menu();
     if (@$_GET['status']) {
         $menus->where('status', $_GET['status']);
     }
     $data['menus'] = $menus->order_by('orderlist', 'asc')->get_page(limit());
     $this->template->append_metadata(js_checkbox('approve'));
     $this->template->build('admin/menu_index', $data);
 }
 public function destroy($id)
 {
     Menu::destroy($id);
     $child_menu_items = Menu::where('parent_id', '=', $id)->get();
     foreach ($child_menu_items as $menu_items) {
         $menu_items->parent_id = NULL;
         $menu_items->save();
     }
     return Redirect::to('admin/menu')->with(array('note' => 'Successfully Deleted Menu Item', 'note_type' => 'success'));
 }
Ejemplo n.º 4
0
 public function menuReorder()
 {
     $ajax = Request::ajax();
     $arrPost = Input::all();
     unset($arrPost['_token']);
     $updated = false;
     if (!empty($arrPost)) {
         $frontend = Permission::can($this->layout->admin, 'menusfrontend_edit_all');
         $backend = Permission::can($this->layout->admin, 'menusbackend_edit_all');
         foreach ($arrPost as $type => $menu) {
             if (empty($menu)) {
                 continue;
             }
             if ($type == 'backend' && !$backend) {
                 continue;
             } else {
                 if (in_array($type, ['header', 'footer']) && !$frontend) {
                     continue;
                 }
             }
             $menu = json_decode($menu);
             foreach ($menu as $key => $value) {
                 $i = 1;
                 Menu::where('id', $value->id)->update(['parent_id' => 0, 'order_no' => $key + 1, 'level' => $i]);
                 if (isset($value->children)) {
                     Menu::updateRecursiveChildOrder($value->children, $value->id, $i + 1);
                 }
             }
             $updated = true;
         }
         if ($updated) {
             Menu::clearCache();
         }
         if ($ajax) {
             if ($updated) {
                 $sidebar = Menu::get(["sidebar" => true]);
                 $arrParent = Menu::getCache(['parent' => true]);
                 $arrReturn = ['status' => 'ok', 'sidebar' => $sidebar, 'parent' => $arrParent];
             } else {
                 $arrReturn = ['status' => 'warning', 'message' => 'Nothing was changed.'];
             }
             $response = Response::json($arrReturn);
             $response->header('Content-Type', 'application/json');
             return $response;
         }
         return Redirect::to(URL . '/admin/menus')->with(['flash_success' => $updated ? 'Menu has been re-ordered.' : 'Nothing was change.']);
     }
     if ($ajax) {
         $response = Response::json(['status' => 'error', 'message' => 'We found nothing to re-order. Please check again.']);
         $response->header('Content-Type', 'application/json');
         return $response;
     }
     return Redirect::to(URL . '/admin/menus');
 }
Ejemplo n.º 5
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $menu = Menu::where('tipe', Sentry::getUser()->last_name)->get();
     $school = School::findOrFail($id);
     $validator = Validator::make($data = Input::all(), School::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $school->update($data);
     return Redirect::route('user.profile.index')->with("successMessage", "Data Sekolah Berhasil di Update")->withTitle('Profile');
 }
 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.º 7
0
 /**
  * Show the form for creating a new payment
  *
  * @return Response
  */
 public function create()
 {
     $tgl = new DateTime(date('Y-m-d'));
     $limit = Setting::first();
     $limitdtend = new DateTime($limit->enddaypay);
     $limitend = $limitdtend->diff($tgl)->format('%R%a');
     $menu = Menu::where('tipe', Sentry::getUser()->last_name)->get();
     $jstotal = Session::get('jstotal');
     if ($limitend > 0) {
         return Redirect::to('user/cost')->with('errorMessage', trans('Pembayaran Sudah Ditutup.'));
     }
     return View::make('payments.create')->withTitle('Payment')->with('menu', $menu)->with('jstotal', $jstotal);
 }
Ejemplo n.º 8
0
 public function edit_post($id)
 {
     $valid = Validator::make(Input::all(), Order::$rule_edit_order, Order::$order_langs);
     if ($valid->passes()) {
         $user = User::where("username", Input::get("username"))->first();
         if (count($user) == 0) {
             return Redirect::route("manage_order_edit_get", $id)->withInput()->with("flash_error", "Người dùng có tên đăng nhập " . Input::get("username") . " là không tồn tại");
         }
         $menu = Menu::where("menu_name", Input::get("menu_name"))->first();
         if (count($menu) == 0) {
             return Redirect::route("manage_order_edit_get", $id)->withInput()->with("flash_error", "Thực đơn có tên " . Input::get("menu_name") . " là không tồn tại");
         }
         $data = array("user_id" => $user->id, "menu_id" => $menu->menu_id, "order_date" => Input::get("order_date"));
         DB::table("orders")->where("order_id", $id)->update($data);
         return Redirect::route("manage_order")->with("flash_success", "Chúc mừng bạn đã sửa yêu cầu thực đơn thành công");
     }
     return Redirect::route("manage_order_edit_get", $id)->withInput()->with("flash_error", $valid->errors()->first());
 }
Ejemplo n.º 9
0
 public function run()
 {
     $admin = Role::where('name', '=', 'admin')->firstOrFail();
     $guest = Role::where('name', '=', 'guest')->firstOrFail();
     $user = Role::where('name', '=', 'user')->firstOrFail();
     $master = Role::where('name', '=', 'master')->firstOrFail();
     Menu::create(['name' => 'home', 'description' => 'show the principal page', 'image' => '', 'title' => 'Home', 'route' => '/']);
     Menu::create(['name' => 'profile', 'description' => 'provide a page to change the user profile', 'image' => '', 'title' => 'Profile', 'route' => 'profile']);
     Menu::create(['name' => 'login', 'description' => 'provide a page to make a login or sign up', 'image' => '', 'title' => 'Login', 'route' => 'login']);
     Menu::create(['name' => 'logout', 'description' => 'make a logout if a user is login', 'image' => '', 'title' => 'Logout', 'route' => 'logout']);
     $login = Menu::where('name', '=', 'login')->firstOrFail();
     $profile = Menu::where('name', '=', 'profile')->firstOrFail();
     $home = Menu::where('name', '=', 'home')->firstOrFail();
     $logout = Menu::where('name', '=', 'logout')->firstOrFail();
     $login->roles()->attach($guest->id);
     $profile->roles()->sync(array($admin->id, $user->id, $master->id));
     $home->roles()->sync(array($guest->id, $admin->id, $user->id, $master->id));
     $logout->roles()->sync(array($admin->id, $user->id, $master->id));
 }
Ejemplo n.º 10
0
 public function doOrder()
 {
     $order = new Transaksi();
     $order->username = Input::get('username');
     $order->tglTransaksi = Input::get('date');
     $order->location = Input::get('address');
     $order->menuname = Input::get('menu');
     $order->jumlahBeli = Input::get('amountOrder');
     $order->idStand = Input::get('idStand');
     $order->statustransaksi = Input::get('status');
     $order->hargaTotal = Input::get('harga') * $order->jumlahBeli;
     $order->save();
     // kurangi saldo user, kurangi stok
     $menuDeliver = Menu::where('name', $order->menuname)->first();
     $menuDeliver->stock = $menuDeliver->stock - $order->jumlahBeli;
     $userOrder = User::where('username', Session::get('user'))->first();
     $userOrder->saldo = $userOrder->saldo - $order->hargaTotal;
     $menuDeliver->save();
     $userOrder->save();
     return Redirect::to('user/admin');
 }
Ejemplo n.º 11
0
		<div class="row">
			<div class="col-lg-12" style="margin-right:30px; margin-left:30px;">
				<div class="col-lg-6">
					<h1>My Menu</h1>
					<div class="table-responsive">
						<table class="table	">
							<thead>
								<tr>
									<th>Menu</th>
									<th>Price</th>
									<th>Status</th>
									<th>Action</th>
								</tr>
							</thead>
							<?php 
$results = Menu::where('idStand', $standLoggedIn->idStand)->get();
?>
							<tbody>
							@foreach($results as $result)
								<tr>
									<td>{{$result->name}}</td>
									<td>{{$result->price}}</td>
									@if($result->stock >0)
										<td>available</td>
									@else
										<td>not available</td>
									@endif
									<td><a class="btn btn-warning" href="{{ url() }}/vendor-admin/myMenu/{{$result->idMenu}}">Edit</a>
									<a class="btn btn-danger" href="" data-toggle="modal" data-target="#myModal{{$result->idMenu}}">Delete</a></td>
									
									<!-- modal confirm -->
Ejemplo n.º 12
0
 /**
  * Show the form for editing the specified contest.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $menu = Menu::where('tipe', Sentry::getUser()->last_name)->get();
     $contest = Contest::find(Crypt::decrypt($id));
     return View::make('contests.edit', compact('contest'))->withTitle('Ubah')->with('menu', $menu);
 }
Ejemplo n.º 13
0
 /**
  * 获取某个店铺的菜单
  *
  * 对应API:
  * 请求类型:POST
  * @return array 该店铺的菜单(分了类的)
  */
 public function getMenus()
 {
     $shop_id = 1;
     $result = array();
     // 最终结果
     $classify = self::getClassify($shop_id);
     // 获取分类的数组
     $result['class_num'] = count($classify);
     // 分类数量
     $menus = array();
     foreach ($classify as $class_id => $class_name) {
         $one_class = array();
         $one_class['name'] = $class_name;
         $one_class['menu'] = Menu::where('group_id', $class_id)->select('id', 'title', 'price', 'pic', 'sold_month', 'state', 'comment_score', 'comment_num')->get();
         array_push($menus, $one_class);
     }
     $result['menus'] = $menus;
     return $result;
 }
Ejemplo n.º 14
0
 public function deleteCategory($id)
 {
     $category = Category::find($id);
     if (!$category) {
         return Redirect::back()->withErrors('Could not find category');
     }
     $menu = Menu::where('scat', '=', $category->name)->delete();
     $category->delete();
     return Redirect::back();
 }
Ejemplo n.º 15
0
 public function postEditMenu($date = null)
 {
     if (!isset($date) or is_null($date)) {
         return Redirect::to('/admin/menu');
     }
     $menu = Menu::where('menu_date', $date)->first();
     if (is_null($menu)) {
         $menu = new Menu();
     }
     $menu->menu_date = $date;
     $menu->save();
     $menu->dishes()->sync(Input::get('dishes'));
     return Redirect::to('admin/menu/edit/' . $date)->with('message', "Successfully edited menu!");
 }
Ejemplo n.º 16
0
 /**
  * 菜单图片的上传
  */
 public function menuImageUpload()
 {
     $file = Input::file('photo');
     $menu_id = Input::get('menu_id');
     if ($file && $file->isValid()) {
         $filename = $file->getClientOriginalName();
         //获取初始文件名
         //获取文件类型并进行验证
         $filetype = $file->getMimeType();
         $typeArray = explode('/', $filetype, 2);
         if ($typeArray['0'] != 'image') {
             echo json_encode(array('status' => '400', 'msg' => '文件格式或类型违法!'));
             exit;
         }
         $typeName = $file->getClientOriginalExtension();
         //获取文件后缀名
         $b_uid = Auth::user()->uid;
         $newFileName = $this->fileNameMake($filename, $typeName);
         $directoryName = $b_uid % 100;
         //根据用户id和100的模值,生成对应存储目录地址
         $savePath = public_path() . '/uploads/businessUser/' . $directoryName . '/menuphoto';
         $fileSave = $file->move($savePath, $newFileName);
         if ($fileSave) {
             $pic = asset('uploads/businessUser/' . $directoryName . '/menuphoto/' . $newFileName);
             if (Menu::where('id', $menu_id)->update(array('pic' => $pic))) {
                 echo json_encode(array('status' => '200', 'msg' => 'upload finished'));
             } else {
                 echo json_encode(array('status' => '400', 'msg' => 'save failed'));
             }
         } else {
             echo json_encode(array('status' => '400', 'msg' => 'move failed'));
         }
     } else {
         echo json_encode(array('status' => '400', 'msg' => 'invalid file'));
     }
 }
Ejemplo n.º 17
0
 public function deleteMenu($idMenu)
 {
     $menu = Menu::where('idMenu', $idMenu)->first();
     $menu->delete();
     return Redirect::back();
 }
Ejemplo n.º 18
0
 public function customerMenuDetails($menu_id)
 {
     $menu_name = Menu::where("menu_id", $menu_id)->first();
     $data['food'] = DB::table("foods")->join("menu_foods", "menu_foods.food_id", "=", "foods.food_id")->join("menus", "menus.menu_id", "=", "menu_foods.menu_id")->where("menus.menu_id", $menu_id)->get();
     return View::make("guest.content.customerMenu.menudetails", $data)->with("titleTable", $menu_name->menu_name)->with("menu_id", $menu_id)->with("menu_date", $menu_name->menu_created_at);
 }
Ejemplo n.º 19
0
 protected function desplegarMenu()
 {
     /*
      * FILTRO PARA MOSTRAR SOLAMENTE LOS MENU PADRE
      */
     $menus_asociados = DB::table('menu_asociado')->where('estado', 'A')->lists('menu_id_asociado');
     if ($menus_asociados) {
         $menus = Menu::where('estado', 'A')->whereNotIn('id', $menus_asociados)->orderBy('orden')->get();
     } else {
         $menus = Menu::where('estado', 'A')->orderBy('orden')->get();
     }
     return $menus;
 }
Ejemplo n.º 20
0
 public function detail($menu_id)
 {
     $this->_data['menu'] = Menu::where("menu_id", $menu_id)->first();
     $this->_data['foods'] = DB::table("foods")->join("menu_foods", "foods.food_id", "=", "menu_foods.food_id")->where("menu_foods.menu_id", $menu_id)->orderBy("menu_foods.created_at", "desc")->get();
     return View::make("admin.content.menu.detail", $this->_data)->with("titlePage", "Detail Menu")->with("titleTable", "Thông tin chi tiết về thực đơn")->with("menu_id", $menu_id);
 }
    function bread_crumb($menu_id)
    {
        $CI =& get_instance();
        //$CI->load->model('Menu','menu');
        $menu = new Menu();
        $menu->where("id", $menu_id)->get(1);
        //$menu = $CI->menu->get($menu_id);
        $bread_crumb = '<!-- Content Header (Page header) -->
		<section class="content-header">
		  <h1>
		    ' . $menu->title . '
		    <small>' . $menu->description . '</small>
		  </h1>
		  <ol class="breadcrumb">
		    <li><a href="siteadmin/dashboard/index"><i class="fa fa-dashboard"></i> Home</a></li>
		    <li class="active">' . $menu->title . '</li>
		  </ol>
		</section>';
        return $bread_crumb;
    }
Ejemplo n.º 22
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.º 23
0
 public function index()
 {
     // $this->layout->content =
     if (Sentry::getUser()->hasPermission('admin')) {
         return View::make('dashboard.indexadmin')->withtitle("Dashboard Admin");
     } elseif (Sentry::getUser()->hasPermission('panitia')) {
         return View::make('dashboard.indexpanitia')->withtitle("Dashboard Panitia");
     } elseif (Sentry::getUser()->hasPermission('user')) {
         $cek = Docbook::where('user_id', Sentry::getUser()->id)->where(DB::raw('YEAR(created_at)'), '=', date('Y'))->count();
         if ($cek == 0) {
             $data['user_id'] = Sentry::getUser()->id;
             Docbook::Create($data);
         }
         $menu = Menu::where('tipe', Sentry::getUser()->last_name)->get();
         $jenjang = Sentry::getUser()->last_name;
         $cost = Setting::first();
         $school = School::where('user_id', Sentry::getUser()->id)->first();
         $payment = Payment::where('user_id', Sentry::getUser()->id)->where(DB::raw('year'), '=', date('Y'))->first();
         $cek = Docbook::where('user_id', Sentry::getUser()->id)->where(DB::raw('YEAR(created_at)'), '=', date('Y'))->first();
         $docbook = Docbook::find($cek->id);
         if ($jenjang === 'SMA') {
             $runpas = Contest::where('nocontest', 'Lari 100m pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
             $runpis = Contest::where('nocontest', 'Lari 100m pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
             $ljpas = Contest::where('nocontest', 'Lompat Jauh pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
             $ljpis = Contest::where('nocontest', 'Lompat Jauh pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
             $tppas = Contest::where('nocontest', 'Tolak Peluru pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
             $tppis = Contest::where('nocontest', 'Tolak Peluru pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
             $ltpas = Contest::where('nocontest', 'Lompat Tinggi pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
             $ltpis = Contest::where('nocontest', 'Lompat Tinggi pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
             $sertatl = Contest::where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->whereNotNull('nodada')->where('sertifikat', '1')->count();
             $sertoff = Officer::where('user_id', Sentry::getUser()->id)->where(DB::raw('YEAR(created_at)'), '=', date('Y'))->where('sertifikat', 1)->count();
             $book = Docbook::where('user_id', Sentry::getUser()->id)->where(DB::raw('YEAR(created_at)'), '=', date('Y'))->where('docbook', 1)->count();
             $jrunpas = $runpas * $cost->moneyreg;
             $jrunpis = $runpis * $cost->moneyreg;
             $jljpas = $ljpas * $cost->moneyreg;
             $jljpis = $ljpis * $cost->moneyreg;
             $jtppas = $tppas * $cost->moneyreg;
             $jtppis = $tppis * $cost->moneyreg;
             $jltpas = $ltpas * $cost->moneyreg;
             $jltpis = $ltpis * $cost->moneyreg;
             $jsertatl = $sertatl * $cost->moneysertatl;
             $jsertoff = $sertoff * $cost->moneysertoff;
             $jbook = $book * $cost->moneydocbook;
             $jbatlit = $jrunpas + $jrunpis + $jljpas + $jljpis + $jtppas + $jtppis + $jltpas + $jltpis;
             $jtotal = $jrunpas + $jrunpis + $jljpas + $jljpis + $jtppas + $jtppis + $jltpas + $jltpis + $jsertatl + $jsertoff + $jbook;
             Session::put('jstotal', $jtotal);
             return View::make('costs.index', compact('docbook'))->withtitle("Dashboard User")->with('menu', $menu)->with('runpas', $runpas)->with('runpis', $runpis)->with('ljpas', $ljpas)->with('ljpis', $ljpis)->with('tppas', $tppas)->with('tppis', $tppis)->with('ltpas', $ltpas)->with('ltpis', $ltpis)->with('sertatl', $sertatl)->with('sertoff', $sertoff)->with('book', $book)->with('jrunpas', $jrunpas)->with('jrunpis', $jrunpis)->with('jljpas', $jljpas)->with('jljpis', $jljpis)->with('jtppas', $jtppas)->with('jtppis', $jtppis)->with('jltpas', $jltpas)->with('jltpis', $jltpis)->with('jsertatl', $jsertatl)->with('jsertoff', $jsertoff)->with('jbook', $jbook)->with('jbatlit', $jbatlit)->with('jtotal', $jtotal)->with('cost', $cost)->with('school', $school)->with('payment', $payment);
         } elseif ($jenjang === 'SMP') {
             $runpas = Contest::where('nocontest', 'Lari 60m pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
             $runpis = Contest::where('nocontest', 'Lari 60m pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
             $ljpas = Contest::where('nocontest', 'Lompat Jauh pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
             $ljpis = Contest::where('nocontest', 'Lompat Jauh pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
             $tppas = Contest::where('nocontest', 'Tolak Peluru pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
             $tppis = Contest::where('nocontest', 'Tolak Peluru pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
             $ltpas = Contest::where('nocontest', 'Lompat Tinggi pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
             $ltpis = Contest::where('nocontest', 'Lompat Tinggi pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
             $sertatl = Contest::where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->whereNotNull('nodada')->where('sertifikat', 1)->count();
             $sertoff = Officer::where('user_id', Sentry::getUser()->id)->where(DB::raw('YEAR(created_at)'), '=', date('Y'))->where('sertifikat', 1)->count();
             $book = Docbook::where('user_id', Sentry::getUser()->id)->where(DB::raw('YEAR(created_at)'), '=', date('Y'))->where('docbook', 1)->count();
             $jrunpas = $runpas * $cost->moneyreg;
             $jrunpis = $runpis * $cost->moneyreg;
             $jljpas = $ljpas * $cost->moneyreg;
             $jljpis = $ljpis * $cost->moneyreg;
             $jtppas = $tppas * $cost->moneyreg;
             $jtppis = $tppis * $cost->moneyreg;
             $jltpas = $ltpas * $cost->moneyreg;
             $jltpis = $ltpis * $cost->moneyreg;
             $jsertatl = $sertatl * $cost->moneysertatl;
             $jsertoff = $sertoff * $cost->moneysertoff;
             $jbook = $book * $cost->moneydocbook;
             $jbatlit = $jrunpas + $jrunpis + $jljpas + $jljpis + $jtppas + $jtppis + $jltpas + $jltpis;
             $jtotal = $jrunpas + $jrunpis + $jljpas + $jljpis + $jtppas + $jtppis + $jltpas + $jltpis + $jsertatl + $jsertoff + $jbook;
             Session::put('jstotal', $jtotal);
             return View::make('costs.index', compact('docbook'))->withtitle("Biaya")->with('menu', $menu)->with('runpas', $runpas)->with('runpis', $runpis)->with('ljpas', $ljpas)->with('ljpis', $ljpis)->with('tppas', $tppas)->with('tppis', $tppis)->with('ltpas', $ltpas)->with('ltpis', $ltpis)->with('sertatl', $sertatl)->with('sertoff', $sertoff)->with('book', $book)->with('jrunpas', $jrunpas)->with('jrunpis', $jrunpis)->with('jljpas', $jljpas)->with('jljpis', $jljpis)->with('jtppas', $jtppas)->with('jtppis', $jtppis)->with('jltpas', $jltpas)->with('jltpis', $jltpis)->with('jsertatl', $jsertatl)->with('jsertoff', $jsertoff)->with('jbook', $jbook)->with('jbatlit', $jbatlit)->with('jtotal', $jtotal)->with('cost', $cost)->with('school', $school)->with('payment', $payment);
         } elseif ($jenjang === 'SD') {
             $runpas = Contest::where('nocontest', 'Lari 50m pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
             $runpis = Contest::where('nocontest', 'Lari 50m pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
             $ljpas = Contest::where('nocontest', 'Lompat Jauh pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
             $ljpis = Contest::where('nocontest', 'Lompat Jauh pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
             $lbpas = Contest::where('nocontest', 'Lempar Bola pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
             $lbpis = Contest::where('nocontest', 'Lempar Bola pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
             $lespa = Contest::where('nocontest', 'Lari Estafet pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
             $lespi = Contest::where('nocontest', 'Lari Estafet pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
             $sertatl = Contest::where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->whereNotNull('nodada')->where('sertifikat', 1)->count();
             $sertoff = Officer::where('user_id', Sentry::getUser()->id)->where(DB::raw('YEAR(created_at)'), '=', date('Y'))->where('sertifikat', 1)->count();
             $book = Docbook::where('user_id', Sentry::getUser()->id)->where(DB::raw('YEAR(created_at)'), '=', date('Y'))->where('docbook', 1)->count();
             $jrunpas = $runpas * $cost->moneyreg;
             $jrunpis = $runpis * $cost->moneyreg;
             $jljpas = $ljpas * $cost->moneyreg;
             $jljpis = $ljpis * $cost->moneyreg;
             $jlbpas = $lbpas * $cost->moneyreg;
             $jlbpis = $lbpis * $cost->moneyreg;
             if ($lespa % 8 == 0) {
                 $lespa = $lespa / 8;
                 $jlespa = $lespa * $cost->moneyregest;
             } else {
                 $lespa = 0;
                 $jlespa = $lespa * $cost->moneyregest;
             }
             if ($lespi % 8 == 0) {
                 $lespi = $lespi / 8;
                 $jlespi = $lespi * $cost->moneyregest;
             } else {
                 $lespi = 0;
                 $jlespi = $lespi * $cost->moneyregest;
             }
             $jsertatl = $sertatl * $cost->moneysertatl;
             $jsertoff = $sertoff * $cost->moneysertoff;
             $jbook = $book * $cost->moneydocbook;
             $jbatlit = $jrunpas + $jrunpis + $jljpas + $jljpis + $jlbpas + $jlbpis + $jlespa + $jlespi;
             $jtotal = $jrunpas + $jrunpis + $jljpas + $jljpis + $jlbpas + $jlbpis + $jlespa + $jlespi + $jsertatl + $jsertoff + $jbook;
             Session::put('jstotal', $jtotal);
             return View::make('costs.index', compact('docbook'))->withtitle("Biaya")->with('menu', $menu)->with('runpas', $runpas)->with('runpis', $runpis)->with('ljpas', $ljpas)->with('ljpis', $ljpis)->with('lbpas', $lbpas)->with('lbpis', $lbpis)->with('lespa', $lespa)->with('lespi', $lespi)->with('sertatl', $sertatl)->with('sertoff', $sertoff)->with('book', $book)->with('jrunpas', $jrunpas)->with('jrunpis', $jrunpis)->with('jljpas', $jljpas)->with('jljpis', $jljpis)->with('jlbpas', $jlbpas)->with('jlbpis', $jlbpis)->with('jlespa', $jlespa)->with('jlespi', $jlespi)->with('jsertatl', $jsertatl)->with('jsertoff', $jsertoff)->with('jbook', $jbook)->with('jbatlit', $jbatlit)->with('jtotal', $jtotal)->with('cost', $cost)->with('school', $school)->with('payment', $payment);
         }
     }
 }
Ejemplo n.º 24
0
 public function mostrarInfoMenuPorMarca($url, $marca)
 {
     $menu = Menu::where('url', $url)->where('estado', 'A')->first();
     if ($menu) {
         $this->array_view['menu'] = $menu;
         if (!is_null($menu->categoria())) {
             $marcas = array();
             foreach ($menu->secciones as $seccion) {
                 if (count($seccion->items) > 0) {
                     foreach ($seccion->items as $item) {
                         if (!is_null($item->producto())) {
                             if (!is_null($item->producto()->marca_principal())) {
                                 array_push($marcas, $item->producto()->marca_principal()->id);
                             }
                         }
                     }
                 }
             }
             $marcas_principales = Marca::where('tipo', 'P')->whereIn('id', $marcas)->where('estado', 'A')->orderBy('nombre')->get();
             $this->array_view['marcas_principales'] = $marcas_principales;
             $this->array_view['marca_id'] = $marca;
             $this->array_view['ancla'] = Session::get('ancla');
             return View::make($this->folder_name . '.menu-contenedor', $this->array_view);
         } else {
             return View::make($this->folder_name . '.' . $this->project_name . '-ver-menu-estatico', $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('/');
     }
 }
Ejemplo n.º 25
0
 public function postData()
 {
     switch (Input::get('type')) {
         case 'nocontest':
             $return = '<option value=""></option>';
             foreach (Menu::where('tipe', Input::get('id'))->get() as $row) {
                 $return .= "<option value='{$row->menu}'>{$row->menu}</option>";
             }
             return $return;
             break;
     }
 }
Ejemplo n.º 26
0
 function sub_menu($id)
 {
     return Menu::where('prnt', $id)->get();
 }
Ejemplo n.º 27
0
 /**
  * 功能:商家菜单页美食分类,商品的分类和活动是一起的,不过活动还是单独列一张表出来的
  */
 public function getGoodCategory($shop_id)
 {
     $data = array();
     $shop = Shop::find($shop_id);
     $groups = $shop->groups->all();
     $goods_category = array();
     $good_activity = array();
     foreach ($groups as $group) {
         $one = array();
         if ($group->activity_id == 0) {
             // 不是活动
             $one['classify_name'] = $group->name;
             $one['classify_name_abbr'] = $group->name_abbr;
             $one['classify_id'] = $group->id;
             $one['classify_count'] = Menu::where('shop_id', $shop_id)->where('group_id', $group->activity_id)->get()->count('shop_id');
             $one['classify_icon'] = $group->icon;
             array_push($goods_category, $one);
         } else {
             // 是活动的
             $act = Activity::find($group->activity_id);
             $one['activity_name'] = $act->name;
             $one['activity_id'] = $act->aid;
             $one['activity_icon'] = $act->icon;
             $one['activity_statement'] = $act->intro;
             array_push($good_activity, $one);
         }
     }
     $data['goods_category'] = $goods_category;
     $data['good_activity'] = $good_activity;
     return $data;
 }
Ejemplo n.º 28
0
 public static function updateRecursive($parentID, $arrData)
 {
     $arrMenu = Menu::select('id')->where('parent_id', $parentID)->get();
     if (!$arrMenu->isEmpty()) {
         foreach ($arrMenu as $menu) {
             self::updateRecursive($menu->id, $arrData);
         }
     }
     Menu::where('parent_id', $parentID)->update($arrData);
 }
Ejemplo n.º 29
0
 /**
  * Update the specified officer in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $date = \Carbon\Carbon::now();
     $thn = date('Y');
     $menu = Menu::where('tipe', Sentry::getUser()->last_name)->get();
     // $officer = Officer::where('type', Input::get('type'))->where('user_id', Sentry::getUser()->id)->where(DB::raw('YEAR(created_at)'), '=', $thn)->count();
     // if ($officer < 1) {
     $officer = Officer::findOrFail($id);
     $validator = Validator::make($data = Input::all(), Officer::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     if (Input::hasFile('foto')) {
         $uploaded_file = Input::file('foto');
         // mengambil extension file
         $extension = $uploaded_file->getClientOriginalExtension();
         // membuat nama file random dengan extension
         $filename = Input::get('nohp') . '.' . $extension;
         $destinationPath = public_path() . DIRECTORY_SEPARATOR . 'uploads/fotopetugas';
         // memindahkan file ke folder public/img
         $uploaded_file->move($destinationPath, $filename);
         // 25
         // ganti field cover dengan cover yang baru
         $officer->foto = $filename;
     }
     $officer['sertifikat'] = Input::has('sertifikat') ? true : false;
     if (!$officer->update(Input::except('foto')) && ($data['sertifikat'] = Input::has('sertifikat') ? true : false)) {
         return Redirect::back();
     }
     // $officer->update($data);
     return Redirect::route('user.officers.index')->with("successMessage", "Data petugas berhasil diubah");
     // } else {
     //     return Redirect::route('user.officers.index')->with('errorMessage', trans(Input::get('type') . ' sudah ada.'));
     // }
 }
Ejemplo n.º 30
0
 public function editPassword()
 {
     //code
     $menu = Menu::where('tipe', Sentry::getUser()->last_name)->get();
     return View::make('dashboard.editpassword')->withTitle('Ubah Password')->with('menu', $menu);
 }