Ejemplo n.º 1
0
 /**
  * Formate les valeurs principales d'un élément suivant la ligne passées en paramètre
  * @param $row
  * @param $current
  * @return array|null
  */
 public function setItemData($row, $current)
 {
     $ModelImagepath = new magixglobal_model_imagepath();
     $ModelDateformat = new magixglobal_model_dateformat();
     $ModelTemplate = new frontend_model_template();
     $ModelRewrite = new magixglobal_model_rewrite();
     $data = null;
     if (isset($row['idnews'])) {
         $data['tag'] = null;
         $tag['data'] = parent::s_tagByNews($row['idnews']);
         if (is_array($tag['data'])) {
             foreach ($tag['data'] as $t) {
                 $t['uri'] = $ModelRewrite->filter_news_tag_url($row['iso'], $t['name_tag'], true);
                 $data['tag'] .= '<a href="' . $t['uri'] . '" title="' . $t['name_tag'] . '">';
                 $data['tag'] .= $t['name_tag'];
                 $data['tag'] .= '</a> ';
             }
         }
         if (isset($row['n_image'])) {
             $data['imgSrc'] = array('small' => $ModelImagepath->filterPathImg(array('filtermod' => 'news', 'img' => 's_' . $row['n_image'])), 'medium' => $ModelImagepath->filterPathImg(array('filtermod' => 'news', 'img' => $row['n_image'])));
         }
         $data['imgSrc']['default'] = $ModelImagepath->filterPathImg(array('img' => 'skin/' . $ModelTemplate->frontendTheme()->themeSelected() . '/img/news/news-default.png'));
         $data['id'] = $row['idnews'];
         $data['name'] = $row['n_title'];
         $data['uri'] = $ModelRewrite->filter_news_url($row['iso'], $ModelDateformat->date_europeen_format($row['date_register']), $row['n_uri'], $row['keynews'], true);
         $data['current'] = false;
         if (isset($current['record']['id'])) {
             $data['active'] = $row['keynews'] == $current['record']['id'] ? true : false;
         }
         $data['date']['register'] = $ModelDateformat->SQLDate($row['date_register']);
         $data['date']['publish'] = $ModelDateformat->SQLDate($row['date_publish']);
         $data['content'] = $row['n_content'];
     }
     return $data;
 }
Ejemplo n.º 2
0
 /**
  * @access private
  * Rechercher une news et retourne sous forme JSON
  */
 private function json_url_news()
 {
     if ($this->news_search != '') {
         if (parent::s_search_news($this->news_search) != null) {
             foreach (parent::s_search_news($this->news_search) as $key) {
                 $dateformat = new magixglobal_model_dateformat();
                 $url_news = magixglobal_model_rewrite::filter_news_url($key['iso'], $dateformat->date_europeen_format($key['date_register']), $key['n_uri'], $key['keynews'], true);
                 $json[] = '{"idnews":' . json_encode($key['idnews']) . ',"n_title":' . json_encode($key['n_title']) . ',"iso":' . json_encode(magixcjquery_string_convert::upTextCase($key['iso'])) . ',"url_news":' . json_encode($url_news) . ',"date_register":' . json_encode($key['date_register']) . '}';
             }
             print '[' . implode(',', $json) . ']';
         }
     } else {
         print '{}';
     }
 }
Ejemplo n.º 3
0
 /**
  * Création d'un noeud dans le fichier XML
  * @param $idlang
  * @param $iso
  */
 private function create_node_xml_news($idlang, $iso)
 {
     $attr_name = parent::s_config_named_data('news');
     if ($attr_name['status'] == 1) {
         foreach (parent::s_news($idlang) as $data) {
             $dateformat = new magixglobal_model_dateformat();
             $uri = magixglobal_model_rewrite::filter_news_url($data['iso'], $dateformat->date_europeen_format($data['date_register']), $data['n_uri'], $data['keynews'], true);
             $this->rss->elementWriteAtom($data['n_title'], $data['date_register'], $uri, null, $data['n_content']);
         }
     }
 }
Ejemplo n.º 4
0
 /**
  * @access private
  * Si les NEWS sont activé, on inscrit les URLs dans le sitemap
  */
 private function writeNews($idlang)
 {
     // Table des langues
     $lang = new backend_db_block_lang();
     // Retourne le code ISO
     $db = $lang->s_data_iso($idlang);
     /*instance la classe*/
     $sitemap = new magixcjquery_xml_sitemap();
     $attr_name = parent::s_config_named_data('news');
     if ($attr_name['status'] == 1) {
         /**
          * La racine des news par langue
          */
         $sitemap->writeMakeNode(magixcjquery_html_helpersHtml::getUrl() . magixglobal_model_rewrite::filter_news_root_url($db['iso'], true), $this->lastmod_dateFormat(), 'always', 0.7);
         /**
          * Les news par langue
          */
         foreach (parent::s_news_sitemap($idlang) as $data) {
             $curl = new magixglobal_model_dateformat();
             $sitemap->writeMakeNode(magixcjquery_html_helpersHtml::getUrl() . magixglobal_model_rewrite::filter_news_url($data['iso'], $curl->date_europeen_format($data['date_register']), $data['n_uri'], $data['keynews'], true), $this->lastmod_dateFormat(), 'always', 0.8);
         }
     }
 }
Ejemplo n.º 5
0
 private function lastmod_dateFormat()
 {
     $dateformat = new magixglobal_model_dateformat();
     return $dateformat->sitemap_lastmod_dateFormat();
 }