Esempio n. 1
0
<?php

$m = new Wtk_Table_Model('champ', 'valeur', 'url', 'flags');
$m->append('Message', $this->event->message, null, 'message');
$m->append('Niveau', $this->event->level, null, array('level', strtolower($this->event->level)));
$m->append('Émetteur', $this->event->logger, null, 'logger');
$m->append('URL', $this->event->url, $this->event->url, 'url');
$m->append('Date', $this->event->date, null, 'date');
$user = $this->event->findParentUsers();
if (!$user) {
    $user = new Nobody();
}
$individu = $user->findParentIndividus();
if ($user->isMember()) {
    $url = $this->url(array('controller' => 'individus', 'action' => 'fiche', 'individu' => $individu->slug));
} else {
    $url = null;
}
$m->append('Utilisateur', $individu->getFullname(), $url, 'user');
$s = $this->document->addSection('event');
$t = $s->addTable($m, false, 'flags');
$t->addNewColumn(null, new Wtk_Table_CellRenderer_Text('text', 'champ'));
$t->addNewColumn(null, new Wtk_Table_CellRenderer_Link('href', 'url', 'label', 'valeur'));
$detail = @unserialize($this->event->detail);
if ($detail) {
    $s->addSection('detail', "Détails")->addText($detail, true);
}
Esempio n. 2
0
 function getUser()
 {
     /* Récupère l'utilisateur depuis l'identité, et l'injecte dans le
      * registre. Initialise les ACL. */
     $auth = Zend_Auth::getInstance();
     $username = null;
     $user = null;
     if ($auth->hasIdentity()) {
         $identity = $auth->getIdentity();
         $username = $identity['username'];
     }
     if ($username) {
         $t = new Users();
         try {
             $user = $t->findByUsername($username);
             if (!Zend_Registry::isRegistered('sudoer')) {
                 $user->last_login = new Zend_Db_Expr('CURRENT_TIMESTAMP');
             }
             $user->save();
         } catch (Exception $e) {
             /* Ça arrive plutôt par un bug de développement, l'identité
                dans la session n'existe plus. On déconnecte. */
             error_log($e->getMessage());
             $auth->clearIdentity();
         }
     }
     if (!$user) {
         $user = new Nobody();
     }
     $individu = $user->findParentIndividus();
     $acl = Zend_Registry::get('acl');
     if (!$acl->hasRole($user)) {
         $user->initAclRole($acl);
     }
     Zend_Registry::set('individu', $individu);
     Zend_Registry::set('user', $user);
     return $user;
 }