/** * Searching Managers based upon the parameters submitted by the user * @param Request $request */ public function searchManagers(Request $request) { $name = 'null'; $manager_type = 'null'; $sport = 'null'; $sport_gender = 'null'; $country = 'null'; $state = 'null'; if ($request->has("coach_name") && trim($request->get("coach_name")) != "") { $name = $request->get("coach_name"); } if ($request->has("manager_type") && trim($request->get("manager_type")) != "" && $request->get("manager_type") != 0) { $manager_type = BasicSiteRepository::getManagerTypes()[$request->get("manager_type")]; } if ($request->has("sport_type") && trim($request->get("sport_type")) != "" && $request->get("sport_type") != 0) { $sport = BasicSiteRepository::getSportTypes()[$request->get("sport_type")]; } if ($request->has("sport_gender") && trim($request->get("sport_gender")) != "" && $request->get("sport_gender") != 0) { $sport_gender = SportsRepository::getSportsGender()[$request->get("sport_gender")]; } if ($request->has("country") && trim($request->get("country")) != "" && $request->get("country") != 0) { $state = BasicSiteRepository::getListOfCountries()[$request->get("country")]; } if ($request->has("state") && trim($request->get("state")) != "" && $request->get("state") != 0) { $state = BasicSiteRepository::getAmericanState()[$request->get("state")]; } return redirect('admin/viewManager/' . $name . '/' . $manager_type . '/' . $sport . '/' . $sport_gender . '/' . $state); }
/** * Opportunities for Sport Talent - either Aspiring professional or Student * @param $state * @param $institution_tye * @param $gender * @param $sport_type */ public function talentOpportunities($state = null, $institution_type = null, $gender = null, $sport_type = null, $country = null) { $talent_management_level = Session::get(SiteSessions::USER_MANAGEMENT_LEVEL); $managers = null; switch ($talent_management_level) { case SiteConstants::USER_TALENT_MANAGEMENT_LEVEL_STUDENT: //Management level and Gender requested by the user. $managerManagementLevel = null; //If Institution type is "High School" if ($institution_type == 1) { $managerManagementLevel = SiteConstants::USER_MANAGER_MANAGEMENT_LEVEL_HIGH_SCHOOL; } else { if ($institution_type == 2) { $managerManagementLevel = SiteConstants::USER_MANAGER_MANAGEMENT_LEVEL_UNIVERSITY; } } $managers = ManagersDatabase::managerType(SiteConstants::USER_MANAGER_COACH)->managementLevel($managerManagementLevel)->state($state)->sportGender($gender)->sport($sport_type)->paginate(25); break; case SiteConstants::USER_TALENT_MANAGEMENT_LEVEL_ASPIRING_PRO: $managers = ManagersDatabase::country($country)->sport($sport_type)->sportGender($gender)->whereIn('management_level', [SiteConstants::USER_MANAGER_MANAGEMENT_LEVEL_AMATEUR, SiteConstants::USER_MANAGER_MANAGEMENT_LEVEL_PRO, SiteConstants::USER_MANAGER_MANAGEMENT_LEVEL_SEMI_PRO])->paginate(25); break; } $managers_already_contacted = DB::table("managers_contacted")->where('user_id', '=', Session::get(SiteSessions::USER_ID))->lists('manager_id'); $userProfile = UserProfile::find(Session::get(SiteSessions::USER_ID)); $userProfile->getMutatedData = false; $sport_gender = array_map('ucfirst', array_merge(['0' => '-- Select Option --'], SportsRepository::getSportsGender())); $state = array_map('ucfirst', array_merge(['0' => "-- Select State --"], BasicSiteRepository::getAmericanState())); $institution_type = array_map('ucfirst', UserProfileRepository::getInstituteType()); $country = array_map('ucfirst', BasicSiteRepository::getListOfCountries()); return view('database.talent_database_search_result', compact('managers', 'managers_already_contacted', 'userProfile', 'sport_gender', 'state', 'institution_type', 'country')); }
<p>Please provide as much information as you can.</p> <?php use Illuminate\Support\Facades\Session; use talenthub\Repositories\SiteSessions; use talenthub\Repositories\SportsRepository; $dataMap = talenthub\TalentCareerStatisticsModels\SwimmingStatistics::$dataMap; if (count($sportStatistics) == 0) { $sportStatistics[0] = new talenthub\TalentCareerStatisticsModels\SwimmingStatistics(); } $event_type = ["0" => "-- Select Type --"]; foreach (SportsRepository::getSportPositions(Session::get(SiteSessions::USER_SPORT_TYPE)) as $key => $value) { $event_type[$value] = $value; } ?> <div class="duplicate_content_container form_container"> <div class="duplicate_this_content carrer_statistics"> <div class="row"> <div class="col-xs-11 col-xs-offset-1"> <table class="table"> <caption>Event Detail</caption> <tr> <th width="150px">Event Name</th> <th>Distance</th> <th >Type</th> <th >min</th> <th >sec</th> <th>hun</th> <th >date</th> </tr> <tbody class="form_container">
/** * Storing corresponding text of the index selected by the admin * @param $manager_type */ public function setsportGenderAttribute($sport_gender) { $this->attributes["sport_gender"] = SportsRepository::getSportsGender()[$sport_gender]; }
/** * Getting param data from database and modifying it to an array of corresponding field values * @param $param */ public function getparamsAttribute($param) { if ($this->getMutatedData) { $finalArray = []; $userProfileParamsKeys = SportsRepository::getExtraParamsKeysUserProfile(); foreach ($userProfileParamsKeys as $key) { $finalArray[$key] = ""; } $dataParam = explode("|", $param); foreach ($dataParam as $data) { $var = explode(":", $data); if (in_array($var[0], $userProfileParamsKeys)) { $finalArray[array_search($var[0], $userProfileParamsKeys)] = $var[1]; } } return $finalArray; } return ucfirst($param); }
/** * Mutating Most Played Position value to have index value after retrieving it from database * @param $school_type */ public function getclubSchoolMostPlayedPositionAttribute($most_played_position) { if ($this->getMutatedData) { return array_search($most_played_position, SportsRepository::getSportPositions(Session::get(SiteSessions::USER_SPORT_TYPE))); } return $most_played_position; }
@extends('app') @section('content') <?php $sport_type = Session::get(\talenthub\Repositories\SiteSessions::USER_SPORT_TYPE); $userProfileExtraParamsKey = \talenthub\Repositories\SportsRepository::getExtraParamsKeysUserProfile(); ?> <div ng-app="edit-profile"> <div class="container edit-profile" ng-controller="tabController as tab"> <div class="row"> <div class="col-xs-12 col-lg-3"> @include("templates.menu.left_menu_edit_profile") </div> <div class="col-xs-12 col-lg-9"> @if(Session::has("cv_update_status")) <div class="col-lg-12"> @if(Session::get("cv_update_status") == "successfull") <p class="alert alert-success">Your CV saved successfully</p> @endif </div> @endif <div class="row"> {!! Form::model($talentProfile,['method'=>'PUT','url'=>'profile/CV','novalidate','name'=>'talent_CV']) !!} <div class="col-xs-12 col-lg-12 "> <h1>Curriculum Vitae</h1> @include("errors.error_raw_list")
/** * --------- Need to implement this logic ------- Logic is that Validate data, if errors then create a session's flash * and store all the user data in it and then make changes on the view to reflect it * * Validating data for CV * @param $request */ public function validateCVData($request) { $rules = []; if ($request->has("positions")) { foreach ($request->get("positions") as $key => $value) { $rules['positions.' . $key] = "in:" . implode(",", array_keys(SportsRepository::getSportPositions(Session::get(SiteSessions::USER_SPORT_TYPE)))); } $rules['preferred_position'] = 'in:' . implode(",", array_keys(SportsRepository::getSportPositions(Session::get(SiteSessions::USER_SPORT_TYPE)))); } $validator = Validator::make($request->all(), $rules); if ($validator->fails()) { //dd($validator->errors()); } //dd($validator); }