Пример #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $teams = \App\Team::all();
     foreach ($teams as $team) {
         factory(App\Player::class, 5)->create(['team_id' => $team->id]);
     }
 }
Пример #2
0
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $leagues = League::all();
     $stadiums = Stadium::all();
     $teams = Team::all();
     return view('admin.fixtures.create', compact('leagues', $leagues, 'teams', $teams, 'stadiums', $stadiums));
 }
Пример #3
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //
     // get all the teams
     $teams = Team::all();
     return $teams;
 }
Пример #4
0
 /**
  * The game page itself
  *
  * @return Response
  */
 public function index()
 {
     $ws = Websitespel::where("ended", false)->orderBy('start_date')->first();
     if ($ws == null) {
         //no games in progress and none planned
         //return done
         return view('game.ended')->with('countDown', false);
     } else {
         if ($ws->start_date > \Carbon\Carbon::now()) {
             // do the countdown
             // return countdown
             return view('game.countdown')->with('countDown', $ws);
         }
     }
     // else carry on
     $team = Auth::user()->team()->first();
     $questionNr = count(Progress::where('team_id', $team->id)->get());
     $question = null;
     $tip = false;
     $times = [];
     if ($questionNr != count(Question::all())) {
         $question = Question::where('sequence', $questionNr + 1)->first();
         $result = QuestionTime::where('team_id', $team->id)->where('question_id', $question->id)->get();
         if (count($result) == 0) {
             $questionTime = new QuestionTime();
             $questionTime->team_id = $team->id;
             $questionTime->question_id = $question->id;
             $questionTime->tip = false;
             $questionTime->start_time = \Carbon\Carbon::now()->timestamp;
             $questionTime->save();
             $tip = false;
         } else {
             $tip = $result->first()->tip;
         }
     } else {
         $teams = Team::all();
         $teamsCount = count($teams);
         $question_id = Question::where('sequence', Question::max('sequence'))->first()->id;
         for ($i = 0; $i < $teamsCount; $i++) {
             $qt = QuestionTime::where('team_id', $teams[$i]->id)->where('question_id', $question_id)->first();
             if ($qt == null) {
                 continue;
             }
             $end_time = $qt->end_time;
             if ($end_time == null) {
                 continue;
             }
             $end_time_string = \Carbon\Carbon::createFromTimestamp($end_time);
             array_push($times, array('name' => $teams[$i]->teamname, 'time' => $end_time_string, 'countDown' => 0));
         }
         usort($times, function ($a, $b) {
             return $a['time']->timestamp - $b['time']->timestamp;
         });
     }
     return view('game.index')->with(array('question' => $question, 'tip' => $tip, 'end_times' => $times, 'countDown', null));
 }
 /**
  * Show team standings
  * @return Response
  */
 public function teamStandings()
 {
     $teams = Team::all()->sort(function ($a, $b) {
         if ($a->points() == $b->points()) {
             // ToDo: Sort on goal average in case two teams have the same points
             return 0;
         }
         return $a->points() < $b->points() ? 1 : -1;
     });
     return view('standings.teams')->with('teams', $teams->values()->all());
 }
Пример #6
0
 public function fixtureTeam(Request $request)
 {
     $this->validate($request, ['team_title' => 'required', 'stadium_id' => 'required', 'file' => 'required|image|mimes:jpeg,jpg,png,bmp,gif,svg']);
     //dd($request->all());
     if ($request->file('file')) {
         //$this->validate($request,['file'=>'required|image|mimes:jpeg,jpg,png,bmp,gif,svg']);
         $file = $request->file('file');
         $path = $this->_team_logo_path;
         $name = uniqid() . $file->getClientOriginalName();
         $file->move($path, $name);
     }
     $team = new Team(array('title' => $request->get('team_title'), 'stadium_id' => $request->get('stadium_id'), 'logo_name' => $name, 'logo_path' => $path));
     $team->save();
     $teams = Team::all();
     return response()->json($teams);
 }
Пример #7
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function generateScheduleByGroup($group = null)
 {
     if ($group) {
         $teams = Team::where('group', $group)->get();
     } else {
         $teams = Team::all();
     }
     $rows = array();
     foreach ($teams as $host) {
         foreach ($teams as $guest) {
             if ($host->id != $guest->id && $host->group == $guest->group && !in_array(array('host' => $guest, 'guest' => $host), $rows)) {
                 $rows[] = array('host' => $host, 'guest' => $guest);
             }
         }
     }
     return view('schedule.index', compact('rows'));
 }
Пример #8
0
 public function getWdc()
 {
     $wdc = Team::all()->where('kategori', 0);
     return view('admin.wdcTable')->with('wdc', $wdc);
 }
Пример #9
0
 public function quizRanking($quizid)
 {
     $quiz = Quiz::find($quizid);
     // RANKING CALC START
     $tables = array();
     foreach (json_decode($quiz->teams) as $table => $value) {
         $tables[$table] = array();
         $tables[$table]['team'] = intval($value->team);
         $tables[$table]['pointsLevel0'] = intval($value->points);
         $tables[$table]['pointsLevel1'] = 0;
         $tables[$table]['pointsLevel2'] = 0;
         $tables[$table]['pointsLevel3'] = 0;
         $tables[$table]['points'] = 0;
         $tables[$table]['tiebreaker'] = intval($value->tiebreak);
     }
     $questionsCollection = Question::where('quiz', $quizid)->get();
     $questions = array();
     foreach ($questionsCollection as $key => $value) {
         $questions[$value->level][$value->genre][$value->tableid] = $value;
         if ($value->tableid_remap == $value->tableid_score && $value->tableid_score) {
             $points = 2;
         } elseif ($value->tableid_score) {
             $points = 1;
         } else {
             $points = 0;
         }
         if ($points && $value->tableid_score != '-1') {
             switch ($value->level) {
                 case '1':
                     $tables[$value->tableid_score]['pointsLevel1'] = $tables[$value->tableid_score]['pointsLevel1'] + $points;
                     break;
                 case '2':
                     $tables[$value->tableid_score]['pointsLevel2'] = $tables[$value->tableid_score]['pointsLevel2'] + $points;
                     break;
                 case '3':
                     $tables[$value->tableid_score]['pointsLevel3'] = $tables[$value->tableid_score]['pointsLevel3'] + $points;
                     break;
             }
         }
     }
     $tiebreaks = array();
     foreach ($tables as $key => $table) {
         $tables[$key]['points'] = $tables[$key]['pointsLevel0'] + $tables[$key]['pointsLevel1'] + $tables[$key]['pointsLevel2'] + $tables[$key]['pointsLevel3'];
         $tables[$key]['pointsLevel1'] = $tables[$key]['points'] - $tables[$key]['pointsLevel0'] - $tables[$key]['pointsLevel2'] - $tables[$key]['pointsLevel3'];
         $tables[$key]['pointsLevel2'] = $tables[$key]['points'] - $tables[$key]['pointsLevel0'] - $tables[$key]['pointsLevel1'] - $tables[$key]['pointsLevel3'];
         $tables[$key]['pointsLevel3'] = $tables[$key]['points'] - $tables[$key]['pointsLevel0'] - $tables[$key]['pointsLevel1'] - $tables[$key]['pointsLevel2'];
         $tables[$key]['tiebreak'] = sprintf("%02d", $tables[$key]['points']) . sprintf("%02d", $tables[$key]['pointsLevel3']) . sprintf("%02d", $tables[$key]['pointsLevel2']) . sprintf("%02d", $tables[$key]['pointsLevel1']) . sprintf("%02d", $tables[$key]['tiebreaker']);
         $tables[$key]['level2'] = false;
         $tables[$key]['level3'] = false;
         array_push($tiebreaks, $tables[$key]['tiebreak']);
     }
     $uniqueTiebreaks = array_unique(array_diff_assoc($tiebreaks, array_unique($tiebreaks)));
     $ties = false;
     foreach ($tables as $key => $table) {
         if (in_array($tables[$key]['tiebreak'], $uniqueTiebreaks)) {
             $ties = true;
             $tables[$key]['tied'] = true;
         } else {
             $tables[$key]['tied'] = false;
         }
     }
     $tables = collect($tables);
     $tables = $tables->sortByDesc('tiebreak');
     $tables->values()->all();
     $tables = $tables->toArray();
     $position = 1;
     foreach ($tables as $key => $value) {
         if ($position <= 10) {
             $tables[$key]['level2'] = true;
         }
         if ($position <= 6) {
             $tables[$key]['level3'] = true;
         }
         $position++;
     }
     // RANKING CALC END
     $teamsCollection = Team::all();
     $teams = array();
     foreach ($teamsCollection as $key => $value) {
         $teams[$value->id] = $value;
     }
     return view('quizranking')->with(['quiz' => $quiz, 'teams' => $teams, 'tables' => $tables, 'ties' => $ties]);
 }
Пример #10
0
<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', function () {
    // prelevo l'elenco delle squadre
    $teams = \App\Team::all();
    return view('home', ['teams' => $teams]);
});
Route::get('team/{slug}', function ($slug) {
    // prelevo l'oggetto TEAM con la lista dei giocatori associati
    $team = \App\Team::where('slug', '=', $slug)->firstOrFail();
    return view('players', ['players' => $team->players]);
});
Route::get('player/{id}', function ($player_id) {
    // prelevo tutte le informazioni del PLAYER con id=$player_id
    $player = \App\Skills::where('player_id', $player_id)->firstOrFail();
    return view('player_info', ['data' => $player]);
});
Route::get('fantateam', function () {
    // prelevo l'elenco delle fanta-squadre
    $teams = \App\Fantateam::all();
    return view('fantateams', ['teams' => $teams]);
Пример #11
0
        return redirect()->back();
        // redirect back if current user tries to access another user
    }
    $user_info = UserInfo::where('user_id', $id)->first();
    $user = User::findorfail($id);
    return view('pages/edit', compact('user', 'user_info'));
});
Route::post('/users/{id}/edit', 'UserController@update');
// Password routes
Route::controllers(['password' => 'Auth\\PasswordController']);
// Admin routes - only accessible by admin user
Route::group(['middleware' => 'App\\Http\\Middleware\\AdminMiddleware'], function () {
    Route::get('/admin', function () {
        $users = User::all();
        $users_info = UserInfo::all();
        $numTeams = count(Team::all());
        $nullteam = UserInfo::where('team_id', null)->first();
        return view('admin.teams', compact('users_info', 'users', 'numTeams', 'nullteam'));
    });
    Route::post('/admin', 'AdminController@generate');
    Route::get('/admin/generate', function () {
        return view('admin.generate');
    });
    Route::get('/admin/users/{id}', function ($id) {
        $user = User::findorfail($id);
        $userinfo = UserInfo::findorfail($id);
        $numTeams = count(Team::all());
        return view('admin.user', compact('user', 'userinfo', 'numTeams'));
    });
    Route::post('/admin/users/{id}', 'AdminController@edit');
});
Пример #12
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $members = Team::all();
     return view('pages.index-team', compact('members'));
 }
Пример #13
0
 public function ShowUsers()
 {
     $usuarios = User::orderBy('id', 'desc')->paginate(5);
     $teams = Team::all();
     return view('admin/usuarios', ['usuarios' => $usuarios, "teams" => $teams]);
 }
 /**
  * Show the match create page.
  *
  * @return Response
  */
 public function createMatch()
 {
     return view('match.create')->with('teams', Team::all());
 }
Пример #15
0
 public static function downloadCSGL_Logos()
 {
     $teams = Team::all();
     foreach ($teams as $team) {
         if ($team->logo == null || $team->logo == "no_logo_new.svg") {
             $team->logo = $team['csgl_name'] . ".jpg";
             Scraper::grab_image(DataLoader::$base_img_url . $team['csgl_name'] . ".jpg", "assets/images/teamlogos/" . $team['csgl_name'] . ".jpg");
             $team->save();
         }
     }
 }
Пример #16
0
 public function Teams()
 {
     $teams = Team::all();
     return view('admin.batchs.teams', array('teams' => $teams));
 }
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index()
 {
     return view('home')->with('teams', App\Team::all())->with('persons', App\Person::all());
 }
Пример #18
0
 public function getAllTeams()
 {
     //automatically converts to json
     return Team::all();
 }
Пример #19
0
 public function resetPasswords($length = 12)
 {
     $csv = \League\Csv\Writer::createFromFileObject(new \SplTempFileObject());
     $csv->insertOne(['Team Naam', 'Gebruikersnaam', 'Paswoord']);
     $teams = Team::all();
     $nrOfTeams = count($teams);
     for ($i = 0; $i < $nrOfTeams; $i++) {
         $user = User::findOrFail($teams[$i]->user_id);
         $password = $this->createPassword();
         $user->password = \Hash::make($password);
         $user->save();
         $csv->insertOne([$teams[$i]->teamname, $user->username, $password]);
     }
     $csv->output('hhd_passwords.csv');
 }
Пример #20
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $teams = Team::all();
     $sport = Sport::lists('name', 'id');
     return view('teams.index', compact('teams', 'sport'));
 }
Пример #21
0
 private function getTeamsChart()
 {
     $teamHoursDataTable = \Lava::DataTable();
     foreach (Team::all()->sortBy('name') as $team) {
         $teamHoursDataTable->addNumberColumn($team->name);
     }
     foreach (Team::all() as $team) {
         $teamHoursDataTable->addRow([$team->workActivities()->sum('hours')]);
     }
     \Lava::LineChart('Overview')->dataTable($clubOverviewChart)->title('Stundenübersicht nach Team, Zeitraum 1 Jahr, Intervall 2 Wochen')->setOptions(array('legend' => \Lava::Legend(array('position' => 'in'))));
 }
Пример #22
0
$end_year = Carbon::createFromFormat("Y-m-d", $plan_option->enddate)->format("Y");
?>
                        <li><a href="/plan/{{ $plan_option->id }}">Plan {{ $start_year }} - {{ $end_year }}</a></li>

                        @if(count(Plan::all()) > $plan_option->id )
                            <li role="separator" class="divider"></li>
                        @endif
                    @endforeach
                </ul>
            </div>
            @endif

            <?php 
$filter_options = ["Actions", "Tasks"];
$dept_options = Department::all();
$team_options = Team::all();
?>

            @foreach($filter_options as $option)
                <a type="button" class="btn btn-primary" href="/sort/{{ $plan->id }}/{{ strtolower(preg_replace('/[^a-z0-9]+/i', '', $option)) }}">{{ $option }}</a>
            @endforeach


            <div class="dropdown btn-group">
                <button class="btn btn-primary dropdown-toggle" type="button" id="teamDeptDropdown" data-toggle="dropdown">
                    Team/Department
                    <span class="caret"></span>
                </button>
                <ul class="dropdown-menu">
                    <li class="dropdown-header">Departments</li>
                    @foreach($dept_options as $dept_option)
Пример #23
0
 /**
  * Display a list of all of the user's teams.
  *
  * @param  Request  $request
  * @return Response
  */
 public function index(Request $request)
 {
     $data['teams'] = $request->user()->role === 'app_admin' ? Team::all() : $this->teamRepo->userTeams($request->user());
     return view('teams.index', $data);
 }
Пример #24
0
 /**
  * Teams List view
  *
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function index()
 {
     $teams = Team::all();
     return view('teams.index', ['teams' => $teams]);
 }
Пример #25
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $team = Team::all();
     return view('admin.team.list', compact('team'));
 }
Пример #26
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $teams = Team::all();
     return view('theme.teams.index', compact('teams'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $teams = Team::all();
     return View('teams.index')->with('teams', $teams);
 }
 public function getNew()
 {
     return view('teams.new')->with('teams', Team::all());
 }
 public function getAll()
 {
     $teams = Team::all();
     return new Http\Response($teams, 200);
 }
Пример #30
0
 /**
  * display about page
  *
  * @return \Illuminate\Http\Response
  */
 public function about()
 {
     $team = Team::all();
     return view('pages.about', compact('team'));
 }