public function getCurrentLevel($code, $id)
 {
     $user = User::find($code);
     $level = Level::where('role_id', $id)->get();
     return view('html.block.level', compact('level', 'user'));
 }
 public function levelAddAction(Request $request)
 {
     $level = $request->input("level");
     $days = $request->input("days");
     $numbers = $request->input("numbers");
     $fee = $request->input("fee");
     $l = new Level();
     $l['level'] = $level;
     $l['days'] = $days;
     $l['numbers'] = $numbers;
     $l['fee'] = $fee;
     $l->save();
     return redirect("/admin/levelManage")->with("msg", "添加成功!");
 }
示例#3
0
 public function updateLevel(Request $request)
 {
     $user = User::with(['level', 'courses' => function ($query) {
         $query->where('level', '1')->where('validated', 1);
     }])->where('id', $request->id)->first();
     $oldLevel = ucfirst($user->level->name);
     if (Auth::check()) {
         if (Auth::user()->id != $user->id) {
             if (Auth::user()->level_id == 5 || Auth::user()->level_id == 4 && $user->level_id < 4) {
                 if ($request->level < 3 && $user->courses->count() > 0) {
                     Flash::error('Impossible de rétrograder cet utilisateur à ce level car il est professeur de ' . $user->courses->count() . ' cours.');
                     return Redirect::back();
                 }
                 $newLevel = ucfirst(Level::find($request->level)->name);
                 $modif = $user->level_id > $request->level ? 'downgraded' : 'upgraded';
                 $user->level_id = $request->level;
                 $user->save();
                 Flash::success('Le changement a été effectué avec succès.');
                 makeModification('users', printUserLinkV2($user) . ' as been ' . $modif . ' from ' . $oldLevel . ' to ' . $newLevel . '.');
                 return Redirect::back();
             }
         }
     }
     Flash::error('Vous n\'avez pas les droits nécéssaires pour cela.');
     return Redirect::back();
 }
示例#4
0
 public function update($id)
 {
     $announcement = Announcement::findOrFail($id);
     $levels = Level::all();
     $dataView = ['announcement' => $announcement, 'levels' => $levels];
     return view('admin.announcement.edit', $dataView);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     for ($i = 0; $i < 20; $i++) {
         $level = Level::create(array('name' => $faker->unique()->word));
     }
 }
示例#6
0
 public function users()
 {
     $users = User::orderBy('level_id', 'asc')->get();
     $level = Level::lists('name', 'id');
     $ppk = Ppk::lists('name', 'id');
     return View('admin.preset.users', compact('users', 'level', 'ppk'));
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     // Create level 0 : member
     Level::create(['level' => 0, 'name' => 'membre']);
     // Create level 1 : band_creator
     Level::create(['level' => 1, 'name' => 'manager']);
     // Create level 2 : teacher
     Level::create(['level' => 2, 'name' => 'professeur']);
     // Create level 3 : admin
     Level::create(['level' => 3, 'name' => 'admin']);
     // Create level 10 : webmaster
     Level::create(['level' => 10, 'name' => 'webmaster']);
     // Create departement : "aucun"
     Department::create(['name' => 'Aucun', 'short_name' => 'Aucun']);
     // Create user : Webmaster (lvl 10)
     User::create(['first_name' => 'Webmaster', 'last_name' => 'Webmaster', 'email' => 'webm@ster', 'school_year' => 0, 'department_id' => 1, 'password' => bcrypt('webmastercmt'), 'level_id' => 5, 'slug' => 'webmaster-webmaster-1']);
     Category::create(['name' => 'Aucune']);
     Category::create(['name' => 'Autre']);
     Category::create(['name' => 'Présentation']);
     Category::create(['name' => 'Création de groupe']);
     Category::create(['name' => 'Recherche de groupe']);
     Category::create(['name' => 'Échange/Vente']);
     //Creation basic instruments :
     $instruments = ['autre', 'guitare', 'piano', 'basse', 'chant', 'flûte', 'violon', 'contrebasse', 'clarinette', 'saxophone', 'batterie', 'violoncelle', 'guitare électrique', 'flûte traversière', 'trompette', 'cor', 'trombone', 'tuba'];
     $this->create_instrument($instruments);
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $crs = Course::find($id);
     $aff = Affiliate::all();
     $stm = Stream::all();
     $lvl = Level::all();
     return view('admin/edit_course')->with('course', $crs)->with('affiliates', $aff)->with('streams', $stm)->with('levels', $lvl);
 }
 public function index()
 {
     $courses = Centre::with('courses')->get();
     $papers = Paper::with('courses')->get();
     $levels = Level::with('levels')->get();
     $courseNum = Course::all();
     return view('acca.base')->withCentres($courses)->withPapers($papers)->withLevels($levels)->with('courseNum', $courseNum);
 }
示例#10
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('levels')->delete();
     $levels = [["id" => 1, "xp_threshold" => 0], ["id" => 2, "xp_threshold" => 100], ["id" => 3, "xp_threshold" => 200], ["id" => 4, "xp_threshold" => 400], ["id" => 5, "xp_threshold" => 800], ["id" => 6, "xp_threshold" => 1600], ["id" => 7, "xp_threshold" => 3200], ["id" => 8, "xp_threshold" => 6400], ["id" => 9, "xp_threshold" => 12800], ["id" => 10, "xp_threshold" => 25600], ["id" => 11, "xp_threshold" => 51200], ["id" => 12, "xp_threshold" => 102400]];
     foreach ($levels as $level) {
         Level::create($level);
     }
 }
 /**
  * Despliega la forma para editar una sugerencia específica, basados en el id
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $levels = Level::all();
     $suggestion = Suggestion::find($id);
     //dd($suggestion->level);
     //return view('suggestions.edit')->with('suggestion',$suggestion);
     return view('suggestions.edit')->with(['suggestion' => $suggestion, 'levels' => $levels]);
 }
示例#12
0
 public function edit($id)
 {
     $user = User::findOrFail($id);
     $bahagian = Bahagian::lists('nama', 'id');
     $cawangan = Cawangan::lists('nama', 'id');
     $level = Level::lists('nama', 'id');
     $unit = Unit::lists('nama', 'id');
     return View('members.admin.pengguna', compact('user', 'bahagian', 'cawangan', 'level', 'unit'));
 }
 /**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot()
 {
     // always returns $user whether logged in or not, null if not
     view()->composer(['layouts._rightnav', 'layouts.loginForm', 'tracks.index', 'skills.create', 'level.index', 'tracks.editForm', 'levels.editForm', 'difficulties.editForm'], function ($view) {
         $view->with('user', Auth::check() ? Auth::user()->firstname : null);
     });
     view()->composer(['questions._questionform', 'skills.newform', 'skills._rowform'], function ($view) {
         $view->with(['tracks' => Track::lists('track', 'id'), 'levels' => Level::lists('description', 'id'), 'difficulties' => Difficulty::lists('difficulty', 'id'), 'skills' => Skill::lists('short_description', 'id'), 'user' => Auth::user()]);
     });
 }
示例#14
0
 public function doDelete($id)
 {
     $level = Level::findOrFail($id);
     try {
         $level->delete();
         return redirect()->back()->with('message', 'Level has been deleted successfully !');
     } catch (ParseException $ex) {
         echo 'Failed to create new meal , with error message: ' . $ex->getMessage();
     }
 }
示例#15
0
 public function update($id)
 {
     $lines = Line::all();
     $levels = Level::all();
     $employee = Employee::findOrFail($id);
     $salesManagers = Employee::where('level_id', 2)->get();
     $areaManagers = Employee::where('level_id', 3)->get();
     $dataView = ['lines' => $lines, 'levels' => $levels, 'employee' => $employee, 'salesManagers' => $salesManagers, 'areaManagers' => $areaManagers];
     return view('admin.employee.edit', $dataView);
 }
示例#16
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $level_id = Auth::user()->level_id;
     $role_id = Level::find($level_id)->role_id;
     $role = Role::find($role_id);
     if ($role->name != 'SystemAdmin') {
         return redirect()->route('admin.department.index')->with('message', 'Access deny!');
     }
     return $next($request);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     $faker = Faker\Factory::create();
     $group = Group::lists('id')->all();
     $level = Level::lists('id')->all();
     for ($i = 0; $i < 20; $i++) {
         $fellows = Fellow::create(array('level_id' => $faker->unique()->randomElement($level), 'group_id' => $faker->unique()->randomElement($group), 'name' => $faker->unique()->word));
     }
 }
示例#18
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Level::create(['name' => strtoupper('sys_admin'), 'position' => strtoupper('penolong pegawai teknologi maklumat')]);
     Level::create(['name' => strtoupper('pengurus besar'), 'position' => strtoupper('pengurus besar mada')]);
     Level::create(['name' => strtoupper('pengarah BPIP'), 'position' => strtoupper('pengarah bahagian pengurusan institusi peladang')]);
     Level::create(['name' => strtoupper('akauntan'), 'position' => strtoupper('akauntan bahagian pengurusan institusi peladang')]);
     Level::create(['name' => strtoupper('kerani pendaftar'), 'position' => strtoupper('kerani bahagian pengurusan institusi peladang')]);
     Level::create(['name' => strtoupper('pengurus wilayah'), 'position' => strtoupper('pengurus wilayah')]);
     Level::create(['name' => strtoupper('pengurus ppk'), 'position' => strtoupper('pengurus ppk')]);
     Level::create(['name' => strtoupper('kerani akaun'), 'position' => strtoupper('kerani akaun ppk')]);
 }
示例#19
0
 public function run()
 {
     Level::create(['level' => 00, 'description' => 'Kindergarten']);
     Level::create(['level' => 100, 'description' => 'Primary/Grade/Year One', 'age' => 7]);
     Level::create(['level' => 200, 'description' => 'Primary/Grade/Year Two', 'age' => 8]);
     Level::create(['level' => 300, 'description' => 'Primary/Grade/Year Three', 'age' => 9]);
     Level::create(['level' => 400, 'description' => 'Primary/Grade/Year Four', 'age' => 10]);
     Level::create(['level' => 500, 'description' => 'Primary/Grade/Year Five', 'age' => 11]);
     Level::create(['level' => 600, 'description' => 'Primary/Grade/Year Six', 'age' => 12]);
     Level::create(['level' => 700, 'description' => 'Sec 1/Grade/Year 7 ', 'age' => 13]);
     Level::create(['level' => 800, 'description' => 'Sec 2/Grade/Year 8 ', 'age' => 14]);
     Level::create(['level' => 900, 'description' => 'Sec 3/Grade/Year 9 ', 'age' => 15]);
     Level::create(['level' => 1000, 'description' => 'Sec 4/Grade/Year 10', 'age' => 16]);
     Level::create(['level' => 1100, 'description' => 'Pre-U1/Grade/Year 11', 'age' => 17]);
     Level::create(['level' => 1200, 'description' => 'Pre-U2/Grade/Year 12', 'age' => 18]);
     Level::create(['level' => 1300, 'description' => 'Beyond Secondary School', 'age' => 99]);
 }
 public function readerDetail(Request $request)
 {
     $msg = $request->session()->get("msg");
     $username = $request->session()->get("username");
     $id = $request->input("id");
     $reader = Reader::find($id);
     $user = User::where('reader-id', '=', $id)->first();
     $levels = Level::all();
     $view = view('admin/ReaderDetail', ['username' => $username, 'reader' => $reader, 'user' => $user, "levels" => $levels]);
     if ($msg == null) {
         return $view;
     } else {
         return $view->with("msg", $msg);
     }
 }
示例#21
0
 /**
  * Delete the given Level.
  *
  * @param  int      $id
  * @return Redirect
  */
 public function getDelete($id = null)
 {
     $level = Level::destroy($id);
     // Redirect to the group management page
     return redirect('admin/levels')->with('success', Lang::get('message.success.delete'));
 }
示例#22
0
 public function getLevel($id, User $staff)
 {
     $level = Level::where('role_id', $id)->get();
     return view('html.level', compact('level', 'staff'));
 }
示例#23
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy(Level $level)
 {
     if (Request::ajax()) {
         return Level::findOrFail($level->id) ? Level::destroy($level->id) : null;
     } else {
     }
     Level::findOrFail($level->id) ? Level::destroy($level->id) : null;
     flash('Level is deleted');
     return redirect('levels');
 }
 public function levelUpIfPossible()
 {
     $points = $this->getUserPoints();
     $currentLevel = $this->getUserLevel();
     $levels = \App\Level::all();
     if ($currentLevel->id != count($levels)) {
         $nextLevel = $levels[$currentLevel->id];
         if ($nextLevel->criteria <= $points) {
             $this->setUserLevel($nextLevel->id);
         }
     }
 }
 public function info(Request $request)
 {
     $username = $request->session()->get("username");
     $user = User::where('username', '=', $username)->first();
     if ($user == null) {
         return redirect('home');
     }
     $reader = Reader::find($user['reader-id']);
     $levels = Level::all();
     return view('/reader/info', ['username' => $username, 'user' => $user, 'reader' => $reader, 'levels' => $levels]);
 }
示例#26
0
 public function clear(Request $request)
 {
     foreach ($request->input('checkbox') as $key => $value) {
         $model = Level::find($value);
         $model->delete();
     }
     return redirect()->route('admin.level.index')->with('success', 'successfully deleted');
 }
示例#27
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(UpdateStaffRequest $request, $id)
 {
     $department = $request->department;
     $position = $request->position;
     $level = $request->level;
     //is manager
     if (Gate::allows('check-manager')) {
         $this->validate($request, ['department' => 'required|numeric|not_in:0']);
         if ($id == Auth::user()->id) {
             $department = 0;
         } else {
             $department = $request->department;
         }
     } else {
         if (Gate::allows('check-leader')) {
             $department = Auth::user()->department_id;
         } else {
             if (Gate::allows('check-admin')) {
                 $this->validate($request, ['department' => 'required|numeric|not_in:0']);
                 $temp1 = (int) $request->level;
                 $role = Level::find($temp1);
                 if ($role->role_id == 2) {
                     $department = 0;
                     $position = 0;
                 } else {
                     $department = $request->department;
                 }
             } else {
                 $department = Auth::user()->department_id;
                 $position = Auth::user()->position_id;
                 $level = Auth::user()->level_id;
             }
         }
     }
     if ($id == Auth::user()->id) {
         $department = Auth::user()->department_id;
         $position = Auth::user()->position_id;
         $level = Auth::user()->level_id;
         $request->rActive = 1;
     }
     $birth = date('Y-m-d', strtotime($request->txtBirth));
     $staff = Staff::find($id);
     $staff->name = $request->txtName;
     $staff->phone = $request->txtPhone;
     $staff->birthday = $birth;
     $staff->position_id = $position;
     $staff->level_id = $level;
     $staff->department_id = $department;
     $staff->active = $request->rActive;
     $staff->save();
     return redirect()->route('admin.staff.edit', $id)->with('message', 'Update profile success');
 }
示例#28
0
 /**
  * Persist a building level to the database
  * @param $request
  * @param $id
  */
 public function persist($request, $id)
 {
     $building = $this->building->findOrFail($id);
     $building->levels()->create(['building_id' => $id, 'level_id' => $request->levelName, 'levelName' => $this->level->where('id', '=', $request->levelName)->first()->levelName]);
     $this->updateLevels($building);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     try {
         $lv = Level::find($id);
         $lv->delete();
         \Session::flash('sucess_message', 'Level is sucessfully DELETED.');
     } catch (Exception $e) {
         \Session::flash('error_message', 'Oops!! Level could not DELETED.');
     }
     return redirect('myAdmin/levels');
 }
 public function getClassWhenLevelid()
 {
     if (\Request::ajax()) {
         $nextYearId = \Input::get('nextYearId');
         $level_id = \Input::get('level_id');
         $level = Level::where('id', $level_id)->where('user_id', \Auth::user()->id)->first();
         foreach ($level->classrooms()->where('school_year_id', $nextYearId)->get() as $cr) {
             echo '<option value="' . $cr->id . '"> ' . $cr->nom_classe . ' ( ' . $cr->schoolYear->ann_scol . ' ) ' . '</option>';
         }
         foreach ($level->lesClasses()->where('school_year_id', $nextYearId)->get() as $cr) {
             echo '<option value="' . $cr->id . '"> ' . $cr->nom_classe . ' ( ' . $cr->schoolYear->ann_scol . ' ) ' . '</option>';
         }
     }
 }