Changeset 468

Show
Ignore:
Timestamp:
11/25/08 16:41:34 (1 month ago)
Author:
nicolas
Message:

Bourse : ajout des secteurs

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/apps/intranet/modules/zone/actions/actions.class.php

    r181 r468  
    77class zoneActions extends sfActions 
    88{ 
    9   /* ZONES */ 
    109  public function executeIndex() 
    1110  { 
     
    2019    $this->zones = ZonePeer::doSelect($c); 
    2120 
    22     //sectors     
     21    // sectors     
    2322    $c = new Criteria(); 
    2423    $c->add(SectorPeer::AGENCY_ID, $this->getUser()->getSubscriber()->getAgencyId()); 
    2524    $this->sectors = SectorPeer::doSelect($c); 
     25 
     26    // market     
     27    $c = new Criteria(); 
     28    $c->add(Market_sectorPeer::AGENCY_ID, $this->getUser()->getSubscriber()->getAgencyId()); 
     29    $this->markets = Market_sectorPeer::doSelect($c); 
    2630  } 
    2731 
     
    196200    return $this->redirect('zone/sector_show?id='.$sector_id); 
    197201  } 
     202 
     203  public function executeMarket_create() 
     204  { 
     205    $this->form = new Market_sectorForm(); 
     206    $this->setTemplate('market_edit'); 
     207  } 
     208 
     209  public function executeMarket_edit($request) 
     210  { 
     211    $this->form = new Market_sectorForm(Market_sectorPeer::retrieveByPk($request->getParameter('id'))); 
     212  } 
     213 
     214  public function executeMarket_update($request) 
     215  { 
     216    $this->forward404Unless($request->isMethod('post')); 
     217 
     218    $this->form = new Market_sectorForm(Market_sectorPeer::retrieveByPk($request->getParameter('id'))); 
     219 
     220    $market_sector = $request->getParameter('market_sector'); 
     221    $market_sector['city_id'] = $request->getParameter('city_id'); 
     222 
     223    $this->form->bind($market_sector); 
     224    if ($this->form->isValid()) 
     225    { 
     226      $market_sector = $this->form->save(); 
     227 
     228      $this->redirect('zone/market_edit?id='.$market_sector->getId()); 
     229    } 
     230 
     231    $this->setTemplate('market_edit'); 
     232  } 
    198233} 
  • trunk/apps/intranet/modules/zone/templates/editSuccess.php

    r151 r468  
    1313</table> 
    1414<hr /> 
    15 <?php echo submit_tag('Enregistrer') ?> 
     15<?php echo submit_image_tag('tpl_02/'.$sf_user->getCulture().'/button/save.png') ?> 
    1616<?php if ($zone->getId()): ?> 
    17   &nbsp;<?php echo link_to('Supprimer', 'zone/delete?id='.$zone->getId(), 'post=true&confirm=Are you sure?') ?> 
    18   &nbsp;<?php echo link_to('Annuler', 'zone/show?id='.$zone->getId()) ?> 
     17  &nbsp;<?php echo link_to(image_tag('tpl_02/'.$sf_user->getCulture().'/button/delete.png'), 'zone/delete?id='.$zone->getId(), 'post=true&confirm=Are you sure?') ?> 
     18  &nbsp;<?php echo link_to(image_tag('tpl_02/'.$sf_user->getCulture().'/button/cancel.png'), 'zone/show?id='.$zone->getId()) ?> 
    1919<?php else: ?> 
    20   &nbsp;<?php echo link_to('Annuler', 'zone/list') ?> 
     20  &nbsp;<?php echo link_to(image_tag('tpl_02/'.$sf_user->getCulture().'/button/cancel.png'), 'zone/list') ?> 
    2121<?php endif; ?> 
    2222</form> 
  • trunk/apps/intranet/modules/zone/templates/listSuccess.php

    r181 r468  
    4949<hr /> 
    5050<?php echo link_to(image_tag('tpl_02/'.$sf_user->getCulture().'/button/add.png'), 'zone/sector_create') ?> 
     51 
    5152<hr /> 
     53<h3><?php echo ucfirst(__('market')) ?></h3> 
     54<table> 
     55<thead> 
     56<tr> 
     57  <th width="50">Num.</th> 
     58  <th width="200"><?php echo ucfirst(__('city')) ?></th> 
     59  <th width="100"><?php echo ucfirst(__('district')) ?></th> 
     60  <th>&nbsp;</th> 
     61</tr> 
     62</thead> 
     63<tbody> 
     64<?php foreach ($markets as $market): ?> 
     65<tr> 
     66  <td><?php echo $market->getId() ?></td> 
     67  <td><?php echo $market->getApicity() ?></td> 
     68  <td><?php echo $market->getApidistrict() ?></td> 
     69  <td><?php echo link_to(image_tag('tpl_02/'.$sf_user->getCulture().'/button/view_inline.png'), 'zone/market_edit?id='.$market->getId()) ?></td> 
     70</tr> 
     71<?php endforeach; ?> 
     72</tbody> 
     73</table> 
     74<hr /> 
     75<?php echo link_to(image_tag('tpl_02/'.$sf_user->getCulture().'/button/add.png'), 'zone/market_create') ?> 
     76<hr /> 
  • trunk/lib/form/base/BaseMarketForm.class.php

    r372 r468  
    1818      'agency'             => new sfWidgetFormInput(), 
    1919      'agency_city'        => new sfWidgetFormInput(), 
     20      'agency_agent'       => new sfWidgetFormInput(), 
     21      'agency_phone'       => new sfWidgetFormInput(), 
     22      'agency_mail'        => new sfWidgetFormInput(), 
    2023      'nature_id'          => new sfWidgetFormPropelSelect(array('model' => 'Market_nature', 'add_empty' => false)), 
    2124      'type_id'            => new sfWidgetFormPropelSelect(array('model' => 'Market_type', 'add_empty' => false)), 
     
    6164      'building'           => new sfWidgetFormInput(), 
    6265      'sector'             => new sfWidgetFormInput(), 
     66      'district_id'        => new sfWidgetFormPropelSelect(array('model' => 'Apidistrict', 'add_empty' => true)), 
    6367      'address1'           => new sfWidgetFormInput(), 
    6468      'address2'           => new sfWidgetFormInput(), 
     
    9296      'building_permit'    => new sfWidgetFormInputCheckbox(), 
    9397      'url'                => new sfWidgetFormInput(), 
     98      'last_change'        => new sfWidgetFormDate(), 
    9499      'created_at'         => new sfWidgetFormDateTime(), 
    95100      'updated_at'         => new sfWidgetFormDateTime(), 
     
    102107      'agency'             => new sfValidatorString(array('max_length' => 100, 'required' => false)), 
    103108      'agency_city'        => new sfValidatorString(array('max_length' => 100, 'required' => false)), 
     109      'agency_agent'       => new sfValidatorString(array('max_length' => 100, 'required' => false)), 
     110      'agency_phone'       => new sfValidatorString(array('max_length' => 100, 'required' => false)), 
     111      'agency_mail'        => new sfValidatorString(array('max_length' => 100, 'required' => false)), 
    104112      'nature_id'          => new sfValidatorPropelChoice(array('model' => 'Market_nature', 'column' => 'id')), 
    105113      'type_id'            => new sfValidatorPropelChoice(array('model' => 'Market_type', 'column' => 'id')), 
     
    145153      'building'           => new sfValidatorString(array('max_length' => 100, 'required' => false)), 
    146154      'sector'             => new sfValidatorString(array('max_length' => 100, 'required' => false)), 
     155      'district_id'        => new sfValidatorPropelChoice(array('model' => 'Apidistrict', 'column' => 'id', 'required' => false)), 
    147156      'address1'           => new sfValidatorString(array('max_length' => 100, 'required' => false)), 
    148157      'address2'           => new sfValidatorString(array('max_length' => 100, 'required' => false)), 
     
    176185      'building_permit'    => new sfValidatorBoolean(array('required' => false)), 
    177186      'url'                => new sfValidatorString(array('max_length' => 160, 'required' => false)), 
     187      'last_change'        => new sfValidatorDate(array('required' => false)), 
    178188      'created_at'         => new sfValidatorDateTime(array('required' => false)), 
    179189      'updated_at'         => new sfValidatorDateTime(array('required' => false)), 
  • trunk/lib/model/Market.php

    r434 r468  
    1212  public function __toString() 
    1313  { 
    14     $txt = $this->getMarket_type(); 
    15     $this->getNatureId() ? $txt .= ' en '.$this->getMarket_nature() : null; 
    16     $this->getCity() ? $txt .= ' '.__('à').' '.$this->getCity() : null; 
    17     return $txt; 
     14    sfLoader::loadHelpers('I18N'); 
     15    // parts or old type 
     16    if($this->getTypeId()==1) $str = $this->getPartsName(); 
     17    else $str = $this->getMarket_type(); 
     18    // city or district 
     19    if(ParamPeer::getValueByName('estate_city', sfContext::getInstance()->getUser()->getSubscriber()->getAgencyId())): 
     20      if($this->getApidistrict()):  
     21      $str .= '  -  '.$this->getApidistrict(); 
     22      elseif($this->getCity()):  
     23      $str .= ' '.__('in(at)').' '.$this->getCity();  
     24      endif; 
     25    else: 
     26      $str .= ' '.__('in(at)').' '.$this->getCity(); 
     27    endif; 
     28    return (string)$str; 
    1829  } 
    1930