Example #1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Club();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Club'])) {
         $model->attributes = $_POST['Club'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->clubId));
         }
     }
     $this->render('create', array('model' => $model));
 }
 /**
 * Store a newly created resource in storage.
 * POST /administratorclub
 *
 * @return Response
 */
 public function store()
 {
     $uuid = Uuid::generate();
     $validator = Validator::make(Input::all(), AdministratorClub::$rules);
     if ($validator->passes()) {
         $repo = App::make('UserRepository');
         $user = $repo->signup(Input::all());
         $role = Role::find(2);
         $user->attachRole($role);
         if ($user->id) {
             $profile = new Profile();
             $profile->user_id = $user->id;
             $profile->firstname = Input::get('firstname');
             $profile->lastname = Input::get('lastname');
             $profile->mobile = Input::get('mobile');
             $profile->avatar = '/img/coach-avatar.jpg';
             $profile->save();
             $club = new Club();
             $club->id = $uuid;
             $club->name = Input::get('name');
             $club->sport = 'lacrosse';
             $club->phone = Input::get('contactphone');
             $club->website = Input::get('website');
             $club->email = Input::get('contactemail');
             $club->add1 = Input::get('add1');
             $club->city = Input::get('city');
             $club->state = Input::get('state');
             $club->zip = Input::get('zip');
             $club->logo = Input::get('logo');
             $club->waiver = Input::get('waiver');
             $club->processor_user = Crypt::encrypt(Input::get('processor_user'));
             $club->processor_pass = Crypt::encrypt(Input::get('processor_pass'));
             $club->save();
             $clubs = Club::find($uuid);
             $clubs->users()->save($user);
             if (Config::get('confide::signup_email')) {
                 Mail::queueOn(Config::get('confide::email_queue'), Config::get('confide::email_account_confirmation'), compact('user'), function ($message) use($user) {
                     $message->to($user->email, $user->username)->subject(Lang::get('confide::confide.email.account_confirmation.subject'));
                 });
             }
             return Redirect::action('UsersController@login')->with('notice', Lang::get('confide::confide.alerts.account_created'));
         } else {
             $error = $user->errors()->all(':message');
             return Redirect::back()->withInput(Input::except('password'))->withErrors($error);
         }
     }
     return Redirect::back()->withErrors($validator)->withInput();
 }
Example #3
0
 /**
  * 
  * @param stdClass $club
  * return Club
  */
 protected function convertClub(stdClass $club)
 {
     $oClub = Club::getByNefubId($club->ID);
     if (!$oClub) {
         $oClub = new Club();
         $oClub->nefub_id = $club->ID;
         $oClub->name = $club->Name;
         $oClub->city = $club->Place;
         if ($club->Website) {
             $oClub->website = 'http://' . str_replace('http://', '', $club->Website);
         }
         $oClub->email = $club->Email;
         $oClub->save();
     }
     return $oClub;
 }
     if (isset($_POST['nom']) && isset($_POST['localisation'])) {
         $club = new Club();
         $club->setNom($_POST['nom']);
         $club->setLocalisation($_POST['localisation']);
         $club->save();
         header('Location: ' . $config['url'] . "/" . basename(__FILE__));
     }
     render("clubs/ajouter", array());
     break;
 case "editer":
     if (isset($_POST['nom']) && isset($_POST['localisation']) && isset($_POST['id'])) {
         $club = new Club();
         $club->setId($_POST['id']);
         $club->setNom($_POST['nom']);
         $club->setLocalisation($_POST['localisation']);
         $club->save();
         header('Location: ' . $config['url'] . "/" . basename(__FILE__));
     }
     if (isset($_GET['id'])) {
         $club_id = intval($_GET['id']);
         render("clubs/editer", array('club' => $cr->findById($club_id)));
     } else {
         header('Location: ' . $config['url'] . "/" . basename(__FILE__));
     }
     break;
 case "supprimer":
     if (isset($_GET['id'])) {
         $club_id = intval($_GET['id']);
         $club = new Club();
         $club->setId($club_id);
         $club->delete();
 private function saveClubInfo($user)
 {
     $title = Input::get('club_title', '');
     $brief = Input::get('club_brief', '');
     $img_token = Input::get('img_token_2', '');
     if ($title) {
         $club = Club::where('u_id', '=', $user->u_id)->first();
         if (empty($club)) {
             $club = new Club();
             $club->u_id = $user->u_id;
             $club->s_id = $user->u_school_id;
             $club->c_title = $title;
             $club->addClub();
         }
         $club->c_title = $title;
         $club->c_brief = $brief;
         $c_id = $club->c_id;
         $imgObj = new Img('club', $img_token);
         $club->c_imgs = $imgObj->getSavedImg($c_id, $club->c_imgs);
         $club->save();
     }
     return true;
 }