Esempio n. 1
0
 private static function getConstants()
 {
     if (self::$constCache === NULL) {
         $reflect = new ReflectionClass(get_called_class());
         self::$constCache = $reflect->getConstants();
     }
     return self::$constCache;
 }
Esempio n. 2
0
 public function getCreate($idCourse, $idUserType, $idDate = '')
 {
     $course = Courses::find($idCourse);
     if ($course) {
         $usertype = UserTypes::find($idUserType);
         if ($usertype) {
             return View::make('backend.dates.create', array('course' => $course, 'usertype' => $usertype, 'route' => self::parseRoute($idCourse, $idUserType)));
         } else {
             return Redirect::to(self::parseRoute($idCourse, $idUserType))->with(array('msg_error' => Lang::get('messages.usertype_not_found')));
         }
     } else {
         return Redirect::to($this->ancestor)->with(array('msg_error' => Lang::get('messages.course_not_found')));
     }
 }
Esempio n. 3
0
 public function postTrabalhocadastro()
 {
     $course = Courses::find(Input::get('course'));
     $usertype = UserTypes::find(Input::get('usertype'));
     $estado = ORGStates::where('id_estado', '=', Input::get('estado'))->take(1)->get();
     $estado_empresa = ORGStates::where('id_estado', '=', Input::get('estado_empresa'))->take(1)->get();
     //dd(Input::all());
     $participant = new ORGParticipants();
     $participant->nome = Input::get('nome') != null ? Input::get('nome') : '';
     $participant->rg = Input::get('rg') != null ? Input::get('rg') : '';
     $participant->cpf = Input::get('cpf') != null ? Input::get('cpf') : '';
     $participant->endereco = Input::get('endereco') != null ? Input::get('endereco') : '';
     $participant->numero = Input::get('numero') != null ? Input::get('numero') : '';
     $participant->complemento = Input::get('complemento') != null ? Input::get('complemento') : '';
     $participant->cep = Input::get('cep') != null ? Input::get('cep') : '';
     $participant->cidade = Input::get('cidade') != null ? Input::get('cidade') : '';
     $participant->estado = isset($estado[0]->name_estado) ? $estado[0]->name_estado : '';
     /*$participant->empresa = Input::get('empresa') != null ? Input::get('empresa') : '';
     		$participant->cnpj = Input::get('cnpj_empresa') != null ? Input::get('cnpj_empresa') : '';
     		$participant->endereco_empresa = Input::get('endereco_empresa') != null ? Input::get('endereco_empresa') : '';
     		$participant->numero_empresa = Input::get('nome') != null ? Input::get('nome') : '';
     		$participant->complemento_empresa = Input::get('complemento_empresa') != null ? Input::get('complemento_empresa') : '';
     		$participant->cep_empresa = Input::get('cep_empresa') != null ? Input::get('cep_empresa') : '';
     		$participant->cidade_empresa = Input::get('cidade_empresa') != null ? Input::get('cidade_empresa') : '';
     		$participant->estado_empresa = isset($estado_empresa[0]->name_estado) ? $estado_empresa[0]->name_estado : '';
     		$participant->celular = Input::get('celular_empresa') != null ? Input::get('celular_empresa') : '';*/
     $participant->telefone = Input::get('telefone_empresa') != null ? Input::get('telefone_empresa') : '';
     $participant->email = Input::get('email') != null ? Input::get('email') : '';
     $participant->save();
     $user = new User();
     $user->email = $participant->email;
     if ($participant->nome != null) {
         $user->name = $participant->nome;
     } else {
         $user->name = "User without name";
     }
     $user->status = 'publish';
     $user->type = 'participant';
     $user->save();
     $participant = ORGParticipants::getByCPF($participant->cpf);
     $part = new Participants();
     $part->participant = $participant[0]->id_participante;
     $part->user = $user->id;
     $part->email = $participant[0]->email;
     $part->name = $participant[0]->nome;
     $part->cpf = $participant[0]->cpf;
     $part->status = 'publish';
     $part->type = 'participant';
     $part->save();
     Auth::user()->login($user);
     if ($inscription = Inscriptions::hasInscription(Auth::user()->user()->id, $course->id)) {
         $array = array('msg_success' => Lang::get('messages.login_welcome'), 'usertype' => $usertype, 'inscription' => $inscription);
         return Redirect::to($course->route . '/arquivos')->with($array);
     } else {
         $inscription = new Inscriptions();
         $inscription->id_course = $course->id;
         $inscription->id_user = Auth::user()->user()->id;
         $inscription->id_usertype = $usertype->id;
         $inscription->save();
         $array = array('usertype' => $usertype, 'inscription' => $inscription);
         return Redirect::to($course->route . '/arquivos')->with($array);
     }
 }
Esempio n. 4
0
 public function postAddassociate($idCourse)
 {
     // dd(Input::get('usertype'));
     $course = Courses::find($idCourse);
     $usertype = UserTypes::find(Input::get('usertype'));
     $associate = ORGAssociates::find(Input::get('associado'));
     // dd($usertype);
     if ($associate->associate == null) {
         $user = new User();
         $user->name = $associate->nombre_completo;
         $user->email = $associate->email;
         $user->type = 'associate';
         $user->save();
         $new_associate = new Associates();
         $new_associate->associate = $associate->id_asociado;
         $new_associate->user = $user->id;
         $new_associate->name = $associate->nombre_completo;
         $new_associate->email = $associate->email;
         $new_associate->password = $associate->senha;
         $new_associate->cpf = $associate->cpf;
         $new_associate->type = 'associate';
         $new_associate->save();
         $inscription = new Inscriptions();
         $inscription->id_course = $course->id;
         $inscription->id_user = $user->id;
         $inscription->id_usertype = $usertype->id;
         $inscription->save();
     } else {
         $this_associate = $associate->associate;
         if ($this_associate->user == null) {
             $user = new User();
             $user->name = $associate->nombre_completo;
             $user->email = $associate->email;
             $user->type = 'associate';
             $user->save();
             $this_associate->user = $user->id;
             $this_associate->save();
         }
         $inscription = new Inscriptions();
         $inscription->id_course = $course->id;
         $inscription->id_user = $this_associate->user;
         $inscription->id_usertype = $usertype->id;
         $inscription->save();
     }
     return Redirect::to(self::parseRoute($idCourse));
 }
Esempio n. 5
0
 public function getDraft($idCourse = '', $id = '')
 {
     if ($id == '') {
         return Redirect::to($this->parseRoute($idCourse))->with('msg_error', Lang::get('messages.usertypes_display_err'));
     } else {
         $usertype = UserTypes::find($id);
         $draft = UserTypes::draft($id);
         if (!$draft) {
             return Redirect::to($this->parseRoute($idCourse))->with('msg_error', Lang::get('messages.usertypes_draft_err', array('title' => $usertype->title)));
         } else {
             return Redirect::to($this->parseRoute($idCourse))->with('msg_success', Lang::get('messages.usertypes_draft', array('title' => $usertype->title)));
         }
     }
 }