BxFilesSearchResult.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup Files Files
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxFilesSearchResult extends BxBaseModTextSearchResult
  12. {
  13. protected $sOrderParamName = 'order';
  14. protected $sBookmarksParamName = 'bookmarks';
  15. protected $sSortingParamName = 'sorting';
  16. protected $sCurrentFolderParamName = 'folder';
  17. protected $sCurrentView;
  18. protected $bFileManagerMode = false;
  19. protected $iFileManagerUploadTo = 0;
  20. protected $sMode = '';
  21. function __construct($sMode = '', $aParams = array())
  22. {
  23. $aParams['unit_views'] = [
  24. 'extended' => 'unit.html',
  25. 'gallery' => 'unit_gallery.html',
  26. 'full' => 'unit_full.html',
  27. 'showcase' => 'unit_showcase.html',
  28. 'table' => 'unit_simple_row.html',
  29. ];
  30. //Enble filemanager (toolbar, table files layout, dynamic menus, folders support) only for author/context blocks.
  31. if (($sMode == 'author' || $sMode == 'context') && !isset($aParams['no_toolbar'])) {
  32. $this->bFileManagerMode = true;
  33. $this->setUnitParams(['show_inline_menu' => true]);
  34. if (!bx_get('unit_view'))
  35. $aParams['unit_view'] = getParam('bx_files_default_layout_mode');
  36. }
  37. $this->sMode = $sMode;
  38. parent::__construct($sMode, $aParams);
  39. $this->sCurrentView = array_flip($aParams['unit_views'])[$this->sUnitTemplate];
  40. $this->aGetParams = array_merge($this->aGetParams, [
  41. $this->sOrderParamName,
  42. $this->sBookmarksParamName,
  43. $this->sSortingParamName,
  44. $this->sUnitViewParamName,
  45. $this->sCurrentFolderParamName,
  46. ]);
  47. $this->aSortingOptions = [
  48. 'name',
  49. 'date',
  50. 'type',
  51. 'author',
  52. ];
  53. $this->aCurrent = array(
  54. 'name' => 'bx_files',
  55. 'module_name' => 'bx_files',
  56. 'object_metatags' => 'bx_files',
  57. 'title' => _t('_bx_files_page_title_browse'),
  58. 'table' => 'bx_files_main',
  59. 'ownFields' => array('id', 'file_id', 'title', 'desc', 'author', 'added', 'type', 'parent_folder_id', 'allow_view_to'),
  60. 'searchFields' => array(),
  61. 'restriction' => array(
  62. 'author' => array('value' => '', 'field' => 'author', 'operator' => '='),
  63. 'featured' => array('value' => '', 'field' => 'featured', 'operator' => '<>'),
  64. 'status' => array('value' => 'active', 'field' => 'status', 'operator' => '='),
  65. 'statusAdmin' => array('value' => 'active', 'field' => 'status_admin', 'operator' => '='),
  66. 'files_only' => array('value' => 'file', 'field' => 'type', 'operator' => '='),
  67. 'context_filter' => array('value' => '', 'field' => 'allow_view_to', 'operator' => '>'),
  68. 'folder' => array('value' => '', 'field' => 'parent_folder_id', 'operator' => '='),
  69. ),
  70. 'paginate' => array('perPage' => getParam('bx_files_per_page_browse'), 'start' => 0),
  71. 'sorting' => 'last',
  72. 'rss' => array(
  73. 'title' => '',
  74. 'link' => '',
  75. 'image' => '',
  76. 'profile' => 0,
  77. 'fields' => array (
  78. 'Guid' => 'link',
  79. 'Link' => 'link',
  80. 'Title' => 'title',
  81. 'DateTimeUTS' => 'added',
  82. 'Desc' => 'desc',
  83. 'Image' => 'thumb'
  84. ),
  85. ),
  86. 'ident' => 'id',
  87. );
  88. $this->sFilterName = 'bx_files_filter';
  89. $this->oModule = $this->getMain();
  90. $CNF = &$this->oModule->_oConfig->CNF;
  91. $sSearchFields = getParam($CNF['PARAM_SEARCHABLE_FIELDS']);
  92. $this->aCurrent['searchFields'] = !empty($sSearchFields) ? explode(',', $sSearchFields) : '';
  93. $oProfileAuthor = null;
  94. switch ($sMode) {
  95. case 'author':
  96. if(!$this->_updateCurrentForAuthor($sMode, $aParams, $oProfileAuthor))
  97. $this->isError = true;
  98. else {
  99. //show only those files/folders which are not posted to some context
  100. $this->aCurrent['restriction']['context_filter']['value'] = 0;
  101. }
  102. break;
  103. case 'context':
  104. if(!$this->_updateCurrentForContext($sMode, $aParams, $oProfileAuthor))
  105. $this->isError = true;
  106. break;
  107. case 'favorite':
  108. if(!$this->_updateCurrentForFavorite($sMode, $aParams, $oProfileAuthor))
  109. $this->isError = true;
  110. break;
  111. case 'public':
  112. $this->sBrowseUrl = BxDolPermalinks::getInstance()->permalink($CNF['URL_HOME']);
  113. $this->aCurrent['title'] = _t('_bx_files_page_title_browse_recent');
  114. $this->aCurrent['rss']['link'] = 'modules/?r=files/rss/' . $sMode;
  115. break;
  116. case 'featured':
  117. $this->sBrowseUrl = BxDolPermalinks::getInstance()->permalink($CNF['URL_HOME']);
  118. $this->aCurrent['title'] = _t('_bx_files_page_title_browse_featured');
  119. $this->aCurrent['restriction']['featured']['value'] = '0';
  120. $this->aCurrent['rss']['link'] = 'modules/?r=files/rss/' . $sMode;
  121. $this->aCurrent['sorting'] = 'featured';
  122. break;
  123. case 'popular':
  124. $this->sBrowseUrl = BxDolPermalinks::getInstance()->permalink($CNF['URL_POPULAR']);
  125. $this->aCurrent['title'] = _t('_bx_files_page_title_browse_popular');
  126. $this->aCurrent['rss']['link'] = 'modules/?r=files/rss/' . $sMode;
  127. $this->aCurrent['sorting'] = 'popular';
  128. break;
  129. case 'top':
  130. $this->sBrowseUrl = BxDolPermalinks::getInstance()->permalink($CNF['URL_TOP']);
  131. $this->aCurrent['title'] = _t('_bx_files_page_title_browse_top');
  132. $this->aCurrent['rss']['link'] = 'modules/?r=files/rss/' . $sMode;
  133. $this->aCurrent['sorting'] = 'top';
  134. break;
  135. case 'updated':
  136. $this->sBrowseUrl = BxDolPermalinks::getInstance()->permalink($CNF['URL_UPDATED']);
  137. $this->aCurrent['title'] = _t('_bx_files_page_title_browse_updated');
  138. $this->aCurrent['rss']['link'] = 'modules/?r=files/rss/' . $sMode;
  139. $this->aCurrent['sorting'] = 'updated';
  140. break;
  141. case '': // search results
  142. $this->sBrowseUrl = BX_DOL_SEARCH_KEYWORD_PAGE;
  143. $this->aCurrent['title'] = _t('_bx_files');
  144. unset($this->aCurrent['paginate']['perPage'], $this->aCurrent['rss']);
  145. break;
  146. default:
  147. $sMode = '';
  148. $this->isError = true;
  149. }
  150. $this->processReplaceableMarkers($oProfileAuthor);
  151. $this->addConditionsForPrivateContent($CNF, $oProfileAuthor);
  152. if ($this->bFileManagerMode) {
  153. $this->addContainerClass('bx-files-with-toolbar');
  154. unset($this->aCurrent['restriction']['files_only']);
  155. if (bx_get($this->sBookmarksParamName))
  156. $this->addConditionsForBookmarks($CNF);
  157. $this->aCurrent['sorting'] = 'name';
  158. if (bx_get($this->sSortingParamName)) $this->aCurrent['sorting'] = bx_get($this->sSortingParamName);
  159. if ($this->aCurrent['sorting'] == 'type')
  160. $this->addConditionsForMimeType($CNF);
  161. $this->removeContainerClass('bx-def-margin-sec-lefttopright-neg');
  162. if (!$this->isError) {
  163. if ($sMode == 'author' && $oProfileAuthor->id() == bx_get_logged_profile_id() || $sMode == 'context')
  164. $this->iFileManagerUploadTo = $oProfileAuthor->id();
  165. }
  166. if ($this->sCurrentView == 'table')
  167. $this->removeContainerClass('bx-def-margin-bottom-neg');
  168. $this->aCurrent['restriction']['folder']['value'] = intval(bx_get($this->sCurrentFolderParamName));
  169. if ($this->aCurrent['restriction']['folder']['value'] < 0) {
  170. //navigate folder top
  171. bx_set($this->sCurrentFolderParamName, $this->oModule->_oDb->getParentFolderId(-$this->aCurrent['restriction']['folder']['value']));
  172. $this->aCurrent['restriction']['folder']['value'] = bx_get($this->sCurrentFolderParamName);
  173. }
  174. //free up one place for folder up item
  175. if ($this->aCurrent['restriction']['folder']['value']) {
  176. $this->aCurrent['paginate']['perPage']--;
  177. }
  178. }
  179. }
  180. protected function addConditionsForBookmarks(&$CNF) {
  181. if(empty($this->aCurrent['join']) || !is_array($this->aCurrent['join'])) $this->aCurrent['join'] = [];
  182. $this->aCurrent['join'] = array_merge($this->aCurrent['join'], [
  183. 'bookmarks' => [
  184. 'type' => 'INNER',
  185. 'table' => $CNF['TABLE_BOOKMARKS'],
  186. 'mainTable' => $CNF['TABLE_ENTRIES'],
  187. 'mainField' => $CNF['FIELD_ID'],
  188. 'onField' => $CNF['FIELD_BOOKMARKS_ID'],
  189. 'joinFields' => array($CNF['FIELD_BOOKMARKS_PROFILE']),
  190. ],
  191. ]);
  192. $this->aCurrent['restriction']['bookmarks'] = [
  193. 'value' => bx_get_logged_profile_id(),
  194. 'field' => $CNF['FIELD_BOOKMARKS_PROFILE'],
  195. 'operator' => '=',
  196. 'table' => $CNF['TABLE_BOOKMARKS'],
  197. ];
  198. }
  199. protected function addConditionsForMimeType(&$CNF) {
  200. if(empty($this->aCurrent['join']) || !is_array($this->aCurrent['join'])) $this->aCurrent['join'] = [];
  201. $this->aCurrent['join'] = array_merge($this->aCurrent['join'], [
  202. 'files' => [
  203. 'type' => 'LEFT',
  204. 'table' => $CNF['TABLE_FILES'],
  205. 'mainTable' => $CNF['TABLE_ENTRIES'],
  206. 'mainField' => $CNF['FIELD_ID'],
  207. 'onField' => $CNF['FIELD_ID'],
  208. 'joinFields' => array($CNF['FIELD_MIME_TYPE']),
  209. ],
  210. ]);
  211. }
  212. public function addCustomParts() {
  213. if ($this->_bLiveSearch) return;
  214. if (!$this->bFileManagerMode) return;
  215. $this->oModule->_oTemplate->addCss('main.css');
  216. $aParams = [
  217. 'aRequestParams' => [
  218. 'unit_view_param' => $this->sUnitViewParamName,
  219. 'bookmarks_param' => $this->sBookmarksParamName,
  220. 'sorting_param' => $this->sSortingParamName,
  221. 'keyword_param' => 'keyword',
  222. 'current_folder' => $this->sCurrentFolderParamName,
  223. ],
  224. 'layout' => $this->sCurrentView,
  225. 'bookmarks' => intval(bx_get($this->sBookmarksParamName)),
  226. 'sorting' => $this->aCurrent['sorting'],
  227. 'sorting_options' => $this->aSortingOptions,
  228. 'keyword' => bx_get('keyword') ? bx_get('keyword') : '',
  229. 'current_folder' => $this->aCurrent['restriction']['folder']['value'],
  230. 'current_page' => $this->aCurrent['paginate']['start'],
  231. ];
  232. return $this->getBrowseToolbar($aParams);
  233. }
  234. function getSearchData ()
  235. {
  236. $CNF = &$this->oModule->_oConfig->CNF;
  237. $aData = parent::getSearchData();
  238. if ($this->bFileManagerMode && $this->aCurrent['restriction']['folder']['value']) {
  239. $aData = array_merge([0 => [
  240. $CNF['FIELD_ID'] => '-1',
  241. $CNF['FIELD_FILE_ID'] => '0',
  242. $CNF['FIELD_TITLE'] => '..',
  243. $CNF['FIELD_AUTHOR'] => bx_get_logged_profile_id(),
  244. $CNF['FIELD_ADDED'] => 0,
  245. $CNF['FIELD_ALLOW_VIEW_TO'] => BX_DOL_PG_ALL,
  246. 'type' => 'folder',
  247. ]], $aData);
  248. $this->aCurrent['paginate']['num']++;
  249. }
  250. return $aData;
  251. }
  252. function processing ()
  253. {
  254. $iViewedProfile = 0;
  255. if ($this->_sMode == 'context' && $this->iFileManagerUploadTo) $iViewedProfile = $this->iFileManagerUploadTo;
  256. if ($this->_sMode == 'author' && $this->aCurrent['restriction']['author']['value']) $iViewedProfile = $this->aCurrent['restriction']['author']['value'];
  257. if ($iViewedProfile) {
  258. if (is_array($iViewedProfile)) $iViewedProfile = abs($iViewedProfile[0]);
  259. $oProfile = BxDolProfile::getInstance($iViewedProfile);
  260. if ($oProfile->checkAllowedProfileView() !== CHECK_ACTION_RESULT_ALLOWED) {
  261. $this->aCurrent['paginate']['num'] = 1;
  262. return MsgBox(_t('_sys_access_denied_to_private_content'));
  263. }
  264. }
  265. $sCode = parent::processing();
  266. if (!$this->aCurrent['paginate']['num'] && $this->bFileManagerMode) {
  267. //to show toolbar in case of empty results
  268. $sCode = $this->displaySearchBox($this->addCustomParts().MsgBox(_t('_Empty')));
  269. }
  270. return $sCode;
  271. }
  272. function showPagination($bAdmin = false, $bChangePage = true, $bPageReload = true)
  273. {
  274. $aAdditionalParams = [
  275. $this->sUnitViewParamName => $this->sCurrentView,
  276. $this->sBookmarksParamName => intval(bx_get($this->sBookmarksParamName)),
  277. $this->sSortingParamName => $this->aCurrent['sorting'],
  278. $this->sCurrentFolderParamName => $this->aCurrent['restriction']['folder']['value'],
  279. ];
  280. $sPageUrl = $this->getCurrentUrl($aAdditionalParams, false);
  281. $sOnClick = $this->getCurrentOnclick($aAdditionalParams, false);
  282. $oPaginate = new BxTemplPaginate([
  283. 'page_url' => $sPageUrl,
  284. 'on_change_page' => $sOnClick,
  285. 'num' => $this->aCurrent['paginate']['num'],
  286. 'per_page' => $this->aCurrent['paginate']['perPage'],
  287. 'start' => $this->aCurrent['paginate']['start'],
  288. ]);
  289. return $sOnClick ? $oPaginate->getSimplePaginate() : $oPaginate->getPaginate();
  290. }
  291. function getAlterOrder() {
  292. if (in_array($this->aCurrent['sorting'], $this->aSortingOptions)) {
  293. $CNF = &$this->oModule->_oConfig->CNF;
  294. $aSql = array();
  295. switch ($this->aCurrent['sorting']) {
  296. case 'name':
  297. $aSql['order'] = ' ORDER BY `'.$CNF['TABLE_ENTRIES'].'`.`type` DESC, `'.$CNF['TABLE_ENTRIES'].'`.`'.$CNF['FIELD_TITLE'].'` ASC';
  298. break;
  299. case 'date':
  300. $aSql['order'] = ' ORDER BY `'.$CNF['TABLE_ENTRIES'].'`.`type` DESC, `'.$CNF['TABLE_ENTRIES'].'`.`'.$CNF['FIELD_ID'].'` DESC';
  301. break;
  302. case 'author':
  303. $aSql['order'] = ' ORDER BY `'.$CNF['TABLE_ENTRIES'].'`.`type` DESC, `'.$CNF['TABLE_ENTRIES'].'`.`'.$CNF['FIELD_AUTHOR'].'` ASC, `'.$CNF['TABLE_ENTRIES'].'`.`'.$CNF['FIELD_TITLE'].'` ASC';
  304. break;
  305. case 'type':
  306. $aSql['order'] = ' ORDER BY `'.$CNF['TABLE_ENTRIES'].'`.`type` DESC, `'.$CNF['TABLE_FILES'].'`.`'.$CNF['FIELD_MIME_TYPE'].'` ASC, `'.$CNF['TABLE_ENTRIES'].'`.`'.$CNF['FIELD_TITLE'].'` ASC';
  307. break;
  308. }
  309. return $aSql;
  310. } else {
  311. return parent::getAlterOrder();
  312. }
  313. }
  314. protected function getBrowseToolbarControls(&$aParams, $sJsObject) {
  315. $aSortingOptions = [];
  316. if (isset($aParams['sorting_options'])) {
  317. foreach ($aParams['sorting_options'] as $sSorting) {
  318. $aSortingOptions[$sSorting] = _t('_bx_files_toolbar_sorting_' . $sSorting);
  319. }
  320. }
  321. $oForm = new BxTemplFormView([], $this->oModule->_oTemplate);
  322. $aInputSorting = [
  323. 'type' => 'select',
  324. 'name' => 'sorting',
  325. 'value' => $aParams['sorting'],
  326. 'values' => $aSortingOptions,
  327. 'attrs' => [
  328. 'onchange' => $sJsObject.'.setSorting(this.value);',
  329. ],
  330. ];
  331. $aInputFilter = [
  332. 'type' => 'text',
  333. 'name' => 'keyword',
  334. 'value' => $aParams['keyword'],
  335. 'attrs' => [
  336. 'placeholder' => _t('_sys_search_placeholder'),
  337. 'onkeyup' => $sJsObject.'.onChangeFilter(this);',
  338. 'onpaste' => $sJsObject.'.onChangeFilter(this);',
  339. ],
  340. ];
  341. $aUploadButtonParams = [];
  342. $bUploadAllowed = $this->oModule->checkAllowedAdd() == CHECK_ACTION_RESULT_ALLOWED && $this->oModule->serviceIsAllowedAddContentToProfile($this->iFileManagerUploadTo);
  343. if ($bUploadAllowed) {
  344. $sUniqId = genRndPwd (8, false);
  345. $oUploader = BxDolUploader::getObjectInstance('bx_files_html5', $this->oModule->_oConfig->CNF['OBJECT_STORAGE'], $sUniqId, $this->oModule->_oTemplate);
  346. $iMaxNestingLevel = intval(getParam($this->oModule->_oConfig->CNF['PARAM_MAX_NESTING_LEVEL']));
  347. $aUploadButtonParams = [
  348. 'js_object' => $sJsObject,
  349. 'uploader_code' => $oUploader->getUploaderJs('', true, [
  350. 'storage_private' => '0',
  351. 'images_transcoder' => 'bx_files_preview',
  352. 'content_id' => 0,
  353. ], true),
  354. 'uploader_js_object' => $oUploader->getNameJsInstanceUploader(),
  355. 'uploader_click_handler' => $oUploader->getNameJsInstanceUploader() . '.showUploaderForm();',
  356. 'bx_if:create_folder_allowed' => [
  357. 'condition' => $iMaxNestingLevel == 0 || $this->oModule->_oDb->getFolderNestingLevel($this->aCurrent['restriction']['folder']['value']) < $iMaxNestingLevel,
  358. 'content' => [
  359. 'js_object' => $sJsObject,
  360. 'folder_name_message' => _t('_bx_files_txt_folder_name'),
  361. ]
  362. ],
  363. ];
  364. }
  365. $aBulkActions = [];
  366. $aBulkActions[] = ['js_object' => $sJsObject, 'handler' => 'downloadFiles', 'title' => _t('_bx_files_bulk_action_title_download'), 'icon' => 'download'];
  367. if (isLogged()) {
  368. $aBulkActions[] = ['js_object' => $sJsObject, 'handler' => 'bookmarkFiles', 'title' => _t('_bx_files_bulk_action_title_bookmark'), 'icon' => 'star'];
  369. if ($bUploadAllowed) {
  370. $aBulkActions[] = ['js_object' => $sJsObject, 'handler' => 'deleteFiles', 'title' => _t('_bx_files_bulk_action_title_delete'), 'icon' => 'remove'];
  371. $aBulkActions[] = ['js_object' => $sJsObject, 'handler' => 'moveFiles', 'title' => _t('_bx_files_bulk_action_title_move_to'), 'icon' => 'file-export'];
  372. }
  373. }
  374. return [
  375. 'sorting_dropdown' => $oForm->genRowStandard($aInputSorting),
  376. 'filter_box' => $oForm->genRowStandard($aInputFilter),
  377. 'bx_if:upload_visible' => [
  378. 'condition' => $bUploadAllowed,
  379. 'content' => $aUploadButtonParams,
  380. ],
  381. 'bx_if:bookmarks_visible' => [
  382. 'condition' => isLogged(),
  383. 'content' => [
  384. 'js_object' => $sJsObject,
  385. 'bookmark_enabled' => $aParams['bookmarks'] ? 'fas' : 'far',
  386. ],
  387. ],
  388. 'bx_if:table_layout_btn' => [
  389. 'condition' => $aParams['layout'] == 'table',
  390. 'content' => [
  391. 'js_object' => $sJsObject,
  392. 'unit_view_param' => $aParams['aRequestParams']['unit_view_param'],
  393. ],
  394. ],
  395. 'bx_if:gallery_layout_btn' => [
  396. 'condition' => $aParams['layout'] == 'gallery',
  397. 'content' => [
  398. 'js_object' => $sJsObject,
  399. 'unit_view_param' => $aParams['aRequestParams']['unit_view_param'],
  400. ],
  401. ],
  402. 'bx_repeat:sorting_options' => $aSortingOptions,
  403. 'bx_repeat:bulk_actions' => $aBulkActions,
  404. ];
  405. }
  406. protected function getBrowseToolbarBreadcrumbs($sJsObject) {
  407. $aFolderPathTmpl = [];
  408. $aFolderPath = $this->oModule->_oDb->getFolderPath($this->aCurrent['restriction']['folder']['value']);
  409. if ($aFolderPath) {
  410. $aFolderPathTmpl[] = [
  411. 'name' => _t('_bx_files_txt_folder_root'),
  412. 'folder' => '0',
  413. 'js_object' => $sJsObject,
  414. ];
  415. foreach ($aFolderPath as $aEntry) {
  416. $aFolderPathTmpl[] = [
  417. 'name' => strmaxtextlen($aEntry['name'], 20),
  418. 'folder' => $aEntry['folder'],
  419. 'js_object' => $sJsObject,
  420. ];
  421. }
  422. }
  423. return $aFolderPathTmpl;
  424. }
  425. protected function getBrowseToolbar(&$aParams) {
  426. $this->oModule->_oTemplate->addJs('toolbar_tools.js');
  427. $sUniqueIdent = mt_rand();
  428. $aParams['unique_ident'] = $sUniqueIdent;
  429. $aParams['context'] = $this->sMode == 'context' ? $this->iFileManagerUploadTo : '';
  430. $sJsCode = $this->oModule->_oTemplate->getJsCode(['type' => 'toolbar_tools', 'uniq' => $sUniqueIdent], $aParams);
  431. $sJsObject = $this->oModule->_oConfig->getJsObject(['type' => 'toolbar_tools', 'uniq' => $sUniqueIdent]);
  432. $this->setUnitParams(['toolbar_js_object' => $sJsObject]);
  433. $aToolbarControls = $this->getBrowseToolbarControls($aParams, $sJsObject);
  434. return $this->oModule->_oTemplate->parseHtmlByName('files_browser_toolbar.html', array_merge($aToolbarControls, [
  435. 'js_object' => $sJsObject,
  436. 'js_code' => $sJsCode,
  437. 'unique_ident' => $sUniqueIdent,
  438. 'bx_repeat:folder_path' => $this->getBrowseToolbarBreadcrumbs($sJsObject),
  439. 'bx_if:select_all_checkbox' => [
  440. 'condition' => $aParams['layout'] == 'table',
  441. 'content' => [
  442. 'js_object' => $sJsObject,
  443. 'unique_ident' => $sUniqueIdent,
  444. ],
  445. ],
  446. ]));
  447. }
  448. }
  449. /** @} */