Ejemplo n.º 1
0
 function calendrier($activites, $annee)
 {
     if (!$activites->count()) {
         $p = new Wtk_Paragraph();
         $p->addFlags('empty')->addInline("Aucune activité prévue en " . $annee);
         return $p;
     }
     $s = new Wtk_Section('calendrier');
     $tam = new Wtk_Table_Model('id', 'slug', 'type', 'lieu', 'date', 'intitule');
     foreach ($activites as $a) {
         if ($a->isFuture() && !$this->view->assert(null, $a, 'consulter')) {
             continue;
         }
         $tam->append($a->id, $a->slug, $a->getIntitule(), $a->lieu, $a->getDate(), $a->getIntituleComplet());
     }
     $t = $s->addTable($tam);
     $t->addNewColumn("Date", new Wtk_Table_CellRenderer_Text('text', 'date'));
     $c = new Wtk_Table_CellRenderer_Link('href', 'slug', 'label', 'type', 'tooltip', 'intitule');
     $t->addNewColumn("Activité", $c);
     // TODO: déterminer par activité si c'est future. Un
     // CellRendererLink spécialisé ferait l'affaire
     $url = $this->view->url(array('controller' => 'activites', 'action' => 'consulter', 'activite' => '%s'));
     $c->setUrlFormat(urldecode($url));
     return $s;
 }
Ejemplo n.º 2
0
 public function cvScout($apps, $admin = false)
 {
     $this->view->document->addStyleComponents('unites');
     $m = new Wtk_Table_Model('unite_slug', 'unite_type', 'unite_nom', 'unite_lien', 'role', 'accr', 'acl', 'debut', 'fin', 'url-editer', 'url-supprimer');
     $individu = null;
     foreach ($apps as $app) {
         if (!$individu) {
             $individu = $app->findParentIndividus();
         }
         $role = $app->findParentRoles();
         $unite = $app->findParentUnites();
         $url_unite = $this->view->url(array('controller' => 'unites', 'action' => 'effectifs', 'unite' => $unite->slug, 'annee' => $app->getAnnee()), true);
         $url_editer = $this->view->url(array('controller' => 'individus', 'action' => 'reinscrire', 'inscription' => $app->id), true);
         $url_suppr = $this->view->url(array('controller' => 'individus', 'action' => 'desinscrire', 'inscription' => $app->id), true);
         $fin = $app->fin ? strftime('au %x', strtotime($app->fin)) : "à aujourd'hui";
         $m->append($unite->slug, $unite->findParentTypesUnite()->slug, $unite->getFullName(), $url_unite, array($role->slug, wtk_strtoid($app->titre)), $app->getAccronyme(), $role->acl_role, strftime('du %x', strtotime($app->debut)), $fin, $url_editer, $url_suppr);
     }
     $t = new Wtk_Table($m, true, array('acl', 'role'));
     $config = Zend_Registry::get('config');
     $t->addFlags('effectifs', $config->system->association, 'appartenances');
     $t->addNewColumn('Poste', new Wtk_Table_CellRenderer_Text('text', 'accr'));
     $t->addNewColumn('Unité', new Wtk_Table_CellRenderer_Link('href', 'unite_lien', 'label', 'unite_nom'), 'unite');
     $t->addNewColumn('Début', new Wtk_Table_CellRenderer_Text('text', 'debut'));
     $t->addNewColumn('Fin', new Wtk_Table_CellRenderer_Text('text', 'fin'));
     if ($admin && $this->view->assert(null, $individu, 'inscrire')) {
         $t->addNewColumn(null, new Wtk_Table_CellRenderer_Link('href', 'url-editer', 'label', 'Éditer', 'flags', array('adminlink', 'editer')));
         $t->addNewColumn(null, new Wtk_Table_CellRenderer_Link('href', 'url-supprimer', 'label', 'Supprimer', 'flags', array('adminlink', 'critical', 'supprimer')));
     }
     return $t;
 }
Ejemplo n.º 3
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)));
     }
 }
Ejemplo n.º 4
0
 function __construct($array)
 {
     $cols = array_keys($array[0]);
     parent::__construct($cols);
     foreach ($array as $tuple) {
         call_user_func_array(array($this, 'append'), $tuple);
     }
 }
Ejemplo n.º 5
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);
}