Changeset 451

Show
Ignore:
Timestamp:
11/14/08 17:00:24 (2 months ago)
Author:
nicolas
Message:

Nouvel accueil, amélioration recherche rapide

Files:

Legend:

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

    r424 r451  
    2828    $this->agencies_num = $user->getAgency()->getCompany()->doCountAgencies(); 
    2929 
    30     /* Num avenants week */ 
     30    // num avenants week 
    3131    $datedeb = date('Y-m-d',mktime(0, 0, 0, date('m'), date('d')-7, date('Y'))); 
    3232    $datefin = date('Y-m-d',mktime(0, 0, 0, date('m'), date('d')+1, date('Y'))); 
     
    4747    $this->numavenants_week_ag = SalesPeer::doCount($c); 
    4848 
    49         /* Num avenants month */ 
     49        // Num avenants month 
    5050        $datedeb = date('Y-m-01'); 
    5151    $datefin = date('Y-m-31'); 
     
    8585    $this->numavenants_month_1_ag = SalesPeer::doCount($c); 
    8686     
    87     // Market 
    88     $this->nbmarkets_week = MarketPeer::doCountNew(date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-7, date('Y'))), date('Y-m-d'), 0); 
    89     $this->nbmarkets_week_upd = MarketPeer::doCountUpd(date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-7, date('Y'))), date('Y-m-d'), 0); 
    90      
    91     /* Requêtes sur site internet par visiteurs */ 
    92     $c = new Criteria(); 
    93     $c->add(BasketPeer::CONTACT_BY, NULL); 
    94     $c->addJoin(BasketPeer::CONTACT_ID , ContactPeer::ID , Criteria::INNER_JOIN); 
    95     $c->add(ContactPeer::AGENCY_ID, $user->getAgencyId()); 
    96     $c->addDescendingOrderByColumn(BasketPeer::ID); 
    97     $c->addGroupByColumn(BasketPeer::CONTACT_ID); 
    98     $this->sales_requests = BasketPeer::doSelectJoinContact($c); 
     87    // market 
     88    $c = new Criteria(); 
     89    $c->add(ExchangePeer::AGENCY_ID, $this->getUser()->getSubscriber()->getAgencyId()); 
     90    $c->add(ExchangePeer::IS_ACTIVE, 1); 
     91    $c->add(ExchangePeer::PROVIDER_ID, 2); 
     92    $this->exchange = ExchangePeer::doSelect($c); 
     93    if($this->exchange): 
     94      $this->nbmarkets_week = MarketPeer::doCountNew(date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-7, date('Y'))), date('Y-m-d'), 0); 
     95      $this->nbmarkets_week_upd = MarketPeer::doCountUpd(date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-7, date('Y'))), date('Y-m-d'), 0); 
     96    endif; 
    9997 
    10098    // users 
     
    129127  public function executeSearchresult() 
    130128  { 
    131         if($this->getRequestParameter('homesearch')): 
     129        if(strlen($this->getRequestParameter('homesearch'))>1): 
    132130 
    133131          $this->limite = 5; 
     
    200198          $criterion->addOr($c->getNewCriterion(ContactPeer::COMPANYNAME, '%'.$this->getRequestParameter('homesearch').'%', Criteria::LIKE)); 
    201199      if((int)$this->getRequestParameter('homesearch')!=0) 
    202         $criterion->addOr($c->getNewCriterion(SalesPeer::PRICE, $this->getRequestParameter('homesearch'))); 
     200      $criterion->addOr($c->getNewCriterion(SalesPeer::PRICE, $this->getRequestParameter('homesearch'))); 
    203201      $criterion->addOr($c->getNewCriterion(SalesPeer::ID, $this->getRequestParameter('homesearch'))); 
     202      $criterion->addOr($c->getNewCriterion(SalesPeer::MANDAT_NUM, $this->getRequestParameter('homesearch'))); 
    204203      $c->add($criterion); 
    205204       
     
    216215      $c->addDescendingOrderByColumn(SalesPeer::CREATED_AT); 
    217216      $this->saless = SalesPeer::doSelect($c); 
    218        
     217 
     218      // market list 
     219      $c = new Criteria(); 
     220          $c->addJoin(ExchangePeer::PROVIDER_ID, Market_providerPeer::EXCHANGE_PROVIDER_ID, Criteria::INNER_JOIN); 
     221      $c->addJoin(Market_providerPeer::ID, MarketPeer::PROVIDER_ID, Criteria::INNER_JOIN); 
     222      $c->add(ExchangePeer::IS_ACTIVE, 1); 
     223      $c->add(ExchangePeer::AGENCY_ID, $this->getUser()->getSubscriber()->getAgencyId()); 
     224      $c->add(MarketPeer::ID, eregi_replace('s', '', $this->getRequestParameter('homesearch'))); 
     225      $this->nbmarkets = MarketPeer::doCount($c); 
     226      $c->addGroupByColumn(MarketPeer::ID); 
     227      $c->setLimit($this->limite); 
     228      $c->addDescendingOrderByColumn(MarketPeer::UPDATED_AT); 
     229      $c->addDescendingOrderByColumn(MarketPeer::CREATED_AT); 
     230      $this->markets = MarketPeer::doSelect($c); 
     231 
    219232      // rents list 
    220233      $c = new Criteria(); 
     
    224237      $c->add(AgencyPeer::COMPANY_ID, $this->getUser()->getSubscriber()->getCompanyId()); 
    225238       
    226       $criterion = $c->getNewCriterion(ContactPeer::COMPANYNAME, '%'.$this->getRequestParameter('homesearch'.'%', Criteria::LIKE)); 
    227       $criterion->addOr($c->getNewCriterion(ContactPeer::FIRSTNAME, '%'.$this->getRequestParameter('homesearch'.'%', Criteria::LIKE))); 
    228       $criterion->addOr($c->getNewCriterion(ContactPeer::LASTNAME, '%'.$this->getRequestParameter('homesearch'.'%', Criteria::LIKE))); 
     239      $criterion = $c->getNewCriterion(ContactPeer::COMPANYNAME, '%'.$this->getRequestParameter('homesearch').'%', Criteria::LIKE); 
     240      $criterion->addOr($c->getNewCriterion(ContactPeer::FIRSTNAME, '%'.$this->getRequestParameter('homesearch').'%', Criteria::LIKE)); 
     241      $criterion->addOr($c->getNewCriterion(ContactPeer::LASTNAME, '%'.$this->getRequestParameter('homesearch').'%', Criteria::LIKE)); 
    229242      if((int)$this->getRequestParameter('homesearch')!=0) 
    230         $criterion->addOr($c->getNewCriterion(RentPeer::PRICE, $this->getRequestParameter('homesearch'))); 
     243      $criterion->addOr($c->getNewCriterion(RentPeer::PRICE, $this->getRequestParameter('homesearch'))); 
    231244      $criterion->addOr($c->getNewCriterion(RentPeer::ID, $this->getRequestParameter('homesearch'))); 
    232245      $c->add($criterion); 
  • trunk/apps/intranet/modules/homepage/templates/_header.php

    r413 r451  
    7070        <li><?php echo link_to(ucfirst(__('settings')),          'agency/index') ?></li> 
    7171        <?php endif; ?> 
     72        <?php if($sf_user->getSubscriber()->getProfilId()<=3): ?> 
     73        <li><?php echo link_to(ucfirst(__('exchange')),          'exchange/index') ?></li> 
     74        <?php endif; ?> 
    7275      </ul> 
    7376    </li> 
     
    7881        <li><?php echo link_to(ucfirst(__('administration')),    'http://'.$_SERVER['HTTP_HOST'].'/admin.php/homepage/') ?></li> 
    7982        <?php endif; ?> 
    80         <li><?php echo link_to(ucfirst(__('calendar')),          '#', array('onclick' => "window.open('http://".$_SERVER['HTTP_HOST']."/app/phpicalendar/week.php?cal=http%3A%2F%2F".$sf_user->getSubscriber()->getUser().":".$sf_user->getSubscriber()->getPassword()."@".$_SERVER['HTTP_HOST']."%2Fcalendar%2Fapimo', 'calendar', 'location=no,toolbar=no,scrollbars=yes,width=900,height=650')")) ?></li> 
     83        <li><?php echo link_to(ucfirst(__('calendar')),          '#', array('onclick' => "window.open('http://".$_SERVER['HTTP_HOST']."/app/phpicalendar/week.php?cal=http%3A%2F%2F".$sf_user->getSubscriber()->getUser().":".$sf_user->getSubscriber()->getPassword()."@".$_SERVER['HTTP_HOST']."%2Fcalendar%2Fapimo', 'calendar', 'location=no,toolbar=no,scrollbars=yes,width=900,height=700')")) ?></li> 
    8184        <li><?php echo link_to(ucfirst(__('credit')),            'tools/credit') ?></li> 
    8285        <li><?php echo link_to(ucfirst(__('maps')),              'maps/index') ?></li> 
  • trunk/apps/intranet/modules/homepage/templates/_searchresult.php

    r413 r451  
    2727    <li class="footer"><?php echo link_to('&gt; '.__('nexts').'...','contact/list?seller=1&search='.$sf_params->get('homesearch')); ?></li> 
    2828  <?php endif; ?> 
     29 
     30  <?php if($markets): ?> 
     31    <li class="title"><?php echo ucfirst(__('market')) ?></li> 
     32  <?php endif; ?> 
     33  <?php foreach($markets as $market): ?> 
     34    <li><?php echo link_to($market.' : '.$market->getPriceWithI18n(), 'market/show?id='.$market->getId()) ?></li> 
     35  <?php endforeach; ?> 
     36 
    2937  <?php if($saless): ?> 
    3038    <li class="title"><?php echo ucfirst(__('sales')) ?></li> 
     
    3745    <li class="footer"><?php echo link_to('&gt; '.__('nexts').'...','sales/search'); ?></li> 
    3846  <?php endif; ?> 
     47 
    3948  <?php if($rents): ?> 
    40     <li class="title"><?php echo ucfirst(__('rents')) ?></li> 
     49    <li class="title"><?php echo ucfirst(__('rentals')) ?></li> 
    4150  <?php endif; ?> 
    4251  <?php foreach($rents as $rent): ?> 
     
    4756    <li class="footer"><?php echo link_to('&gt; '.__('nexts').'...','rent/search'); ?></li> 
    4857  <?php endif; ?> 
     58 
    4959</ul> 
  • trunk/apps/intranet/modules/homepage/templates/indexSuccess.php

    r424 r451  
    77<?php endif; ?> 
    88 
    9 <?php //echo image_tag('tpl_02/icones/stats_80.gif') ?
    10 <table
     9<h2><?php echo image_tag('tpl_02/icones/stats_56.gif') ?> actualités</h2
     10<table class="homepage_table"
    1111<thead> 
    1212<tr> 
    13   <th width="150">&nbsp;</th> 
    14   <th width="80" style="text-align:center"><?php echo '15 '.__('days') ?></th> 
    15   <th width="80" style="text-align:center"><?php echo '30 '.__('days') ?></th> 
    16   <th width="80" style="text-align:center"><?php echo '45 '.__('days') ?></th> 
    17   <th width="80" style="text-align:center"><?php echo '60 '.__('days') ?></th> 
     13  <th width="200">&nbsp;</th> 
     14  <th width="100" style="text-align:center"><?php echo '15 '.__('days') ?></th> 
     15  <th width="100" style="text-align:center"><?php echo '30 '.__('days') ?></th> 
     16  <th width="100" style="text-align:center"><?php echo '45 '.__('days') ?></th> 
     17  <th width="100" style="text-align:center"><?php echo '60 '.__('days') ?></th> 
    1818</tr> 
    1919</thead> 
     
    2121<tr> 
    2222  <th><?php echo ucfirst('mandats sans visites') ?></th> 
    23   <td style="text-align:center"><?php echo link_to(count(SalesPeer::doSelectNoVisit(date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-15, date('Y'))), $user->getAgencyId(), $user->getId())), 'sales/novisit?search_in_by='.$user->getId().'&since='.date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-15, date('Y')))) ?></td> 
    24   <td style="text-align:center"><?php echo link_to(count(SalesPeer::doSelectNoVisit(date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-30, date('Y'))),  $user->getAgencyId(), $user->getId())), 'sales/novisit?search_in_by='.$user->getId().'&since='.date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-30, date('Y')))) ?></td> 
    25   <td style="text-align:center"><?php echo link_to(count(SalesPeer::doSelectNoVisit(date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-45, date('Y'))),  $user->getAgencyId(), $user->getId())), 'sales/novisit?search_in_by='.$user->getId().'&since='.date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-45, date('Y')))) ?></td> 
    26   <td style="text-align:center"><?php echo link_to(count(SalesPeer::doSelectNoVisit(date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-60, date('Y'))),  $user->getAgencyId(), $user->getId())), 'sales/novisit?search_in_by='.$user->getId().'&since='.date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-60, date('Y')))) ?></td> 
     23  <td style="text-align:center"> 
     24    <?php  
     25      $num = count(SalesPeer::doSelectNoVisit(date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-15, date('Y'))), $user->getAgencyId(), $user->getId())); 
     26      if($num>0) echo '<span class="highlight">'; 
     27      echo link_to($num, 'sales/novisit?search_in_by='.$user->getId().'&since='.date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-15, date('Y')))); 
     28      if($num>0) echo '</span>'; 
     29    ?></td> 
     30  <td style="text-align:center"> 
     31    <?php 
     32      $num = count(SalesPeer::doSelectNoVisit(date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-30, date('Y'))), $user->getAgencyId(), $user->getId())); 
     33      if($num>0) echo '<span class="highlight">'; 
     34      echo link_to($num, 'sales/novisit?search_in_by='.$user->getId().'&since='.date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-30, date('Y')))); 
     35      if($num>0) echo '</span>'; 
     36    ?></td> 
     37  <td style="text-align:center"> 
     38    <?php 
     39      $num = count(SalesPeer::doSelectNoVisit(date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-45, date('Y'))), $user->getAgencyId(), $user->getId())); 
     40      if($num>0) echo '<span class="highlight">'; 
     41      echo link_to($num, 'sales/novisit?search_in_by='.$user->getId().'&since='.date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-45, date('Y')))); 
     42      if($num>0) echo '</span>'; 
     43    ?></td> 
     44  <td style="text-align:center"> 
     45    <?php 
     46      $num = count(SalesPeer::doSelectNoVisit(date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-60, date('Y'))), $user->getAgencyId(), $user->getId())); 
     47      if($num>0) echo '<span class="highlight">'; 
     48      echo link_to($num, 'sales/novisit?search_in_by='.$user->getId().'&since='.date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-60, date('Y')))); 
     49      if($num>0) echo '</span>'; 
     50    ?></td> 
    2751</tr> 
    2852<tr> 
     
    3761<hr /> 
    3862 
    39 <table
     63<table class="homepage_table"
    4064<thead> 
    4165  <tr> 
     66   <th width="200">&nbsp;</th> 
     67   <th width="100" style="text-align:center"><?php echo ucfirst(__('personal')) ?></th> 
     68   <th width="100" colspan="2" style="text-align:center"><?php echo ucfirst(__('agency')) ?></th> 
     69   <?php if($exchange): ?> 
     70   <th width="100" style="text-align:center"><?php echo ucfirst(__('market')) ?></th> 
     71   <th width="100" style="text-align:center"><?php echo ucfirst(__('market')) ?> MàJ</th> 
     72   <?php endif; ?> 
     73   <?php if($agencies_num>1): ?> 
     74   <th width="100" style="text-align:center"><?php echo ucfirst(__('company')) ?></th> 
     75   <?php endif; ?> 
     76   <?php if($user->getAgency()->getBrandId()): ?> 
     77   <th width="100" style="text-align:center"><?php echo ucfirst(__('brand')) ?></th> 
     78   <?php endif; ?> 
     79  </tr> 
     80  <tr> 
    4281   <th width="150">&nbsp;</th> 
    43    <th width="80" colspan="2" style="text-align:center"><?php echo ucfirst(__('agency')) ?></th> 
    44    <th width="80" style="text-align:center"><?php echo ucfirst(__('personal')) ?></th> 
    45    <th width="80" style="text-align:center"><?php echo ucfirst(__('market')) ?></th> 
    46    <th width="80" style="text-align:center"><?php echo ucfirst(__('market')) ?> MàJ</th> 
    47    <?php if($agencies_num>1): ?> 
    48    <th width="80" style="text-align:center"><?php echo ucfirst(__('company')) ?></th> 
    49    <?php endif; ?> 
    50    <?php if($user->getAgency()->getBrandId()): ?> 
    51    <th width="80" style="text-align:center"><?php echo ucfirst(__('brand')) ?></th> 
    52    <?php endif; ?> 
    53   </tr> 
    54   <tr> 
    55    <th width="150">&nbsp;</th> 
    56    <th width="40" style="text-align:center">7 <?php echo __('days') ?></th> 
    57    <th width="40" style="text-align:center">Total</th> 
    5882   <th style="text-align:center">Total</th> 
     83   <th width="50" style="text-align:center">7 <?php echo __('days') ?></th> 
     84   <th width="50" style="text-align:center">Total</th> 
     85   <?php if($exchange): ?> 
    5986   <th style="text-align:center">72 <?php echo __('h(hours)') ?></th> 
    60    <th width="80" style="text-align:center">72 <?php echo __('h(hours)') ?></th> 
    61    <?php if($agencies_num>1): ?> 
    62    <th width="80" style="text-align:center">72 <?php echo __('h(hours)') ?></th> 
    63    <?php endif; ?> 
    64    <?php if($user->getAgency()->getBrandId()): ?> 
    65    <th width="80" style="text-align:center">72 <?php echo __('h(hours)') ?></th> 
     87   <th width="100" style="text-align:center">72 <?php echo __('h(hours)') ?></th> 
     88   <?php endif; ?> 
     89   <?php if($agencies_num>1): ?> 
     90   <th width="100" style="text-align:center">72 <?php echo __('h(hours)') ?></th> 
     91   <?php endif; ?> 
     92   <?php if($user->getAgency()->getBrandId()): ?> 
     93   <th width="100" style="text-align:center">72 <?php echo __('h(hours)') ?></th> 
    6694   <?php endif; ?> 
    6795  </tr> 
     
    7098  <tr> 
    7199   <th><?php echo ucfirst(__('sales')) ?></th> 
    72    <td style="text-align:center"><?php echo link_to(count(SalesPeer::doSelectNew(date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-7, date('Y'))), date('Y-m-d'), 1)), 'sales/list?search_start_at='.date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-7, date('Y'))).'&search_end_at='.date('Y-m-d').'&search_file=1&search=1&search_step_id=1') ?></td> 
    73    <td style="text-align:center"><?php echo link_to(count(SalesPeer::doSelectNew('1997-01-01', date('Y-m-d'), 1)), 'sales/list?search_start_at=1997-01-01&search_end_at='.date('Y-m-d').'&search_file=1&search=1&search_step_id=1') ?></td> 
    74    <td style="text-align:center"><?php echo link_to(count(SalesPeer::doSelectNew('1997-01-01', date('Y-m-d'), 0, $user->getId())), 'sales/list?search_in_by='.$user->getId().'&search_start_at=1997-01-01&search_end_at='.date('Y-m-d').'&search_file=0&search=1&search_step_id=1') ?></td> 
    75    <td style="text-align:center"><?php echo link_to($nbmarkets_week, 'market/list') ?></td> 
    76    <td style="text-align:center"><?php echo link_to($nbmarkets_week_upd, 'market/list') ?></td> 
    77    <?php if($agencies_num>1): ?> 
    78    <td style="text-align:center"><?php echo link_to(count(SalesPeer::doSelectNew(date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-7, date('Y'))), date('Y-m-d'), 0)), 'sales/list?search_start_at='.date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-7, date('Y'))).'&search_end_at='.date('Y-m-d').'&search_file=0&search=1&search_step_id=1') ?></td> 
    79    <?php endif; ?> 
    80    <?php if($user->getAgency()->getBrandId()): ?> 
    81    <td style="text-align:center"><?php echo link_to(count(SalesPeer::doSelectNew(date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-7, date('Y'))), date('Y-m-d'), 2)), 'sales/list?search_start_at='.date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-7, date('Y'))).'&search_end_at='.date('Y-m-d').'&search_file=2&search=1&search_step_id=1') ?></td> 
     100   <td style="text-align:center"> 
     101     <?php  
     102       $num = SalesPeer::doCountNew('1997-01-01', date('Y-m-d'), 0, $user->getId()); 
     103       if($num>0) echo '<span class="highlight">'; 
     104       echo link_to($num, 'sales/list?search_in_by='.$user->getId().'&search_start_at=1997-01-01&search_end_at='.date('Y-m-d').'&search_file=0&search=1&search_step_id=1'); 
     105       if($num>0) echo '</span>'; 
     106     ?></td> 
     107   <td style="text-align:center"> 
     108     <?php 
     109       $num = SalesPeer::doCountNew(date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-7, date('Y'))), date('Y-m-d'), 1); 
     110       if($num>0) echo '<span class="highlight">'; 
     111       echo link_to($num, 'sales/list?search_start_at='.date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-7, date('Y'))).'&search_end_at='.date('Y-m-d').'&search_file=1&search=1&search_step_id=1'); 
     112       if($num>0) echo '</span>'; 
     113     ?></td> 
     114   <td style="text-align:center"> 
     115     <?php  
     116       $num = SalesPeer::doCountNew('1997-01-01', date('Y-m-d'), 1); 
     117       if($num>0) echo '<span class="highlight">'; 
     118       echo link_to($num, 'sales/list?search_start_at=1997-01-01&search_end_at='.date('Y-m-d').'&search_file=1&search=1&search_step_id=1'); 
     119       if($num>0) echo '</span>'; 
     120     ?></td> 
     121   <?php if($exchange): ?> 
     122   <td style="text-align:center"> 
     123     <?php  
     124       if($nbmarkets_week>0) echo '<span class="highlight">';  
     125       echo link_to($nbmarkets_week, 'market/list');  
     126       if($nbmarkets_week>0) echo '</span>'; 
     127     ?></td> 
     128   <td style="text-align:center"> 
     129     <?php  
     130       if($nbmarkets_week_upd>0) echo '<span class="highlight">';  
     131       echo link_to($nbmarkets_week_upd, 'market/list'); 
     132       if($nbmarkets_week_upd>0) echo '</span>'; 
     133     ?></td> 
     134   <?php endif; ?> 
     135   <?php if($agencies_num>1): ?> 
     136   <td style="text-align:center"> 
     137     <?php  
     138       $num = SalesPeer::doCountNew(date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-7, date('Y'))), date('Y-m-d'), 0); 
     139       if($num>0) echo '<span class="highlight">'; 
     140       echo link_to($num, 'sales/list?search_start_at='.date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-7, date('Y'))).'&search_end_at='.date('Y-m-d').'&search_file=0&search=1&search_step_id=1'); 
     141       if($num>0) echo '</span>'; 
     142     ?></td> 
     143   <?php endif; ?> 
     144   <?php if($user->getAgency()->getBrandId()): ?> 
     145   <td style="text-align:center"> 
     146     <?php 
     147       $num = SalesPeer::doCountNew(date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-7, date('Y'))), date('Y-m-d'), 2); 
     148       if($num>0) echo '<span class="highlight">'; 
     149       echo link_to($num, 'sales/list?search_start_at='.date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-7, date('Y'))).'&search_end_at='.date('Y-m-d').'&search_file=2&search=1&search_step_id=1'); 
     150       if($num>0) echo '</span>'; 
     151     ?></td> 
    82152   <?php endif; ?> 
    83153  </tr> 
     
    85155  <tr> 
    86156   <th><?php echo ucfirst(__('rentals')) ?></th> 
    87    <td style="text-align:center"><?php echo link_to(count(RentPeer::doSelectNew(date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-7, date('Y'))), date('Y-m-d'), 1)), 'rent/list?search_start_at='.date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-7, date('Y'))).'&search_end_at='.date('Y-m-d').'&search_file=1&search=1&search_step_id=1') ?></td> 
    88    <td style="text-align:center"><?php echo link_to(count(RentPeer::doSelectNew('1997-01-01', date('Y-m-d'), 1)), 'rent/list?search_start_at=1997-01-01&search_end_at='.date('Y-m-d').'&search_file=1&search=1&search_step_id=1') ?></td> 
    89    <td style="text-align:center"><?php echo link_to(count(RentPeer::doSelectNew('1997-01-01', date('Y-m-d'), 0, $user->getId())), 'rent/list?search_in_by='.$user->getId().'&search_start_at=1997-01-01&search_end_at='.date('Y-m-d').'&search_file=0&search=1&search_step_id=1') ?></td> 
    90    <td style="text-align:center">-</td> 
    91    <td style="text-align:center">-</td> 
     157   <td style="text-align:center"> 
     158     <?php  
     159       $num = count(RentPeer::doSelectNew('1997-01-01', date('Y-m-d'), 0, $user->getId())); 
     160       if($num>0) echo '<span class="highlight">'; 
     161       echo link_to($num, 'rent/list?search_in_by='.$user->getId().'&search_start_at=1997-01-01&search_end_at='.date('Y-m-d').'&search_file=0&search=1&search_step_id=1'); 
     162       if($num>0) echo '</span>'; 
     163     ?> 
     164   </td> 
     165   <td style="text-align:center"> 
     166     <?php  
     167       $num = count(RentPeer::doSelectNew(date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-7, date('Y'))), date('Y-m-d'), 1)); 
     168       if($num>0) echo '<span class="highlight">'; 
     169       echo link_to($num, 'rent/list?search_start_at='.date('Y-m-d', mktime(0, 0, 0, date('m'), date('d')-7, date('Y'))).'&search_end_at='.date('Y-m-d').'&search_file=1&search=1&search_step_id=1'); 
     170       if($num>0) echo '</span>'; 
     171     ?></td> 
     172   <td style="text-align:center"> 
     173     <?php  
     174       $num = count(RentPeer::doSelectNew('1997-01-01', date('Y-m-d'), 1)); 
     175       if($num>0) echo '<span class="highlight">'; 
     176       echo link_to($num, 'rent/list?search_start_at=1997-01-01&search_end_at='.date('Y-m-d').'&search_file=1&search=1&search_step_id=1'); 
     177       if($num>0) echo '</span>'; 
     178     ?></td> 
     179   <?php if($exchange): ?> 
     180   <td style="text-align:center">-</td> 
     181   <td style="text-align:center">-</td> 
     182   <?php endif; ?> 
    92183   <?php if($agencies_num>1): ?> 
    93184   <td style="text-align:center">-</td> 
     
    105196    $c->add(SearchPeer::ACTIVE, 1); 
    106197    $searchs_user = SearchPeer::doCount($c); 
     198    if(!$searchs_user) $searchs_user = '0'; 
    107199 
    108200    // num searches for agency 
     
    111203    $c->add(SearchPeer::ACTIVE, 1); 
    112204    $searchs_agency = SearchPeer::doCount($c); 
     205    if(!$searchs_agency) $searchs_agency = '0'; 
    113206  ?> 
    114207  <tr> 
    115208   <th><?php echo ucfirst(__('asks')) ?></th> 
    116    <td style="text-align:center">-</td> 
    117    <td style="text-align:center"><?php echo link_to($searchs_agency, 'search/list?search=1&active=1') ?></td> 
    118    <td style="text-align:center"><?php echo link_to($searchs_user, 'search/list?search=1&active=1&user_id='.$user_show_id) ?></td> 
    119    <td style="text-align:center">-</td> 
    120    <td style="text-align:center">-</td> 
     209   <td style="text-align:center"> 
     210     <?php  
     211       if($searchs_user>0) echo '<span class="highlight">'; 
     212       echo link_to($searchs_user, 'search/list?search=1&active=1&user_id='.$user_show_id); 
     213       if($searchs_user>0) echo '</span>'; 
     214     ?></td> 
     215   <td style="text-align:center">-</td> 
     216   <td style="text-align:center"> 
     217     <?php  
     218       if($searchs_agency>0) echo '<span class="highlight">'; 
     219       echo link_to($searchs_agency, 'search/list?search=1&active=1'); 
     220       if($searchs_agency>0) echo '</span>'; 
     221     ?> 
     222   </td> 
     223   <?php if($exchange): ?> 
     224   <td style="text-align:center">-</td> 
     225   <td style="text-align:center">-</td> 
     226   <?php endif; ?> 
    121227   <?php if($agencies_num>1): ?> 
    122228   <td style="text-align:center">-</td> 
     
    130236   <th><?php echo ucfirst(__('leases')) ?></th> 
    131237   <td style="text-align:center">-</td> 
    132    <td style="text-align:center"><?php echo link_to(count(LeasePeer::doSelectNew('1997-01-01', date('Y-m-d'), 1)), 'lease/list') ?></td> 
    133    <td style="text-align:center">-</td> 
    134    <td style="text-align:center">-</td> 
    135    <td style="text-align:center">-</td> 
     238   <td style="text-align:center">-</td> 
     239   <td style="text-align:center"> 
     240     <?php 
     241       $num = count(LeasePeer::doSelectNew('1997-01-01', date('Y-m-d'), 1)); 
     242       if($num>0) echo '<span class="highlight">'; 
     243       echo link_to($num, 'lease/list'); 
     244       if($num>0) echo '</span>'; 
     245     ?> 
     246   </td> 
     247   <?php if($exchange): ?> 
     248   <td style="text-align:center">-</td> 
     249   <td style="text-align:center">-</td> 
     250   <?php endif; ?> 
    136251   <?php if($agencies_num>1): ?> 
    137252   <td style="text-align:center">-</td> 
     
    183298<hr /> 
    184299 
    185 <?php echo link_to(image_tag('tpl_02/'.$sf_user->getCulture().'/button/view.png'), '#', array('onclick' => "window.open('http://".$_SERVER['HTTP_HOST']."/app/phpicalendar/week.php?cal=http%3A%2F%2F".$sf_user->getSubscriber()->getUser().":".$sf_user->getSubscriber()->getPassword()."@".$_SERVER['HTTP_HOST']."%2Fcalendar%2Fapimo', 'calendar', 'location=no,toolbar=no,scrollbars=yes,width=900,height=650')")) ?>  
     300<?php echo link_to(image_tag('tpl_02/'.$sf_user->getCulture().'/button/view.png'), '#', array('onclick' => "window.open('http://".$_SERVER['HTTP_HOST']."/app/phpicalendar/week.php?cal=http%3A%2F%2F".$sf_user->getSubscriber()->getUser().":".$sf_user->getSubscriber()->getPassword()."@".$_SERVER['HTTP_HOST']."%2Fcalendar%2Fapimo', 'calendar', 'location=no,toolbar=no,scrollbars=yes,width=900,height=700')")) ?>  
    186301&nbsp;<?php echo link_to(image_tag('tpl_02/'.$sf_user->getCulture().'/button/add.png'), 'calendar/create') ?> 
  • trunk/apps/intranet/modules/homepage/templates/searchresultSuccess.php

    r289 r451  
    1 <?php include_partial('searchresult', array('limite' => $limite, 'contacts' => $contacts, 'nbcontacts' => $nbcontacts, 'buyers' => $buyers, 'nbbuyers' => $nbbuyers, 'sellers' => $sellers, 'nbsellers' => $sellers, 'saless' => $saless, 'nbsaless' => $nbsaless, 'rents' => $rents, 'nbrents' => $nbrents, 'users' => $users, 'nbusers' => $nbusers)); ?> 
     1<?php include_partial('searchresult', array('limite' => $limite, 'contacts' => $contacts, 'nbcontacts' => $nbcontacts, 'buyers' => $buyers, 'nbbuyers' => $nbbuyers, 'sellers' => $sellers, 'nbsellers' => $sellers, 'saless' => $saless, 'nbsaless' => $nbsaless, 'rents' => $rents, 'nbrents' => $nbrents, 'markets' => $markets)) ?> 
  • trunk/lib/model/SalesPeer.php

    r425 r451  
    5454  } 
    5555 
    56   public static function doSelectNew($start_at = '1997-01-01', $end_at, $file = 0, $user_id = false , $agency_id = false) 
     56  public static function doCriteriaNew($start_at = '1997-01-01', $end_at, $file = 0, $user_id = false , $agency_id = false) 
    5757  { 
    5858    $start_at = $start_at.' 00:00:00'; 
     
    8181    if($user_id) 
    8282    $c->add(SalesPeer::IN_BY, $user_id); 
    83     return SalesPeer::doSelect($c); 
     83    return $c; 
     84  } 
     85 
     86  public static function doSelectNew($start_at = '1997-01-01', $end_at, $file = 0, $user_id = false , $agency_id = false) 
     87  { 
     88    $c = SalesPeer::doCriteriaNew($start_at, $end_at, $file, $user_id, $agency_id); 
     89    return SalesPeer::doSelect($c); 
     90  } 
     91 
     92  public static function doCountNew($start_at = '1997-01-01', $end_at, $file = 0, $user_id = false , $agency_id = false) 
     93  { 
     94    $c = SalesPeer::doCriteriaNew($start_at, $end_at, $file, $user_id, $agency_id); 
     95    return SalesPeer::doCount($c); 
    8496  } 
    8597   
     
    121133        return SalesPeer::doCountJoinEstate($c); 
    122134  } 
    123   public static function doCountNew($start_at , $end_at, $user_id = false , $agency_id = false) 
    124   { 
    125         $start_at = $start_at.' 00:00:00'; 
    126     $end_at = $end_at.' 23:59:59'; 
    127     $c = new Criteria(); 
    128         $criterion = $c->getNewCriterion(SalesPeer::CREATED_AT, $start_at, Criteria::GREATER_EQUAL); 
    129         $criterion->addAnd($c->getNewCriterion(SalesPeer::CREATED_AT, $end_at, Criteria::LESS_EQUAL)); 
    130         $c->add($criterion); 
    131         $c->add(SalesPeer::STEP_ID, 1); 
    132     if($agency_id): 
    133       // limité à l'agence 
    134       $c->add(SalesPeer::AGENCY_ID, $agency_id , Criteria::IN); 
    135           endif; 
    136     //limitation user 
    137     if($user_id) 
    138       $c->add(SalesPeer::IN_BY, $user_id , Criteria::IN); 
    139     return SalesPeer::doCount($c); 
    140   } 
    141135   
    142136  public static function doCountSold($start_at , $end_at, $user_id = false , $agency_id = false)