public function NhapDiem() { $macb = \Auth::user()->taikhoan; //Lấy năm học và học kỳ hiện tại $nam = DB::table('nien_khoa')->distinct()->orderBy('nam', 'desc')->value('nam'); $hk = DB::table('nien_khoa')->distinct()->orderBy('hocky', 'desc')->where('nam', $nam)->value('hocky'); $mank = DB::table('nien_khoa as nk')->join('nhom_hocphan as hp', 'nk.mank', '=', 'hp.mank')->where('nk.nam', $nam)->where('nk.hocky', $hk)->value('nk.mank'); //Lấy ds nhóm học phần mà GV đang phụ trách giảng dạy $dshp = DB::table('nhom_hocphan as hp')->select('hp.manhomhp', 'hp.tennhomhp')->join('nien_khoa as nk', 'hp.mank', '=', 'nk.mank')->where('nk.mank', $mank)->where('hp.macb', $macb)->get(); $tieuchi = DB::table('tieu_chi_danh_gia as tc')->select('tc.matc', 'tc.heso', 'tc.noidungtc')->join('quy_dinh as qd', 'tc.matc', '=', 'qd.matc')->where('qd.macb', $macb)->where('qd.mank', $mank)->get(); //Lấy mã hp trên url khi chọn liệt kê $mahp = \Request::segment(3); if ($mahp == null || $mahp == 0) { $dsNhomth = DB::table('chia_nhom as chn')->distinct()->select('chn.manhomthuchien')->join('nhom_hocphan as hp', 'chn.manhomhp', '=', 'hp.manhomhp')->where('hp.macb', $macb)->lists('chn.manhomthuchien'); } else { if ($mahp != null || $mahp != 0) { $dsNhomth = DB::table('chia_nhom as chn')->distinct()->select('chn.manhomthuchien')->join('nhom_hocphan as hp', 'chn.manhomhp', '=', 'hp.manhomhp')->where('chn.manhomhp', $mahp)->where('hp.macb', $macb)->lists('chn.manhomthuchien'); } } $dssv = DB::table('sinh_vien as sv')->orderBy('chn.manhomthuchien', 'asc')->join('chia_nhom as chn', 'sv.mssv', '=', 'chn.mssv')->whereIn('chn.manhomthuchien', $dsNhomth)->where('chn.manhomthuchien', '<>', "")->get(); $tendt = DB::table('chia_nhom as chn')->distinct()->select('dt.tendt', 'chn.manhomthuchien')->join('ra_de_tai as radt', 'chn.manhomthuchien', '=', 'radt.manhomthuchien')->join('de_tai as dt', 'radt.madt', '=', 'dt.madt')->whereIn('chn.manhomthuchien', $dsNhomth)->get(); //Lấy 1 mảng mssv của các nhóm thực hiện $masv = DB::table('sinh_vien as sv')->select('chn.mssv')->join('chia_nhom as chn', 'sv.mssv', '=', 'chn.mssv')->whereIn('chn.manhomthuchien', $dsNhomth)->lists('chn.mssv'); //Lấy điểm của mỗi sv trong mảng mssv trên $dsdiem = DB::table('chitiet_diem as diem')->select('chn.mssv', 'diem.matc', 'diem.diem')->orderBy('diem.matc', 'asc')->join('chia_nhom as chn', 'chn.mssv', '=', 'diem.mssv')->whereIn('chn.mssv', $masv)->get(); $tongdiem = DB::table('chitiet_diem as diem')->distinct()->select('chn.mssv', DB::raw('sum(diem.diem) as tongdiem'))->rightjoin('chia_nhom as chn', '.diem.mssv', '=', 'chn.mssv')->orderBy('chn.mssv', 'asc')->whereIn('diem.mssv', $masv)->groupBy('chn.mssv')->get(); $nhanxet = DB::table('chia_nhom')->select('mssv', 'nhanxet')->orderBy('mssv', 'asc')->whereIn('mssv', $masv)->get(); return view('giangvien.nhap-diem')->with('tieuchi', $tieuchi)->with('dssv', $dssv)->with('dsdiem', $dsdiem)->with('dshp', $dshp)->with('nam', $nam)->with('hk', $hk)->with('tendt', $tendt)->with('tongdiem', $tongdiem)->with('nhanxet', $nhanxet)->with('mahp', $mahp)->with('macb', $macb); }
/** * Simply display a view by the slug * @param string $slug * @return View */ public function getView($slug = null) { if (!$slug) { $slug = \Request::segment(1); } return $this->view('theme::' . $slug, array('slug' => $slug)); }
public function __call($name, $args) { $name = Request::segment(1); $class = "Endpoints\\{$name}"; $endpoint = new $class(); return $endpoint->call(Request::segment($name)); }
public function filter() { if (!isset($this->user) || !$this->user || $this->user == parent::ANONYMOUS_USER) { return Response::json(['error' => true, 'error_description' => 'Permission denied'], 401); } if (!$this->user->can('item_delete')) { return Response::json(['error' => true, 'error_description' => 'Permission denied'], 401); } //$company_id = Request::segment(3); $company_id = Input::get('company_id'); $id = Request::segment(3); $company = Company::with('items')->find($company_id); if (!$company) { return Response::json(['error' => true, 'error_description' => 'Company not found'], 400); } $find = 0; foreach ($company->items as $item) { if ($item->id == $id) { $find = 1; } } if (!$find) { return Response::json(['error' => true, 'error_description' => 'Permission denied'], 401); } }
/** * Get the validation rules that apply to the request. * * @return array */ public function rules() { if (Request::segment(6) == 'create') { $this->rules['photo'] .= '|required'; } return $this->rules; }
/** * Get the validation rules that apply to the request. * * @return array */ public function rules() { if (Request::segment(3) == 'create') { $this->rules['thumbnail'] .= '|required'; } return $this->rules; }
public function post($language, $id) { // Définition de la langue : if (!$this->setupLanguage($language)) { App::abort(404); } // Récupération de l'id de la news à afficher : $id = explode("-", $id); if (!isset($id[0]) or empty($id[0])) { App::abort(404); } // Variables : // News (dans un try catch pour gérer les erreurs) : try { $languages = Language::where('_url', '=', $language)->firstOrFail(); $page = Pages::where('_language', $languages->_id)->where("_name", "=", "news")->get()->first(); $new = News::whereRaw('_langue = ' . $languages->_id . ' and _id=' . $id[0])->firstOrFail(); } catch (Exception $e) { App::abort(404); } $data = array("situation" => array("title" => $page->_title, "description" => $page->_description), "position" => array($page->_title => URL::to(Request::segment(1) . '/news/'), $new->_title => "")); // Renvoi de la vue avec la news : $page = $this->layout->content = View::make('pages.news.post', array("data" => $data, "page" => $page, "new" => $new)); return Response::make($page); }
public static function commonName($name = NULL) { if ($name == NULL) { $name = Request::segment(2); } if ($name == '') { return 'Product'; } if ($name == 'manager') { return 'Admin'; } if ($name == 'price') { return 'Price'; } if ($name == 'category') { return 'Category'; } if ($name == 'product') { return 'Product'; } if ($name == 'user') { return 'User'; } if ($name == 'feedback') { return 'Feedback'; } }
public function ChiaNhomNL() { $macb = \Auth::user()->taikhoan; //Nếu selectbox có giá trị manhp thì lấy manhp //Lấy học kỳ niên khóa sau cùng của 1 cán bộ $namcb = DB::table('nien_khoa as nk')->orderBy('nam', 'desc')->join('nhom_hocphan as hp', 'nk.mank', '=', 'hp.mank')->where('hp.macb', $macb)->value('nk.nam'); $hkcb = DB::table('nien_khoa as nk')->orderBy('nam', 'desc')->join('nhom_hocphan as hp', 'nk.mank', '=', 'hp.mank')->where('hp.macb', $macb)->value('nk.hocky'); //Lấy giá trị một đoạn của chuỗi url $var = \Request::segment(3); if ($var == null) { //Lấy 1 mã nhóm HP nhỏ nhất của năm hiện tại mà cán bộ phụ trách $mahp = DB::table('nhom_hocphan as hp')->join('nien_khoa as nk', 'hp.mank', '=', 'nk.mank')->where('hp.macb', $macb)->where('nk.nam', $namcb)->where('nk.hocky', $hkcb)->orderBy('hp.manhomhp', 'asc')->value('hp.manhomhp'); } else { $mahp = $var; } $dsmahp = DB::table('nhom_hocphan as hp')->select('hp.manhomhp', 'hp.tennhomhp')->join('giang_vien as gv', 'hp.macb', '=', 'gv.macb')->where('hp.macb', $macb)->get(); //Lấy những sinh viên chưa có nhóm thực hiện niên luận $dstensv = DB::table('chia_nhom as chn')->distinct()->select('chn.mssv', 'sv.hoten', 'chn.nhomtruong')->join('sinh_vien as sv', 'chn.mssv', '=', 'sv.mssv')->where('chn.manhomhp', '=', $mahp)->where('chn.manhomthuchien', '=', "")->get(); //Lấy ds nhóm của học kỳ niên khóa hiện tại mà cán bộ đang dạy $dsNhom = DB::table('sinh_vien as sv')->distinct()->select('chn.manhomthuchien', 'sv.mssv', 'sv.hoten', 'chn.nhomtruong')->orderby('chn.manhomthuchien', 'asc')->join('chia_nhom as chn', 'sv.mssv', '=', 'chn.mssv')->join('nhom_hocphan as hp', 'chn.manhomhp', '=', 'hp.manhomhp')->join('nien_khoa as nk', 'hp.mank', '=', 'nk.mank')->where('chn.manhomthuchien', '<>', "")->where('hp.manhomhp', $mahp)->where('nk.nam', $namcb)->where('nk.hocky', $hkcb)->get(); //Lấy tên đề tài của các nhóm trong hoc kỳ niên khóa của cán bộ đang dạy $detainhom = DB::table('de_tai as dt')->distinct()->orderBy('chn.manhomthuchien', 'asc')->select('dt.tendt', 'dt.taptindinhkem', 'chn.manhomthuchien', 'hp.tennhomhp')->join('ra_de_tai as radt', 'dt.madt', '=', 'radt.madt')->join('chia_nhom as chn', 'radt.manhomthuchien', '=', 'chn.manhomthuchien')->join('nhom_hocphan as hp', 'chn.manhomhp', '=', 'hp.manhomhp')->join('nien_khoa as nk', 'hp.mank', '=', 'nk.mank')->where('dt.macb', $macb)->where('nk.nam', $namcb)->where('nk.hocky', $hkcb)->where('chn.manhomthuchien', '<>', "")->get(); //Lấy mã đề tài trong bảng ra_de_tai $madt = DB::table('ra_de_tai')->select('madt')->lists('madt'); //Lấy madt, tendt của 1 cán bộ mà chưa có nhóm nào thực hiện, ở bất cứ năm học, học kỳ nào $dsdetai = DB::table('de_tai')->distinct()->select('madt', 'tendt', 'taptindinhkem')->where('macb', $macb)->whereNotIn('madt', $madt)->get(); $manth = $this->manth_tutang(); return view('giangvien.chia-nhom-nien-luan')->with('dstensv', $dstensv)->with('dsmahp', $dsmahp)->with('dsdetai', $dsdetai)->with('dsNhom', $dsNhom)->with('detainhom', $detainhom)->with('namcb', $namcb)->with('hkcb', $hkcb)->with('macb', $macb)->with('manth', $manth)->with('mahp', $mahp); }
/** * Detect and set application localization environment (language). * NOTE: Don't foreget to ADD/SET/UPDATE the locales array in app/config/app.php! * */ private function configureLocale() { $mLocale = Config::get('app.locale'); if (!Session::has('locale')) { $mFromCookie = Cookie::get('locale', null); if ($mFromCookie != null && in_array($mFromCookie, Config::get('app.locales'))) { $mLocale = $mFromCookie; } else { $mFromURI = Request::segment(1); if ($mFromURI != null && in_array($mFromURI, Config::get('app.locales'))) { $mLocale = $mFromURI; } else { $mFromBrowser = substr(Request::server('http_accept_language'), 0, 2); if ($mFromBrowser != null && in_array($mFromBrowser, Config::get('app.locales'))) { $mLocale = $mFromBrowser; } } } Session::put('locale', $mLocale); Cookie::forever('locale', $mLocale); } else { $mLocale = Session::get('locale'); } App::setLocale($mLocale); }
public function __construct() { $this->userdata = $this->checkUserdata(); // apply authorization filter $this->beforeFilter(function () { if (!$this->userdata && Request::segment(1) !== 'login') { return Redirect::to('/login'); } }); // templates for app errors App::missing(function ($exception) { return Response::view('errors.404_cms', array(), 404); }); App::error(function (Exception $exception, $code) { Log::error($exception); if ($code == 403) { return Response::view('/errors/error_403', array(), 403); } }); // shared assets Orchestra\Asset::add("bootstrap-css", "assets/css/bootstrap.min.css"); Orchestra\Asset::add("bootstrap-theme", "assets/css/bootstrap-theme.min.css"); Orchestra\Asset::add("font-awesome", "assets/css/font-awesome.min.css"); Orchestra\Asset::add("cms-css", "assets/css/cms.css"); Orchestra\Asset::add("jquery", "assets/js/jquery.js"); Orchestra\Asset::add("bootstrap-js", "assets/js/bootstrap.min.js"); Orchestra\Asset::add("handlers-js", "assets/js/handlers.js"); // shared views View::share("active_menu_id", 1); View::share("userdata", $this->userdata); // configuration Config::set("view.pagination", "common/pagination"); }
/** * Returns breadcrumbs made up by URI segments * * @return string */ public static function breadcrumbs() { $breadcrumbs = []; $crumbs = Request::segments(); if (count($crumbs) < 2) { return; } $url = ""; end($crumbs); $last_key = key($crumbs); foreach ($crumbs as $key => $crumb) { $url .= '/' . $crumb; $crumb = ucwords($crumb); if ($key != $last_key) { $crumb = '<span typeof="v:Breadcrumb">' . link_to($url, $crumb, ['rel' => 'v:url', 'property' => 'v:title']) . '</span>'; } else { if (Request::segment(1) === 'snippets') { $crumb = ""; } else { $crumb = '<span class="current">' . $crumb . '</span>'; } } array_push($breadcrumbs, $crumb); } $return = '<div class="clearfix">'; $return .= '<div class="breadcrumbs" xmlns:v="http://rdf.data-vocabulary.org/#">'; $return .= '<div class="container">'; $return .= implode('<i class="fa fa-chevron-right"></i>', $breadcrumbs); $return .= '</div>'; $return .= '</div>'; $return .= '</div>'; return $return; }
public function show_item($slug) { $data['title'] = 'Fréttir'; $s1 = \Request::segment(1); $type = 'news'; switch ($s1) { case 'frettir': $type = 'news'; break; case 'namskeid': $type = 'seminar'; break; case 'greinar': $type = 'article'; break; case 'hugleidingar': $type = 'thought'; break; default: break; } $_f = \App\Page::where('slug', 'frettir')->first(); $crumbs[] = ['id' => $_f->id, 'title' => $_f->title, 'path' => $_f->path]; $_p = \App\News::where('slug', $slug)->first(); $crumbs[] = ['id' => $_p->id, 'title' => $_p->title, 'path' => 'frettir/' . $_p->slug]; $data['page'] = $_p; $data['banner'] = $data['page']->banner; $data['crumbs'] = $crumbs; return view('frontend.page')->with($data); }
/** * Display a listing of the resource. * * @return Response */ public function getIndex() { if (Request::segment(2) == 'search') { $input = Session::get('search') && !Input::get('search_category') ? Session::get('search') : Input::only(array('search_category', 'search_keyword')); switch ($input['search_category']) { case '0': return Redirect::to('gateway'); break; case 'owner': $gateways = Gateway::whereHas('user', function ($q) { $q->where('username', 'LIKE', '%' . Input::get('search_keyword') . '%'); })->get(); break; default: if (Auth::user()->status == 2) { $gateways = Gateway::where($input['search_category'], 'LIKE', '%' . $input['search_keyword'] . '%')->get(); } else { $gateways = Gateway::where('user_id', Auth::user()->id)->where($input['search_category'], 'LIKE', '%' . $input['search_keyword'] . '%')->get(); } break; } Session::set('search', $input); } else { Session::remove('search'); $input = array('search_category' => '', 'search_keyword' => ''); $gateways = Auth::user()->status == 2 ? Gateway::all() : Gateway::where('user_id', Auth::user()->id)->get(); } return View::make('gateway.index')->with('gateways', $gateways)->with('selected', $input); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { // $type = ucfirst(\Request::segment(2)); $contents = Content::where('type', $type)->get(); return view('admin.content.index')->with(['contents' => $contents]); }
public function handleRequest() { // TODO create "page not found" page $uri = Request::path(); // Default version of the documentation $page = 'introduction'; $versions = array("4.0", "4.1", "4.2", "4.3", "4.6", "5.0", "5.6", "5.12"); $version = end($versions); // If not the root, then split the uri to find the content $segment1 = Request::segment(1); $segment2 = Request::segment(2); if (!empty($segment1)) { $version = $segment1; if (!empty($segment2)) { $page = $segment2; } } // Show the correct markdown contents $page = __DIR__ . '/docs/' . $version . '/' . $page . '.md'; if (file_exists($page)) { $contents = file_get_contents($page); $sidebar = file_get_contents(__DIR__ . '/docs/' . $version . '/sidebar.md'); // Transform documents $contents_html = Markdown::defaultTransform($contents); $sidebar_html = Markdown::defaultTransform($sidebar); // Replace url variable $sidebar_html = preg_replace('/{url}/mi', URL::to($version), $sidebar_html); return View::make('layouts.master')->with('version', $version)->with('versions', $versions)->with('sidebar', $sidebar_html)->with('content', $contents_html); } else { \App::abort(400, "The page you were looking for could not be found."); } }
/** * Get the validation rules that apply to the request. * * @return array */ public function rules() { if (Request::segment(5) == 'create') { $this->rules['group_category_id'] .= '|required'; } return $this->rules; }
public function showDisclosureDetail($disclosure_slug) { $segment2 = Request::segment(2); if ($disclosure_slug == 'medical-assistant') { // MA Program $this->layout->content = View::make('education.disclosure.ma_disclosure'); } elseif ($disclosure_slug == 'medical-billing-and-coding') { // MBC Program $this->layout->content = View::make('education.disclosure.mbc_disclosure'); } elseif ($disclosure_slug == 'patient-care-technician') { // PTC Program $this->layout->content = View::make('education.disclosure.pct_disclosure'); } elseif ($disclosure_slug == 'pharmacy-technician') { // PHT Program $this->layout->content = View::make('education.disclosure.pht_disclosure'); } elseif ($disclosure_slug == 'medical-office-administrator') { // MOA Program $this->layout->content = View::make('education.disclosure.moa_disclosure'); } elseif ($disclosure_slug == 'massage-therapy') { // MT Program $this->layout->content = View::make('education.disclosure.mt_disclosure'); } elseif ($disclosure_slug == 'business-management') { // BM Program $this->layout->content = View::make('education.disclosure.bm_disclosure'); } $page_title = isset($this->metaData[$segment2 . '-disclosures-detail-title']) ? $this->metaData[$segment2 . '-disclosures-detail-title'] : null; $page_desc = isset($this->metaData[$segment2 . '-disclosures-detail-desc']) ? $this->metaData[$segment2 . '-disclosures-detail-desc'] : null; $headerData = array('title' => $page_title, 'description' => $page_desc); $this->layout->header = View::make('includes.header', $headerData); }
/** * Prepare admin CRUD vars */ private static function prepare_data_vars() { /** * Default controller */ $data['default_controller'] = Config::get('admin/_config.default_controller', 'dashboard'); /** * Section */ $data['section'] = Request::segment(2) ? strtolower((string) Request::segment(2)) : $data['default_controller']; /** * action */ $data['action'] = Request::segment(3) ? strtolower((string) Request::segment(3)) : 'index'; /** * ID */ $data['id'] = Request::segment(4) ? strtolower((int) Request::segment(4)) : 0; /** * Parent ID */ $data['parent'] = Request::segment(5) ? strtolower((int) Request::segment(5)) : 0; /** * Push data */ self::$_data += $data; // pr($data); /** * Share data to view */ View::share($data); }
public function __construct(UserTransformer $transformer) { parent::__construct(); $this->transformer = $transformer; if (Request::segment(2) !== Auth::id()) { return $this->respondUnauthorized(); } }
/** * Get the validation rules that apply to the request. * * @return array */ public function rules() { if (\Request::segment(3)) { return ["curso" => "required|field_in_use:cursos,id"]; } else { return ["curso" => "required|unique:cursos"]; } }
public function __construct() { $this->model = new Menu(); $this->parents = $this->model->whereParentId(0)->orderBy('order', 'desc')->get(); view()->share('modelMenu', $this->model); view()->share('parents', $this->parents); view()->share('segment2', \Request::segment(2)); }
public function __construct() { parent::__construct(); $this->communityRepository = app('App\\Repositories\\CommunityRepository'); $slug = \Request::segment(2); $this->community = $this->communityRepository->get($slug); $this->theme->share('community', $this->community); }
public function singlePage() { // If the page isn't found if (!Page::whereSlug(Request::segment(2))->exists()) { return App::abort(404); } return Theme::render('page'); }
public function __construct() { parent::__construct(); $this->eventRepository = app('App\\Repositories\\EventRepository'); $slug = \Request::segment(2); $this->event = $this->eventRepository->get($slug); $this->theme->share('event', $this->event); }
public function __construct() { parent::__construct(); $this->pageRepository = app('App\\Repositories\\PageRepository'); $slug = \Request::segment(2); $this->page = $this->pageRepository->get($slug); $this->theme->share('page', $this->page); }
/** * Get the validation rules that apply to the request. * * @return array */ public function rules() { if (Request::segment(3) == 'create') { $this->rules['file_main'] .= '|required'; $this->rules['file_logo'] .= '|required'; } return $this->rules; }
public function __construct() { parent::__construct(); $this->gameRepository = app('App\\Repositories\\GameRepository'); $slug = \Request::segment(2); $this->game = $this->gameRepository->getProfile($slug); $this->theme->share('game', $this->game); }
/** * Get the validation rules that apply to the request. * * @return array */ public function rules() { if (\Request::segment(3)) { return ["title" => "required|field_in_use:posts,id", "content" => "required|min:5"]; } else { return ["title" => "required|unique:posts", "content" => "required|min:5"]; } }
public function getDelete() { $id = Request::segment(3); $inbox = Inbox::find($id); $inbox->delete(); //DB::table('rinks')->where('id','=',Request::segment(3))->delete(); return Redirect::to('dashboard/messages')->with('message', 'Record deleted successfully'); }