Exemple #1
1
 public function executeFeed(sfWebRequest $request)
 {
     $vanity = $request->getParameter('id');
     $s = $request->getParameter('s', 0);
     $culture = $this->getUser()->getCulture();
     $c = new Criteria();
     $c->add(PropuestaPeer::VANITY, $vanity);
     $entity = PropuestaPeer::doSelectOne($c);
     $this->forward404Unless($entity);
     if ($entity->getCulture() != $culture) {
         $this->redirect("@homepage");
     }
     $filter = array();
     $filter['type_id'] = Propuesta::NUM_ENTITY;
     $filter['entity_id'] = $entity->getId();
     $reviews = SfReviewManager::getReviews($filter);
     $title = sfContext::getInstance()->getI18N()->__('%1% en Voota.es', array('%1%' => $entity));
     $description = sfContext::getInstance()->getI18N()->__('Opiniones sobre %1%, %2% votos a favor y %3% votos en contra', array('%1%' => $entity, '%2%' => $entity->getSumu(), '%3%' => $entity->getSumd()));
     $feed = new sfRssFeed();
     $feed->setTitle($title);
     $feed->setLanguage($culture);
     $feed->setSubtitle($description);
     $feed->setDescription($description);
     $feed->setLink('propuesta/show?id=' . $entity->getVanity());
     $domainExt = $culture == 'ca' ? "cat" : $culture;
     $feed->setAuthorName("Voota.{$domainExt}");
     $feedImage = new sfFeedImage();
     $feedImage->setLink('propuesta/show?id=' . $entity->getVanity());
     $feedImage->setImage(S3Voota::getImagesUrl() . '/' . $entity->getImagePath() . '/cc_' . $entity->getImagen());
     $feedImage->setTitle($entity);
     $feed->setImage($feedImage);
     foreach ($reviews as $review) {
         $item = new sfFeedItem();
         $item->setTitle(sfContext::getInstance()->getI18N()->__('%1%, voota %2%.', array('%1%' => $review->getSfGuardUser(), '%2%' => $review->getValue() == -1 ? sfContext::getInstance()->getI18N()->__('en contra') : sfContext::getInstance()->getI18N()->__('a favor'))));
         $item->setLink('sfReviewFront/show?id=' . SfVoUtil::reviewPermalink($review));
         $item->setAuthorName($review->getSfGuardUser());
         $item->setPubdate($review->getCreatedAt('U'));
         $item->setUniqueId($review->getId());
         $avatar = S3Voota::getImagesUrl() . '/usuarios/cc_s_' . $review->getSfGuardUser()->getProfile()->getImagen();
         $text = $culture == $review->getCulture() || !$review->getCulture() ? $review->getText() : '';
         $img = $review->getSfGuardUser()->getProfile()->getImagen() ? "<img src=\"{$avatar}\" alt =\"" . $review->getSfGuardUser() . "\" /> " : "";
         $content = "{$text}";
         $item->setDescription($content);
         $feed->addItem($item);
     }
     $this->feed = $feed;
 }
Exemple #2
0
 public function configure()
 {
     unset($this['partido_lista_list'], $this['created_at'], $this['partido_id'], $this['sumu'], $this['sumd'], $this['etiqueta_partido_list'], $this['lista_calle_list']);
     $this->embedI18n(array('es', 'ca'));
     //$this->widgetSchema['sumu'] = new sfWidgetFormInputHidden();
     //$this->widgetSchema['sumd'] = new sfWidgetFormInputHidden();
     $this->widgetSchema['imagen'] = new sfWidgetFormInputFileEditable(array('label' => 'Imagen Principal', 'file_src' => S3Voota::getImagesUrl() . '/partidos/cc_s_' . $this->getObject()->getImagen(), 'is_image' => true, 'edit_mode' => !$this->isNew(), 'template' => '<div>%file% <label></label>%input%<br /><label></label>%delete% Eliminar imagen actual</div>'));
     $this->validatorSchema['imagen'] = new sfValidatorFile(array('required' => false, 'mime_types' => 'web_images', 'path' => sfConfig::get('sf_upload_dir') . '/partidos', 'validated_file_class' => 'sfResizedFile'));
     //$this->validatorSchema['sumu'] = new sfValidatorString(array('required' => true));
     //$this->validatorSchema['sumd'] = new sfValidatorString(array('required' => true));
     if (!$this->isNew()) {
         // embed all enlace forms
         foreach ($this->getObject()->getEnlaces() as $enlace) {
             // create a new enlace form for the current enlace model object
             $enlaceForm = new PartidoEnlaceForm($enlace);
             // embed the enlace form in the main partido form
             $this->embedForm('enlace' . $enlace->getId(), $enlaceForm);
             // set a custom label for the embedded form
             $this->widgetSchema['enlace' . $enlace->getId()]->setLabel('Enlace ' . $enlace->getId());
             // change the name widget to sfWidgetFormInputDelete
             $this->widgetSchema['enlace' . $enlace->getId()]['url'] = new sfWidgetFormInputDelete(array('url' => 'partido/deleteEnlace', 'model_id' => $enlace->getId(), 'confirm' => 'Sure???'));
         }
         // create a new enlace form for a new enlace model object
         $enlaceForm = new PartidoEnlaceForm();
         // embed the enlace form in the main partido form
         $this->embedForm('enlace', $enlaceForm);
         // set a custom label for the embedded form
         $this->widgetSchema['enlace']->setLabel('Nuevo enlace');
     }
     $this->validatorSchema['imagen_delete'] = new sfValidatorBoolean();
 }
 public function configure()
 {
     unset($this['id'], $this['vanity'], $this['titulo'], $this['descripcion'], $this['imagen']);
     $this->setWidgets(array('doc' => new sfWidgetFormInputFileEditable(array('label' => sfContext::getInstance()->getI18N()->__('Imagen', array(), 'notices'), 'file_src' => $this->getObject() ? '' . S3Voota::getImagesUrl() . '/usuarios/cc_s_' . $this->getObject()->getDoc() : '', 'is_image' => false, 'edit_mode' => !$this->isNew(), 'template' => '%input%'))));
     $this->widgetSchema->setNameFormat('propuesta[%s]');
     $this->setValidators(array('doc' => new sfValidatorFile(array('required' => false, 'max_size' => '512000', 'path' => sfConfig::get('sf_upload_dir') . '/docs', 'validated_file_class' => 'sfResizedFile'), sfVoForm::getImageMessages())));
 }
 public function configure()
 {
     unset($this['politico_institucion_list'], $this['eleccion_institucion_list'], $this['created_at']);
     $this->embedI18n(array('es', 'ca'));
     $this->widgetSchema['disabled'] = new sfWidgetFormSelect(array('choices' => self::$estados));
     $this->widgetSchema['imagen'] = new sfWidgetFormInputFileEditable(array('label' => 'Imagen Principal', 'file_src' => S3Voota::getImagesUrl() . '/instituciones/cc_s_' . $this->getObject()->getImagen(), 'is_image' => true, 'edit_mode' => !$this->isNew(), 'template' => '<div>%file% <label></label>%input%<br /><label></label>%delete% Eliminar imagen actual</div>'));
     $this->validatorSchema['imagen'] = new sfValidatorFile(array('required' => false, 'mime_types' => 'web_images', 'path' => sfConfig::get('sf_upload_dir') . '/instituciones', 'validated_file_class' => 'sfResizedFile'));
     $this->validatorSchema['imagen_delete'] = new sfValidatorBoolean();
 }
Exemple #5
0
 public function configure()
 {
     unset($this['sumu'], $this['sumd'], $this['created_at'], $this['modified_at'], $this['doc'], $this['doc_size'], $this['etiqueta_propuesta_list']);
     $this->widgetSchema['descripcion'] = new sfWidgetFormTextarea(array(), array('style' => "width: 500px; height:200px"));
     $this->widgetSchema['imagen'] = new sfWidgetFormInputFileEditable(array('label' => 'Imagen Principal', 'file_src' => S3Voota::getImagesUrl() . '/propuestas/cc_' . $this->getObject()->getImagen(), 'is_image' => true, 'edit_mode' => !$this->isNew(), 'template' => '<div>%file% <br /> %input%<br />%delete% Eliminar imagen actual</div>'));
     $this->widgetSchema['doc'] = new sfWidgetFormInputFileEditable(array('label' => sfContext::getInstance()->getI18N()->__('Doc', array(), 'notices'), 'file_src' => $this->getObject() ? '' . S3Voota::getImagesUrl() . '/docs/' . $this->getObject()->getDoc() : '', 'is_image' => false, 'edit_mode' => !$this->isNew(), 'template' => '<div>%file% <br /> %input% <span class="hints">' . sfContext::getInstance()->getI18N()->__('(opcional)') . '<br />' . ($this->getObject()->getDoc() ? '%delete% Eliminar documento actual' : '') . '</div>'));
     $this->validatorSchema['imagen'] = new sfValidatorFile(array('required' => false, 'max_size' => '512000', 'mime_types' => 'web_images', 'path' => sfConfig::get('sf_upload_dir') . '/propuestas', 'validated_file_class' => 'sfResizedFile'), sfVoForm::getImageMessages("500K"));
     $this->validatorSchema['doc'] = new sfValidatorFile(array('required' => false, 'max_size' => '2048000', 'path' => sfConfig::get('sf_upload_dir') . '/docs', 'validated_file_class' => 'sfResizedFile'), sfVoForm::getImageMessages("2M"));
     $this->validatorSchema['imagen_delete'] = new sfValidatorBoolean();
     $this->validatorSchema['doc_delete'] = new sfValidatorBoolean();
     $this->validatorSchema['url_video_1'] = new sfValidatorUrl(array('required' => false));
     $this->validatorSchema['url_video_2'] = new sfValidatorUrl(array('required' => false));
 }
Exemple #6
0
function getAvatarFull($user)
{
    // TODO: Refactorizar con getAvatar
    $ret = "";
    if ($user && $user->getProfile()->getImagen()) {
        $ret .= image_tag(S3Voota::getImagesUrl() . '/usuarios/cc_' . $user->getProfile()->getImagen(), array('alt' => fullName($user)));
    } else {
        if ($user && $user->getProfile()->getFacebookUid()) {
            $ret .= jsWrite("fb:profile-pic", array('uid' => $user->getProfile()->getFacebookUid(), 'linked' => 'false', 'size' => 'normal', 'facebook-logo' => 'true'));
        } else {
            //$ret .= image_tag(S3Voota::getImagesUrl().'/usuarios/no-imago.png', array('alt' => fullName( $user ), 'width' => 180, 'height' => 240));
            $ret .= image_tag('/images/no-imago.png', array('alt' => fullName($user), 'width' => 180, 'height' => 240));
        }
    }
    return $ret;
}
 public function configure()
 {
     unset($this['id'], $this['vanity']);
     $this->setWidgets(array('op' => new sfWidgetFormInputHidden(), 'titulo' => new sfWidgetFormTextArea(array()), 'descripcion' => new sfWidgetFormTextArea(array(), array('rows' => 20, 'cols' => 30)), 'imagen' => new sfWidgetFormInputFileEditable(array('label' => sfContext::getInstance()->getI18N()->__('Imagen', array(), 'notices'), 'file_src' => $this->getObject() ? '' . S3Voota::getImagesUrl() . '/usuarios/cc_s_' . $this->getObject()->getImagen() : '', 'is_image' => false, 'edit_mode' => !$this->isNew(), 'template' => '<div>' . ($this->getObject()->getImagen() ? '<p><img src="%file%" alt="' . $this->getObject()->getTitulo() . '" /> %delete% <label for="profile_imagen_delete">' . sfContext::getInstance()->getI18N()->__('Eliminar imagen actual', array(), 'notices') . '</label></p>' : '') . '%input% <span class="hints">' . sfContext::getInstance()->getI18N()->__('(opcional)') . '</span></div>')), 'doc' => new sfWidgetFormInputFileEditable(array('label' => sfContext::getInstance()->getI18N()->__('Imagen', array(), 'notices'), 'file_src' => $this->getObject() ? '' . S3Voota::getImagesUrl() . '/usuarios/cc_s_' . $this->getObject()->getDoc() : '', 'is_image' => false, 'edit_mode' => !$this->isNew(), 'template' => '<div>' . ($this->getObject()->getImagen() ? '<p>' . $this->getObject()->getTitulo() . ' %delete% <label for="profile_imagen_delete">' . sfContext::getInstance()->getI18N()->__('Eliminar documento actual', array(), 'notices') . '</label></p>' : '') . '%input% <span class="hints">' . sfContext::getInstance()->getI18N()->__('(opcional)') . '</span></div>'))));
     $this->widgetSchema->setNameFormat('propuesta[%s]');
     $this->widgetSchema->setLabels(array('titulo' => sfContext::getInstance()->getI18N()->__('Título', array(), 'notices'), 'descripcion' => sfContext::getInstance()->getI18N()->__('Descripción', array(), 'notices')));
     $this->setValidators(array('titulo' => new sfValidatorString(array("min_length" => SfVoUtil::VANITY_MIN_LENGTH, 'required' => true), sfVoForm::getStringMessages()), 'descripcion' => new sfValidatorString(array('required' => true), sfVoForm::getStringMessages()), 'vanity' => new sfValidatorString(array('required' => true)), 'sf_guard_user_id' => new sfValidatorInteger(array('required' => true)), 'imagen' => new sfValidatorFile(array('required' => false, 'max_size' => '512000', 'mime_types' => 'web_images', 'path' => sfConfig::get('sf_upload_dir') . '/propuestas', 'validated_file_class' => 'sfResizedFile'), sfVoForm::getImageMessages("500K")), 'doc' => new sfValidatorFile(array('required' => false, 'max_size' => '2048000', 'path' => sfConfig::get('sf_upload_dir') . '/docs', 'validated_file_class' => 'sfResizedFile'), sfVoForm::getImageMessages("2M"))));
     $this->validatorSchema->setPostValidator(new sfValidatorAnd(array(new sfValidatorPropelUnique(array('model' => 'Propuesta', 'column' => array('vanity')), sfVoForm::getUniqueMessages()), new sfValidatorPropelUnique(array('model' => 'Propuesta', 'column' => array('titulo')), sfVoForm::getUniqueMessages()))));
     // Vacíos
     $idx = 0;
     while ($idx < 5) {
         $idx++;
         // create a new enlace form for a new enlace model object
         $enlaceForm = new PropuestaEnlaceForm();
         // embed the enlace form in the main politico form
         $this->embedForm("enlace_n{$idx}", $enlaceForm);
         $this->widgetSchema["enlace_n{$idx}"]['orden'] = new sfWidgetFormInputHidden();
         // set a custom label for the embedded form
         $this->widgetSchema["enlace_n{$idx}"]->setLabel('Nuevo enlace');
     }
 }
Exemple #8
0
">
  <?php 
if ($activity->getMode() == 1) {
    ?>
	  <div class="review-avatar">
		  <?php 
    if (!$activity->getAnonymous()) {
        ?>
		    <?php 
        echo getAvatar($activity->getsfGuardUser());
        ?>
		  <?php 
    } else {
        ?>
		  	<?php 
        echo image_tag(S3Voota::getImagesUrl() . '/usuarios/v.png', array('alt' => __('Vooto secreto (está en su derecho)'), 'width' => 36, 'height' => 36));
        ?>
		  <?php 
    }
    ?>
	  </div>
  <?php 
}
?>
  <div class="review-name">
	<?php 
if ($activity->getMode() == 1) {
    ?>
		<?php 
    if (!$activity->getAnonymous()) {
        ?>
Exemple #9
0
?>
',
	'<?php 
echo $politico;
?>
',
	'<?php 
echo cutToLength(sq(formatBio($politico->getBio())), 255, '');
?>
',
	'<?php 
echo url_for('politico/show?id=' . $politico->getVanity(), true);
?>
',
	'<?php 
echo S3Voota::getImagesUrl() . '/' . $politico->getImagePath() . '/cc_s_' . $politico->getImagen();
?>
', 
	'0',
	{
		'categoria': 'Político',
		'partido': '<?php 
echo sq($politico->getPartido());
?>
'
	}
	);
</script>


Exemple #10
0
use_helper('jQuery');
?>

<li class="review">
	<div class="photo">
	  <?php 
if ($entity->getImagen()) {
    ?>
      <?php 
    echo link_to(image_tag(S3Voota::getImagesUrl() . '/' . $entity->getImagePath() . '/cc_s_' . $entity->getImagen(), 'alt="' . __('Imagen de %1%', array('%1%' => $entity)) . '"'), $entity->getModule() . '/show?id=' . $entity->getVanity());
    ?>
    <?php 
} else {
    ?>
      <?php 
    echo link_to(image_tag(S3Voota::getImagesUrl() . '/' . $entity->getImagePath() . '/cc_s_p_unknown.png', 'alt="' . __('No disponible') . '"'), $entity->getModule() . '/show?id=' . $entity->getVanity());
    ?>
    <?php 
}
?>
  </div>
    
	<div class="name">
		<?php 
echo $review->getValue() == 1 ? __('A favor de') : __('En contra de');
?>
 
		<?php 
if (!$review->getSfReviewType()) {
    ?>
            <?php 
Exemple #11
0
</a></td>
			    <?php 
    } else {
        ?>
        		<?php 
        echo __('No disponible');
        ?>
        	<?php 
    }
    ?>
        <td class="position"><?php 
    echo $idx + 1;
    ?>
.</td>
        <td class="photo"><?php 
    echo image_tag(S3Voota::getImagesUrl() . '/' . $politico->getImagePath() . '/cc_s_' . $politico->getImagen(), 'alt="' . __('Foto de %1%', array('%1%' => $politico)) . '"');
    ?>
</td>
        <td class="name"><a href="<?php 
    echo url_for('politico/show?id=' . $politico->getVanity());
    ?>
"><?php 
    echo $politico;
    ?>
</a></td>
        <?php 
    if (!$convocatoria->getClosedAt()) {
        ?>
<td class="voto">
          <?php 
        include_component_slot('quickvote', array('entity' => $politico));
Exemple #12
0
<li>
	<div class="avatar">
    	<?php 
echo image_tag(S3Voota::getImagesUrl() . '/instituciones/cc_s_' . ($institucion['imagen'] != '' ? $institucion['imagen'] : 'p_unknown.png'), 'alt="' . __('Foto de %1%', array('%1%' => $institucion['nombre'])) . '"');
?>
    </div>
	<h4 class="name"><?php 
echo link_to($institucion['nombre'], 'politico/ranking?partido=all&institucion=' . $institucion['vanity']);
?>
</h4>
</li>
Exemple #13
0
 public function configure()
 {
     unset($this['politico_lista_list'], $this['pais'], $this['created_at'], $this['partido_txt'], $this['sumu'], $this['sumd'], $this['politico_institucion_list'], $this['sf_guard_user_id'], $this['etiqueta_politico_list'], $this['etiqueta_lista_list'], $this['lista_calle_list']);
     $this->widgetSchema['sf_guard_user_profile_id'] = new sfWidgetFormChoice(array('choices' => array(), 'renderer_class' => 'sfWidgetFormPropelJQueryAutocompleter', 'renderer_options' => array('model' => 'Institucion', 'url' => $this->getOption('url'))));
     $this->embedI18n(array('es', 'ca'));
     $this->widgetSchema['sexo'] = new sfWidgetFormSelect(array('choices' => self::$generos));
     $this->widgetSchema['relacion'] = new sfWidgetFormSelect(array('choices' => self::$relaciones));
     $years = range(1920, date('Y'));
     $this->widgetSchema['fecha_nacimiento'] = new sfWidgetFormJQueryDate(array('culture' => 'es', 'format' => '%day%/%month%/%year%', 'years' => array_combine($years, $years)));
     $this->widgetSchema['imagen'] = new sfWidgetFormInputFileEditable(array('label' => 'Imagen Principal', 'file_src' => S3Voota::getImagesUrl() . '/politicos/cc_' . $this->getObject()->getImagen(), 'is_image' => true, 'edit_mode' => !$this->isNew(), 'template' => '<div>%file%  <img src="' . S3Voota::getImagesUrl() . '/politicos/bw_' . $this->getObject()->getImagen() . '"><br /><label></label>%input%<br /><label></label>%delete% Eliminar imagen actual</div>'));
     $this->validatorSchema['email'] = new sfValidatorEmail(array('required' => false));
     $this->validatorSchema['imagen'] = new sfValidatorFile(array('required' => false, 'mime_types' => 'web_images', 'path' => sfConfig::get('sf_upload_dir') . '/politicos', 'validated_file_class' => 'sfResizedFile'));
     if (!$this->isNew()) {
         // embed all enlace forms
         foreach ($this->getObject()->getEnlaces() as $enlace) {
             // create a new enlace form for the current enlace model object
             $enlaceForm = new PoliticoEnlaceForm($enlace);
             // embed the enlace form in the main politico form
             $this->embedForm('enlace' . $enlace->getId(), $enlaceForm);
             // set a custom label for the embedded form
             $this->widgetSchema['enlace' . $enlace->getId()]->setLabel('Enlace ' . $enlace->getId());
             // change the name widget to sfWidgetFormInputDelete
             $this->widgetSchema['enlace' . $enlace->getId()]['url'] = new sfWidgetFormInputDelete(array('url' => 'politico/deleteEnlace', 'model_id' => $enlace->getId(), 'confirm' => 'Sure???'));
         }
         // create a new enlace form for a new enlace model object
         $enlaceForm = new PoliticoEnlaceForm();
         // embed the enlace form in the main politico form
         $this->embedForm('enlace', $enlaceForm);
         // set a custom label for the embedded form
         $this->widgetSchema['enlace']->setLabel('Nuevo enlace');
     }
     if (!$this->isNew()) {
         // embed all institucion forms
         foreach ($this->getObject()->getPoliticoInstitucions() as $institucion) {
             // create a new insti form for the current insti model object
             $institucionForm = new PoliticoInstitucionForm($institucion);
             $institucionForm->setOption('url', $this->getOption('url'));
             $institucionForm->configure();
             // embed the institucion form in the main politico form
             $this->embedForm('institucion' . $institucion->getInstitucion()->getId(), $institucionForm);
             // set a custom label for the embedded form
             $this->widgetSchema['institucion' . $institucion->getInstitucion()->getId()]->setLabel('Institucion ' . $institucion->getInstitucion()->getId());
             // change the name widget to sfWidgetFormInputDelete
             /*
             $this->widgetSchema['institucion'.$institucion->getInstitucion()->getId()]['url'] = new sfWidgetFormInputDelete(array(
             	'url' => 'politico/deleteInstitucion',      // required
             	'model_id' => $institucion->getInstitucion()->getId(),        // required
             	'confirm' => 'Sure???',                     // optional
             ));
             */
         }
         // create a new institucion form for a new institucion model object
         $politicoInstitucion = new PoliticoInstitucion();
         $politicoInstitucion->setPoliticoId($this->getObject()->getId());
         $institucionForm = new PoliticoInstitucionForm($politicoInstitucion);
         $institucionForm->setOption('url', $this->getOption('url'));
         $institucionForm->configure();
         // embed the institucion form in the main politico form
         $this->embedForm('institucion', $institucionForm);
         // set a custom label for the embedded form
         $this->widgetSchema['institucion']->setLabel('Nueva institución');
     }
     $this->validatorSchema['imagen_delete'] = new sfValidatorBoolean();
 }
Exemple #14
0
  <tbody>
    <?php 
foreach ($results = $propuestasPager->getResults() as $idx => $propuesta) {
    ?>
      <tr class="<?php 
    echo fmod($idx, 2) ? 'even' : 'odd';
    ?>
">
  	    <td class="position"><?php 
    echo format_number($propuestasPager->getFirstIndice() + $idx, 'es_ES');
    ?>
.</td>
  	    <td class="photo">
          <?php 
    echo link_to(image_tag(S3Voota::getImagesUrl() . '/' . $propuesta->getImagePath() . '/cc_s_' . $propuesta->getImagen(), 'alt="' . __('Foto de %1%', array('%1%' => $propuesta)) . '"'), 'propuesta/show?id=' . $propuesta->getVanity());
    ?>
  	    </td>
        <td class="name">
          <?php 
    echo link_to($propuesta->getTitulo(), 'propuesta/show?id=' . $propuesta->getVanity(), array('class' => 'tooltip_propuesta', 'title' => secureString(__('Sobre esta propuesta') . '|' . __('Creada el %1%', array('%1%' => format_date($propuesta->getCreatedAt()))) . '|' . cutToLength($propuesta->getDescripcion(), 200, '...', true))));
    ?>
        </td>
        <td class="voto">
            <?php 
    include_component_slot('quickvote', array('entity' => $propuesta));
    ?>
        </td>
        <td class="positive-votes"><?php 
    echo sumu($propuesta);
    ?>
Exemple #15
0
<?php

use_helper('VoFormat');
?>
<tr>
	<td class="photo">
		<?php 
echo image_tag(S3Voota::getImagesUrl() . '/instituciones/cc_s_' . ($obj->getImagen() != '' ? $obj->getImagen() : 'p_unknown.png'), 'alt="' . __('Foto de %1%', array('%1%' => $obj)) . '"');
?>
    </td>
    <td class="name">
		<?php 
echo link_to(highlightWords($obj->getNombre(), $q), 'politico/ranking?partido=all&institucion=' . $obj->getVanity());
?>
      
    </td>
</tr>
	        
	        
	        
Exemple #16
0
  </script>

  <?php 
if ($propuesta->getDoc() || $sf_user->isAuthenticated() && $propuesta->getSfGuardUserId() == $sf_user->getGuardUser()->getId()) {
    ?>
    <p>
      <?php 
    echo __('Documento');
    ?>
:
      <span id="fileName"> 
        <?php 
    if ($propuesta->getDoc()) {
        ?>
    	    <a class="document" href="<?php 
        echo S3Voota::getImagesUrl() . '/docs/' . $propuesta->getDoc();
        ?>
"><?php 
        echo $propuesta->getDoc();
        ?>
</a> (<?php 
        echo ByteSize($propuesta->getDocSize());
        ?>
)
        <?php 
    } else {
        ?>
    	    <?php 
        echo __('ninguno');
        ?>
        <?php 
Exemple #17
0
      <?php 
echo format_number_choice('[0]%1% votos positivos|[1]1 voto positivo|(1,+Inf]%1% votos positivos', array('%1%' => $partido->getSumu()), $partido->getSumu());
?>
      <?php 
echo format_number_choice('[0] y %1% votos negativos|[1] y 1 voto negativo|(1,+Inf] y %1% votos negativos', array('%1%' => $partido->getSumd()), $partido->getSumd());
?>
    </span>
  </h2>

  <div id="content">
    <div title="<?php 
echo secureString($partido->getNombre());
?>
" id="photo">
      <?php 
echo image_tag(S3Voota::getImagesUrl() . '/partidos/' . $image, 'alt="' . __('Logo de %1%', array('%1%' => $partido->getAbreviatura())) . '"');
?>
      <div class="vote">
        <h3><?php 
echo __('Voota sobre');
?>
 <?php 
echo $partido->getAbreviatura();
?>
</h3>
        <div id="sf_review1">
        <?php 
if ($sf_user->isAuthenticated() && $sfr_status && $sfr_status['b'] == 'sf_review1') {
    ?>
	        <?php 
    include_component_slot('sfrForm', array('reviewId' => false, 'reviewEntityId' => $partido->getId(), 'reviewType' => Partido::NUM_ENTITY, 'reviewBox' => 'sf_review1', 'redirect' => false, 'reviewValue' => $sfr_status['v'], 'reviewText' => '', 'reviewToFb' => false));
 private function usuario($arguments = array(), $options = array())
 {
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection();
     $s3 = new S3Voota();
     $c = new Criteria();
     $usuarios = SfGuardUserProfilePeer::doSelect($c);
     foreach ($usuarios as $usuario) {
         if ($usuario->getImagen() != '') {
             echo "Creating " . $usuario->getImagen() . " ...\n";
             $s3->createUsuarioFromOri($usuario->getImagen());
         }
     }
 }
Exemple #19
0
<?php

use_helper('VoFormat');
?>

<li>
	<div class="avatar">
    	<?php 
echo image_tag(S3Voota::getImagesUrl() . '/' . $reviewable->getImagePath() . '/cc_s_' . $reviewable->getImagen(), 'width="36" height="36" alt="' . __('Foto de %1%', array('%1%' => $reviewable)) . '"');
?>
    </div>
	<h4 class="name"><?php 
echo link_to(cutToLength($reviewable->getLongName()), $reviewable->getModule() . '/show?id=' . $reviewable->getVanity());
?>
</h4>
  <div class="votes">
    <?php 
if ($showSparkline) {
    ?>
		  <?php 
    include_partial('general/sparkline_box', array('id' => $id));
    ?>
		<?php 
}
?>
		<span class="votes-count">
			<?php 
if ($showVotes) {
    ?>
				<?php 
    if ($reviewable->getSumut() > 0 && $reviewable->getSumdt() > 0) {
Exemple #20
0
          	    $('#edit-photo-box').hide();
        	    $('#edit2-photo-box').show();
            	return false;
    		});
        	$('#close-ed-photo-box').click(function(){
          	    $('#edit-photo-box').hide();
        	    $('#edit2-photo-box').hide();
            	return false;
    		});
          	
    });
    //-->
  </script>
  
  <?php 
echo image_tag(S3Voota::getImagesUrl() . '/propuestas/cc_' . $propuesta->getImagen(), 'alt="' . __('Imagen de %1%', array('%1%' => $propuesta->getTitulo())) . '"');
?>
  <?php 
if ($sf_user->isAuthenticated() && $propuesta->getSfGuardUserId() == $sf_user->getGuardUser()->getId()) {
    ?>
	  <p><a href="#" id="edit-photo" class="edit-link"><?php 
    echo __('Hacer cambios');
    ?>
</a></p>
  <?php 
}
?>
</div>

<?php 
if ($sf_user->isAuthenticated() && $propuesta->getSfGuardUserId() == $sf_user->getGuardUser()->getId()) {
Exemple #21
0
 public function createFromOri($type, $fileName)
 {
     $uri = "{$type}/{$fileName}";
     if (($info = $this->getObjectInfo(S3Voota::getBucketOri(), $uri)) !== false) {
         $fileOnDisk = "/tmp/{$fileName}";
         if (($object = S3::getObject(S3Voota::getBucketOri(), $uri, "{$fileOnDisk}")) !== false) {
             $this->createFromFile($type, $fileOnDisk);
             unlink("{$fileOnDisk}");
         }
     }
 }
Exemple #22
0
  	</td>
    <td class="escanos"><?php 
    echo $numEscanyos;
    ?>
</td>
    <td class="politicos">
    	<?php 
    $idx = 0;
    foreach ($politicos as $politico) {
        $idx++;
        ?>
    	  <?php 
        if ($idx < $numEscanyos + 1 && $idx <= 20) {
            ?>
    	    <?php 
            echo link_to(image_tag(S3Voota::getImagesUrl() . '/' . $politico->getImagePath() . '/cc_s_' . $politico->getImagen(), 'id="politico_' . $politico->getId() . '" class="politico" width="36" height="36" alt="' . $politico . '"'), 'politico/show?id=' . $politico->getVanity());
            ?>
          <script type="text/javascript">
            $("#<?php 
            echo "politico_" . $politico->getId();
            ?>
").data('nombre', '<?php 
            echo $politico;
            ?>
')
            $("#<?php 
            echo "politico_" . $politico->getId();
            ?>
").data('url', '<?php 
            echo url_for('politico/show?id=' . $politico->getVanity());
            ?>
Exemple #23
0
<?php

use_helper('VoFormat');
?>
<tr>
	<td class="photo">
    <?php 
echo link_to(image_tag(S3Voota::getImagesUrl() . '/' . $obj->getImagePath() . '/cc_s_' . $obj->getImagen(), 'alt="' . __('Foto de %1%', array('%1%' => $obj)) . '"'), 'politico/show?id=' . $obj->getVanity());
?>
  </td>
  <td class="name">
		<?php 
echo link_to(highlightWords($obj, $q), 'politico/show?id=' . $obj->getVanity());
?>
    <?php 
if ($obj->getPartido()) {
    ?>
 (<?php 
    echo highlightWords($obj->getPartido(), $q);
    ?>
)<?php 
}
?>
    <?php 
if (count($obj->getPoliticoInstitucions()) > 0) {
    ?>
, 
      <?php 
    foreach ($obj->getPoliticoInstitucions() as $idx => $politicoInstitucion) {
        if ($idx > 0) {
            ?>
Exemple #24
0
<?php

use_helper('VoFormat');
use_helper('VoUser');
?>

<tr>
	<td class="photo">
		<?php 
echo link_to(image_tag(S3Voota::getImagesUrl() . '/usuarios/cc_s_' . ($obj->getProfile()->getImagen() != '' ? $obj->getProfile()->getImagen() : 'p_unknown.png'), 'alt="' . __('Foto de %1%', array('%1%' => $obj)) . '"'), '@usuario?username='******'@usuario?username='******'[0]%1% votos|[1]%1% voto|(1,+Inf]%1% votos', array('%1%' => $numReviews), $numReviews);
?>
    <br />
  	<?php 
echo $quote;
?>
  </td>
</tr>
Exemple #25
0
<?php

use_helper('VoFormat');
use_helper('VoUser');
?>

<tr>
	<td class="photo">
        <?php 
echo !$obj->getImagen() ? '' : image_tag(S3Voota::getImagesUrl() . '/elecciones/cc_s_' . $obj->getImagen(), ' width="36" height="36" alt="' . __('Imagen de %1%', array('%1%' => $obj->getEleccion()->getNombre())) . '"');
?>
  </td>
  <td class="name">
   <?php 
echo link_to(cutToLength("" . $obj->getEleccion()->getNombre() . " " . $obj->getNombre() . "", 105), 'eleccion/show?vanity=' . $obj->getEleccion()->getVanity() . '&convocatoria=' . $obj->getNombre());
?>
  </td>
</tr>
Exemple #26
0
echo formatDesc($form['descripcion']->getValue());
?>
      <?php 
if ($form['doc']->getValue()) {
    ?>
        <p><?php 
    echo __('Documento');
    ?>
: <a class="document"  href="<?php 
    echo S3Voota::getImagesUrl() . '/docs/' . $form['doc']->getValue();
    ?>
"><?php 
    echo $form['doc']->getValue();
    ?>
</a> (<?php 
    $s = new S3Voota();
    echo ByteSize($s->getSize('docs/' . $form['doc']->getValue()));
    ?>
)</p><?php 
    // TODO: Sustituir por enlace a fichero y tamaño de fichero correcto
    ?>
      <?php 
}
?>
    </div>
    
    <div id="sidebar">
      <div id="external-links">
      	<?php 
if ($form['enlace_n1']['url']->getValue() || $form['enlace_n2']['url']->getValue() || $form['enlace_n3']['url']->getValue() || $form['enlace_n4']['url']->getValue() || $form['enlace_n5']['url']->getValue()) {
    ?>
Exemple #27
0
<li>
	<div class="avatar">
    	<?php 
echo link_to(image_tag(S3Voota::getImagesUrl() . '/partidos/cc_s_' . ($partido->getImagen() != '' ? $partido->getImagen() : 'p_unknown.png'), 'width="36" height="36" alt="' . __('Foto de %1%', array('%1%' => $partido)) . '"'), 'partido/show?id=' . $partido->getAbreviatura());
?>
    </div>
	<h4 class="name"><?php 
echo link_to($partido->getNombre() . " (" . $partido->getAbreviatura() . ")", 'partido/show?id=' . $partido->getAbreviatura());
?>
</h4>
  <div class="votes">
    <?php 
if ($showSparkline) {
    ?>
		  <?php 
    include_partial('general/sparkline_box', array('reviewable' => $partido, 'id' => 'sparkline_tp_' . $partido->getId()));
    ?>
		<?php 
}
?>
		<span class="votes-count">
				<?php 
if (sumu($partido) > 0 && sumd($partido) > 0) {
    ?>
					<?php 
    echo str_replace(" ", "&nbsp;", format_number_choice('[0]0|[1]1 positivo|(1,+Inf]%1% positivos', array('%1%' => sumu($partido)), sumu($partido)));
    ?>
					<?php 
    // echo str_replace  (" ", "&nbsp;", format_number_choice('[0]0|[1] y 1 negativo|(1,+Inf] y %1% negativos', array('%1%' => sumd($partido)), sumd($partido)))
    ?>
				<?php 
Exemple #28
0
 public function executeFeed(sfWebRequest $request)
 {
     $vanity = $request->getParameter('username');
     $this->f = $request->getParameter('f');
     $culture = $this->getUser()->getCulture();
     $c = new Criteria();
     $c->add(SfGuardUserProfilePeer::VANITY, $vanity, Criteria::EQUAL);
     $userProfile = SfGuardUserProfilePeer::doSelectOne($c);
     $this->forward404Unless($userProfile);
     $this->user = $userProfile->getsfGuardUser();
     if (!$this->user->getIsActive() && is_numeric($userProfile->getFacebookUid())) {
         $user = SfGuardUserPeer::retrieveByPK($userProfile->getFacebookUid());
         $this->forward404Unless($user);
         $this->redirect('perfil/show?username='******'%1% en Voota.es', array('%1%' => $this->user));
     $descripcion = SfVoUtil::cutToLength($userProfile->getPresentacion(), 155, '...', true);
     $description = $descripcion ? $descripcion : sfContext::getInstance()->getI18N()->__('Votos y opiniones de %1% sobre políticos y partidos de España', array('%1%' => trim($this->user) ? $this->user : $this->user->getProfile()->getVanity()));
     $feed = new sfRssFeed();
     $feed->setTitle($title);
     $feed->setLanguage($culture);
     $feed->setSubtitle($description);
     $feed->setDescription($description);
     $feed->setLink('perfil/show?username='******'ca' ? "cat" : $culture;
     $feed->setAuthorName("Voota.{$domainExt}");
     $feedImage = new sfFeedImage();
     $feedImage->setLink('perfil/show?username='******'/usuarios/cc_' . $this->user->getProfile()->getImagen());
     $feedImage->setTitle($this->user);
     $feed->setImage($feedImage);
     foreach ($reviews as $review) {
         $item = new sfFeedItem();
         $entityText = "";
         if (!$review->getSfReviewType()) {
             $tmpReview = $review->getSfReviewRelatedBySfReviewId();
             $entityText = sfContext::getInstance()->getI18N()->__('Otra opinión sobre') . ' ';
         } else {
             $tmpReview = $review;
         }
         $sfReviewType = SfReviewTypePeer::retrieveByPk($tmpReview->getSfReviewTypeId());
         $peer = $sfReviewType->getModel() . 'Peer';
         $entity = $peer::retrieveByPk($tmpReview->getEntityId());
         $entityText .= $entity;
         $item->setTitle(sfContext::getInstance()->getI18N()->__('%1%, voota %2%.', array('%1%' => $entityText, '%2%' => $review->getValue() == -1 ? sfContext::getInstance()->getI18N()->__('en contra') : sfContext::getInstance()->getI18N()->__('a favor'))));
         $item->setLink('sfReviewFront/show?id=' . SfVoUtil::reviewPermalink($review));
         $item->setAuthorName($review->getSfGuardUser());
         $item->setPubdate($review->getCreatedAt('U'));
         $item->setUniqueId($review->getId());
         $avatar = S3Voota::getImagesUrl() . '/usuarios/cc_s_' . $review->getSfGuardUser()->getProfile()->getImagen();
         $text = $culture == $review->getCulture() || !$review->getCulture() ? $review->getText() : '';
         $img = $review->getSfGuardUser()->getProfile()->getImagen() ? "<img src=\"{$avatar}\" alt =\"" . $review->getSfGuardUser() . "\" /> " : "";
         $content = "{$text}";
         $item->setDescription($content);
         $feed->addItem($item);
     }
     $this->feed = $feed;
 }
Exemple #29
0
<?php

use_helper('VoFormat');
?>

<li>
	<div class="avatar">
  	<?php 
echo link_to(image_tag(S3Voota::getImagesUrl() . '/' . $politico->getImagePath() . '/cc_s_' . $politico->getImagen(), 'width="36" height="36" alt="' . __('Foto de %1%', array('%1%' => $politico)) . '"'), 'politico/show?id=' . $politico->getVanity());
?>
  </div>
	<h4 class="name"><?php 
echo link_to(cutToLength("" . $politico->getNombre() . " " . $politico->getApellidos(), 26) . ' ' . '(' . $politico->getPartido() . ')', 'politico/show?id=' . $politico->getVanity());
?>
</h4>
  <div class="votes">
    <?php 
if ($showSparkline) {
    ?>
		  <?php 
    include_partial('general/sparkline_box', array('id' => $id));
    ?>
		<?php 
}
?>
		<span class="votes-count">
			<?php 
if (sumu($politico) > 0 && sumd($politico) > 0) {
    ?>
				<?php 
    echo str_replace(" ", "&nbsp;", format_number_choice('[0]0|[1]1 positivo|(1,+Inf]%1% positivos', array('%1%' => sumu($politico)), sumu($politico)));
Exemple #30
0
  <h2 id="name"><?php 
echo $convocatoria->getEleccion()->getNombre();
?>
. 
  <?php 
echo __("%dia% de %mes% de %aaaa%", array('%dia%' => format_date($convocatoria->getFecha(), ' d'), '%mes%' => format_date($convocatoria->getFecha(), 'MMMM'), '%aaaa%' => format_date($convocatoria->getFecha(), 'yyyy')));
?>
.</h2>

  <div id="content">
    <div title="<?php 
echo secureString($convocatoria->getEleccion()->getNombre());
?>
" id="photo">
    	<?php 
echo !$convocatoria->getImagen() ? '' : image_tag(S3Voota::getImagesUrl() . '/elecciones/cc_' . $convocatoria->getImagen(), 'alt="' . __('Imagen de %1%', array('%1%' => $convocatoria->getEleccion()->getNombre())) . '"');
?>
    </div>
    
    <div title="info" id="description">
      <?php 
echo formatPresentacion($convocatoria->getDescripcion());
?>
    </div><!-- end of description -->

<?php 
if (count($circus) > 1) {
    ?>
    <div class="selector-convocatoria">
      <ul>
        <?php