Beispiel #1
0
 public function seccionAction($seccion_slug)
 {
     $this->view->disable();
     $result = array();
     foreach (\Rpp\Services\Get\Flow::seccion($seccion_slug, 50, 0) as $item) {
         $article['abstractText'] = \Rpp\Services\Get\Content::node($item->_id)->bajada;
         $article['date'] = array('published' => date('Y-m-d\\TH:i:sP', \Rpp\Services\Get\Content::node($item->_id)->fecha_publicacion), 'updated' => date('Y-m-d\\TH:i:sP', \Rpp\Services\Get\Content::node($item->_id)->fecha_publicacion));
         $article['id'] = $item->_id;
         $image = $audio = $video = array();
         $texto_nota = $relacionado = array();
         if (\Rpp\Services\Get\Content::part($item->_id, 'tipo') == 'galeria') {
             $galeria = $gitem = array();
             foreach (\Rpp\Services\Get\Content::part($item->_id, 'galeria') as $v => $key) {
                 $gitem[] = array('title' => @\Rpp\Services\Get\Content::part($item->_id, 'contenido')[$key]['alt'], 'author' => @\Rpp\Services\Get\Content::part($item->_id, 'contenido')[$key]['credito'], 'description' => @\Rpp\Services\Get\Content::part($item->_id, 'contenido')[$key]['alt'], 'id' => 0, 'url' => \Rpp\Services\Get\UrlMedia::image(\Rpp\Services\Get\Content::part($item->_id, 'contenido')[$key]['foto']['hash'], 'medium'), 'thumbnail' => \Rpp\Services\Get\UrlMedia::image(\Rpp\Services\Get\Content::part($item->_id, 'contenido')[$key]['foto']['hash'], 'small'));
                 \Rpp\Services\Get\Content::unset_part($item->_id, 'contenido', $key);
             }
             $galeria[0]['images'] = $gitem;
             $article['slideshows'] = $galeria;
         }
         foreach (\Rpp\Services\Get\Content::part($item->_id, 'contenido') as $contenido) {
             if ($contenido['tipo'] == 'photo') {
                 $image[] = array('title' => @$contenido['foto']['alt'], 'autor' => @$contenido['credito'], 'description' => @$contenido['foto']['alt'], 'id' => 0, 'url' => \Rpp\Services\Get\UrlMedia::image($contenido['foto']['hash'], 'medium'), 'thumbnail' => \Rpp\Services\Get\UrlMedia::image($contenido['foto']['hash'], 'samll'));
             } elseif ($contenido['tipo'] == 'video') {
                 $video[] = array('title' => @$contenido['video']['alt'], 'autor' => @$contenido['via'], 'description' => @$contenido['foto']['alt'], 'id' => 0, 'size' => 17791133, 'duration' => 10, 'url' => @$contenido['video']['url'], 'thumbnail' => @$contenido['video']['url_cover']);
             } elseif ($contenido['tipo'] == 'audio') {
                 $audio[] = array('title' => @$contenido['audio']['alt'], 'autor' => @$contenido['via'], 'description' => @$contenido['audio']['alt'], 'id' => 0, 'size' => 1547822, 'duration' => 10, 'url' => @$contenido['audio']['url'], 'thumbnail' => @$contenido['audio']['url_cover']);
             } elseif ($contenido['tipo'] == 'text') {
                 $texto_nota[] = strip_tags($contenido['texto']);
                 if (count(@$contenido['relacionado']['items']) > 0) {
                     foreach ($contenido['relacionado']['items'] as $value) {
                         $relacionado[] = array('rel' => 'related', 'href' => \Rpp\Services\Get\Content::nurl($value['nid']), 'mediaType' => 'text/html', 'thumbnail' => \Rpp\Services\Get\UrlMedia::image(\Rpp\Services\Get\Content::node($value['nid'])->imagen_portada['hash'], 'samll'), 'title' => \Rpp\Services\Get\Content::node($value['nid'])->imagen_portada['alt'], 'author' => 'RPP', 'description' => \Rpp\Services\Get\Content::node($value['nid'])->bajada);
                     }
                 }
             }
         }
         $keywords = array();
         foreach (\Rpp\Services\Get\Content::part($item->_id, 'keywords') as $value) {
             $keywords[] = $value['nombre'];
         }
         $article['images'] = $image;
         $article['videos'] = $video;
         $article['audio'] = $audio;
         $article['title'] = \Rpp\Services\Get\Content::node($item->_id)->titulo;
         $article['subtitle'] = \Rpp\Services\Get\Content::node($item->_id)->titulo_corto;
         $article['body'] = implode(' ', $texto_nota);
         $article['keywords'] = $keywords;
         $article['relatedLinks'] = $relacionado;
         $result[] = $article;
     }
     echo json_encode(array('items' => $result));
 }
Beispiel #2
0
 public function moreAction($init = 1)
 {
     $this->view->disable();
     $interval = 3;
     $init = 50 + ($init - 1) * $interval;
     $response = array();
     foreach (\Rpp\Services\Get\Flow::home($interval, $init) as $item) {
         if (empty($item->_id)) {
             continue;
         }
         $response[] = array('img' => \Rpp\Services\Get\UrlMedia::image(\Rpp\Services\Get\Content::node($item->_id)->imagen_portada['hash'], 'medium'), 'titulo' => \Rpp\Services\Get\Content::node($item->_id)->titulo, 'bajada' => \Rpp\Services\Get\Content::node($item->_id)->bajada, 'fecha' => date('Y-m-d H:i', \Rpp\Services\Get\Content::node($item->_id)->fecha_publicacion), 'categoria' => \Rpp\Services\Get\Content::node($item->_id)->categoria['nombre'], 'categoria_url' => str_replace(SITESLUG, '', \Rpp\Services\Get\Content::node($item->_id)->categoria['slug']), 'nota_url' => $this->view->host . \Rpp\Services\Get\Content::nurl($item->_id), 'tipo' => \Rpp\Services\Get\Content::node($item->_id)->tipo);
     }
     echo json_encode($response);
     die;
 }
Beispiel #3
0
<?php

$e = 0;
foreach (\Rpp\Services\Get\Flow::tag($this->model->slug) as $item) {
    ?>
    <?php 
    echo $this->partial('partials/portada/flujo/box/normal', array('nid' => $item->_id, 'position' => $e + 1));
    $e++;
    ?>
    
<?php 
}
Beispiel #4
0
       <?php 
$e = 0;
?>
       <?php 
foreach (\Rpp\Services\Get\Flow::home(20) as $item) {
    ?>
            <?php 
    echo $this->partial('partials/portada/flujo/box/' . \Rpp\Services\Get\Content::node($item->_id)->tipo, array('nid' => $item->_id, 'position' => $e + 1));
    ?>
        <?php 
    $e++;
    ?>
        <?php 
    if (($e + \Rpp\Services\Get\Destacados::$size['home'] - 1) % 5 == 0) {
        ?>
        	<?php 
        echo $this->partial('partials/portada/flujo/box/ads');
        ?>
        <?php 
    }
    ?>
       <?php 
}
?>

Beispiel #5
0
 public function builder()
 {
     var_dump("Corrigiendo bug eliminar");
     $Pattern = $this->patternBuilder->addFilter(array('_id' => $this->nid, 'estado' => 'despublicado'))->build();
     $this->nota = $Pattern->load();
     foreach ($this->nota as $key => $value) {
         Cache::request()->save(Cache::get_conf()->cache_prefix->nota . $this->nid . '.' . $key, null, Cache::get_conf()->cache_time->nota);
         Cachejson::request()->save(Cachejson::get_conf()->cache_prefix->nota . $this->nid . '.' . $key, null, Cachejson::get_conf()->cache_time->nota);
     }
     Cache::request()->save(Cache::get_conf()->cache_prefix->nota . $this->nid . '.node', null, Cache::get_conf()->cache_time->nota);
     Cachejson::request()->save(Cachejson::get_conf()->cache_prefix->nota . $this->nid . '.node', null, Cachejson::get_conf()->cache_time->nota);
     \Rpp\Services\Get\Content::$content = null;
     \Rpp\Services\Get\Flow::$flow = null;
     $home = new \Rpp\Services\Publish\Dominio\Home();
     $home->make();
     //---flujo galerias----//
     if ($this->nota->tipo == 'galeria') {
         \Rpp\Services\Get\Gallery::home();
     } elseif ($this->nota->tipo == 'blog') {
         \Rpp\Services\Get\Flow::autor();
     } elseif ($this->nota->tipo == 'brandcontent') {
         \Rpp\Services\Get\Flow::brandcontent();
     }
     \Rpp\Services\Get\Instantarticle::flow();
     \Rpp\Services\Get\Instantarticle::flowupd();
     $seccion = new \Rpp\Services\Publish\Dominio\Seccion();
     var_dump($this->nota->categoria_slug);
     foreach ($this->nota->categoria_slug as $seccion_slug) {
         $seccion_slug = explode("/", $seccion_slug);
         unset($seccion_slug[0]);
         if (count($seccion_slug) > 0) {
             for ($i = count($seccion_slug); $i > 0; $i--) {
                 //var_dump('del:',implode('/',$seccion_slug));
                 $seccion->set_slug(implode('/', $seccion_slug));
                 $seccion->make();
                 unset($seccion_slug[$i]);
             }
         }
     }
     $tag = new \Rpp\Services\Publish\Dominio\Tag();
     foreach ($this->nota->tags as $tag_slug) {
         $tag->set_slug($tag_slug['slug']);
         $tag->make();
     }
     $this->viewCache->delete("portada.bodyopen.home");
     $this->viewCache->delete("portada.bodycentral.home");
     $this->viewCache->delete("portada.bodyclose.home");
     ###remaquetado##########
     $this->viewCache->delete("portada.body.open.home");
     $this->viewCache->delete("portada.body.central.home");
     $this->viewCache->delete("portada.body.close.home");
     if ($this->nota->tipo == 'galeria') {
         foreach ($this->nota->galeria as $v => $e) {
             $this->viewCache->delete("nota.header.geleria." . $this->nid . "." . $v);
             ###remaquetado##########
             $this->viewCache->delete("nota.header.galeria." . $this->nid . "." . $v);
         }
     }
     $this->viewCache->delete("nota.wrap.group." . $this->nid);
     ###remaquetado##########
     $this->viewCache->delete("nota.article.body." . $this->nid);
     var_dump("terminate.......");
 }
Beispiel #6
0
 private function reload_tag($tags)
 {
     foreach ($tags as $tag_slug) {
         \Rpp\Services\Get\Flow::tag($tag_slug['slug']);
         \Shared\Cache::request()->delete(\Shared\Cache::get_conf()->cache_prefix->tag . 'relatedtag.' . $tag_slug['slug']);
     }
 }
Beispiel #7
0
<?php

$e = 0;
foreach (\Rpp\Services\Get\Flow::seccion($slug, 50, 1) as $item) {
    ?>
    <?php 
    echo $this->partial('partials/portada/flujo/box/normal', array('nid' => $item->_id, 'position' => $e + 1));
    $e++;
}
Beispiel #8
0
  <section class="flow-news module module-green">          
    <h3>BLOOPERS</h3>
    <div class="box">
      <ul>
      <?php 
foreach (\Rpp\Services\Get\Flow::tag('bloopers', 5) as $position => $item) {
    ?>
        <li>
          <article>
            <figure class="media"><a href="<?php 
    echo \Rpp\Services\Get\Content::nurl($item->_id);
    echo \Rpp\Services\Get\UrlTrack::add_params($position + 1);
    ?>
"><img src="<?php 
    echo \Rpp\Services\Get\Content::node($item->_id)->imagen_portada['url'];
    ?>
" alt="<?php 
    echo \Rpp\Services\Get\Content::node($item->_id)->imagen_portada['alt'];
    ?>
" width="86" height="70"></a></figure>
            <h2><a href="<?php 
    echo \Rpp\Services\Get\Content::nurl($item->_id);
    echo \Rpp\Services\Get\UrlTrack::add_params($position + 1);
    ?>
"><?php 
    echo \Rpp\Services\Get\Content::node($item->_id)->titulo;
    ?>
</a></h2>
          </article>
        </li>
      <?php 
Beispiel #9
0
 public function contenidoAction($nid)
 {
     $home = \Rpp\Services\Get\Flow::home();
     var_dump(json_decode(json_encode($home)));
     var_dump(\Rpp\Services\Get\Content::part($nid, 'contenido'));
 }
Beispiel #10
0
      <article class="flow-prominent">
              <?php 
foreach (\Rpp\Services\Get\Flow::seccion($this->model->slug, 1) as $item) {
    ?>
                    <h1> <a href="<?php 
    echo \Rpp\Services\Get\Content::nurl($item->_id);
    echo \Rpp\Services\Get\UrlTrack::add_params(1);
    ?>
"><?php 
    echo \Rpp\Services\Get\Content::node($item->_id)->titulo_corto;
    ?>
</a></h1>
                    <div class="prominent-media">
                   <?php 
    foreach (\Rpp\Services\Get\Content::part($item->_id, 'contenido') as $contenido) {
        ?>
                 
                      <?php 
        if ($contenido['tipo'] == 'photo') {
            ?>
                      <figure class="media"><a href="<?php 
            echo \Rpp\Services\Get\Content::nurl($item->_id);
            echo \Rpp\Services\Get\UrlTrack::add_params(1);
            ?>
"><img src="<?php 
            echo $contenido['foto']['url'];
            ?>
" alt="<?php 
            echo $contenido['foto']['alt'];
            ?>
" width="445" height="251"></a></figure>
Beispiel #11
0
 public function make($user)
 {
     Cache::request()->save('analitica.recomendadas.rebuild' . $user, true, Cache::get_conf()->cache_time->analitica_user_recomendados_rebuild);
     $intervalos_timeline = array(12, 24, 36, 48, 60, 72, 84, 96, 108, 120);
     /*intervalos de timeline*/
     $hot_minimo_numero = 2;
     $nids_view = array();
     $nids_suggested = array();
     $secciones_rank_timeline = array();
     $tag_rank_timeline = array();
     foreach ($intervalos_timeline as $intervalo) {
         $now = $intervalo - 12;
         $notas_muestra = $this->redis->zRangeByScore(user_notas . $user, strtotime("-{$intervalo} hours"), strtotime("-{$now} hours"), array('limit' => array(0, 20)));
         $notas_muestra = array_reverse($notas_muestra);
         foreach ($notas_muestra as $time_nid) {
             $time_nid = explode(":", $time_nid);
             //var_dump("[", date("Y:m:d G:i:s",$time_nid[1]) , " ]");
             $nids_view[$time_nid[0]] = $time_nid[0];
             $mtags = \Rpp\Services\Get\Content::part($time_nid[0], 'tags');
             if (is_array($mtags)) {
                 foreach ($mtags as $tag) {
                     if (isset($tag_rank_timeline[$tag['slug']])) {
                         $tag_rank_timeline[$tag['slug']]++;
                     } else {
                         $tag_rank_timeline[$tag['slug']] = 1;
                     }
                 }
             }
             $categoria = \Rpp\Services\Get\Content::part($time_nid[0], 'categoria')['slug'];
             if (isset($secciones_rank_timeline[$categoria])) {
                 $secciones_rank_timeline[$categoria]++;
             } else {
                 $secciones_rank_timeline[$categoria] = 1;
             }
         }
     }
     arsort($tag_rank_timeline);
     arsort($secciones_rank_timeline);
     $portadas_view_rank = array();
     foreach ($intervalos_timeline as $intervalo) {
         $now = $intervalo - 12;
         $portadas_view = $this->redis->zRangeByScore(user_portadas . $user, strtotime("-{$intervalo} hours"), strtotime("-{$now} hours"), array('limit' => array(0, 20)));
         foreach ($portadas_view as $portada) {
             $time_portada = explode(":", $portada);
             if (isset($portadas_view_rank[$time_portada[0]])) {
                 $portadas_view_rank[$time_portada[0]]++;
             } else {
                 $portadas_view_rank[$time_portada[0]] = 1;
             }
         }
     }
     arsort($portadas_view_rank);
     $nids_portada_top = array();
     /*nids de la portada hot*/
     if (count($portadas_view_rank) > 0) {
         foreach ($portadas_view_rank as $portada => $rank) {
             if ($rank >= $hot_minimo_numero) {
                 $portada = str_replace(".", "/", $portada);
                 foreach (\Rpp\Services\Get\Flow::seccion($portada, 30) as $node) {
                     $nids_portada_top[$node->_id] = $node->_id;
                 }
                 break;
             } else {
                 break;
             }
         }
     }
     /*var_dump("<!!!!!!!!!!!!!!!!!!!!!!!!!!!!!>");
              $ultimas_temas = $this->redis->zRevRange(user_temas.$user, 0,50, true);  
     
              foreach ($ultimas_temas as $tema => $time) {
              	$tema = explode(":", $tema);
              	var_dump("[",date("Y:m:d h:i:s",$time)," => ", $tema[0] , " ]");
              }
     
              var_dump("<!!!!!!!!!!!!!!!!!!!!!!!!!!!!!>");
              $ultimas_search = $this->redis->zRevRange(user_search.$user, 0,50, true);
              foreach ($ultimas_search as $search => $time) {
              	var_dump("[",date("Y:m:d h:i:s",$time)," => ", $search , " ]");
              }*/
     $nids_suggested[1] = array();
     $nids_suggested[2] = array();
     $nids_suggested[3] = array();
     $tags_top = array_slice($tag_rank_timeline, 0, 3);
     $secciones_top = array_slice($secciones_rank_timeline, 0, 3);
     if (count($tags_top) > 0) {
         $tags_slug = array_keys($tags_top);
         $SearchPatternBuilder = new SearchPatternBuilder(new \Rpp\Repositorio\Builder\Search\Pattern\Tag());
         $Pattern = $SearchPatternBuilder->addFields(array("_id"))->addFilter(array("tags.slug" => $tags_slug[0]))->addLimit(20)->build();
         $result = $Pattern->load();
         foreach ($result as $suggested) {
             $nids_suggested[1][$suggested->_id] = $suggested->_id;
         }
         $Pattern = $SearchPatternBuilder->addFilter(array("tags.slug" => array('$in' => $tags_slug)))->build();
         $result = $Pattern->load();
         foreach ($result as $suggested) {
             $nids_suggested[3][$suggested->_id] = $suggested->_id;
         }
         array_pop($tags_top);
         if (count($tags_top) > 0) {
             $tags_slug = array_keys($tags_top);
             $Pattern = $SearchPatternBuilder->addFilter(array("tags.slug" => $tags_slug[0]))->build();
             $result = $Pattern->load();
             foreach ($result as $suggested) {
                 $nids_suggested[1][$suggested->_id] = $suggested->_id;
             }
             $Pattern = $SearchPatternBuilder->addFilter(array("tags.slug" => array('$in' => $tags_slug)))->build();
             $result = $Pattern->load();
             foreach ($result as $suggested) {
                 $nids_suggested[2][$suggested->_id] = $suggested->_id;
             }
         }
     }
     $add = 20;
     $top_rangos = array(3 => 20, 2 => 40, 1 => 60);
     $notas_by_tops = array();
     $sugeridas_news_calculate[3] = array();
     $sugeridas_news_calculate[2] = array();
     $sugeridas_news_calculate[1] = array();
     foreach ($top_rangos as $id => $rango) {
         $notas_by_tops[$id] = $this->redis->zRevRangeByScore(SITESLUG . ':notas:views', 10000000, 0, array('withscores' => TRUE, 'limit' => array($rango - $add, $rango)));
         $notas_by_tops[$id] = array_reverse(array_keys($notas_by_tops[$id]));
         $notas_by_tops[$id] = array_combine($notas_by_tops[$id], $notas_by_tops[$id]);
     }
     foreach ($notas_by_tops as $id => $top) {
         $notas_by_tops[$id] = array_diff($top, $nids_view);
     }
     foreach ($nids_suggested as $id => $suggested) {
         $nids_suggested[$id] = array_diff($suggested, $nids_view);
     }
     $nids_portada_top = array_diff($nids_portada_top, $nids_view);
     $sugeridas_portadas_calculate = array();
     $levels = array(3, 2, 1);
     foreach ($levels as $lsuge) {
         $sugeridas_news_calculate['level'][$lsuge] = array();
         foreach ($levels as $ltops) {
             $sugeridas_news_calculate['level'][$lsuge] = $sugeridas_news_calculate['level'][$lsuge] + array_intersect($nids_suggested[$lsuge], $notas_by_tops[$ltops]);
         }
     }
     foreach ($levels as $ltops) {
         $sugeridas_portadas_calculate = $sugeridas_portadas_calculate + array_intersect($nids_portada_top, $notas_by_tops[$ltops]);
     }
     $nids_sugeridos = array();
     $nids_sugeridos = array_slice($sugeridas_news_calculate['level'][3], 0, 3, true) + array_slice($sugeridas_portadas_calculate, 0, 2, true) + array_slice($sugeridas_news_calculate['level'][3], 3, 6, true) + array_slice($sugeridas_portadas_calculate, 2, 2, true) + array_slice($sugeridas_news_calculate['level'][3], 6, 20, true) + array_slice($sugeridas_news_calculate['level'][2], 0, 3, true) + array_slice($sugeridas_portadas_calculate, 4, 8, true) + array_slice($sugeridas_news_calculate['level'][2], 3, true) + $sugeridas_news_calculate['level'][1];
     $nids_sugeridos = array_slice($nids_sugeridos, 0, 15, true);
     Cache::request()->save('analitica.recomendadas.' . $user, $nids_sugeridos, Cache::get_conf()->cache_time->analitica_user_recomendados);
     $this->viewCache->delete('sidebar.recomendados.' . $user);
     var_dump(Cache::request()->get('analitica.recomendadas.' . $user));
 }
Beispiel #12
0
<section class="goals module module-blue">
<h3>PEPAZAS</h3>
<div class="box">
<ul class="title-top">
  <?php 
foreach (\Rpp\Services\Get\Flow::tag('pepazas', 5) as $position => $item) {
    ?>
   <li>
    <article>
     <figure class="media"><a href="<?php 
    echo \Rpp\Services\Get\Content::nurl($item->_id);
    echo \Rpp\Services\Get\UrlTrack::add_params($position + 1);
    ?>
"><img src="<?php 
    echo \Rpp\Services\Get\Content::node($item->_id)->imagen_portada['url'];
    ?>
" alt="<?php 
    echo \Rpp\Services\Get\Content::node($item->_id)->imagen_portada['alt'];
    ?>
"></a></figure>
     <h2><span><a href="<?php 
    echo \Rpp\Services\Get\Content::nurl($item->_id);
    echo \Rpp\Services\Get\UrlTrack::add_params($position + 1);
    ?>
"><?php 
    echo \Rpp\Services\Get\Content::node($item->_id)->titulo;
    ?>
</a></span></h2>
    </article>
   </li>
<?php