Changeset 2723


Ignore:
Timestamp:
May 17, 2012, 4:05:36 PM (8 years ago)
Author:
goya
Message:

widgetisation du module titre/photo/plot/activite

Location:
cpc/trunk/project/apps/frontend
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • cpc/trunk/project/apps/frontend/config/routing.yml

    r2556 r2723  
    130130  param: {module: parlementaire, action: id}
    131131# Liste de tous les parlementaires ou par catégorie
     132parlementaire_widget:
     133  url: /widget/:depute
     134  param: {module: parlementaire, action: widget}
    132135parlementaires_tags:
    133136  url: /deputes/tags
  • cpc/trunk/project/apps/frontend/modules/parlementaire/actions/actions.class.php

    r2718 r2723  
    523523  public function executeError404() {
    524524  }
     525
     526  public function executeWidget(sfWebRequest $request) {
     527    $this->parl = $request->getParameter('depute');
     528    $this->options = array(
     529      'titre' => $request->getParameter('notitre', true),
     530      'photo' => $request->getParameter('nophoto', true),
     531      'graphe' => $request->getParameter('nographe', true),
     532      'activite' => $request->getParameter('noactivite', true));
     533    $this->setLayout(false);
     534  }
    525535}
  • cpc/trunk/project/apps/frontend/modules/parlementaire/actions/components.class.php

    r2688 r2723  
    4848    }
    4949  }
     50
     51  public function executeWidget() {
     52    $search = $this->depute;
     53    $sexe = null;
     54    if (preg_match("/M\([.mle]\)+ */", $search, $match)) {
     55      $sexe = "H";
     56      if (preg_match("/e/", $match[1]))
     57        $sexe = "F";
     58      $search = preg_replace("/^.*M\([.mle]\)+ */", "", $search);
     59    }
     60    $search = preg_replace("/([ \-.]\w)/", strtoupper("\\1"), ucfirst(strtolower($search)));
     61    $this->parl = Doctrine::getTable('Parlementaire')->findOneBySlug(strtolower($search));
     62    if (!$this->parl)
     63      $this->parl = Doctrine::getTable('Parlementaire')->findOneByNom($search);
     64    if (!$this->parl)
     65      $this->parl = Doctrine::getTable('Parlementaire')->findOneByNomDeFamille($search);
     66#    if (!$this->parl)
     67#      $this->parl = Doctrine::getTable('Parlementaire')->findOneByNomSexeGroupeCirco($search, $sexe);
     68    if (!$this->options)
     69      $this->options = array('titre' => 1, 'photo' => 1, 'graphe' => 1, 'activite' => 1);
     70  } 
    5071}
Note: See TracChangeset for help on using the changeset viewer.