function fetch($annee = NULL) { if (!$this->activite) { return array('activites' => $this->unite->findActivites($annee)); } else { $this->controller->assert(null, $this->activite, 'envoyer-photo', "Vous n'avez pas le droit d'envoyer de photo de " . $this->activite->getIntituleComplet() . "."); } $m = new Wtk_Form_Model('envoyer'); $i = $m->addString('titre', 'Titre'); $m->addConstraintRequired($i); $m->addFile('photo', "Photo"); $m->addString('commentaire', 'Votre commentaire'); $m->addBool('envoyer', "J'ai d'autres photos à envoyer", true); $m->addNewSubmission('envoyer', "Envoyer"); $t = new Photos(); if ($m->validate()) { $p = new Photo(); $p->titre = $m->titre; $p->slug = $t->createSlug(wtk_strtoid($m->titre)); $p->activite = $this->activite->id; $action = $m->envoyer ? 'envoyer' : 'consulter'; $c = new Commentaire(); $c->auteur = Zend_Registry::get('individu')->id; $c->message = $m->commentaire; $db = $t->getAdapter(); $db->beginTransaction(); try { $c->save(); $p->commentaires = $c->id; $p->save(); $i = $m->getInstance('photo'); if ($i->isUploaded()) { $tmp = $i->getTempFilename(); $p->storeFile($tmp); } $url = $this->controller->_helper->Url('voir', 'photos', null, array('photo' => $p->slug), true); $this->controller->logger->info("Photo envoyée", $url); foreach ($this->activite->findUnitesParticipantesExplicites() as $u) { $ident = new Identification(); $ident->photo = $p->id; $ident->unite = $u->id; $ident->save(); $this->controller->logger->info("Unité identifiée sur une photo", $url); } $db->commit(); } catch (Exception $e) { $db->rollBack(); throw $e; } $this->controller->_helper->Flash->info("Photo envoyée"); $this->controller->redirectSimple($action, null, null, array('album' => $this->activite->slug)); } $photos = $this->activite->findPhotos($t->select()->order('date')); return array('unite' => $this->unite, 'annee' => $annee, 'model' => $m, 'activite' => $this->activite, 'photos' => $photos); }
<?php /* */ session_start(); require_once "php/main.php"; try { if (empty($_SESSION['id'])) { $c = new Identification(); $c->handleRequest(); } elseif (!empty($_SESSION['id'])) { if (!empty($_SESSION['administrateur'])) { $c = new Gestion(); $c->gestion_admin(); } else { if (isset($_REQUEST['idpro3'])) { $c = new Nouvelleconsult(); // $c->find($_REQUEST['idpro3'],$_REQUEST['idani'],"_accueil", $tva, $marge_medic); $c->find($_REQUEST['idpro3'], $_REQUEST['idani'], "_accueil"); } else { if (isset($_REQUEST['reglage'])) { $c = new Reglage(); // $c->zone_reglage($tva); $c->zone_reglage(); } else { if (isset($_REQUEST['admin'])) { $c = new Log_admin(); $c->login_admin(); } else { if (isset($_REQUEST['agenda'])) { $c = new Agenda();
$loginOK = true; } // echo $data['password']; // die(); } // Si le login a été validé on met les données en sessions if ($loginOK) { $_SESSION['connecte'] = true; $_SESSION['utilisateur'] = $data; var_dump($_SESSION); } else { if (isset($_SESSION['nombreEssais'])) { $nombreEssais = $_SESSION['nombreEssais'] + 1; } else { $nombreEssais = 1; } // On écrase le tableau de session $_SESSION = array(); $_SESSION['connecte'] = false; $_SESSION['nombreEssais'] = $nombreEssais; // On détruit la session // session_destroy(); } } } $identification = new Identification(); if (isset($_POST['button_Connexion'])) { if (!empty($_POST['login']) && !empty($_POST['password'])) { $identification->identifier_Utilisateur($_POST['login'], $_POST['password']); } }
function identifierAction() { $this->metas(array('DC.Title' => "Identifier une unité", 'DC.Subject' => 'identifier,photos')); $this->view->photo = $p = $this->_helper->Photo(); $this->assert(null, $p); $this->actions->append("Éditer", array('action' => 'editer'), array(null, $p)); $this->view->model = $m = new Wtk_Form_Model('identifier'); $idents = $p->findIdentifications(); $values = array(); foreach ($idents as $ident) { $values[] = $ident->unite; } $a = $p->findParentActivites(); $unites = $a->findUnitesParticipantes(); $enum = array(); foreach ($unites as $unite) { $enum[$unite->id] = $unite->getFullname(); } $m->addEnum('unites', 'Unités', $values, $enum, true); // multiple $m->addNewSubmission('enregistrer', "Enregistrer"); if ($m->validate()) { $db = $p->getTable()->getAdapter(); $db->beginTransaction(); $new_idents = $m->get('unites'); try { foreach ($idents as $ident) { if (($k = array_search($ident->unite, $new_idents)) !== false) { unset($new_idents[$k]); continue; } $ident->delete(); $this->logger->warn("Identification retirée", $this->_helper->Url('voir', 'photos')); } foreach ($new_idents as $uid) { $ident = new Identification(); $ident->photo = $p->id; $ident->unite = $uid; $ident->save(); $this->logger->info("Unité identifiée sur une photo", $this->_helper->Url('voir', 'photos')); } $db->commit(); } catch (Exception $e) { $db->rollBack(); throw $e; } $this->_helper->Flash->info("Identifications mise-à-jour"); $this->redirectSimple('voir'); } }
<!DOCTYPE html> <html> <head> <title>orgaMIsation !</title> <link rel="stylesheet" href="content/common.css"> <link rel="stylesheet" href="content/index.css"> <meta charset="UTF-8"> </head> <body> <?php include "loginLogic/loginForm.php"; include "getConnectionObject.php"; include "loginLogic/Identification.php"; $connectionObject = getConnectionObject(); $identification = new Identification($connectionObject); if (isset($_POST['logout'])) { session_destroy(); $identification->logout(); } elseif (isset($_POST['username']) and isset($_POST['password'])) { $identification->login($_POST['username'], $_POST['password']); } ?> <div class="centering"> <img src="content/logo.png"/><br/> <span class="title"> Bienvenue sur orgaMIsation !<br/> Que voulez-vous ? <br/> </span> <ul>