Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
search_list.inc
1 <?php
17 require_once SQ_PACKAGES_PATH.'/cms/listing_engine/listing_engine.inc';
18 require_once SQ_INCLUDE_PATH.'/general_occasional.inc';
19 
32 {
33 
34 
41  function __construct($assetid=0)
42  {
43  parent::__construct($assetid);
44 
45  }//end constructor
46 
47 
59  function _createAdditional(&$link)
60  {
61  if (!Page::_createAdditional($link)) return FALSE;
62  return $this->_createBodycopies(Array('content' => '%asset_listing%'));
63 
64  }//end _createAdditional()
65 
66 
84  function getAssetList()
85  {
86  $search_page = NULL;
87  $search_page_link = $GLOBALS['SQ_SYSTEM']->am->getLink($this->id, SQ_LINK_NOTICE, '', FALSE, 'search_page');
88  if (!empty($search_page_link)) {
89  $search_page = $GLOBALS['SQ_SYSTEM']->am->getAsset($search_page_link['minorid']);
90  }
91  if (is_null($search_page)) return Array();
92 
93  $sm = $GLOBALS['SQ_SYSTEM']->am->getSystemAsset('search_manager');
94  $plugin =& $sm->_getDBPlugin();
95  $children = $plugin->getSearchListAssets($this, $search_page);
96 
97  // See printContents() in Listing Engine. It needs to set this flag to by-pass
98  // certain asset info caching since the format of returning array is not the same as
99  // the parent.
100  $this->_tmp['no_asset_info_url_cache'] = TRUE;
101 
102  $this->_tmp['search_terms'] = $children;
103 
104  return $children;
105 
106  }//end getAssetList()
107 
108 
119  function filterAssetList(&$todo)
120  {
121  return;
122 
123  }//end filterAssetList()
124 
125 
136  function printAssetList($todo)
137  {
138  $search_field_name = $this->attr('search_field');
139  if (empty($search_field_name)) return;
140 
141  $search_page = NULL;
142  $search_page_link = $GLOBALS['SQ_SYSTEM']->am->getLink($this->id, SQ_LINK_NOTICE, '', FALSE, 'search_page');
143  if (!empty($search_page_link)) {
144  $search_page = $GLOBALS['SQ_SYSTEM']->am->getAsset($search_page_link['minorid']);
145  }
146  if (is_null($search_page)) return;
147 
148  $this->_tmp['search_url'] = $search_page->getURL().'?mode=results&amp;queries_'.$search_field_name.'_query=';
149 
150  $this->_printAssetList($todo);
151 
152  }//end printAssetList()
153 
154 
165  function _printAsset($word, $list_position)
166  {
167  $format = $this->attr('default_format');
168  $keywords = Array(
169  'search_term' => '<a href="'.$this->_tmp['search_url'].$word.'">'.$word.'</a>',
170  'number_of_occurrences' => $this->_tmp['search_terms'][$word]['num_values'],
171  );
172 
173  echo replace_keywords($format, $keywords);
174 
175  }//end _printAsset()
176 
177 
178 }//end class
179 
180 ?>