public function __construct($nid, $position) { parent::__construct(); $this->nid = (int) $nid; $this->position = $position; $this->slug_seccion = explode("/", \Rpp\Services\Get\Content::node($nid)->categoria['slug']); $this->brandeo = !empty(\Rpp\Services\Get\Content::part($this->nid, 'imagen_branding')); $seccion_epl = str_replace('-', '_', $this->slug_seccion[1]); $categoria_epl = str_replace('-', '_', @$this->slug_seccion[2]); $eplsec = array($seccion_epl, 'Tag'); $this->epl_sec = $eplsec[$this->brandeo]; $eplss['nota'] = array($categoria_epl . '_Nota', 'Auspiciado_Nota'); $eplss['galeria'] = array($categoria_epl . '_Galeria', 'Auspiciado_Galeria'); if (\Rpp\Services\Get\Content::node($this->nid)->tipo == 'galeria') { $this->epl_ss = 'ss:"' . $eplss['galeria'][$this->brandeo] . '",'; $this->slug_categoria = $eplss['galeria'][$this->brandeo]; } else { $this->epl_ss = 'ss:"' . $eplss['nota'][$this->brandeo] . '",'; $this->slug_categoria = $eplss['nota'][$this->brandeo]; } $this->preroll = ""; $this->epl_position = '"Interna1" , "Interna2" , "Interna3" , "Interna4" , "Interna5" , "Interna6" , "Interna7" , "Interna8" , "Interna9" , "Interna10"'; $this->epl_kvs = ""; $this->scri_bgbanner = '1'; }
public function notacacheAction() { $this->mqconf = new \Phalcon\Config\Adapter\Ini(CONFIG_PATH . DIRS . "ini/mq.ini"); $connection = new AMQPConnection($this->mqconf->host, $this->mqconf->port, $this->mqconf->user, $this->mqconf->pasw); $channel = $connection->channel(); $channel->queue_declare(SITESLUG . '_nota_cache_invalid', false, true, false, false); echo ' [*] Servicio listener para la publicacion , CTRL+C para cancelar', "\n"; $callback = function ($msg) { $node = json_decode($msg->body); var_dump($node); foreach ($node as $nota) { try { if (\Rpp\Services\Get\Content::node($nota->nid)->tipo == 'galeria') { foreach (\Rpp\Services\Get\Content::part($nota->nid, 'galeria') as $v => $e) { $this->viewCache->delete("nota.header.geleria." . $nota->nid . "." . $v); } } $this->viewCache->delete("nota.wrap.group." . $nota->nid); var_dump("cache reload..."); } catch (\Exception $e) { var_dump($e->getMessage()); } } die; }; $channel->basic_consume(SITESLUG . '_nota_cache_invalid', '', false, true, false, false, $callback); while (count($channel->callbacks)) { $channel->wait(); } }
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)); }
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; }
public function permalinkAction($nid, $position = false) { if (empty(\Rpp\Services\Get\Content::part($nid, '_id'))) { $this->dispatcher->forward(array('controller' => 'error', 'action' => 'show404')); } $query_url = explode("?", $_SERVER["REQUEST_URI"]); if (isset($query_url[1])) { $query_url = "?" . $query_url[1]; } else { $query_url = null; } if (is_numeric($position)) { $query_url = "/" . $position . $query_url; } return $this->response->redirect($this->view->host . \Rpp\Services\Get\Content::nurl($nid) . $query_url, true, 301); }
public function permalinkAction($nid) { if (empty(\Rpp\Services\Get\Content::part($nid, '_id'))) { $this->dispatcher->forward(array('controller' => 'error', 'action' => 'show404')); } $query_url = explode("?", $_SERVER["REQUEST_URI"]); if (isset($query_url[1])) { $query_url = "?" . $query_url[1]; } else { $query_url = null; } header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0'); header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); header("Location: " . $this->view->host . \Rpp\Services\Get\Content::nurl($nid) . $query_url, TRUE, 301); //return $this->response->redirect($this->view->host.\Rpp\Services\Get\Content::nurl($nid).$query_url , false , 301); }
public function notaserviceAction($slug = false, $init = 1) { $this->view->disable(); $init = ($init - 1) * 3; $response = array(); $tag_info = \Rpp\Services\Get\Tags::get_tag($slug); if (empty(@$tag_info->_id)) { echo json_encode($response); die; } foreach (\Rpp\Services\Get\LFlow::tag($slug, 3, $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; }
<header> <?php echo $this->partial('partials/nota/header/pubtime', array('fecha_publicacion' => \Rpp\Services\Get\Content::node($this->model->nid)->fecha_publicacion)); ?> <?php echo $this->partial('partials/nota/header/antetitulo', array('antetitulo' => \Rpp\Services\Get\Content::part($this->model->nid, 'volada'))); ?> <?php echo $this->partial('partials/nota/header/titulo', array('titulo' => \Rpp\Services\Get\Content::node($this->model->nid)->titulo)); ?> <?php echo $this->partial('partials/nota/header/bajada', array('bajada' => \Rpp\Services\Get\Content::node($this->model->nid)->bajada)); ?> </header>
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 } ?> </ul> </div> </section>
<section class="tags"> <h3>Tags:</h3> <?php foreach (\Rpp\Services\Get\Content::part($this->model->nid, 'tags') as $tag) { ?> <?php echo $this->partial('partials/nota/tags/list', array('tag' => $tag)); ?> <?php } ?> </section>
} elseif ($contenido['tipo'] == 'youtube') { ?> <div id="swfplayer_<?php echo $contenido['youtube']['id']; ?> " class="nd_galeriaopen_<?php echo $contenido['youtube']['id']; ?> "></div></p> <script type="text/javascript">setJW6("swfplayer_<?php echo $contenido['youtube']['id']; ?> ", "https://www.youtube.com/watch?v=<?php echo $contenido['youtube']['id']; ?> ", "http://img.youtube.com/vi/<?php echo $contenido['youtube']['id']; ?> /0.jpg");</script> <?php \Rpp\Services\Get\Content::unset_part($this->model->nid, 'contenido', $i); ?> <?php break; ?> <?php } ?> <?php $i++; }
echo \Rpp\Services\Get\Content::node($nid)->imagen_portada['url']; ?> " alt="<?php echo \Rpp\Services\Get\Content::node($nid)->imagen_portada['alt']; ?> " width="259" height="146"></a></figure> <h3 class="tag-title"><?php echo \Rpp\Services\Get\Content::node($nid)->categoria['nombre']; ?> </h3> <h2><span><a href="<?php echo \Rpp\Services\Get\Content::nurl($nid); echo \Rpp\Services\Get\UrlTrack::add_params($i); ?> "><?php echo \Rpp\Services\Get\Content::node($nid)->titulo_corto; ?> </a></span></h2> </div> </li> <?php if ($i >= 2) { break; } ?> <?php } ?> </ul> </section> <?php
private function builder_view() { $this->nota = \Rpp\Services\Get\Content::nota($this->nid); }
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)); }
public function load_epl() { $seccion_epl = str_replace('-', '_', $this->slug_seccion[1]); $categoria_epl = str_replace('-', '_', @$this->slug_seccion[2]); $eplsec = array($seccion_epl, 'Tag'); $this->epl_sec = $eplsec[$this->brandeo]; $eplss['nota'] = array($categoria_epl . '_Nota', 'Auspiciado_Nota'); $eplss['galeria'] = array($categoria_epl . '_Galeria', 'Auspiciado_Galeria'); if (\Rpp\Services\Get\Content::node($this->nid)->tipo == 'galeria') { $this->epl_ss = 'ss:"' . $eplss['galeria'][$this->brandeo] . '",'; $this->slug_categoria = $eplss['galeria'][$this->brandeo]; } else { $this->epl_ss = 'ss:"' . $eplss['nota'][$this->brandeo] . '",'; $this->slug_categoria = $eplss['nota'][$this->brandeo]; } // $this->preroll = "http://ads.us.e-planning.net/eb/4/17632/".$seccion_epl."/".$this->slug_categoria."/Preroll?o=v&ma=1&vv=3&kw_ctxt=rpp|".implode('|',$this->keywords_slug); $this->preroll = "https://pubads.g.doubleclick.net/gampad/ads?sz=400x300&iu=/1028310/RPP_Video&impl=s&gdfp_req=1&env=vp&output=xml_vast2&unviewed_position_start=1&url=[referrer_url]&description_url=[description_url]&correlator=[timestamp]"; $this->epl_position = '"Top","Peel", "Interna1" , "Interna2" , "Interna3" , "Interna4" , "Interna5" , "Interna6" , "Interna7" , "Interna8" , "Interna9" , "Interna10" , "Intersticial", "VerticalLeft","VerticalRight","Expandible","Middle1","Middle2","RightSmall","Right","Right1","Right2","Right3"'; $this->epl_kvs = implode('|', $this->keywords_slug); $this->scri_bgbanner = '1'; }
<?php foreach (\Rpp\Services\Get\Content::part($this->model->nid, 'contenido') as $contenido) { ?> <?php if ($contenido['tipo'] == 'text') { ?> <p> <?php echo $contenido['texto']; ?> </p> <?php } elseif ($contenido['tipo'] == 'photo') { ?> <figure class="media full"> <p> <?php echo $contenido['subtitulo']; ?> </p> <?php echo $this->partial('partials/nota/contenido/bloque/' . $this->model->package . 'imagen', $contenido); ?> <figcaption class="help-media"><?php echo $contenido['texto']; ?> </figcaption> </figure> <?php } elseif ($contenido['tipo'] == 'embed') { ?>
public function make($user) { Cache::request()->save('analitica.sugerido.rebuild' . $user, true, Cache::get_conf()->cache_time->analitica_user_recomendados_rebuild); $intervalos_timeline = array(12, 24, 36, 48, 60); $nids_view = array(); $tag_rank_timeline = array(); $nids_by_tag = array(); $nids_sugeridos_by_tag = 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); $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; } } } } } arsort($tag_rank_timeline); $tag_rank_timeline = array_slice($tag_rank_timeline, 0, 15); $notas_by_tops = $this->redis->zRevRangeByScore('notas:views', 10000000, 0, array('withscores' => TRUE, 'limit' => array(0, 60))); $notas_by_tops = array_reverse(array_keys($notas_by_tops)); $notas_by_tops = array_combine($notas_by_tops, $notas_by_tops); $notas_by_tops = array_diff($notas_by_tops, $nids_view); $SearchPatternBuilder = new SearchPatternBuilder(new \Rpp\Repositorio\Builder\Search\Pattern\Tag()); foreach ($tag_rank_timeline as $slug => $score) { $Pattern = $SearchPatternBuilder->addFields(array("_id"))->addFilter(array("tags.slug" => $slug))->addLimit(30)->build(); $result = $Pattern->load(); foreach ($result as $node) { $nids_by_tag[$slug][$node->_id] = $node->_id; } $nids_by_tag[$slug] = array_diff($nids_by_tag[$slug], $nids_view); } foreach ($nids_by_tag as $slug => $list) { $nids_sugeridos_by_tag[$slug] = array_intersect($list, $notas_by_tops); } $nids_by_secciones = array(); $menu = new \Phalcon\Config\Adapter\Ini(CONFIG_PATH . DIRS . "ini/menu.ini"); $secciones = explode(",", $menu->secciones->slug); $Pattern = $SearchPatternBuilder->reset(new \Rpp\Repositorio\Builder\Search\Pattern\Seccion()); foreach ($secciones as $seccion) { $Pattern = $SearchPatternBuilder->addFields(array("_id"))->addSlug($seccion)->addLimit(20)->build(); $result = $Pattern->load(); foreach ($result as $node) { $nids_by_secciones[$seccion][$node->_id] = $node->_id; } $nids_by_secciones[$seccion] = array_diff($nids_by_secciones[$seccion], $nids_view); } $nids_sugeridos_by_secciones = array(); foreach ($nids_by_secciones as $seccion => $list) { $nids_sugeridos_by_secciones[$seccion] = array_intersect($list, $notas_by_tops); } /*----guardando tags------*/ foreach ($nids_sugeridos_by_tag as $tag => $list) { var_dump($tag); Cache::request()->save('analitica.sugeridos.tag.' . $tag . '-' . $user, $list, Cache::get_conf()->cache_time->analitica_user_sugeridos); var_dump(Cache::request()->get('analitica.sugeridos.tag.' . $tag . '-' . $user)); } foreach ($nids_sugeridos_by_secciones as $seccion => $list) { Cache::request()->save('analitica.sugeridos.seccion.' . $seccion . '-' . $user, $list, Cache::get_conf()->cache_time->analitica_user_sugeridos); var_dump(Cache::request()->get('analitica.sugeridos.seccion.' . $seccion . '-' . $user)); } }
break; ?> <?php } ?> <?php } ?> <div class="prominent-txt"> <p> <?php echo \Rpp\Services\Get\Content::node($item->_id)->bajada; ?> </p> <div class="time-related">Publicado el <time datetime="<?php echo date('Y-m-d H:i', \Rpp\Services\Get\Content::node($item->_id)->fecha_publicacion); ?> "> <?php echo date('d/m/y', \Rpp\Services\Get\Content::node($item->_id)->fecha_publicacion); ?> </time> </div> </div> </div> <?php break; } ?> </article>
<?php echo $this->partial('partials/breadcrum/index', array('elements' => array(\Rpp\Services\Get\Content::node($this->model->nid)->categoria['nombre'])));
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')); }
<?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 } ?>
foreach (\Rpp\Services\Get\Visitas::ranking($slug, 5) as $position => $item) { ?> <li> <article> <figure class="media"><a href="<?php echo \Rpp\Services\Get\Content::nurl($item['nid']); echo \Rpp\Services\Get\UrlTrack::add_params($position + 1); ?> "><img src="<?php echo \Rpp\Services\Get\Content::node($item['nid'])->imagen_portada['url']; ?> " height="86" width="70" alt="<?php echo \Rpp\Services\Get\Content::node($item['nid'])->imagen_portada['alt']; ?> "></a></figure> <h2><a href="<?php echo \Rpp\Services\Get\Content::nurl($item['nid']); echo \Rpp\Services\Get\UrlTrack::add_params($position + 1); ?> "><?php echo \Rpp\Services\Get\Content::node($item['nid'])->titulo; ?> </a></h2> </article> </li> <?php } ?> </ul> </div> </section>
<?php echo $this->partial('partials/nota/detalle/open/nota/' . \Rpp\Services\Get\Content::node($this->model->nid)->tipo); ?>
<section class="social-detail"> <ul> <li><a href="<?php echo $host; echo \Rpp\Services\Get\Content::nurl($this->model->nid); echo \Rpp\Services\Get\UrlTrack::add_params_social('facebook', $position); ?> " class="facebook"><i class="icon icon-facebook"></i></a></li> <li><a href="<?php echo $host; echo \Rpp\Services\Get\Content::nurl($this->model->nid); echo \Rpp\Services\Get\UrlTrack::add_params_social('twitter', $position); ?> " class="twitter"><i class="icon icon-twitter"></i></a></li> <li><a href="<?php echo $host; echo \Rpp\Services\Get\Content::nurl($this->model->nid); echo \Rpp\Services\Get\UrlTrack::add_params_social('googleplus', $position); ?> " class="gplus"><i class="icon icon-google-plus"></i></a></li> <li class="li-whatsapp"><a href="<?php echo $host; echo \Rpp\Services\Get\Content::nurl($this->model->nid); echo \Rpp\Services\Get\UrlTrack::add_params_social('whatsapp', $position); ?> " class="whatsapp"><i class="icon icon-whatsapp"></i></a></li> </ul> </section>
<h1><a href="<?php echo \Rpp\Services\Get\Content::nurl($nid); echo \Rpp\Services\Get\UrlTrack::add_params($position); ?> "> <?php echo \Rpp\Services\Get\Content::node($nid)->titulo_corto; ?> </a></h1> <p><?php echo \Rpp\Services\Get\Content::node($nid)->bajada; ?> </p> </header> </div> <figure class="media"> <a href="<?php echo \Rpp\Services\Get\Content::nurl($nid); echo \Rpp\Services\Get\UrlTrack::add_params($position); ?> "><img src="<?php echo \Rpp\Services\Get\Content::node($nid)->imagen_portada['url']; ?> " alt="<?php echo \Rpp\Services\Get\Content::node($nid)->imagen_portada['alt']; ?> "></a> </figure> </article> </div>
echo $contenido['cita']['titulo']; ?> </h4> <h2><a href="#"><?php echo $contenido['cita']['desarrollo']; ?> </a></h2> </li> </ul> </section> <?php } elseif ($contenido['tipo'] == 'photo') { ?> <?php if (\Rpp\Services\Get\Content::node($this->model->nid)->tipo == 'galeria') { ?> <?php continue; ?> <?php } ?> <figure class="media full"> <p> <?php echo $contenido['subtitulo']; ?> </p> <?php echo $this->partial('partials/nota/contenido/bloque/' . $this->model->package . 'imagen', $contenido); ?>