예제 #1
0
 function inscriptionAction()
 {
     $this->metas(array('DC.Title' => "Fiche d'inscription"));
     $this->branche->append();
     $m = new Wtk_Form_Model('inscription');
     // FICHE INDIVIDU
     $g = $m->addGroup('fiche');
     $i = $g->addString('prenom', "Prénom");
     $m->addConstraintRequired($i);
     $i = $g->addString('nom', "Nom");
     $m->addConstraintRequired($i);
     $t = new Unites();
     $sexes = $t->findSexesAccueillis();
     if (in_array('m', $sexes) || count($sexes) > 1) {
         $enum = array('h' => 'Masculin', 'f' => 'Féminin');
         $i = $g->addEnum('sexe', 'Sexe', null, $enum);
         $m->addConstraintRequired($i);
     } else {
         $i = $g->addString('sexe', 'Sexe', $sexes[0])->setReadonly(true);
     }
     $i = $g->addDate('naissance', "Date de naissance", 0);
     $m->addConstraintRequired($i);
     // COMPTE
     $g = $m->addGroup('compte');
     $i = $g->addEMail('adelec', "Adresse électronique");
     $t = new Inscriptions();
     $m->addConstraintForbid($i, $t->findAllEMails(), "Cette adresse électronique est déjà utilisée");
     $i0 = $g->addString('motdepasse', "Mot de passe");
     $m->addConstraintLength($i0, 6);
     $i1 = $g->addString('confirmer', "Confirmer");
     $m->addConstraintEqual($i1, $i0);
     $i = $g->addString('presentation', "Présentation");
     $m->addConstraintRequired($i);
     $this->view->model = $pm = new Wtk_Pages_Model_Form($m);
     if ($pm->validate()) {
         $data = $m->get('fiche');
         $data['adelec'] = strtolower($m->get('compte/adelec'));
         $data['password'] = Users::hashPassword($m->get('compte/adelec'), $m->get('compte/motdepasse'));
         $data['presentation'] = $m->compte->presentation;
         $db = $t->getAdapter();
         $db->beginTransaction();
         try {
             $k = $t->insert($data);
             $i = $t->findOne($k);
             $this->logger->info("Nouvelle inscription", $this->_helper->Url('valider', 'membres', null, array('adelec' => $i->adelec)));
             $this->_helper->Flash->info("Inscription en modération");
             $mail = new Strass_Mail_Inscription($i);
             try {
                 $mail->send();
             } catch (Zend_Mail_Transport_Exception $e) {
                 $this->logger->error("Échec de l'envoi de mail aux admins", null, $e);
             }
             $db->commit();
         } catch (Exception $e) {
             $db->rollBack();
             throw $e;
         }
         $this->redirectSimple('index', 'unites', null, array(), true);
     }
 }
예제 #2
0
 function indexAction()
 {
     $this->metas(array('DC.Title' => 'Administration'));
     $this->actions->append("Paramètres du site", array('action' => 'parametres'));
     $this->view->indicateurs = $m = new Wtk_Table_Model('label', 'url', 'compteur', 'level');
     $config = Zend_Registry::get('config');
     $m->append('Version', null, Strass_Version::PROJET, array('version-produit', 'notice'));
     $m->append('Version des données', null, Strass_Version::dataCurrent(), array('version-data', strass_admin_count_level(Strass_Version::DATA - Strass_Version::dataCurrent(), 1, 1)));
     $m->append('Association', null, strtoupper($config->system->association), 'notice');
     $t = new Inscriptions();
     $count = $t->countRows();
     $m->append("Inscriptions à valider", $this->_helper->Url('valider', 'membres'), $count, strass_admin_count_level($count, 1, 5));
     $t = new Unites();
     $count = $t->countRows();
     $m->append("Unités", $this->_helper->Url('unites'), $count, strass_admin_count_level(0 - $count, 0, 0));
     $t = new Individus();
     $count = $t->countRows();
     $m->append("Fiches d'individu", $this->_helper->Url('index', 'individus'), $count, 'notice');
     $t = new Users();
     $count = $t->countRows();
     $m->append("Membres", $this->_helper->Url('index', 'individus', null, array('filtre' => 'membres')), $count, 'notice');
     $t = new Citation();
     $count = $t->countRows();
     $m->append("Citations", $this->_helper->Url('index', 'citation'), $count, 'notice');
     $this->view->log = $m = new Wtk_Table_Model('date', 'level', 'logger', 'label', 'url', 'prenom-nom', 'fiche', 'detail-url');
     $t = new Logs();
     $events = $t->fetchAll($t->select()->order('date DESC')->limit(20));
     foreach ($events as $e) {
         $url = $this->_helper->Url('event', null, null, array('id' => $e->id));
         $u = $e->findParentUsers();
         if ($u) {
             $i = $u->findParentIndividus();
             $pn = $i->getFullname();
             $fiche = $this->_helper->Url('fiche', 'individus', null, array('individu' => $i->slug));
         } else {
             $pn = 'Visiteur';
             $fiche = null;
         }
         $m->append($e->date, strtolower($e->level), $e->logger, $e->message, $e->url, $pn, $fiche, $url);
     }
     $this->view->connexions = $m = new Wtk_Table_Model('date', 'prenom-nom', 'fiche');
     $t = new Users();
     $users = $t->fetchAll($t->select()->where('last_login')->order('last_login DESC')->limit(8));
     foreach ($users as $u) {
         $i = $u->findParentIndividus();
         $m->append($u->last_login, $i->getFullname(false, false), $this->_helper->Url('fiche', 'individus', null, array('individu' => $i->slug)));
     }
 }
예제 #3
0
 public function getIndex($idCourse, $idInscription)
 {
     $course = Courses::find($idCourse);
     $inscription = Inscriptions::find($idInscription);
     $files = $inscription->files;
     $array = array('course' => $course, 'inscription' => $inscription, 'files' => $files, 'route' => self::parseRoute($course->id, $idInscription), 'parent' => self::parseParent($course->id), 'ancestor' => self::$ancestor, 'msg_success' => Session::get('msg_success'), 'msg_error' => Session::get('msg_error'));
     return View::make('backend.inscriptions.files')->with($array);
 }
예제 #4
0
 public function postTrabalhoactualizacaoassociado()
 {
     $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 = ORGAssociates::find(Input::get('id'));
     $participant->nombre_completo = Input::get('nombre_completo') != null ? Input::get('nombre_completo') : $participant->nombre_completo;
     $participant->rg = Input::get('rg') != null ? Input::get('rg') : $participant->rg;
     $participant->razon_social = Input::get('razon_social') != null ? Input::get('razon_social') : $participant->razon_social;
     $participant->inscripcion_estadual = Input::get('inscription_estadual') != null ? Input::get('inscription_estadual') : $participant->inscripcion_estadual;
     $participant->inscripcion_municipal = Input::get('inscription_municipal') != null ? Input::get('inscription_municipal') : $participant->inscripcion_municipal;
     $participant->tipo_pessoa = Input::get('tipo_pessoa') != null ? Input::get('tipo_pessoa') : $participant->tipo_pessoa;
     $participant->cpf = Input::get('cpf') != null ? Input::get('cpf') : $participant->cpf;
     $participant->cnpj = Input::get('cnpj') != null ? Input::get('cnpj') : $participant->cnpj;
     $participant->passaporte = Input::get('passaporte') != null ? Input::get('passaporte') : $participant->passaporte;
     $participant->email = Input::get('email') != null ? Input::get('email') : $participant->email;
     $participant->web_site = Input::get('web_site') != null ? Input::get('web_site') : $participant->web_site;
     $participant->responsavel = Input::get('responsavel') != null ? Input::get('responsavel') : $participant->responsavel;
     $participant->observacao = Input::get('observacao') != null ? Input::get('observacao') : $participant->observacao;
     $participant->empresa = Input::get('empresa') != null ? Input::get('empresa') : $participant->empresa;
     $participant->cargo = Input::get('cargo') != null ? Input::get('cargo') : $participant->cargo;
     $participant->cep_res = Input::get('cep_res') != null ? Input::get('cep_res') : $participant->cep_res;
     $participant->cep_com = Input::get('cep_com') != null ? Input::get('cep_com') : $participant->cep_com;
     $participant->logradouro_res = Input::get('logradouro_res') != null ? Input::get('logradouro_res') : $participant->logradouro_res;
     $participant->logradouro_com = Input::get('logradouro_com') != null ? Input::get('logradouro_com') : $participant->logradouro_com;
     $participant->dir_res = Input::get('dir_res') != null ? Input::get('dir_res') : $participant->dir_res;
     $participant->dir_com = Input::get('dir_com') != null ? Input::get('dir_com') : $participant->dir_com;
     $participant->complemento_res = Input::get('complemento_res') != null ? Input::get('complemento_res') : $participant->complemento_res;
     $participant->complemento_com = Input::get('complemento_com') != null ? Input::get('complemento_com') : $participant->complemento_com;
     $participant->numero_res = Input::get('numero_res') != null ? Input::get('numero_res') : $participant->numero_res;
     $participant->numero_com = Input::get('numero_com') != null ? Input::get('numero_com') : $participant->numero_com;
     $participant->bairro_res = Input::get('bairro_res') != null ? Input::get('bairro_res') : $participant->bairro_res;
     $participant->bairro_com = Input::get('bairro_com') != null ? Input::get('bairro_com') : $participant->bairro_com;
     $participant->pais_res = Input::get('pais_res') != null ? Input::get('pais_res') : $participant->pais_res;
     $participant->pais_com = Input::get('pais_com') != null ? Input::get('pais_com') : $participant->pais_com;
     $participant->municipio_res = Input::get('municipio_res') != null ? Input::get('municipio_res') : $participant->municipio_res;
     $participant->municipio_com = Input::get('municipio_com') != null ? Input::get('municipio_com') : $participant->municipio_com;
     $participant->uf_res = Input::get('uf_res') != null ? Input::get('uf_res') : $participant->uf_res;
     $participant->uf_com = Input::get('uf_com') != null ? Input::get('uf_com') : $participant->uf_com;
     $participant->ddi_res = Input::get('ddi_res') != null ? Input::get('ddi_res') : $participant->ddi_res;
     $participant->ddi_com = Input::get('ddi_com') != null ? Input::get('ddi_com') : $participant->ddi_com;
     $participant->ddd_res = Input::get('ddd_res') != null ? Input::get('ddd_res') : $participant->ddd_res;
     $participant->ddd_com = Input::get('ddd_com') != null ? Input::get('ddd_com') : $participant->ddd_com;
     $participant->ddi_two_res = Input::get('ddi_two_res') != null ? Input::get('ddi_two_res') : $participant->ddi_two_res;
     $participant->ddi_two_com = Input::get('ddi_two_com') != null ? Input::get('ddi_two_com') : $participant->ddi_two_com;
     $participant->ddd_two_res = Input::get('ddd_two_res') != null ? Input::get('ddd_two_res') : $participant->ddd_two_res;
     $participant->ddd_two_com = Input::get('ddd_two_com') != null ? Input::get('ddd_two_com') : $participant->ddd_two_com;
     $participant->ddi_cel_res = Input::get('ddi_cel_res') != null ? Input::get('ddi_cel_res') : $participant->ddi_cel_res;
     $participant->ddi_cel_com = Input::get('ddi_cel_com') != null ? Input::get('ddi_cel_com') : $participant->ddi_cel_com;
     $participant->telefone_res = Input::get('telefone_res') != null ? Input::get('telefone_res') : $participant->telefone_res;
     $participant->telefone_com = Input::get('telefone_com') != null ? Input::get('telefone_com') : $participant->telefone_com;
     $participant->telefone_seg_res = Input::get('telefone_seg_res') != null ? Input::get('telefone_seg_res') : $participant->telefone_seg_res;
     $participant->telefone_seg_com = Input::get('telefone_seg_com') != null ? Input::get('telefone_seg_com') : $participant->telefone_seg_com;
     $participant->ddd_cel_res = Input::get('ddd_cel_res') != null ? Input::get('ddd_cel_res') : $participant->ddd_cel_res;
     $participant->ddd_cel_com = Input::get('ddd_cel_com') != null ? Input::get('ddd_cel_com') : $participant->ddd_cel_com;
     $participant->celular_res = Input::get('celular_res') != null ? Input::get('celular_res') : $participant->celular_res;
     $participant->celular_com = Input::get('celular_com') != null ? Input::get('celular_com') : $participant->celular_com;
     $participant->save();
     Auth::user()->login($participant->associate->getuser);
     $array = array('msg_success' => Lang::get('messages.login_welcome'), 'usertype' => $usertype, 'inscription' => $inscription);
     return Redirect::to($inscription->course->route . '/arquivos')->with($array);
 }
예제 #5
0
 public static function getCoursePayment($id, $course, $idContent)
 {
     if (count($course->inscriptions) > $course->min) {
         $inscription = Inscriptions::hasInscription(Auth::user()->user()->id, $course->id);
         $button = '';
         $message = '';
         foreach ($inscription->usertype->dates as $date) {
             $datetime1 = date_create($date->start);
             $datetime2 = date_create(date('Y-m-d'));
             $datetime3 = date_create($date->end);
             $interval1 = date_diff($datetime1, $datetime2);
             $interval2 = date_diff($datetime3, $datetime2);
             if ($interval1->format('%R') == '+' and $interval2->format('%R') == '-') {
                 $button = $date->button;
                 $message = $date->message;
             }
         }
     } elseif (count($course->inscriptions) >= $course->max) {
         $inscription = Inscriptions::hasInscription(Auth::user()->user()->id, $course->id);
         $button = '';
         $message = $course->max_message;
     } else {
         $inscription = Inscriptions::hasInscription(Auth::user()->user()->id, $course->id);
         $button = '';
         $message = $course->min_message;
     }
     $array = array('button' => $button, 'message' => $message, 'course' => $course, 'contents' => self::getOrderedContent($course->coursesections));
     return View::make('frontend.courses.payment')->with($array);
 }
예제 #6
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));
 }