Changeset 2743


Ignore:
Timestamp:
May 19, 2012, 11:28:43 PM (8 years ago)
Author:
teymour
Message:

Ajout de l'éditeur de widget

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

Legend:

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

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

    r2742 r2743  
    524524  }
    525525
    526   public function executeWidget(sfWebRequest $request) {
    527     $this->search = $request->getParameter('depute');
    528     $search = $this->search;
     526  private function searchDepute($search) {
    529527    $sexe = null;
    530528    if (preg_match("/M\([.mle]\)+ */", $search, $match)) {
     
    542540#   if (!$dep)
    543541#     $dep = Doctrine::getTable('Parlementaire')->findOneByNomSexeGroupeCirco($search, $sexe);
     542      return $dep;
     543  }
     544
     545  public function executeWidgetEditor(sfWebRequest $request) {
     546    $this->depute = $this->searchDepute($request->getParameter('depute'));
     547    if (!$this->depute)
     548    $this->depute = Doctrine::getTable('Parlementaire')->createQuery('p')->where('fin_mandat IS NULL')->orderBy('rand()')->limit(1)->fetchOne();
     549
     550  }
     551
     552  public function executeWidget(sfWebRequest $request) {
     553    $this->search = $request->getParameter('depute');
     554    $dep = $this->searchDepute($this->search);
     555    $this->parl = null;
     556    if (!$dep) return;
    544557    $this->parl = $dep->slug;
    545558    $this->options = array('titre' => 1, 'photo' => 1, 'graphe' => 1, 'activite' => 1, 'tags' => 1, 'iframe' => 0);
Note: See TracChangeset for help on using the changeset viewer.