public function login() { if ($this->auth->logged_in()) { $form = new Formation('auth_demo/logout', 'Log Out'); $form->submit('Logout Now'); } else { $form = new Formation(NULL, 'User Login'); $form->input('email')->label(true)->rules('required|length[4,32]'); $form->password('password')->label(true)->rules('required|length[5,40]'); $form->submit('Attempt Login'); if ($form->validate()) { // Load the user $user = new Model_User($form->email->value); // Attempt a login if ($this->auth->login($user, $form->password->value, true)) { echo '<h4>Login Success!</h4>'; $form = new Formation('auth_demo/logout', 'Log Out'); $form->submit('Logout Now'); } else { $form->password->add_error('login_failed', 'Invalid username or password.'); } } } // Display the form echo $form->render(); }
public function __get($key) { if ($key == 'type' || $key == 'name') { return $this->data[$key]; } elseif ($key == 'html_class') { return $this->key; } else { return parent::__get($key); } }
public function upload() { $profiler = new Profiler(); $form = new Formation(); $form->input('hello')->label(YES); $form->upload('file', YES)->label(YES)->rules('required|size[200KB]|allow[jpg,png,gif]'); $form->submit('Upload'); if ($form->validate()) { echo Eight::debug($form->as_array()); } echo $form->render(); }
if ($promo % 2 == 0) { $upload = FrankizUpload::fromFile(dirname(__FILE__) . '/../images/rouje.png'); $label = 'Chic à la rouje'; } else { $upload = FrankizUpload::fromFile(dirname(__FILE__) . '/../images/jone.png'); $label = 'Chic à la jone'; } $i = new FrankizImage(); $i->insert(); $i->caste($g->caste(Rights::everybody())); $i->label($label); $i->image($upload, false); $g->image($i); } // Update formations $formations = Formation::selectAll(FormationSelect::base()); foreach ($formations as $form) { // Update group $f = new UserFilter(new UFC_Study(new Formation($form->id()))); $g = update_group('formation_' . $form->abbrev(), $form->label(), Group::NS_STUDY, $f); $g->description($form->description()); // Admin caste if ($form->abbrev() == 'x') { $c = $g->caste(Rights::admin()); $c->select(CasteSelect::base()); if (!$c->userfilter()) { $uf_kes = new UserFilter(new UFC_Group(Group::from('kes'), Rights::admin())); $c->userfilter($uf_kes); } } }
/** * Add Config * * Merges a config array into the current config * * @access public * @param array $config * @return void */ public static function add_config($config) { self::$_config = array_merge_recursive(self::$_config, $config); // Add the forms from the config array if (isset(self::$_config['forms']) and is_array(self::$_config['forms'])) { foreach (self::$_config['forms'] as $form_name => $attributes) { $fields = $attributes['fields']; unset($attributes['fields']); self::add_form($form_name, $attributes, $fields); } unset(self::$_config['forms']); } }
<?php /* Date de création: 29/01/2009*/ if ($numpara) { $laForma=new Formation(); $laForma->numpara=$numpara; $laForma->infosFormation(); } $laPage = new Page(); $laPage->numpage=$numpage; $laPage->infosPage(); $laPage->infosColonnes(); //setlocale(LC_ALL, "french"); if ($laPage->nomPageGoogle) { ?> <div class="item" id="<?php if ($laPage->C0) echo "coltexte585"; else if ($laPage->C1) echo "coltexte385";?>"> <div class="sap-content"> <!-- item 1 585 pixels wide --> <p class="<?php if ($laPage->C0) echo "titre585"; else if ($laPage->C1) echo "titre385";?>"><?=$laPage->titrePage?></p> <fieldset> <?php if (!$action) { ?> <legend>S'inscrire à la formation<br /> "<?=$laForma->titrePara?>"</legend><br /> <label for="name"></label> <strong>Vous avez un compte IFIP ? Identifiez-vous :</strong> <br /> <br />
/** * Affiche les formations */ function afficherFormations() { if ($this->type == "categ") { $result = mysql_query("SELECT if_para_categ.numpara FROM if_para_categ, if_v_form WHERE numcateg='{$this->nummenu}' AND if_para_categ.numpara=if_v_form.numpara AND if_v_form.enligne='o' {$this->tri_date}"); // Requête pour afficher les formations liées aux categ et sous-categ dans le contenu associé à droite } else { if ($this->type == "categorie") { if ($this->nummenu) { $result = mysql_query("SELECT if_para_categ.numpara FROM if_para_categ, if_categorie, if_v_form WHERE if_para_categ.numpara=if_v_form.numpara AND if_categorie.numcateg='{$this->nummenu}' AND if_para_categ.numcateg=if_categorie.numcateg AND if_v_form.enligne='o' {$this->tri_date} ORDER BY date_deb"); } else { $result = mysql_query("SELECT if_para_categ.numpara FROM if_para_categ, if_v_form WHERE if_para_categ.numpara=if_v_form.numpara AND if_v_form.enligne='o' GROUP BY if_para_categ.numpara ORDER BY date_deb"); } // Requête utilisée par le moteur de recherche formations-ifip.php (site public) } else { if ($this->type == "sscateg") { $result = mysql_query("SELECT if_para_sscateg.numpara FROM if_para_sscateg, if_v_form WHERE numsscateg='{$this->nummenu}' AND if_para_sscateg.numpara=if_v_form.numpara AND if_v_form.enligne='o' {$this->tri_date}"); // Requête utilisée par le moteur de recherche formations-ifip.php (site public) } } } while ($row = mysql_fetch_row($result)) { $laForma = new Formation(); $laForma->numpara = $row[0]; $laForma->infosFormation(); $this->listforma[] = $laForma; } if (count($this->listforma) >= 1) { return true; } }
// Get webmaster caste $ufc_web = new UFC_Group(Group::from('webmasters'), Rights::member()); // Get kes admins $ufc_kes = new UFC_Group(Group::from('kes'), Rights::admin()); // Shalom-CCX-AMEP $shccxamep_groups = new Collection(); $shccxamep_groups->add(Group::from('shalom')); $shccxamep_groups->add(Group::from('ccx')); $shccxamep_groups->add(Group::from('amep')); $ufc_shalom_ccx_amep = new UFC_Group($shccxamep_groups, Rights::admin()); unset($shccxamep_groups); // licenses members = on_platal and X $ufc_licenses = new PFC_And(array(new UFC_Group(Group::from('formation_x'), Rights::restricted()), new UFC_Group(Group::from('on_platal'), Rights::restricted()))); // Get formations $formations = array(); foreach (Formation::selectAll(FormationSelect::base()) as $form) { $formations[$form->abbrev()] = intval($form->id()); } // Test wether the userfilter which is in the database is the expected one function test_userfilters($grouptext, $rights, $db_caste, $expected_condition = null) { $castetext = $rights . " userfilter (caste " . $db_caste->id() . ")"; $db_userfilter = $db_caste->userfilter(); if (is_null($expected_condition)) { if ($db_userfilter) { echo "Info: group " . $grouptext . " has unexpected " . $castetext . " " . json_encode($db_userfilter->export()) . "\n"; } } else { $expected_userfilter = new UserFilter($expected_condition); $expected_json = json_encode($expected_userfilter->export()); if (!$db_userfilter) {
//fin du foreach listform ?> </table> <br /><br /> <?php } else { ?> Il n'y a aucune formation sur mesure non validée. <?php } //fin de if ($nb_form) } else { //$numpara => détail de la formation $laFormation = new Formation(); $laFormation->numpara = $numpara; $list_inscrits = $laFormation->listerInscrits(); ?> Valider cette formation<br /><br /> Date de début de la formation (format jj/mm/aaaa) <em>*</em>: <input type="text" id="name" name="textDateDeb"/><br /> Date de fin de la formation (format jj/mm/aaaa) : <input type="text" id="name" name="textDateFin" /><br /><br /> <input type="hidden" name="valide" value="<?php echo $numpara; ?> " /> <br /> <table> <tr class="entete"><td>Client</td><td>Désignation</td><td>Tarif €</td></tr>
<?php /* Date de cration: 18/12/2008 */ if ($numpara) { //on est en modification $modifForm = new Formation(); $modifForm->numpara = $numpara; $modifForm->infosFormation(); } ?> <div class="item" id="coltexteAdmin"> <div class="sap-content"> <div class="TabbedPanels"> <div class="TabbedPanelsContentGroup"> <div class="TabbedPanelsContent"> <fieldset> <legend><?php if ($numpara) { echo "Modifier la formation"; } else { echo "Ajouter une formation"; } ?> </legend> <ol> <li> <label for="name">Titre<em>*</em> :</label> <input type="text" id="name" name="textTitre" value="<?php echo $modifForm->titrePara; ?>
function handler_mail($page) { $subject = Env::t('subject', ''); $body = Env::t('mail_body', ''); $no_wiki = Env::has('no_wiki'); // Retrieve the years on_platal of each formation $formations = Formation::selectAll(FormationSelect::on_platal()); if (Env::has('send')) { try { $required_fields = array('subject' => 'Il faut donner un sujet à ton mail', 'mail_body' => 'Tu ne veux pas envoyer de mail vide à tous. Si ?'); foreach ($required_fields as $field => $msg) { if (Env::v($field, '') == '') { throw new Exception($msg); } } if (Env::t('origin_mail_proposal') == 'false') { $origin = false; } else { $origin = new Group(Env::i('origin_mail_proposal')); } if ($origin !== false && !S::user()->hasRights($origin, Rights::admin())) { throw new Exception("Invalid credentials for origin Group"); } if (Env::t('type_mail_proposal') == 'group') { // Mail to a group list($temp, $target_group) = self::target_picker_to_caste_group('mail'); $target = new Collection('Caste'); $target->add($temp); $target_group->select(GroupSelect::validate()); $nv = new MailValidate(array('writer' => S::user(), 'type_mail' => Env::t('type_mail_proposal'), 'origin' => $origin, 'targets' => $target, 'subject' => $subject, 'body' => $body, 'nowiki' => $no_wiki, 'formation' => $target_group)); $el = new Validate(array('item' => $nv, 'group' => $target_group, 'writer' => S::user(), 'type' => 'mail')); $el->insert(); } elseif (Env::t('type_mail_proposal') == 'promo') { // Target group is a Collection of formation groups, which validate requests $target_group = new Collection('Group'); // Group promos by formation $promos = unflatten(Env::v('promos')); $promosByFormation = array(); foreach ($promos as $formation_promo) { $formation_promo = trim($formation_promo); if (!$formation_promo) { continue; } if (!preg_match('/^([0-9]+)_([0-9]+)$/', $formation_promo, $matches)) { throw new Exception("Oops, mauvais format de destinataire."); } $formid = (int) $matches[1]; $promo = (int) $matches[2]; if (isset($promosByFormation[$formid])) { $promosByFormation[$formid][] = $promo; } else { $promosByFormation[$formid] = array($promo); } } if (empty($promosByFormation)) { throw new Exception("Il faut indiquer au moins un destinataire."); } foreach ($promosByFormation as $formid => $promos) { // Now, $promos are the list of promos of formation $formid $form = $formations->get($formid); // Study group are the people the mail is sent to, array of CasteFilterCondition $cfc_study_groups = array(); foreach ($promos as $promo) { if (!$form->hasPlatalYear($promo)) { throw new Exception("Mauvaise promo " . $promo . " pour " . $form->label() . "."); } $cfc_study_groups[] = new CFC_Group($form->getGroupForPromo($promo), Rights::restricted()); } $target = new CasteFilter(new PFC_Or($cfc_study_groups)); $target = $target->get(); $target->select(CasteSelect::validate()); // $target_group is the group which validates this email $target_group = $form->getGroup(); $target_group->select(GroupSelect::validate()); $nv = new MailValidate(array('writer' => S::user(), 'type_mail' => Env::t('type_mail_proposal'), 'origin' => $origin, 'targets' => $target, 'subject' => $subject, 'body' => $body, 'nowiki' => $no_wiki, 'formation' => $target_group)); $el = new Validate(array('item' => $nv, 'group' => $target_group, 'writer' => S::user(), 'type' => 'mail')); $el->insert(); } } $page->assign('envoye', true); } catch (Exception $e) { $page->trigError($e->getMessage()); } } $page->assign('subject', $subject); $page->assign('body', $body); $page->assign('nowiki', $no_wiki); $page->assign('formations', $formations); $page->assign('title', 'Envoi des mails'); $page->addCssLink('validate.css'); $page->changeTpl('validate/prop.mail.tpl'); }
/** * affiche la liste des paragraphes * @return si on voit les docs on retourne le nombre de doc, sinon on retourne le nombre de paragraphes */ function afficherListeParas() { //requete sql if ($this->numpage) { // Liste des paragraphes liés à la page if (isset($this->colonne)) { $fin_req = "AND colonne='{$this->colonne}'"; } $result = mysql_query("SELECT numpara FROM if_page_para WHERE numpage='{$this->numpage}' {$fin_req} ORDER BY ordre"); //echo "SELECT numpara FROM if_page_para WHERE numpage='$this->numpage' $fin_req ORDER BY ordre<br/>"; while ($row = mysql_fetch_row($result)) { $unPara = new Paragraphe(); $unPara->numpara = $row[0]; $unPara->numpage = $this->numpage; $unPara->infosPara(); $this->paras[] = $unPara; } //fin du while } else { if ($this->formation) { // Liste des formations IFIP $result = mysql_query("SELECT numpara FROM if_v_form {$this->tri_date}"); while ($row = mysql_fetch_row($result)) { $unPara = new Formation(); $unPara->numpara = $row[0]; $unPara->infosFormation(); $this->paras[] = $unPara; } //fin du while } else { if ($this->doc) { // Liste des docs IFIP $result = mysql_query("SELECT numpara FROM if_v_doc {$this->req_doc}"); while ($row = mysql_fetch_row($result)) { $unPara = new Documentation(); $unPara->numpara = $row[0]; if ($this->docvcourte) { $unPara->infosDocVersionCourte(); } else { $unPara->infosDoc(); } $this->paras[] = $unPara; //mise en commentaire HC sept. 2009 - on refait un tri sur le champ date //usort($this->paras, 'trierDocs');//tri sur le tableau d'ojets Documentation (sur anneeDoc créée dans InfosDoc) } //fin du while if ($this->docvcourte) { $this->nbdocs = count($this->paras); $this->paras = array_slice($this->paras, $this->borneinf, $this->bornesup); // troncage du tableau //print_r($this->paras); } } else { if ($this->breve) { // Liste des brèves internationales IFIP $result = mysql_query("SELECT numpara FROM if_v_breve {$this->req_breve}"); while ($row = mysql_fetch_row($result)) { $unPara = new Breve(); $unPara->numpara = $row[0]; $unPara->infosBreve(); $this->paras[] = $unPara; } //fin du while } else { if ($this->actu) { // Liste des brèves d'actualités IFIP $result = mysql_query("SELECT numpara FROM if_v_actu {$this->req_actu}"); while ($row = mysql_fetch_row($result)) { $unPara = new Actualite(); $unPara->numpara = $row[0]; $unPara->infosActu(); $this->paras[] = $unPara; } //fin du while } else { // Liste de tous les paragraphes (pour choisir un paragraphe à associer lors de la création ou modification de la page sauf les paragraphes de type Formation et de type Doc $result = mysql_query("SELECT numpara FROM if_paragraphe WHERE numpara NOT IN (SELECT numpara FROM if_v_form) AND NOT IN (SELECT numpara FROM if_v_doc)"); while ($row = mysql_fetch_row($result)) { $unPara = new Paragraphe(); $unPara->numpara = $row[0]; $unPara->numpage = $this->numpage; $unPara->infosPara(); $this->paras[] = $unPara; } //fin du while } } } } } if ($this->docvcourte) { return $this->nbdocs; } else { return count($this->paras); } }
public function validerEntreprise($id) { $this->connexion(); $statement = $this->connexion->prepare('INSERT INTO entreprise(nomEnt,mdpEnt,typeCreneau,formationsRecherchees,nbRecruteurs,nbPlaces,nbStands,nbRepas, mailEnt,nomContact,prenomContact,numTelEnt,codePostal,villeEnt,adresseEnt) SELECT nomEnt,mdpEnt,typeCreneau,formationsRecherchees,nbRecruteurs,nbPlaces,nbStands,nbRepas, mailEnt,nomContact,prenomContact,numTelEnt,codePostal,villeEnt,adresseEnt FROM temp_entreprise WHERE IDEnt = ' . $id . ';'); $statement->execute(); $statement = $this->connexion->prepare('DELETE FROM temp_entreprise WHERE IDEnt = ' . $id . ';'); $statement->execute(); $statement = $this->connexion->prepare('SELECT * FROM entreprise ORDER BY IDEnt DESC LIMIT 1;'); $statement->execute(); $ent = $statement->fetch(); $this->deconnexion(); $tabConfig = $this->getConfiguration(); $idEnt = $ent['IDEnt']; $formationsRecherchees = $ent['formationsRecherchees']; $nbStands = $ent['nbStands']; $disponibilite = $ent['typeCreneau']; $creationFormation = new Formation($idEnt, $formationsRecherchees, $nbStands, $disponibilite, $tabConfig['nbCreneauxMatin'], $tabConfig['nbCreneauxAprem']); $creationFormation->createForm(); return; }
$leClient->raison = $textRaison; $leClient->adr1 = $textAdr1; $leClient->adr2 = $textAdr2; $leClient->cp = $textCp; $leClient->ville = $textVille; $leClient->pays = $selectPays; $leClient->tel = $textTel; $leClient->gsm = $textGsm; $leClient->fax = $textFax; if ($textAutreFonct) { $leClient->fonction = $textAutreFonct; } else { $leClient->fonction = $radioFonct; } $leClient->modifierClient(); $laForma = new Formation(); $laForma->numpara = $numpara; $laForma->infosFormation(); $ajoutPanier = new Panier(); $ajoutPanier->numclient = $_SESSION['numclient']; $ajoutPanier->ajouterArticle($numpara, "Inscription formation", "1", $laForma->titrePara, ""); if ($checkVeille) { $ajoutPanier->ajouterArticle($numpara, $checkVeille, "1", $laForma->titrePara, ""); } if ($checkDiner) { $ajoutPanier->ajouterArticle($numpara, $checkDiner, "1", $laForma->titrePara, ""); } if ($checkPendant) { $ajoutPanier->ajouterArticle($numpara, $checkPendant, "1", $laForma->titrePara, ""); } if ($textPedag && $textPedagTva) {