public function getMyprofile()
 {
     $id = Auth::user()->id;
     $alumni_id = null;
     $sql = "SELECT * FROM alumni WHERE account_id = ?";
     $prof = DB::select($sql, array($id));
     if ($prof != null) {
         $alumni_id = $prof[0]->id;
     }
     $sql2 = "SELECT * FROM degree WHERE alumni_id = ?";
     $deg = DB::select($sql2, array($alumni_id));
     $sql3 = "SELECT * FROM work_experience WHERE alumni_id = ?";
     $wrk_exp = DB::select($sql3, array($alumni_id));
     $sql4 = "SELECT * FROM certificate WHERE alumni_id = ?";
     $certificate = DB::select($sql4, array($alumni_id));
     // $sql5 = "SELECT * FROM alumni_tracer WHERE alumni_id = ?";
     $sql5 = "SELECT at.*, sq.question, sc.choice\n\t\t\t\tFROM alumni_tracer AS at\n\t\t\t\tINNER JOIN survey_questions AS sq\n\t\t\t\tON sq.id = at.question_id\n\t\t\t\tINNER JOIN survey_choices AS sc\n\t\t\t\tON sc.id = at.choice_id\n\t\t\t\tWHERE at.alumni_id = ?\n\t\t\t\tORDER BY at.question_id";
     $a_tracer = DB::select($sql5, array($alumni_id));
     $dept = Department::all();
     $region = Region::all();
     $province = Province::all();
     $occupation = Occupation::all();
     $company = Company::all();
     $deg_title = DegreeTitle::all();
     $school = School::all();
     $jobs = Job::all();
     $field = Field::all();
     $questions = DB::select("SELECT * FROM survey_questions");
     $civil_status = DB::select("SELECT * FROM civil_status");
     return View::make('user.profile')->with('company', $company)->with('field', $field)->with('occupation', $occupation)->with('work_exp', $wrk_exp)->with('degree', $deg)->with('a_tracer', $a_tracer)->with('certificate', $certificate)->with('school', $school)->with('deg_title', $deg_title)->with('profile', $prof)->with('dept', $dept)->with('region', $region)->with('province', $province)->with('civil_status', $civil_status)->with('questions', $questions)->with('jobs', $jobs);
 }
Esempio n. 2
0
$view->parserExtensions = array(new \Slim\Views\TwigExtension(), new Twig_Extension_Debug());
$data = array();
$data['base_url'] = '/admin/';
$data['current_url'] = rtrim($data['base_url'], '/') . $app->request->getResourceUri();
$data['mainmenu'] = array(array('title' => 'Dashboard', 'url' => 'dashboard', 'icon' => 'fa-dashboard'), array('title' => 'Gebruikers', 'url' => 'users_overview', 'icon' => 'fa-users'), array('title' => 'Scholen', 'url' => 'schools_overview', 'icon' => 'fa-university'), array('title' => 'Talenten', 'url' => 'talents_overview', 'icon' => 'fa-tasks'), array('title' => 'Vaardigheden', 'url' => 'skills_overview', 'icon' => 'fa-sliders'), array('title' => 'Beroepen', 'url' => 'occupations_overview', 'icon' => 'fa-briefcase'), array('title' => 'Uitloggen', 'url' => 'logout', 'icon' => 'fa-lock'));
$app->notFound(function () use($app, $data) {
    $app->render('404.html', $data);
});
$app->get('/dashboard(/:school_id)', function ($school_id = null) use($app, $data) {
    $data['active_school_id'] = $school_id;
    if ($school_id == null) {
        $users = User::with('talents', 'skills', 'educationLevel')->get();
    } else {
        $users = User::with('talents', 'skills', 'educationLevel')->where('school_id', '=', (int) $school_id)->get();
    }
    $occupations = Occupation::all();
    $schools = School::orderBy('name', 'ASC')->get();
    $talents = Talent::all();
    $data['schools'] = $schools->toArray();
    $data['total_occupations'] = $occupations->count();
    $data['total_users'] = $users->count();
    $users_male = $users->filter(function ($user) {
        return $user->gender == 'm';
    });
    $users_female = $users->filter(function ($user) {
        return $user->gender == 'f';
    });
    $data['users_gender'] = array(array('label' => 'vrouw', 'value' => $users_female->count()), array('label' => 'man', 'value' => $users_male->count()));
    // Get amount of people picking talents
    $picked_talents = array();
    $users->each(function ($user) use(&$picked_talents) {