public function postSelectPackage()
 {
     //verify the user input and create account
     $validator = Validator::make(Input::all(), array('Package' => 'required'));
     if ($validator->fails()) {
         return Redirect::route('advanced_squeeb-get')->withInput()->with('global', 'Please select a package.');
     } else {
         $package = Input::get('Package');
         View::share('package', $package);
         //check for the world package
         if ($package == 'pkg1') {
             $countries = Country::all();
             View::share('countries', $countries);
             $obj = new BaseController();
             $countryid = 0;
             $countryname = $obj->getCountryName();
             if ($countryname != 'NONE') {
                 $locationcountry = Country::where('name', '=', $countryname);
                 if ($locationcountry->count()) {
                     $countryid = $locationcountry->first()->id;
                     $colleges = Institution::where('country_id', '=', $countryid)->get();
                     View::share('colleges', $colleges);
                 }
             }
             View::share('countryid', $countryid);
             return View::make('guest.advancedselectcollege');
         } else {
             if ($package == 'pkg2') {
                 $countries = Country::all();
                 View::share('countries', $countries);
                 $obj = new BaseController();
                 $countryid = 0;
                 $countryname = $obj->getCountryName();
                 if ($countryname != 'NONE') {
                     $locationcountry = Country::where('name', '=', $countryname);
                     if ($locationcountry->count()) {
                         $countryid = $locationcountry->first()->id;
                     }
                 }
                 View::share('countryid', $countryid);
                 return View::make('guest.advancedpostcountry')->with('msg', 'Country Squeeb Package');
             }
         }
         if ($package == 'pkg3') {
             return View::make('guest.advancedpost')->with('msg', 'World Squeeb Package');
         }
     }
 }
Exemple #2
0
 function get_logged_company()
 {
     if (!$this->is_signed_in()) {
         return NULL;
     } else {
         if ($this->CI->session->userdata('company_id') || $this->CI->session->userdata('institution_id')) {
             $c = new Company();
             $c->where('id', $this->CI->session->userdata('company_id'))->get();
             if ($c->exists()) {
                 return $c;
             } else {
                 $c = new Institution();
                 $c->where('id', $this->CI->session->userdata('institution_id'))->get();
                 if ($c->exists()) {
                     return $c;
                 }
             }
         }
         return NULL;
     }
 }
 public function getSelectCountry($code)
 {
     $code = strtoupper($code);
     $countryid = Country::where('code', '=', $code)->first()->id;
     //get the country name
     $countryname = Country::where('id', '=', $countryid)->first()->name;
     //query the database for colleges in that country
     $colleges = Institution::where('country_id', '=', $countryid)->orderBy('name', 'ASC')->get();
     if ($colleges->count()) {
         $countries = Country::where('id', '>', 0)->get();
         View::share('countries', $countries);
         View::share('colleges', $colleges);
         View::share('countryid', $countryid);
         View::share('countryname', $countryname);
         return View::make('guest.selectcampus1');
     } else {
         $countries = Country::where('id', '>', 0)->get();
         View::share('countries', $countries);
         return Redirect::route('selectcampus-get')->withInput()->with('global', 'No Colleges were found in ' . $countryname . '!<br>Please <a href="http://www.squeeber.com/signup">add your college</a> and invite friends');
     }
     return Redirect::route('selectcampus-get')->withInput()->with('global', 'Sorry!! Campus details were not loaded, please retry.');
 }
 public function postNewCampus()
 {
     //verify the user input and create account
     $validator = Validator::make(Input::all(), array('Country' => 'required|exists:countrys,id'));
     if ($validator->fails()) {
         return Redirect::route('newcampus-get')->withErrors($validator)->withInput()->with('global', 'Sorry!! College details were not posted, please retry.');
     } else {
         $countryid = Input::get('Country');
         //query the database for colleges in that country
         $colleges = Institution::where('country_id', '=', $countryid)->get();
         if ($colleges->count()) {
             $countries = Country::where('id', '>', 0)->get();
             View::share('countries', $countries);
             View::share('colleges', $colleges);
             View::share('countryid', $countryid);
             return View::make('member.addcampus2');
         } else {
             $countries = Country::where('id', '>', 0)->get();
             View::share('countries', $countries);
             return Redirect::route('newcampus-get')->withInput()->with('global', 'No Colleges were found in this country!');
         }
         return Redirect::route('newcampus-get')->withInput()->with('global', 'Sorry!! Campus details were not posted, please retry.');
     }
 }