| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <?php defined('BX_DOL') or die('hack attempt');
- /**
- * Copyright (c) UNA, Inc - https://una.io
- * MIT License - https://opensource.org/licenses/MIT
- * @defgroup Resources Resources
- * @ingroup UnaModules
- *
- * @{
- */
- class BxResourcesSearchResult extends BxBaseModTextSearchResult
- {
- function __construct($sMode = '', $aParams = [])
- {
- parent::__construct($sMode, $aParams);
- $this->aCurrent = array(
- 'name' => 'bx_resources',
- 'module_name' => 'bx_resources',
- 'object_metatags' => 'bx_resources',
- 'title' => _t('_bx_resources_page_title_browse'),
- 'table' => 'bx_resources_entries',
- 'ownFields' => array('id', 'link', 'title', 'text', 'thumb', 'author', 'added'),
- 'searchFields' => array(),
- 'restriction' => array(
- 'author' => array('value' => '', 'field' => 'author', 'operator' => '='),
- 'cat' => array('value' => '', 'field' => 'cat', 'operator' => '='),
- 'status' => array('value' => 'active', 'field' => 'status', 'operator' => '='),
- 'statusAdmin' => array('value' => 'active', 'field' => 'status_admin', 'operator' => '='),
- ),
- 'paginate' => array('perPage' => getParam('bx_resources_per_page_browse'), 'start' => 0),
- 'sorting' => 'last',
- 'rss' => array(
- 'title' => '',
- 'link' => '',
- 'image' => '',
- 'profile' => 0,
- 'fields' => array (
- 'Guid' => 'link',
- 'Link' => 'link',
- 'Title' => 'title',
- 'DateTimeUTS' => 'added',
- 'Desc' => 'text',
- 'Image' => 'thumb'
- ),
- ),
- 'ident' => 'id',
- );
- $this->sFilterName = 'bx_resources_filter';
- $this->oModule = $this->getMain();
- $CNF = &$this->oModule->_oConfig->CNF;
- $sSearchFields = getParam($CNF['PARAM_SEARCHABLE_FIELDS']);
- $this->aCurrent['searchFields'] = !empty($sSearchFields) ? explode(',', $sSearchFields) : '';
- $oProfileAuthor = null;
- switch ($sMode) {
- case 'author':
- if(!$this->_updateCurrentForAuthor($sMode, $aParams, $oProfileAuthor))
- $this->isError = true;
- break;
- case 'context':
- if(!$this->_updateCurrentForContext($sMode, $aParams, $oProfileAuthor)) {
- $this->isError = true;
- break;
- }
- if(($sCategory = $aParams['category'] ?? false))
- $this->aCurrent['restriction']['cat']['value'] = $sCategory;
- break;
- case '': // search results
- $this->sBrowseUrl = BX_DOL_SEARCH_KEYWORD_PAGE;
- $this->aCurrent['title'] = _t('_bx_resources');
- unset($this->aCurrent['paginate']['perPage'], $this->aCurrent['rss']);
- break;
- default:
- $sMode = '';
- $this->isError = true;
- }
- $this->processReplaceableMarkers($oProfileAuthor);
- $this->addConditionsForPrivateContent($CNF, $oProfileAuthor);
- }
- }
- /** @} */
|