public function getListOfSports(Request $request)
 {
     //List of Sports
     $sports = BasicSiteRepository::getSportTypes();
     array_shift($sports);
     $this->response['sports'] = $sports;
     return $this->sendResponse($this->response);
 }
 /**
  * Storing corresponding text of the index selected by the admin
  * @param $state
  */
 public function setstateAttribute($state)
 {
     if ($this->setMutatedData) {
         $this->attributes["state"] = $state != null && $state != "" && $state != 0 ? BasicSiteRepository::getAmericanState()[$state] : "";
     } else {
         $this->attributes["state"] = BasicSiteRepository::getAmericanState()[$state];
     }
 }
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     if (SiteConstants::isTalent(Session::get(SiteSessions::USER_TYPE))) {
         return ['dob' => 'date', 'gender' => 'in:' . implode(",", array_keys(UserProfileRepository::getUserGender())), 'height' => '', 'weight' => '', 'mobile_number' => 'numeric', 'home_number' => 'numeric', 'address_type' => 'in:' . implode(",", array_keys(UserProfileRepository::getAddressTypes())), 'zip' => 'numeric', 'country' => 'in:' . implode(",", array_keys(BasicSiteRepository::getListOfCountries())), 'graduation_year' => 'numeric', 'father_mobile_number' => 'numeric', 'father_living_with' => 'in:' . implode(",", array_keys(UserProfileRepository::getLivingWithType())), 'mother_mobile_number' => 'numeric', 'mother_living_with' => 'in:' . implode(",", array_keys(UserProfileRepository::getLivingWithType())), 'guardian_mobile_number' => 'numeric', 'guardian_living_with' => 'in:' . implode(",", array_keys(UserProfileRepository::getLivingWithType())), 'school_type' => 'in:' . implode(",", array_keys(UserProfileRepository::getInstituteType())), 'school_zip' => 'regex:/^\\d{4,5}$/', 'school_country' => 'in:' . implode(",", array_keys(BasicSiteRepository::getListOfCountries())), 'school_contact_person_phone' => 'numeric', 'grade_avg' => 'in:' . implode(",", array_keys(UserProfileRepository::getGradeAverageType())), 'sat_verbal' => 'regex:/^\\d+(\\.?\\d+)?$/', 'sat_math' => 'regex:/^\\d+(\\.?\\d+)?$/', 'sat_writing' => 'regex:/^\\d+(\\.?\\d+)?$/', 'sat_reading' => 'regex:/^\\d+(\\.?\\d+)?$/', 'sat_overall' => 'regex:/^\\d+(\\.?\\d+)?$/', 'pact' => 'regex:/^\\d+(\\.?\\d+)?$/', 'act' => 'regex:/^\\d+(\\.?\\d+)?$/', 'psat' => 'regex:/^\\d+(\\.?\\d+)?$/'];
     } else {
         if (SiteConstants::isManager(Session::get(SiteSessions::USER_TYPE))) {
             return ['dob' => 'date', 'gender' => 'in:' . implode(",", array_keys(UserProfileRepository::getUserGender())), 'mobile_number' => 'numeric', 'home_number' => 'numeric', 'address_type' => 'in:' . implode(",", array_keys(UserProfileRepository::getAddressTypes())), 'zip' => 'numeric', 'country' => 'in:' . implode(",", array_keys(BasicSiteRepository::getListOfCountries()))];
         }
     }
 }
 /**
  * Redirect the user to Sign Up page
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View
  */
 public function signUp()
 {
     if (Auth::user()) {
         return redirect('/home');
     }
     $sport_types = BasicSiteRepository::getSportTypes();
     $userManagerManagementLevel = BasicSiteRepository::getUserManagementLevelType(SiteConstants::USER_MANAGER);
     $managerTypes = array_merge(["0" => "-- Select Option --"], BasicSiteRepository::getManagerTypes());
     return view('sign_up', compact('sport_types', 'userManagerManagementLevel', 'managerTypes'));
 }
Example #5
0
 public function setmanagementLevelAttribute($management_level)
 {
     if (SiteConstants::isManager($this->attributes['user_type'])) {
         $this->attributes['management_level'] = BasicSiteRepository::getUserManagementLevelType(SiteConstants::USER_MANAGER)[$management_level];
     } else {
         if (SiteConstants::isTalent($this->attributes['user_type'])) {
             $this->attributes['management_level'] = BasicSiteRepository::getUserManagementLevelType(SiteConstants::USER_TALENT)[$management_level];
         }
     }
 }
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 public function create(array $data)
 {
     if (SiteConstants::isManager($data["user_type"])) {
         $userType = BasicSiteRepository::getManagerTypes()[$data["managerType"]];
         return User::create(['username' => $data['username'], 'password' => $data['password'], 'active' => 0, 'user_type' => $userType, 'management_level' => $data['management_level'], 'sport_type' => $data['sport_type'], 'profile_image_path' => $data['profile_image_path'], 'confirmation_token' => bcrypt(time())]);
     } else {
         if (SiteConstants::isTalent($data["user_type"])) {
             return User::create(['username' => $data['username'], 'password' => $data['password'], 'active' => 0, 'user_type' => $data['user_type'], 'management_level' => $data['management_level'], 'sport_type' => $data['sport_type'], 'profile_image_path' => $data['profile_image_path'], 'confirmation_token' => bcrypt(time())]);
         }
     }
 }
Example #7
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 public function create(array $data)
 {
     if (SiteConstants::isManager($data["user_type"])) {
         $userType = BasicSiteRepository::getManagerTypes()[$data["managerType"]];
         $user = null;
         $user = DB::transaction(function () use($data, $user, $userType) {
             $user = User::create(['username' => $data['username'], 'password' => $data['password'], 'active' => 0, 'user_type' => $userType, 'management_level' => $data['management_level'], 'sport_type' => $data['sport_type'], 'profile_image_path' => $data['profile_image_path'], 'confirmation_token' => bcrypt(time())]);
             $user->managerProfile()->create(['first_name' => '', 'middle_name' => '', 'last_name' => '']);
             return $user;
         });
         return $user;
     } else {
         if (SiteConstants::isTalent($data["user_type"])) {
             return User::create(['username' => $data['username'], 'password' => $data['password'], 'active' => 0, 'user_type' => $data['user_type'], 'management_level' => $data['management_level'], 'sport_type' => $data['sport_type'], 'profile_image_path' => $data['profile_image_path'], 'confirmation_token' => bcrypt(time())]);
         }
     }
 }
 /**
  * Mutator to update country name to index number from database before showing to user
  * @param $country
  */
 public function getcareerCountryAttribute($country)
 {
     return array_search($country, BasicSiteRepository::getListOfCountries());
 }
 /**
  * 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'));
 }
                                                'data-toggle'=>'tooltip','data-placement'=>'bottom','title'=>'Value is required',
                                                'ng-model'=>'first_name','ng-init'=>'first_name = "'.$userProfile->first_name.'"']) !!}
                                            </div>
                                        </div>
                                        <div class="col-xs-12 col-lg-4">
                                            <div class="form-group">
                                                {!! Form::label('last_name',"Last Name:") !!}
                                                {!! Form::text('last_name',$userProfile->last_name,['class'=>'form-control',
                                                'ng-model'=>'last_name','ng-init'=>'last_name = "'.$userProfile->last_name.'"']) !!}
                                            </div>
                                        </div>

                                        <div class="col-xs-12 col-lg-4">
                                            <div class="form-group">
                                                <?php 
$countryCode = array_search($userProfile->country, \talenthub\Repositories\BasicSiteRepository::getListOfCountries());
?>
                                                {!! Form::label('country',"Country:") !!}
                                                {!! Form::select('country',$country,$countryCode,['class'=>'form-control','data-validate'=>'select',
                                                'data-invalidValue'=>'0','data-toggle'=>'tooltip','data-placement'=>'bottom',
                                                'title'=>'Select proper option from the list provided.','ng-model'=>'country',
                                                'ng-init'=>'country = "'.$countryCode.'"']) !!}
                                            </div>
                                        </div>
                                    </div>

                                    <div class="row">
                                        <div class="col-xs-12 col-lg-12">
                                            <div class="form-group">
                                                {!! Form::label('about',"About:") !!}
                                                {!! Form::textarea('about',null,['class'=>'form-control','ng-model'=>'about',
 /**
  * Mutating country before presenting it to a user
  * @param $country
  * @return mixed
  */
 public function getschoolCountryAttribute($country)
 {
     if ($this->getMutatedData) {
         return array_search($country, BasicSiteRepository::getListOfCountries());
     }
     return ucfirst($country);
 }
 /**
  *Showing User's Profile, A user can be manager or talent
  */
 public function showUserProfile($id)
 {
     Blade::setContentTags('<%', '%>');
     // for variables and all things Blade
     Blade::setEscapedContentTags('<%%', '%%>');
     // for escaped data
     if ($this->checkIfGuestDoNotHavePermission($id, UserSettings::PRIVACY_TYPE_PROFILE)) {
         return redirect('/');
     }
     $userProfile = UserProfile::find($id);
     $userProfile->getMutatedData = false;
     $country = BasicSiteRepository::getListOfCountries();
     //        $sportPositions=array_map('ucfirst',SportsRepository::getSportPositions(Session::get(SiteSessions::USER_SPORT_TYPE)));
     $userCareerHistory = $userProfile->careerInformation;
     $awards = $userProfile->awards;
     if ($awards == null) {
         $awards = new Awards();
     }
     $endorsements = $userProfile->endorsements()->take(10)->get();
     $visitingUserEndorsed = $userProfile->endorsements()->wherePivot('user_id', '=', $userProfile->user_id)->wherePivot('endorsement_by', '=', Session::get(SiteSessions::USER_ID))->get();
     if (count($visitingUserEndorsed) <= 0) {
         $visitingUserEndorsed = 0;
     } else {
         $visitingUserEndorsed = 1;
     }
     //Setting whether profile is editable or not.
     $profileEditable = false;
     if ($userProfile->user_id == Session::get(SiteSessions::USER_ID)) {
         $profileEditable = true;
     }
     //Setting whether profile is favourited by visiting user or not
     $visitingUserFavourited = DB::table('favourite')->where('user_id', '=', Session::get(SiteSessions::USER_ID))->where('favourited_to', '=', $userProfile->user_id)->get();
     if (count($visitingUserFavourited) > 0) {
         $visitingUserFavourited = 1;
     } else {
         $visitingUserFavourited = 0;
     }
     return view('profile.user_profile', compact('userProfile', 'country', 'userCareerHistory', 'awards', 'endorsements', 'visitingUserEndorsed', 'profileEditable', 'visitingUserFavourited'));
 }