Beispiel #1
0
 public function postAddparticipant($idCourse)
 {
     $course = Courses::find($idCourse);
     $usertype = UserTypes::find(Input::get('usertype'));
     $participant = ORGParticipants::find(Input::get('participante'));
     if ($participant->participant == null) {
         $user = new User();
         $user->name = $participant->nome;
         $user->email = $participant->email;
         $user->type = 'participant';
         $user->save();
         $new_participant = new Participants();
         $new_participant->participant = $participant->id_participante;
         $new_participant->user = $user->id;
         $new_participant->name = $participant->nome;
         $new_participant->email = $participant->email;
         $new_participant->cpf = $participant->cpf;
         $new_participant->type = 'participant';
         $new_participant->status = 'publish';
         $new_participant->save();
         $inscription = new Inscriptions();
         $inscription->id_course = $course->id;
         $inscription->id_user = $user->id;
         $inscription->id_usertype = $usertype->id;
         $inscription->save();
     } else {
         $this_participant = $participant->participant;
         if ($this_participant->user == null) {
             $user = new User();
             $user->name = $participant->nome;
             $user->email = $participant->email;
             $user->type = 'participant';
             $user->save();
             $this_participant->user = $user->id;
             $this_participant->save();
         }
         $inscription = new Inscriptions();
         $inscription->id_course = $course->id;
         $inscription->id_user = $this_participant->user;
         $inscription->id_usertype = $usertype->id;
         $inscription->save();
     }
     return Redirect::to(self::parseRoute($idCourse));
 }
 public function postTrabalhoactualizacaoparticipante()
 {
     $course = Input::get('course');
     $usertype = Input::get('usertype');
     $inscription = Inscriptions::find(Input::get('inscription'));
     $estado = ORGStates::where('id_estado', '=', Input::get('estado'))->take(1)->get();
     $estado_empresa = ORGStates::where('id_estado', '=', Input::get('estado_empresa'))->take(1)->get();
     $participant = ORGParticipants::find(Input::get('id'));
     $participant->nome = Input::get('nome');
     $participant->rg = Input::get('rg');
     $participant->cpf = Input::get('cpf');
     $participant->endereco = Input::get('endereco');
     $participant->numero = Input::get('numero');
     $participant->complemento = Input::get('complemento');
     $participant->cep = Input::get('cep');
     $participant->cidade = Input::get('cidade');
     $participant->estado = $estado[0]->name_estado;
     $participant->empresa = Input::get('empresa');
     /*$participant->cnpj = Input::get('cnpj_empresa');
     		$participant->endereco_empresa = Input::get('endereco_empresa');
     		$participant->numero_empresa = Input::get('nome');
     		$participant->complemento_empresa = Input::get('complemento_empresa');
     		$participant->cep_empresa = Input::get('cep_empresa');
     		$participant->cidade_empresa = Input::get('cidade_empresa');
     		$participant->estado_empresa = $estado_empresa[0]->name_estado;
     		$participant->celular = Input::get('celular_empresa');*/
     $participant->telefone = Input::get('telefone_empresa');
     $participant->email = Input::get('email');
     $participant->save();
     Auth::user()->login($participant->participant->getuser);
     $array = array('msg_success' => Lang::get('messages.login_welcome'), 'usertype' => $usertype, 'inscription' => $inscription);
     return Redirect::to($inscription->course->route . '/arquivos')->with($array);
 }
 public function getDelete($id = '')
 {
     if ($id == '') {
         return Redirect::to($this->route)->with('msg_error', Lang::get('messages.participants_display_err'));
     } else {
         $participant = ORGParticipants::find($id);
         $delete = ORGParticipants::destroy($id);
         if (!$delete) {
             return Redirect::to($this->route)->with('msg_error', Lang::get('messages.participants_delete_err', array('title' => $participant->title)));
         } else {
             return Redirect::to($this->route)->with('msg_success', Lang::get('messages.participants_delete', array('title' => $participant->title)));
         }
     }
 }