Changeset 2726


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

gestion du cache

Location:
cpc/trunk/project/apps/frontend/modules/parlementaire
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cpc/trunk/project/apps/frontend/modules/parlementaire/actions/actions.class.php

    r2724 r2726  
    525525
    526526  public function executeWidget(sfWebRequest $request) {
    527     $this->parl = $request->getParameter('depute');
     527    $search = $request->getParameter('depute');
     528    $sexe = null;
     529    if (preg_match("/M\([.mle]\)+ */", $search, $match)) {
     530      $sexe = "H";
     531      if (preg_match("/e/", $match[1]))
     532        $sexe = "F";
     533      $search = preg_replace("/^.*M\([.mle]\)+ */", "", $search);
     534    }
     535    $search = preg_replace("/([ \-.]\w)/", strtoupper("\\1"), ucfirst(strtolower($search)));
     536    $dep = Doctrine::getTable('Parlementaire')->findOneBySlug(strtolower($search));
     537    if (!$dep)
     538      $dep = Doctrine::getTable('Parlementaire')->findOneByNom($search);
     539    if (!$dep)
     540      $dep = Doctrine::getTable('Parlementaire')->findOneByNomDeFamille($search);
     541#   if (!$dep)
     542#     $dep = Doctrine::getTable('Parlementaire')->findOneByNomSexeGroupeCirco($search, $sexe);
     543    $this->parl = $dep->slug;
    528544    $this->options = array('titre' => 1, 'photo' => 1, 'graphe' => 1, 'activite' => 1);
    529545    if ($request->getParameter('notitre', false))
  • cpc/trunk/project/apps/frontend/modules/parlementaire/actions/components.class.php

    r2723 r2726  
    5050
    5151  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);
     52    $search = $this->slug;
     53    $this->parl = Doctrine::getTable('Parlementaire')->findOneBySlug($this->slug);
    6854    if (!$this->options)
    6955      $this->options = array('titre' => 1, 'photo' => 1, 'graphe' => 1, 'activite' => 1);
  • cpc/trunk/project/apps/frontend/modules/parlementaire/config/cache.yml

    r1633 r2726  
    44rss:
    55  lifetime: 3600
     6  enabled: true
     7_widget:
     8  lifetime: 86400
    69  enabled: true
    710_duJour:
  • cpc/trunk/project/apps/frontend/modules/parlementaire/templates/widgetSuccess.php

    r2723 r2726  
    1 <?php include_component('parlementaire', 'widget', array('depute' => $parl, 'options' => $options)); ?>
     1<?php if ($parl) include_component('parlementaire', 'widget', array('slug' => $parl, 'options' => $options)); ?>
Note: See TracChangeset for help on using the changeset viewer.