Ignore:
Timestamp:
Feb 28, 2010, 4:47:36 PM (11 years ago)
Author:
roux
Message:

url propres questions en question/QEnumero vers lesquelles redirigent les question/id d'origine

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

Legend:

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

    r964 r1137  
    1313  public function executeShow(sfWebRequest $request)
    1414  {
    15     $this->question = doctrine::getTable('QuestionEcrite')->find($request->getParameter('id'));
    16     $this->forward404Unless($this->question);
    17     $this->parlementaire = doctrine::getTable('Parlementaire')->find($this->question->parlementaire_id);
    18     $this->forward404Unless($this->parlementaire);
     15    $id = $request->getParameter('id');
     16    if (preg_match('/^(\d+)$/' , $id)) {
     17      $question = doctrine::getTable('QuestionEcrite')->find($id);
     18      $this->forward404Unless($question);
     19      $this->redirect('@question?id=QE'.$question->numero);
     20    } else if (preg_match('/^QE(\d+)$/' , $id, $match)) {
     21      $this->question = doctrine::getTable('QuestionEcrite')
     22        ->createquery('q')
     23       ->where('q.numero = ?', $match[1])
     24        ->fetchOne();
     25      $this->forward404Unless($this->question);
     26      $this->parlementaire = doctrine::getTable('Parlementaire')->find($this->question->parlementaire_id);
     27      $this->forward404Unless($this->parlementaire);
     28    } else $this->forward404();
    1929  }
    2030
  • cpc/trunk/project/apps/frontend/modules/questions/templates/_parlementaire.php

    r757 r1137  
    99  $titre .= ' ('.$theme.')';
    1010?>
    11   <li><?php echo link_to($titre, url_for('@question?id='.$question->id)); ?></li>
     11  <li><?php echo link_to($titre, url_for('@question?id=QE'.$question->numero)); ?></li>
    1212<?php if (isset($limit) && $cpt >= $limit) break; endforeach; ?>
    1313</ul>
  • cpc/trunk/project/apps/frontend/modules/questions/templates/_search.php

    r1135 r1137  
    33    <div>
    44<?php $parlementaire = $question->getParlementaire(); ?>
    5   <h2><?php echo link_to($parlementaire->nom.'&nbsp;: '.$question->getTitre(), '@question?id='.$question->id); ?></h2>
     5  <h2><?php echo link_to($parlementaire->nom.'&nbsp;: '.$question->getTitre(), '@question?id=QE'.$question->numero); ?></h2>
    66    </div>
    77  <div class="texte_question"><?php
    88  if (!isset($nophoto))
    9     echo '<a href="'.url_for('@question?id='.$question->id).'" class="intervenant"><img width="50" height="70" alt="'.$parlementaire->nom.'" src="'.url_for('@resized_photo_parlementaire?height=64&slug='.$parlementaire->slug).'" /></a>';
     9    echo '<a href="'.url_for('@question?id=QE'.$question->numero).'" class="intervenant"><img width="50" height="70" alt="'.$parlementaire->nom.'" src="'.url_for('@resized_photo_parlementaire?height=64&slug='.$parlementaire->slug).'" /></a>';
    1010  $inter = preg_replace('/<\/?p>|\&[^\;]+\;/i', ' ', $question->getQuestion().' '.$question->getReponse().' Thèmes : '.$question->getThemes());
    1111  $p_inter = '';
     
    2121?>
    2222  <div class="contexte">
    23     <a href="<?php echo url_for('@question?id='.$question->id); ?>">Lire la suite de la question</a></div>
     23    <a href="<?php echo url_for('@question?id=QE'.$question->numero); ?>">Lire la suite de la question</a></div>
    2424  </div>
    2525  </div>
  • cpc/trunk/project/apps/frontend/modules/questions/templates/parlementaireSuccess.php

    r808 r1137  
    55?>
    66<div class="questions">
    7 <?php
    8   echo include_component('questions', 'pagerQuestions', array('question_query' => $questions, 'mots'=>'', 'nophoto' => true));
    9 
    10 
    11 if(count($questions) < 1) : ?>
    12 Ce député n'a posé aucune question.
    13 <?php else : ?>
    14 <?php foreach($questions as $question) : ?>
    15 <tr>
    16 <td><?php echo link_to($question->numero, '@question?id=' . $question->id) ?></td>
    17 <td><?php echo $question->ministere ?></td>
    18 <td><?php echo $question->themes ?></td>
    19 </tr>
    20 <?php endforeach ?>
    21 </table>
    22 <?php endif ?>
     7<?php echo include_component('questions', 'pagerQuestions', array('question_query' => $questions, 'mots'=>'', 'nophoto' => true)); ?>
    238</div>
Note: See TracChangeset for help on using the changeset viewer.