BxBaseStudioStore.php 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111
  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 UnaView UNA Studio Representation classes
  7. * @ingroup UnaStudio
  8. * @{
  9. */
  10. class BxBaseStudioStore extends BxDolStudioStore
  11. {
  12. protected $iPerPageDefault = 24;
  13. function __construct($sPage = "")
  14. {
  15. parent::__construct($sPage);
  16. }
  17. function getPageCss()
  18. {
  19. return array_merge(parent::getPageCss(), array(BX_DIRECTORY_PATH_PLUGINS_PUBLIC . 'fancybox/|jquery.fancybox.css', 'module.css', 'store.css', 'store-media-tablet.css', 'store-media-desktop.css'));
  20. }
  21. function getPageJs()
  22. {
  23. BxDolStudioTemplate::getInstance()->addJsTranslation(array('_adm_btn_queued_submit'));
  24. return array_merge(parent::getPageJs(), array('fancybox/jquery.fancybox.pack.js', 'store.js'));
  25. }
  26. function getPageJsObject()
  27. {
  28. return 'oBxDolStudioStore';
  29. }
  30. function getPageMenu($aMenu = array(), $aMarkers = array())
  31. {
  32. $sJsObject = $this->getPageJsObject();
  33. $oTemplate = BxDolStudioTemplate::getInstance();
  34. $aMenu = [];
  35. $aMenuItems = [
  36. 'goodies' => ['icon' => 'mi-str-home.svg'],
  37. 'latest' => ['icon' => 'mi-str-latest.svg'],
  38. 'featured' => ['icon' => 'mi-str-featured.svg'],
  39. 'popular' => ['icon' => 'mi-str-popular.svg'],
  40. 'categories' => ['icon' => 'mi-str-categories.svg'],
  41. 'search' => ['icon' => 'mi-str-search.svg'],
  42. 'purchases' => ['icon' => 'mi-str-purchases.svg'],
  43. 'updates' => ['icon' => 'mi-str-updates.svg'],
  44. 'checkout' => ['icon' => 'mi-str-checkout.svg', 'title' => '_adm_lmi_ttl_checkout'],
  45. 'downloaded' => ['icon' => 'mi-str-downloaded.svg']
  46. ];
  47. foreach($aMenuItems as $sMenuItem => $aItem)
  48. $aMenu[] = [
  49. 'name' => $sMenuItem,
  50. 'icon' => $aItem['icon'],
  51. 'icon_bg' => true,
  52. 'link' => $this->getBaseUrl($sMenuItem),
  53. 'title' => _t('_adm_lmi_cpt_' . $sMenuItem),
  54. 'title_attr' => !empty($aItem['title']) ? _t($aItem['title']) : '',
  55. 'selected' => $sMenuItem == $this->sPage
  56. ];
  57. $iCounter = BxDolStudioCart::getInstance()->getCount();
  58. $aMarkers = array(
  59. 'checkout_counter' => $oTemplate->parseHtmlByName('menu_side_counter.html', array(
  60. 'bx_if:hide_counter' => array(
  61. 'condition' => $iCounter <= 0,
  62. 'content' => array()
  63. ),
  64. 'counter' => $iCounter
  65. ))
  66. );
  67. return parent::getPageMenu($aMenu, $aMarkers);
  68. }
  69. function getPageCode($sPage = '', $bWrap = true)
  70. {
  71. $sResult = parent::getPageCode($sPage, $bWrap);
  72. if($sResult === false)
  73. return false;
  74. $sMethod = 'get' . ucfirst($this->sPage) . 'List';
  75. if(!method_exists($this, $sMethod))
  76. return '';
  77. return $this->$sMethod() . $sResult;
  78. }
  79. function getPageContent()
  80. {
  81. $sMethod = 'get' . ucfirst($this->sPage) . 'List';
  82. if(!method_exists($this, $sMethod))
  83. return '';
  84. return $this->$sMethod(false);
  85. }
  86. protected function getGoodiesList()
  87. {
  88. $sJsObject = $this->getPageJsObject();
  89. $oTemplate = BxDolStudioTemplate::getInstance();
  90. $mixedResult = $this->authorizeClient();
  91. if($mixedResult === true) {
  92. $aProducts = $this->loadGoodies();
  93. $sContent = "";
  94. $sContent .= $this->displayNonOwnerNotification();
  95. $sContent .= $this->getBlocksLine(array(
  96. array(
  97. 'caption' => '_adm_block_cpt_categories',
  98. 'actions' => array(),
  99. 'items' => $this->getCategoriesList(false)
  100. ),
  101. array(
  102. 'caption' => '_adm_block_cpt_tags',
  103. 'actions' => array(),
  104. 'items' => $this->getTagsList(false)
  105. )
  106. ));
  107. foreach($aProducts as $aBlock) {
  108. $aBlock['items'] = $oTemplate->parseHtmlByName('str_products.html', array(
  109. 'list' => $this->displayProducts($aBlock['items']),
  110. 'paginate' => ''
  111. ));
  112. $sContent .= $this->getBlockCode($aBlock);
  113. }
  114. }
  115. else
  116. $sContent = $this->getBlockCode(array(
  117. 'caption' => '_adm_block_cpt_goodies',
  118. 'items' => $mixedResult,
  119. ));
  120. return $oTemplate->parseHtmlByName('store.html', array(
  121. 'js_object' => $sJsObject,
  122. 'content' => $sContent
  123. ));
  124. }
  125. protected function getLatestList($bWrapInBlock = true)
  126. {
  127. return $this->getBrowsingList('latest', $bWrapInBlock);
  128. }
  129. protected function getFeaturedList($bWrapInBlock = true)
  130. {
  131. return $this->getBrowsingList('featured', $bWrapInBlock);
  132. }
  133. protected function getPopularList($bWrapInBlock = true)
  134. {
  135. return $this->getBrowsingList('popular', $bWrapInBlock);
  136. }
  137. protected function getBrowsingList($sType, $bWrapInBlock = true)
  138. {
  139. $sJsObject = $this->getPageJsObject();
  140. $oTemplate = BxDolStudioTemplate::getInstance();
  141. $mixedResult = $this->authorizeClient();
  142. if($mixedResult === true) {
  143. $iStart = (int)bx_get('str_start');
  144. $iPerPage = (int)bx_get('str_per_page');
  145. if(empty($iPerPage))
  146. $iPerPage = $this->iPerPageDefault;
  147. $aProducts = $this->{'load' . bx_gen_method_name($sType)}($iStart, $iPerPage + 1);
  148. $oPaginate = new BxTemplPaginate(array(
  149. 'start' => $iStart,
  150. 'per_page' => $iPerPage,
  151. 'on_change_page' => $sJsObject . ".changePagePaginate(this, '" . $sType . "', null, {start}, {per_page})"
  152. ));
  153. $oPaginate->setNumFromDataArray($aProducts);
  154. $sContent = $oTemplate->parseHtmlByName('str_products.html', array(
  155. 'list' => $this->displayProducts($aProducts),
  156. 'paginate' => $oPaginate->getSimplePaginate()
  157. ));
  158. }
  159. else
  160. $sContent = $mixedResult;
  161. if(!$bWrapInBlock)
  162. return $sContent;
  163. return $oTemplate->parseHtmlByName('store.html', array(
  164. 'js_object' => $sJsObject,
  165. 'content' => $this->getBlockCode(array(
  166. 'caption' => '_adm_block_cpt_' . $sType,
  167. 'items' => $sContent
  168. ))
  169. ));
  170. }
  171. protected function getCategoriesList($bWrapInBlock = true)
  172. {
  173. return $this->getLabelsList('categories', $bWrapInBlock);
  174. }
  175. protected function getCategoryList($bWrapInBlock = true)
  176. {
  177. $sKey = 'value';
  178. if(bx_get($sKey) === false)
  179. $sKey = 'str_value';
  180. $aValue = array();
  181. $aValue['value'] = (int)bx_get($sKey);
  182. if(bx_get('title') !== false)
  183. $aValue['title'] = bx_process_input(urldecode(bx_get('title')));
  184. return $this->getLabelList('category', $aValue, $bWrapInBlock);
  185. }
  186. protected function getTagsList($bWrapInBlock = true)
  187. {
  188. return $this->getLabelsList('tags', $bWrapInBlock);
  189. }
  190. protected function getTagList($bWrapInBlock = true)
  191. {
  192. $sKey = 'value';
  193. if(bx_get($sKey) === false)
  194. $sKey = 'str_value';
  195. return $this->getLabelList('tag', bx_process_input(bx_get($sKey)), $bWrapInBlock);
  196. }
  197. protected function getLabelsList($sType, $bWrapInBlock = true)
  198. {
  199. $mixedResult = $this->authorizeClient();
  200. if($mixedResult === true) {
  201. $aLabels = $this->{'load' . bx_gen_method_name($sType)}();
  202. $sContent = $this->{'display' . bx_gen_method_name($sType)}($aLabels);
  203. }
  204. else
  205. $sContent = $mixedResult;
  206. if(!$bWrapInBlock)
  207. return $sContent;
  208. return BxDolStudioTemplate::getInstance()->parseHtmlByName('store.html', array(
  209. 'js_object' => $this->getPageJsObject(),
  210. 'content' => $this->getBlockCode(array(
  211. 'caption' => '_adm_block_cpt_' . $sType,
  212. 'items' => $sContent
  213. ))
  214. ));
  215. }
  216. protected function getLabelList($sType, $mixedValue, $bWrapInBlock = true)
  217. {
  218. $sJsObject = $this->getPageJsObject();
  219. $oTemplate = BxDolStudioTemplate::getInstance();
  220. $iStart = (int)bx_get('str_start');
  221. $iPerPage = (int)bx_get('str_per_page');
  222. if(empty($iPerPage))
  223. $iPerPage = $this->iPerPageDefault;
  224. $bArray = is_array($mixedValue);
  225. $sValue = $bArray ? $mixedValue['value'] : $mixedValue;
  226. $sTitle = $bArray && !empty($mixedValue['title']) ? $mixedValue['title'] : $sValue;
  227. $sMethod = 'load' . bx_gen_method_name($sType);
  228. $aProducts = $this->$sMethod($sValue, $iStart, $iPerPage + 1);
  229. $oPaginate = new BxTemplPaginate(array(
  230. 'start' => $iStart,
  231. 'per_page' => $iPerPage,
  232. 'on_change_page' => $sJsObject . ".changePagePaginate(this, '" . $sType . "', '" . $sValue . "', {start}, {per_page})"
  233. ));
  234. $oPaginate->setNumFromDataArray($aProducts);
  235. $sContent = $oTemplate->parseHtmlByName('str_products.html', array(
  236. 'list' => $this->displayProducts($aProducts),
  237. 'paginate' => $oPaginate->getSimplePaginate()
  238. ));
  239. if(!$bWrapInBlock)
  240. return $sContent;
  241. return $oTemplate->parseHtmlByName('store.html', array(
  242. 'js_object' => $sJsObject,
  243. 'content' => $this->getBlockCode(array(
  244. 'caption' => array('_adm_block_cpt_' . $sType, $sTitle),
  245. 'items' => $sContent,
  246. ))
  247. ));
  248. }
  249. protected function getSearchList($bWrapInBlock = true)
  250. {
  251. $sJsObject = $this->getPageJsObject();
  252. $oTemplate = BxDolStudioTemplate::getInstance();
  253. $mixedResult = $this->authorizeClient();
  254. if($mixedResult === true) {
  255. //--- Search form
  256. $aForm = array(
  257. 'form_attrs' => array(
  258. 'id' => 'adm-str-search-form',
  259. 'name' => 'adm-str-search-form',
  260. 'action' => '',
  261. 'method' => 'post'
  262. ),
  263. 'params' => array(
  264. 'db' => array(
  265. 'table' => '',
  266. 'key' => '',
  267. 'uri' => '',
  268. 'uri_title' => '',
  269. 'submit_name' => 'search'
  270. ),
  271. ),
  272. 'inputs' => array(
  273. 'page' => array(
  274. 'type' => 'hidden',
  275. 'name' => 'page',
  276. 'value' => $this->sPage
  277. ),
  278. 'keyword' => array(
  279. 'type' => 'text',
  280. 'name' => 'keyword',
  281. 'caption' => '',
  282. 'value' => '',
  283. 'attrs' => array(
  284. 'placeholder' => bx_html_attribute(_t('_sys_search_placeholder'))
  285. ),
  286. 'db' => array (
  287. 'pass' => 'Xss',
  288. )
  289. ),
  290. 'search' => array(
  291. 'type' => 'submit',
  292. 'name' => 'search',
  293. 'value' => _t('_adm_btn_store_search'),
  294. )
  295. )
  296. );
  297. $oForm = new BxTemplStudioFormView($aForm);
  298. $oForm->initChecker();
  299. $sResults = '';
  300. if($oForm->isSubmittedAndValid()) {
  301. $sKeyword = $oForm->getCleanValue('keyword');
  302. $iStart = (int)bx_get('str_start');
  303. $iPerPage = (int)bx_get('str_per_page');
  304. if(empty($iPerPage))
  305. $iPerPage = 999;
  306. $aProducts = $this->loadSearch($sKeyword, $iStart, $iPerPage + 1);
  307. $sResults = empty($aProducts) || !is_array($aProducts) ? MsgBox(_t('_Empty')) : $oTemplate->parseHtmlByName('str_products.html', array(
  308. 'list' => $this->displayProducts($aProducts),
  309. 'paginate' => ''
  310. ));
  311. }
  312. $sContent = $oTemplate->parseHtmlByName('str_search.html', array(
  313. 'form' => $oForm->getCode(),
  314. 'bx_if:show_results' => array(
  315. 'condition' => !empty($sResults),
  316. 'content' => array(
  317. 'results' => $sResults
  318. )
  319. )
  320. ));
  321. }
  322. else
  323. $sContent = $mixedResult;
  324. if(!$bWrapInBlock)
  325. return $sContent;
  326. return $oTemplate->parseHtmlByName('store.html', array(
  327. 'js_object' => $sJsObject,
  328. 'content' => $this->getBlockCode(array(
  329. 'caption' => '_adm_block_cpt_search',
  330. 'items' => $sContent
  331. ))
  332. ));
  333. }
  334. protected function getPurchasesList()
  335. {
  336. $oTemplate = BxDolStudioTemplate::getInstance();
  337. $aProducts = $this->loadPurchases();
  338. return $oTemplate->parseHtmlByName('store.html', array(
  339. 'js_object' => $this->getPageJsObject(),
  340. 'content' => $this->getBlockCode(array(
  341. 'caption' => '_adm_block_cpt_purchases',
  342. 'items' => $oTemplate->parseHtmlByName('str_products.html', array(
  343. 'list' => $this->displayProducts($aProducts),
  344. 'paginate' => ''
  345. ))
  346. ))
  347. ));
  348. }
  349. protected function getUpdatesList()
  350. {
  351. $oTemplate = BxDolStudioTemplate::getInstance();
  352. $aUpdates = $this->loadUpdates();
  353. return $oTemplate->parseHtmlByName('store.html', array(
  354. 'js_object' => $this->getPageJsObject(),
  355. 'content' => $this->getBlockCode(array(
  356. 'caption' => '_adm_block_cpt_updates',
  357. 'items' => $oTemplate->parseHtmlByName('str_products.html', array(
  358. 'list' => $this->displayUpdates($aUpdates),
  359. 'paginate' => ''
  360. ))
  361. ))
  362. ));
  363. }
  364. protected function getCheckoutList()
  365. {
  366. $sJsObject = $this->getPageJsObject();
  367. $oTemplate = BxDolStudioTemplate::getInstance();
  368. //--- Empty cart by vendor if the payment was accepted.
  369. $mixedVendor = bx_get('vendor');
  370. $mixedProducts = bx_get('products');
  371. if($mixedVendor !== false && $mixedProducts !== false) {
  372. $oCart = BxDolStudioCart::getInstance();
  373. $aProducts = explode(',', base64_decode($mixedProducts));
  374. foreach($aProducts as $iId)
  375. $oCart->delete($mixedVendor, $iId);
  376. return $this->getMessage('_adm_block_cpt_checkout', '_adm_msg_modules_success_checkouted');
  377. }
  378. $aVendors = $this->loadCheckout();
  379. if(empty($aVendors))
  380. return $this->getMessage('_adm_block_cpt_checkout', '_Empty');
  381. $sContent = '';
  382. foreach($aVendors as $iVendor => $aInfo) {
  383. $fTotal = 0;
  384. $sVendor = $sCurrency = '';
  385. if(!empty($aInfo['products']) && is_array($aInfo['products']))
  386. foreach($aInfo['products'] as $aProduct) {
  387. $iCount = isset($aInfo['counts'][$aProduct['id']]) ? (int)$aInfo['counts'][$aProduct['id']] : 1;
  388. $fTotal += $iCount * $aProduct['price_single'];
  389. if($sVendor == '' && isset($aProduct['author_name']))
  390. $sVendor = $aProduct['author_name'];
  391. if($sCurrency == '' && isset($aProduct['author_currency_sign']))
  392. $sCurrency = $aProduct['author_currency_sign'];
  393. }
  394. $aMenu = array(
  395. array('id' => 'checkout-' . $iVendor, 'name' => 'checkout-' . $iVendor, 'link' => 'javascript:void(0)', 'onclick' => $sJsObject . ".checkoutCart(" . $iVendor . ", this);", 'target' => '_self', 'title' => '_adm_action_cpt_checkout', 'active' => 1),
  396. array('id' => 'delete-all-' . $iVendor, 'name' => 'delete-all-' . $iVendor, 'link' => 'javascript:void(0)', 'onclick' => $sJsObject . ".deleteAllFromCart(" . $iVendor . ", this)", 'target' => '_self', 'title' => '_adm_action_cpt_delete_all', 'active' => 1)
  397. );
  398. $oMenu = new BxTemplMenu(array('object'=> 'adm-std-checkout', 'template' => 'menu_buttons_hor.html', 'menu_items' => $aMenu));
  399. $sContent .= $this->getBlockCode(array(
  400. 'caption' => _t('_adm_block_cpt_checkout_by_vendor_csign', $sVendor, $sCurrency, $fTotal),
  401. 'items' => $oTemplate->parseHtmlByName('str_products.html', array(
  402. 'list' => $this->displayProducts($aInfo['products'], array('is_shopping_cart' => true, 'counts' => $aInfo['counts'])),
  403. 'paginate' => ''
  404. )),
  405. 'panel_bottom' => $oMenu->getCode()
  406. ));
  407. }
  408. return $oTemplate->parseHtmlByName('store.html', array(
  409. 'js_object' => $sJsObject,
  410. 'content' => $sContent
  411. ));
  412. }
  413. protected function getDownloadedList()
  414. {
  415. $sJsObject = $this->getPageJsObject();
  416. $oTemplate = BxDolStudioTemplate::getInstance();
  417. $sContent = $sModules = $sUpdates = "";
  418. $aProducts = $this->loadDownloaded();
  419. //--- Prepare modules.
  420. $bCacheImage = getParam('sys_template_cache_image_enable') == 'on';
  421. foreach($aProducts['modules'] as $aModule) {
  422. $sIcon = BxDolStudioUtils::getModuleIcon($aModule, 'store');
  423. $bIcon = ($bCacheImage && substr($sIcon, 0, 10) == 'data:image') || strpos($sIcon, '.') !== false;
  424. $bInstalled = $aModule['installed'];
  425. $bQueued = !$bInstalled && $this->oDb->isQueued('action', $aModule['dir']);
  426. $sModules .= $oTemplate->parseHtmlByName('str_product_v1.html', array(
  427. 'js_object' => $sJsObject,
  428. 'name' => $aModule['name'],
  429. 'bx_if:no_icon' => array (
  430. 'condition' => !$bIcon,
  431. 'content' => array(
  432. 'icon' => $sIcon
  433. ),
  434. ),
  435. 'bx_if:icon' => array (
  436. 'condition' => $bIcon,
  437. 'content' => array(
  438. 'icon_url' => $sIcon,
  439. ),
  440. ),
  441. 'title' => $aModule['title'],
  442. 'vendor' => strtolower($aModule['vendor']) == 'boonex' ? 'UNA INC' : $aModule['vendor'],
  443. 'version' => $aModule['version'],
  444. 'dir' => $aModule['dir'],
  445. 'bx_if:hide_install' => array(
  446. 'condition' => $bInstalled || $bQueued,
  447. 'content' => array()
  448. ),
  449. 'bx_if:hide_queued' => array(
  450. 'condition' => !$bQueued,
  451. 'content' => array()
  452. ),
  453. 'bx_if:hide_installed' => array(
  454. 'condition' => !$bInstalled || $bQueued,
  455. 'content' => array()
  456. )
  457. ));
  458. }
  459. //--- Prepare updates.
  460. foreach($aProducts['updates'] as $aUpdate) {
  461. $sIcon = BxDolStudioUtils::getModuleIcon(array('type' => $aUpdate['module_type'], 'name' => $aUpdate['module_name'], 'dir' => $aUpdate['module_dir']), 'store');
  462. $bIcon = ($bCacheImage && substr($sIcon, 0, 10) == 'data:image') || strpos($sIcon, '.') !== false;
  463. $sUpdates .= $oTemplate->parseHtmlByName('str_update_v1.html', array(
  464. 'js_object' => $sJsObject,
  465. 'name' => $aUpdate['module_name'],
  466. 'bx_if:no_icon' => array (
  467. 'condition' => !$bIcon,
  468. 'content' => array(
  469. 'icon' => $sIcon
  470. ),
  471. ),
  472. 'bx_if:icon' => array (
  473. 'condition' => $bIcon,
  474. 'content' => array(
  475. 'icon_url' => $sIcon,
  476. ),
  477. ),
  478. 'title' => $aUpdate['title'],
  479. 'vendor' => strtolower($aUpdate['vendor']) == 'boonex' ? 'UNA INC' : $aUpdate['vendor'],
  480. 'versions' => _t('_adm_str_txt_update_from_to', $aUpdate['version_from'], $aUpdate['version_to']),
  481. 'dir' => $aUpdate['dir']
  482. ));
  483. }
  484. if(!empty($sModules))
  485. $sContent .= $this->getBlockCode(array(
  486. 'type' => BX_DB_DEF,
  487. 'caption' => '_adm_block_cpt_downloaded_modules',
  488. 'items' => $oTemplate->parseHtmlByName('str_products.html', array(
  489. 'list' => $sModules,
  490. 'paginate' => ''
  491. )),
  492. ));
  493. if(!empty($sUpdates))
  494. $sContent .= $this->getBlockCode(array(
  495. 'type' => BX_DB_DEF,
  496. 'caption' => '_adm_block_cpt_downloaded_updates',
  497. 'items' => $oTemplate->parseHtmlByName('str_products.html', array(
  498. 'list' => $sUpdates,
  499. 'paginate' => ''
  500. )),
  501. ));
  502. return $oTemplate->parseHtmlByName('store.html', array(
  503. 'js_object' => $sJsObject,
  504. 'content' => $sContent
  505. ));
  506. }
  507. protected function getMessage($sCaption, $sContent, $aActions = array())
  508. {
  509. return BxDolStudioTemplate::getInstance()->parseHtmlByName('store.html', array(
  510. 'js_object' => $this->getPageJsObject(),
  511. 'content' => $this->getBlockCode(array(
  512. 'caption' => $sCaption,
  513. 'actions' => $aActions,
  514. 'items' => MsgBox(_t($sContent))
  515. ))
  516. ));
  517. }
  518. protected function getProduct($sModuleName)
  519. {
  520. $bShowRating = true;
  521. $sJsObject = $this->getPageJsObject();
  522. $oTemplate = BxDolStudioTemplate::getInstance();
  523. $aProduct = $this->loadProduct($sModuleName);
  524. if(empty($aProduct) || !is_array($aProduct))
  525. return array('code' => BX_DOL_STUDIO_IU_RC_FAILED, 'message' => (!empty($aProduct) ? $aProduct : _t('_adm_str_err_no_product_info')));
  526. $aDownloaded = $this->getDownloadedModules(false);
  527. $bFree = (int)$aProduct['is_free'] == 1;
  528. $bPurchased = (int)$aProduct['is_purchased'] == 1;
  529. $bPurchaseSingle = !$bFree && !$bPurchased && (float)$aProduct['price_single'] != 0;
  530. $bInCart = $bPurchaseSingle && BxDolStudioCart::getInstance()->exists($aProduct['author_id'], $aProduct['id']);
  531. $bPurchaseRecurring = !$bFree && !$bPurchased && (float)$aProduct['price_recurring'] != 0;
  532. $bDownloadable = (int)$aProduct['is_file'] == 1;
  533. $bDownloaded = array_key_exists($sModuleName, $aDownloaded);
  534. $bDownload = ($bFree || $bPurchased) && $bDownloadable;
  535. $bDiscount = !empty($aProduct['discount_single']);
  536. $sVersion = $bDownloaded && version_compare(strtolower($aDownloaded[$sModuleName]['version']), strtolower($aProduct['version'])) != 0 ? _t('_adm_str_txt_pv_version_mask', $aDownloaded[$sModuleName]['version'], $aProduct['version']) : $aProduct['version'];
  537. $iScreenshots = 0;
  538. $aScreenshots = array();
  539. $bScreenshots = is_array($aProduct['screenshots']) && !empty($aProduct['screenshots']);
  540. if($bScreenshots) {
  541. $iScreenshots = count($aProduct['screenshots']);
  542. foreach($aProduct['screenshots'] as $aScreenshot)
  543. $aScreenshots[] = array(
  544. 'view_url' => $aProduct['url'],
  545. 'image_url' => $aScreenshot['big']
  546. );
  547. }
  548. $bTmplVarsRate = $bShowRating;
  549. if($bTmplVarsRate)
  550. $aTmplVarsRate = array(
  551. 'rate' => $this->getVoteStars($aProduct)
  552. );
  553. $aTmplVarsVotes = array();
  554. $bTmplVarsVotes = $bShowRating && (int)$aProduct['votes_cnt'] > 0;
  555. if($bTmplVarsVotes)
  556. $aTmplVarsVotes = array(
  557. 'count' => (int)$aProduct['votes_cnt']
  558. );
  559. $sContent = $oTemplate->parseHtmlByname('str_product_view.html', array(
  560. 'id' => $aProduct['id'],
  561. 'title' => $aProduct['title'],
  562. 'url' => $aProduct['url'],
  563. 'author_name' => $aProduct['author_name'],
  564. 'author_url' => $aProduct['author_url'],
  565. 'version' => $sVersion,
  566. 'bx_if:show_price_single' => array(
  567. 'condition' => $bFree || (float)$aProduct['price_single'] != 0,
  568. 'content' => array(
  569. 'price_single' => !$bFree ? _t('_adm_str_txt_price_single', $aProduct['author_currency_sign'], $aProduct['price_single']) : _t('_adm_str_txt_price_free'),
  570. 'bx_if:show_discount' => array(
  571. 'condition' => !$bFree && $bDiscount,
  572. 'content' => array(
  573. 'discount_single' => $bDiscount ? _t('_adm_str_txt_pv_discount_off_csign', $aProduct['discount_single']['percent'], $aProduct['author_currency_sign'], $aProduct['discount_single']['save']) : ''
  574. )
  575. )
  576. )
  577. ),
  578. 'bx_if:show_price_recurring' => array(
  579. 'condition' => (float)$aProduct['price_recurring'] != 0,
  580. 'content' => array(
  581. 'price_recurring' => _t('_adm_str_txt_price_recurring', $aProduct['author_currency_sign'], $aProduct['price_recurring'], _t('_adm_str_txt_per_' . $aProduct['duration_recurring']))
  582. )
  583. ),
  584. 'bx_if:show_rate' => array(
  585. 'condition' => $bTmplVarsRate,
  586. 'content' => $aTmplVarsRate
  587. ),
  588. 'bx_if:show_votes' => array(
  589. 'condition' => $bTmplVarsVotes,
  590. 'content' => $aTmplVarsVotes
  591. ),
  592. 'category' => $aProduct['category'],
  593. 'category_url' => $aProduct['category_url'],
  594. 'tags' => implode(', ', explode(',', $aProduct['tags'])),
  595. 'reviews' => _t('_adm_str_txt_pv_stats_reviews', $aProduct['reviews_cnt']),
  596. 'reviews_url' => $aProduct['reviews_url'],
  597. 'votes' => _t('_adm_str_txt_pv_stats_votes', $aProduct['votes_cnt']),
  598. 'views' => _t('_adm_str_txt_pv_stats_views', $aProduct['views_cnt']),
  599. 'created' => bx_time_js($aProduct['created']),
  600. 'updated' => bx_time_js($aProduct['updated']),
  601. 'description' => $aProduct['description'],
  602. 'bx_if:show_screenshots' => array(
  603. 'condition' => $bScreenshots,
  604. 'content' => array(
  605. 'width' => 222 * $iScreenshots - 20,
  606. 'bx_repeat:screenshots' => $aScreenshots
  607. )
  608. ),
  609. 'bx_if:show_purchase' => array(
  610. 'condition' => $bPurchaseSingle || $bPurchaseRecurring,
  611. 'content' => array(
  612. 'bx_if:show_purchase_single' => array(
  613. 'condition' => $bPurchaseSingle && !$bInCart,
  614. 'content' => array(
  615. 'js_object' => $sJsObject,
  616. 'id' => $aProduct['id'],
  617. 'vendor_id' => $aProduct['author_id'],
  618. 'price_single' => _t('_adm_str_txt_price_single', $aProduct['author_currency_sign'], $aProduct['price_single'])
  619. )
  620. ),
  621. 'bx_if:show_checkout_single' => array(
  622. 'condition' => $bPurchaseSingle,
  623. 'content' => array(
  624. 'js_object' => $sJsObject,
  625. 'id' => $aProduct['id'],
  626. 'vendor_id' => $aProduct['author_id'],
  627. 'bx_if:show_as_hidden' => array(
  628. 'condition' => !$bInCart,
  629. 'content' => array()
  630. )
  631. )
  632. ),
  633. 'bx_if:show_purchase_recurring' => array(
  634. 'condition' => $bPurchaseRecurring,
  635. 'content' => array(
  636. 'js_object' => $sJsObject,
  637. 'id' => $aProduct['id'],
  638. 'vendor_id' => $aProduct['author_id'],
  639. 'price_recurring' => _t('_adm_str_txt_price_recurring', $aProduct['author_currency_sign'], $aProduct['price_recurring'], _t('_adm_str_txt_per_' . $aProduct['duration_recurring']))
  640. )
  641. )
  642. )
  643. ),
  644. 'bx_if:show_download' => array(
  645. 'condition' => $bDownload && !$bDownloaded,
  646. 'content' => array(
  647. 'js_object' => $sJsObject,
  648. 'file_id' => $aProduct['file_id'],
  649. )
  650. ),
  651. 'bx_if:show_download_disabled' => array(
  652. 'condition' => $bDownload && $bDownloaded,
  653. 'content' => array()
  654. ),
  655. ));
  656. return [
  657. 'code' => BX_DOL_STUDIO_IU_RC_SUCCESS,
  658. 'message' => '',
  659. 'popup' => BxTemplStudioFunctions::getInstance()->popupBox('bx-std-str-popup-product', $aProduct['title'], $sContent, true),
  660. 'screenshots' => $iScreenshots
  661. ];
  662. }
  663. protected function getFile($iFileId)
  664. {
  665. $mixedResult = $this->loadFile($iFileId);
  666. if($mixedResult === true)
  667. return array('code' => BX_DOL_STUDIO_IU_RC_SUCCESS, 'message' => _t('_adm_str_msg_download_successfully'));
  668. if(is_string($mixedResult))
  669. return array('code' => BX_DOL_STUDIO_IU_RC_FAILED, 'message' => (!empty($mixedResult) ? $mixedResult : _t('_adm_str_err_download_failed')));
  670. if(is_array($mixedResult))
  671. return array_merge(array('code' => BX_DOL_STUDIO_IU_RC_FAILED, 'message' => _t('_adm_str_err_download_failed')), $mixedResult);
  672. }
  673. protected function getUpdate($sModuleName, $bApplyUpdate = false)
  674. {
  675. $aResult = array();
  676. $mixedResult = $this->loadUpdate($sModuleName, $bApplyUpdate);
  677. if($mixedResult === true)
  678. $aResult = array('code' => BX_DOL_STUDIO_IU_RC_SUCCESS, 'message' => _t('_adm_str_msg_download' . ($bApplyUpdate ? '_and_install' : '') . '_successfully'));
  679. else if(is_string($mixedResult))
  680. $aResult = array('code' => BX_DOL_STUDIO_IU_RC_FAILED, 'message' => (!empty($mixedResult) ? $mixedResult : _t('_adm_str_err_download_failed')));
  681. else if(is_array($mixedResult))
  682. $aResult = array_merge(array('code' => BX_DOL_STUDIO_IU_RC_FAILED, 'message' => _t('_adm_str_err_download_failed')), $mixedResult);
  683. $aResult['reload'] = 3000;
  684. return $aResult;
  685. }
  686. protected function displayProducts($mixedItems, $aParams = array())
  687. {
  688. $bShowRating = false;
  689. if(!is_array($mixedItems))
  690. return MsgBox($mixedItems);
  691. $sJsObject = $this->getPageJsObject();
  692. $oTemplate = BxDolStudioTemplate::getInstance();
  693. $aDownloaded = $this->getDownloadedModules();
  694. $bShoppingCart = isset($aParams['is_shopping_cart']) && $aParams['is_shopping_cart'];
  695. $sResult = '';
  696. foreach($mixedItems as $aItem) {
  697. $bFree = (int)$aItem['is_free'] == 1;
  698. $bPurchased = (int)$aItem['is_purchased'] == 1;
  699. $bPurchaseSingle = !$bShoppingCart && !$bFree && !$bPurchased && (float)$aItem['price_single'] != 0;
  700. $bInCart = $bPurchaseSingle && BxDolStudioCart::getInstance()->exists($aItem['author_id'], $aItem['id']);
  701. $bPurchaseRecurring = !$bShoppingCart && !$bFree && !$bPurchased && (float)$aItem['price_recurring'] != 0;
  702. $bDownloadable = (int)$aItem['is_file'] == 1;
  703. $bDownloaded = in_array($aItem['name'], $aDownloaded);
  704. $bDownload = !$bShoppingCart && ($bFree || $bPurchased) && $bDownloadable;
  705. $bQueued = $this->oDb->isQueued('download', $aItem['name']);
  706. $sPrice = !$bFree ? _t('_adm_str_txt_price_single', $aItem['author_currency_sign'], $aItem['price_single']) : _t('_adm_str_txt_price_free');
  707. $sDiscount = !$bFree && !empty($aItem['discount_single']) ? _t('_adm_str_txt_discount_csign', $aItem['author_currency_sign'], $aItem['discount_single']['price']) : '';
  708. $sIcon = !empty($aItem['thumbnail']['small']) ? $aItem['thumbnail']['small'] : BxDolStudioUtils::getIconDefault(BX_DOL_MODULE_TYPE_MODULE);
  709. $bIcon = strpos($sIcon, '.') !== false;
  710. $sImage = '';
  711. $bImage = $bImageRaw = false;
  712. if(empty($aItem['cover_raw'])) {
  713. if(!empty($aItem['cover']['medium']))
  714. $sImage = $aItem['cover']['medium'];
  715. else if(!empty($aItem['cover']['large']))
  716. $sImage = $aItem['cover']['large'];
  717. else if(!empty($aItem['cover']['big']))
  718. $sImage = $aItem['cover']['big'];
  719. $bImage = !empty($sImage) && strpos($sImage, '.') !== false;
  720. }
  721. else {
  722. $sImage = $aItem['cover_raw'];
  723. $bImageRaw = true;
  724. }
  725. $aTmplVarsRate = array();
  726. $bTmplVarsRate = $bShowRating && !$bShoppingCart;
  727. if($bTmplVarsRate)
  728. $aTmplVarsRate = array(
  729. 'rate' => $this->getVoteStars($aItem)
  730. );
  731. $aTmplVarsVotes = array();
  732. $bTmplVarsVotes = $bShowRating && !$bShoppingCart && (int)$aItem['votes_cnt'] > 0;
  733. if($bTmplVarsVotes)
  734. $aTmplVarsVotes = array(
  735. 'count' => (int)$aItem['votes_cnt']
  736. );
  737. $sResult .= $oTemplate->parseHtmlByName('str_product_v2.html', array(
  738. 'js_object' => $sJsObject,
  739. 'id' => $aItem['id'],
  740. 'name' => $aItem['name'],
  741. 'url' => $aItem['url'],
  742. 'description_plain_attr' => bx_html_attribute($aItem['description_plain']),
  743. 'bx_if:no_icon' => array (
  744. 'condition' => !$bIcon,
  745. 'content' => array(
  746. 'icon' => $sIcon
  747. ),
  748. ),
  749. 'bx_if:icon' => array (
  750. 'condition' => $bIcon,
  751. 'content' => array(
  752. 'icon_url' => $sIcon,
  753. ),
  754. ),
  755. 'bx_if:no_image' => array (
  756. 'condition' => !$bImage && !$bImageRaw,
  757. 'content' => array(
  758. 'description_plain' => $aItem['description_plain'],
  759. 'strecher' => mb_strlen($aItem['description_plain']) > 240 ? '' : str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ', round((240 - mb_strlen($aItem['description_plain'])) / 6))
  760. ),
  761. ),
  762. 'bx_if:image' => array (
  763. 'condition' => $bImage,
  764. 'content' => array(
  765. 'image_url' => $sImage,
  766. 'strecher' => str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ', 40)
  767. ),
  768. ),
  769. 'bx_if:image_raw' => array (
  770. 'condition' => $bImageRaw,
  771. 'content' => array(
  772. 'image_raw' => $sImage,
  773. ),
  774. ),
  775. 'title' => $aItem['title'],
  776. 'bx_if:show_vendor' => array(
  777. 'condition' => !$bShoppingCart,
  778. 'content' => array(
  779. 'vendor_name' => $aItem['author_name'],
  780. 'vendor_url' => $aItem['author_url'],
  781. 'bx_if:show_version' => array(
  782. 'condition' => !empty($aItem['file_version']),
  783. 'content' => array(
  784. 'version' => $aItem['file_version'],
  785. )
  786. ),
  787. )
  788. ),
  789. 'bx_if:show_count_price' => array(
  790. 'condition' => $bShoppingCart,
  791. 'content' => array(
  792. 'count' => isset($aParams['counts'][$aItem['id']]) ? (int)$aParams['counts'][$aItem['id']] : 1,
  793. 'price_single' => $sPrice,
  794. 'discount_single' => $sDiscount,
  795. )
  796. ),
  797. 'bx_if:show_rate' => array(
  798. 'condition' => $bTmplVarsRate,
  799. 'content' => $aTmplVarsRate
  800. ),
  801. 'bx_if:show_votes' => array(
  802. 'condition' => $bTmplVarsVotes,
  803. 'content' => $aTmplVarsVotes
  804. ),
  805. 'bx_if:show_purchase_single' => array(
  806. 'condition' => $bPurchaseSingle && !$bInCart,
  807. 'content' => array(
  808. 'js_object' => $sJsObject,
  809. 'id' => $aItem['id'],
  810. 'vendor_id' => $aItem['author_id'],
  811. 'price_single' => _t('_adm_str_txt_price_single', $aItem['author_currency_sign'], $aItem['price_single'])
  812. )
  813. ),
  814. 'bx_if:show_checkout_single' => array(
  815. 'condition' => $bPurchaseSingle,
  816. 'content' => array(
  817. 'js_object' => $sJsObject,
  818. 'id' => $aItem['id'],
  819. 'vendor_id' => $aItem['author_id'],
  820. 'bx_if:show_as_hidden' => array(
  821. 'condition' => !$bInCart,
  822. 'content' => array()
  823. )
  824. )
  825. ),
  826. 'bx_if:show_purchase_recurring' => array(
  827. 'condition' => $bPurchaseRecurring,
  828. 'content' => array(
  829. 'js_object' => $sJsObject,
  830. 'id' => $aItem['id'],
  831. 'vendor_id' => $aItem['author_id'],
  832. 'price_recurring' => _t('_adm_str_txt_price_recurring', $aItem['author_currency_sign'], $aItem['price_recurring'], _t('_adm_str_txt_per_' . $aItem['duration_recurring'] . '_short'))
  833. )
  834. ),
  835. 'bx_if:show_download' => array(
  836. 'condition' => $bDownload && !$bQueued && !$bDownloaded,
  837. 'content' => array(
  838. 'js_object' => $sJsObject,
  839. 'file_id' => $aItem['file_id']
  840. )
  841. ),
  842. 'bx_if:show_download_disabled' => array(
  843. 'condition' => $bDownload && !$bQueued && $bDownloaded,
  844. 'content' => array()
  845. ),
  846. 'bx_if:show_queued_disabled' => array(
  847. 'condition' => $bDownload && $bQueued && !$bDownloaded,
  848. 'content' => array()
  849. ),
  850. 'bx_if:show_delete' => array(
  851. 'condition' => $bShoppingCart,
  852. 'content' => array(
  853. 'js_object' => $sJsObject,
  854. 'id' => $aItem['id'],
  855. 'vendor_id' => $aItem['author_id']
  856. )
  857. )
  858. ));
  859. }
  860. return $sResult;
  861. }
  862. protected function displayUpdates($mixedItems, $aParams = array())
  863. {
  864. if(!is_array($mixedItems))
  865. return MsgBox($mixedItems);
  866. if(empty($mixedItems))
  867. return MsgBox(_t('_Empty'));
  868. $sJsObject = $this->getPageJsObject();
  869. $oTemplate = BxDolStudioTemplate::getInstance();
  870. $sResult = '';
  871. foreach($mixedItems as $aItem) {
  872. $bDownloadable = (int)$aItem['is_file'] == 1;
  873. $bQueued = $this->oDb->isQueued('download', $aItem['name']);
  874. $sIcon = !empty($aItem['thumbnail']['big']) ? $aItem['thumbnail']['big'] : BxDolStudioUtils::getIconDefault(BX_DOL_MODULE_TYPE_MODULE);
  875. $bIcon = strpos($sIcon, '.') !== false;
  876. $sImage = !empty($aItem['cover']['big']) ? $aItem['cover']['big'] : '';
  877. $bImage = strpos($sImage, '.') !== false;
  878. $sResult .= $oTemplate->parseHtmlByName('str_update_v2.html', array(
  879. 'js_object' => $sJsObject,
  880. 'id' => $aItem['id'],
  881. 'name' => $aItem['name'],
  882. 'url' => $aItem['url'],
  883. 'bx_if:no_icon' => array (
  884. 'condition' => !$bIcon,
  885. 'content' => array(
  886. 'icon' => $sIcon
  887. ),
  888. ),
  889. 'bx_if:icon' => array (
  890. 'condition' => $bIcon,
  891. 'content' => array(
  892. 'icon_url' => $sIcon,
  893. ),
  894. ),
  895. 'bx_if:no_image' => array (
  896. 'condition' => !$bImage,
  897. 'content' => array(
  898. 'note' => $aItem['description_plain'],
  899. 'strecher' => mb_strlen($aItem['description_plain']) > 240 ? '' : str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ', round((240 - mb_strlen($aItem['description_plain'])) / 6))
  900. ),
  901. ),
  902. 'bx_if:image' => array (
  903. 'condition' => $bImage,
  904. 'content' => array(
  905. 'image_url' => $sImage,
  906. 'strecher' => str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ', 40)
  907. ),
  908. ),
  909. 'title' => $aItem['title'],
  910. 'vendor' => $aItem['author_name'],
  911. 'versions' => _t('_adm_str_txt_update_from_to', $aItem['file_version'], $aItem['file_version_to']),
  912. 'bx_if:show_download' => array(
  913. 'condition' => $bDownloadable && !$bQueued,
  914. 'content' => array(
  915. 'caption' => _t('_adm_btn_install_submit'),
  916. 'on_click' => $sJsObject . ".getUpdateAndInstall('" . $aItem['name'] . "', this)"
  917. )
  918. ),
  919. 'bx_if:show_queued_disabled' => array(
  920. 'condition' => $bDownloadable && $bQueued,
  921. 'content' => array()
  922. )
  923. ));
  924. }
  925. return $sResult;
  926. }
  927. protected function displayCategories($aCategories)
  928. {
  929. foreach($aCategories['bx_repeat:cats'] as $iKey => $aItem)
  930. $aCategories['bx_repeat:cats'][$iKey]['url'] = $this->getBaseUrl(array('page' => 'category', 'value' => $aItem['value'], 'title' => urlencode($aItem['name'])));
  931. return BxDolStudioTemplate::getInstance()->parseHtmlByName('str_lbl_categories.html', $aCategories);
  932. }
  933. protected function displayTags($aTags)
  934. {
  935. foreach($aTags['bx_repeat:units'] as $iKey => $aItem)
  936. $aTags['bx_repeat:units'][$iKey]['href'] = $this->getBaseUrl(array('page' => 'tag', 'value' => $aItem['keyword']));
  937. return BxDolStudioTemplate::getInstance()->parseHtmlByName('str_lbl_tags.html', $aTags);
  938. }
  939. protected function displayNonOwnerNotification()
  940. {
  941. if(BxDolStudioOAuth::isAuthorizedOwner())
  942. return;
  943. $oSession = BxDolSession::getInstance();
  944. if($oSession->getValue($this->sSessionKeyNonOwnerNotified) === true)
  945. return;
  946. $oSession->setValue($this->sSessionKeyNonOwnerNotified, true);
  947. return $this->getJsResultBy(array(
  948. 'message' => '_adm_msg_oauth_non_owner_logged',
  949. 'translate' => array(BX_DOL_MARKET_URL_ROOT),
  950. 'on_page_load' => true
  951. ));
  952. }
  953. private function getDownloadedModules($bNamesOnly = true)
  954. {
  955. $aModules = BxDolStudioInstallerUtils::getInstance()->getModules(false);
  956. return $bNamesOnly ? array_keys($aModules) : $aModules;
  957. }
  958. private function getVoteStars($aItem)
  959. {
  960. $aTmplVarsStars = array();
  961. for($i = (int)$aItem['rate_min']; $i <= (int)$aItem['rate_max']; $i++)
  962. $aTmplVarsStars[] = array('value' => $i);
  963. return BxDolStudioTemplate::getInstance()->parseHtmlByName('str_vote_stars.html', array(
  964. 'id' => $aItem['id'],
  965. 'value' => (float)$aItem['rate'],
  966. 'bx_repeat:stars' => $aTmplVarsStars,
  967. 'bx_repeat:slider' => $aTmplVarsStars,
  968. ));
  969. }
  970. }
  971. /** @} */