OXID eShop CE  4.10.2
 All Classes Namespaces Files Functions Variables Pages
oxtaglist.php
Go to the documentation of this file.
1 <?php
2 
3 // @deprecated v5.3 (2016-05-04); Tags will be moved to own module.
4 if (!defined('OXTAGCLOUD_MINFONT')) {
5  define('OXTAGCLOUD_MINTAGLENGTH', 4);
6  define('OXTAGCLOUD_STARTPAGECOUNT', 20);
7  define('OXTAGCLOUD_EXTENDEDCOUNT', 200);
8 }
9 // END deprecated
10 
17 class oxTagList extends oxI18n implements oxITagList
18 {
19 
25  protected $_oTagSet = null;
26 
32  protected $_blExtended = false;
33 
37  public function __construct()
38  {
40  $this->_oTagSet = oxNew('oxtagset');
41  }
42 
48  public function getCacheId()
49  {
50  return 'tag_list_' . $this->getLanguage();
51  }
52 
58  public function loadList()
59  {
61 
62  $iLang = $this->getLanguage();
63 
64  $sArtView = getViewName('oxarticles', $iLang);
65  $sViewName = getViewName('oxartextends', $iLang);
66 
67  // check if article is still active
68  $oArticle = oxNew('oxarticle');
69  $oArticle->setLanguage($iLang);
70  $sArtActive = $oArticle->getActiveCheckQuery(true);
71 
72  $sQ = "SELECT {$sViewName}.`oxtags` AS `oxtags`
73  FROM {$sArtView} AS `oxarticles`
74  LEFT JOIN {$sViewName} ON `oxarticles`.`oxid` = {$sViewName}.`oxid`
75  WHERE `oxarticles`.`oxactive` = 1 AND $sArtActive";
76 
77  $oDb->setFetchMode(oxDb::FETCH_MODE_ASSOC);
78  $oRs = $oDb->select($sQ);
79 
80  $this->get()->clear();
81  while ($oRs && $oRs->recordCount() && !$oRs->EOF) {
82  $this->_addTagsFromDb($oRs->fields['oxtags']);
83  $oRs->moveNext();
84  }
85 
86  return $this->_isLoaded = true;
87  }
88 
94  public function get()
95  {
96  return $this->_oTagSet;
97  }
98 
104  public function addTag($mTag)
105  {
106  $this->_oTagSet->addTag($mTag);
107  }
108 
116  protected function _addTagsFromDb($sTags)
117  {
118  if (empty($sTags)) {
119  return;
120  }
121  $sSeparator = $this->get()->getSeparator();
122  $aTags = explode($sSeparator, $sTags);
123  foreach ($aTags as $sTag) {
124  $oTag = oxNew("oxtag");
125  $oTag->set($sTag, false);
126  $oTag->removeUnderscores();
127  $this->addTag($oTag);
128  }
129  }
130 }