Changeset 2733


Ignore:
Timestamp:
May 19, 2012, 7:48:10 PM (8 years ago)
Author:
goya
Message:

options width et maxtags pour le widget

Location:
cpc/trunk/project/apps/frontend/modules
Files:
7 edited

Legend:

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

    r2729 r2733  
    553553    if ($request->getParameter('notags', false))
    554554      $this->options['tags'] = 0;
     555    if (preg_match('/^\d+$/', $request->getParameter('maxtags', 40)))
     556      $this->options['maxtags'] = $request->getParameter('maxtags', 40);
     557    if (preg_match('/^\d+$/', $request->getParameter('width', 935)))
     558      $this->options['width'] = $request->getParameter('width', 935);
    555559    $this->setLayout(false);
    556560  }
  • cpc/trunk/project/apps/frontend/modules/parlementaire/actions/components.class.php

    r2729 r2733  
    5353    $this->parl = Doctrine::getTable('Parlementaire')->findOneBySlug($this->slug);
    5454    if (!$this->options)
    55       $this->options = array('titre' => 1, 'photo' => 1, 'graphe' => 1, 'activite' => 1, 'tags' => 1);
     55      $this->options = array('titre' => 1, 'photo' => 1, 'graphe' => 1, 'activite' => 1, 'tags' => 1, 'width' => 935, 'maxtags' => 40);
    5656  } 
    5757}
  • cpc/trunk/project/apps/frontend/modules/parlementaire/templates/_top.php

    r2730 r2733  
    7878?>
    7979<ul><?php
     80$icosize = 16;
     81if (isset($widthrate))
     82  $icosize = floor($icosize*$widthrate);
    8083foreach(array_keys($images) as $k) {
    8184  if (isset($top[$k]['value']))
     
    100103    echo 'a';
    101104  else echo 'span';
    102   echo ' class="jstitle" title="'.$titre.'" href="'.url_for('@top_global_sorted?sort='.$sort[$k].'#'.$parlementaire->slug, $abs).'"><img style="height: 16px; width: 16px;" src="'.$serv.$sf_request->getRelativeUrlRoot().'/images/xneth/';
     105  echo ' class="jstitle" title="'.$titre.'" href="'.url_for('@top_global_sorted?sort='.$sort[$k].'#'.$parlementaire->slug, $abs).'"><img style="height: '.$icosize.'px; width: '.$icosize.'px;" src="'.$serv.$sf_request->getRelativeUrlRoot().'/images/xneth/';
    103106  printf($images[$k], $couleur);
    104107  echo '" alt="'.$titre.'" />';
  • cpc/trunk/project/apps/frontend/modules/parlementaire/templates/_widget.php

    r2730 r2733  
    44$url = url_for('@parlementaire?slug='.$parl->slug, 'absolute=true'); ?>
    55<style type="text/css">
    6  .nosdeputes_widget { width: 935px; text-align: center; font-size: 11px; }
     6 .nosdeputes_widget { width: <?php echo $options['width']; ?>px; text-align: center; font-size: <?php echo max(8, floor(14*$options['width']/935)); ?>px; }
    77 .nosdeputes_widget a { text-decoration: none; color: inherit; }
    88 .nosdeputes_widget #overDiv { position: absolute; visibility: hidden; z-index: 1000; }
    99<?php if ($options['graphe']) : ?>
    10  .nosdeputes_widget .graph_depute { float: left; height: 170px; margin-right: 3px; width: 800px; }
    11  .nosdeputes_widget .graph_depute p { margin: 0; padding: 0; }
     10 .nosdeputes_widget .graph_depute { float: left; height: <?php echo floor(170*$options['width']/935); ?>px; margin: 1px; width: <?php echo floor(800*$options['width']/935); ?>px; }
     11 .nosdeputes_widget .graph_depute p { font-size: <?php echo floor(11*$options['width']/935); ?>px; margin: 0; padding: 0; }
    1212<?php endif;
    1313if ($options['activite']) : ?>
    14  .nosdeputes_widget .barre_activite { text-align: center; background-color: #EBEBEB; float: left; margin-top: 10px; padding-top: 3px; width: 935px; text-align: left; }
    15  .nosdeputes_widget .barre_activite ul, .barre_activite li { background-color: transparent; display: inline; font-weight: bold; line-height: 24px; margin: -3px; padding: 0; }
    16  .nosdeputes_widget .barre_activite h3 { background-color: transparent; color: #6B6B6B; display: inline; font-size: 1.3em; line-height: 24px; margin: 0; padding-left: 5px; }
    17  .nosdeputes_widget .barre_activite li img { margin-left: 25px; }
     14 .nosdeputes_widget .barre_activite { font-size: <?php echo floor(13*$options['width']/935); ?>px; background-color: #EBEBEB; float: left; margin-top: <?php echo floor(10*$options['width']/935); ?>px; padding-top: <?php echo floor(3*$options['width']/935); ?>px; width: <?php echo floor($options['width']); ?>px; text-align: left; }
     15 .nosdeputes_widget .barre_activite ul, .barre_activite li { background-color: transparent; display: inline; font-weight: bold; line-height: <?php echo floor(24*$options['width']/935); ?>px; margin: -<?php echo floor(3*$options['width']/935); ?>px; padding: 0; }
     16 .nosdeputes_widget .barre_activite h3 { background-color: transparent; color: #6B6B6B; display: inline; font-size: 1.2em; line-height: <?php echo floor(24*$options['width']/935); ?>px; margin: 0; padding-left: <?php echo floor(5*$options['width']/935); ?>px; }
     17 .nosdeputes_widget .barre_activite li img { margin-left: <?php echo floor(25*$options['width']/935); ?>px; }
    1818<?php endif;
    1919if ($options['tags']) : ?>
    20  .nosdeputes_widget .tag_level_0 { font-size: 0.8em; }
    21  .nosdeputes_widget .tag_level_1 { font-size: 0.9em; }
    22  .nosdeputes_widget .tag_level_2 { font-size: 1em; }
    23  .nosdeputes_widget .tag_level_3 { font-size: 1.5em; }
    24  .nosdeputes_widget .tag_level_4 { font-size: 1.7em; }
    25  .nosdeputes_widget .internal_tag_cloud { margin: auto; position: relative; text-align: center; }
     20 .nosdeputes_widget .tag_level_0 { font-size: 0.5em; }
     21 .nosdeputes_widget .tag_level_1 { font-size: 0.7em; }
     22 .nosdeputes_widget .tag_level_2 { font-size: 0.9em; }
     23 .nosdeputes_widget .tag_level_3 { font-size: 1.1em; }
     24 .nosdeputes_widget .tag_level_4 { font-size: 1.3em; }
     25 .nosdeputes_widget .internal_tag_cloud { margin: <?php echo floor(2*$options['width']/935); ?>px; position: relative; text-align: center; font-size: 12px; }
    2626 <?php endif; ?>
    2727</style>
     
    2929 <?php if ($options['titre']) : ?>
    3030  <div style="text-align:center;">
    31    <h2><a href="<?php echo $url; ?>"><?php echo $parl->nom; ?>, <?php echo $parl->getLongStatut(); ?></h2>
     31   <h2><a href="<?php echo $url; ?>"><?php echo $parl->nom; ?><?php if ($options['width'] > 600) echo ', '.$parl->getLongStatut(); else if ($options['width'] > 300) echo ', '.$parl->getStatut(); ?></a></h2>
    3232  </div>
    3333 <?php endif;
    34  if ($options['photo']) : ?>
    35   <div style="float: left; border: 2px solid #DCD6CA; height: 160px; width: 125px; margin-right: 3px;">
    36    <a href="<?php echo $url; ?>"><?php include_partial('photoParlementaire', array('parlementaire' => $parl, 'height' => 160, 'absolute' => true)); ?></a>
     34 if ($options['photo']) :
     35  if (!$options['graphe']) {
     36    $photow = $options['width']-2;
     37    $photoh = floor(160/125*$photow);
     38  } else {
     39    $photoh = floor(160*($options['width']-4)/935);
     40    $photow = floor(125*($options['width']-4)/935);
     41  } ?>
     42  <div style="<?php echo ($options['graphe'] ? 'float: left; ' : ''); ?>border: <?php echo floor(2*$options['width']/935); ?>px solid #DCD6CA; height: <?php echo $photoh; ?>px; width: <?php echo $photow; ?>px;">
     43   <a href="<?php echo $url; ?>"><?php include_partial('photoParlementaire', array('parlementaire' => $parl, 'height' => $photoh, 'absolute' => true)); ?></a>
    3744  </div>
    3845 <?php endif;
    39  if ($options['graphe']) : ?>
    40   <div class="graph_depute">
    41    <?php echo include_component('plot', 'parlementaire', array('parlementaire' => $parl, 'options' => array('plot' => 'total', 'questions' => 'true', 'link' => 'true', 'absolute' => true))); ?>
     46 if ($options['graphe']) :
     47  if (!$options['photo'])
     48    $widthrate = $options['width']/800.;
     49  else $widthrate = $options['width']/935.; ?>
     50  <div class="graph_depute" style="margin: auto; <?php echo ($widthrate > 1/3 ? 'margin-bottom: 10px; ' : ''); ?>height: <?php echo floor(160*$widthrate); ?>px">
     51   <?php echo include_component('plot', 'parlementaire', array('parlementaire' => $parl, 'options' => array('plot' => 'total', 'questions' => 'true', 'link' => 'true', 'absolute' => true, 'widthrate' => $widthrate))); ?>
    4252  </div>
    4353  <div style="clear: both;"></div>
     
    4555 if ($options['activite']) : ?>
    4656  <div class="barre_activite">
    47    <?php include_partial('top', array('parlementaire'=>$parl, 'absolute' => true)); ?>
     57   <?php include_partial('top', array('parlementaire'=>$parl, 'absolute' => true, 'widthrate' => $options['width']/935.)); ?>
    4858  </div>
    4959  <div style="clear: both;"></div>
     
    5161 if ($options['tags']) : ?>
    5262  <div style="text-align: justify; border: 2px solid #EBEBEB">
    53     <?php echo include_component('tag', 'parlementaire', array('parlementaire'=>$parl, 'absolute' => true)); ?>
     63    <?php echo include_component('tag', 'parlementaire', array('parlementaire'=>$parl, 'absolute' => true, 'limit' => $options['maxtags'])); ?>
    5464  </div>
    5565 <?php endif; ?>
  • cpc/trunk/project/apps/frontend/modules/plot/templates/_parlementaire.php

    r2730 r2733  
    11<div id="overDiv"></div>
    2 <?php $plotarray = array('parlementaire' => $parlementaire, 'time' => 'lastyear', 'questions' => 'false', 'link' => 'false', 'absolute' => false);
     2<?php $plotarray = array('parlementaire' => $parlementaire, 'time' => 'lastyear', 'questions' => 'false', 'link' => 'false', 'absolute' => false, 'widthrate' => 1);
    33if (isset($options['session'])) $plotarray['time'] = $options['session'];
    44if (isset($options['questions'])) $plotarray['questions'] = $options['questions'];
    55if (isset($options['link'])) $plotarray['link'] = $options['link'];
    66if (isset($options['absolute'])) $plotarray['absolute'] = $options['absolute'];
     7if (isset($options['widthrate'])) $plotarray['widthrate'] = $options['widthrate'];
    78
    89if ($options['plot'] == 'all' || $options['plot'] == 'total') {
  • cpc/trunk/project/apps/frontend/modules/plot/templates/_plotParlementaire.php

    r2730 r2733  
    1818  $time = 'lastyear';
    1919  if (myTools::isFinLegislature()) $time = 'legislature';
    20   echo '<a href="'.url_for('@parlementaire_plot?slug='.$parlementaire->slug.'&time=legislature', $abs).'">';
    21   $size = 'height:150px; width:800px';
     20  echo '<a href="'.url_for('@parlementaire'.(isset($absolute) ? '' : '_plot').'?slug='.$parlementaire->slug.(isset($absolute) ? '' : '&time=legislature'), $abs).'">';
     21  if (!isset($widthrate))
     22    $size = 'height:150px; width:800px';
     23  else $size = 'height:'.floor(150*$widthrate).'px; width:'.floor(800*$widthrate).'px';
    2224 } else echo '<div class="par_session">'; ?>
    2325 <img style="<?php echo $size; ?>" id="graph<?php echo $PictureID; ?>" alt="Participation <?php echo $titre; ?> de <?php echo $parlementaire->nom; ?>" src="<?php echo url_for('@parlementaire_plot_graph?slug='.$parlementaire->slug.'&time='.$time.'&type='.$type.'&questions='.$questions.'&link='.$link.'&mapId='.$PictureID, $abs); ?>" onmousemove="getMousePosition(event);" onmouseout="nd();"/>
     
    3032<?php } ?>
    3133
    32 <?php if ($link === 'true') echo '</a>';
     34<?php if (!isset($widthrate) || $widthrate > 1/3) {
     35if ($link === 'true') echo '</a>';
    3336echo "<p><span style='background-color: rgb(255,0,0);'>&nbsp;</span> ";
    3437if ($type === 'commission') echo '&nbsp;Présences enregistrées&nbsp;&nbsp;&nbsp;';
     
    4548if ($link != 'true')
    4649  echo '</div>';
     50}
    4751?>
  • cpc/trunk/project/apps/frontend/modules/tag/templates/_parlementaire.php

    r2730 r2733  
    33if (isset($absolute) && $absolute)
    44  $abs = true;
    5 echo include_component('tag', 'tagcloud', array('tagquery' => $qtag, 'model' => 'Intervention', 'min_tag' => 2, 'route' => '@tag_parlementaire_interventions?parlementaire='.$parlementaire->slug.'&', 'limit' => 100, 'absolute' => $abs)); ?>
     5if (!isset($limit))
     6  $limit = 100;
     7echo include_component('tag', 'tagcloud', array('tagquery' => $qtag, 'model' => 'Intervention', 'min_tag' => 2, 'route' => '@tag_parlementaire_interventions?parlementaire='.$parlementaire->slug.'&', 'limit' => $limit, 'absolute' => $abs)); ?>
    68</div>
Note: See TracChangeset for help on using the changeset viewer.