BxBaseStudioStore.php 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112
  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'));
  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. 'image_alt' => bx_html_attribute(_t('_adm_str_txt_pv_screenshot', $aProduct['title']))
  547. );
  548. }
  549. $bTmplVarsRate = $bShowRating;
  550. if($bTmplVarsRate)
  551. $aTmplVarsRate = array(
  552. 'rate' => $this->getVoteStars($aProduct)
  553. );
  554. $aTmplVarsVotes = array();
  555. $bTmplVarsVotes = $bShowRating && (int)$aProduct['votes_cnt'] > 0;
  556. if($bTmplVarsVotes)
  557. $aTmplVarsVotes = array(
  558. 'count' => (int)$aProduct['votes_cnt']
  559. );
  560. $sContent = $oTemplate->parseHtmlByname('str_product_view.html', array(
  561. 'id' => $aProduct['id'],
  562. 'title' => $aProduct['title'],
  563. 'url' => $aProduct['url'],
  564. 'author_name' => $aProduct['author_name'],
  565. 'author_url' => $aProduct['author_url'],
  566. 'version' => $sVersion,
  567. 'bx_if:show_price_single' => array(
  568. 'condition' => $bFree || (float)$aProduct['price_single'] != 0,
  569. 'content' => array(
  570. 'price_single' => !$bFree ? _t('_adm_str_txt_price_single', $aProduct['author_currency_sign'], $aProduct['price_single']) : _t('_adm_str_txt_price_free'),
  571. 'bx_if:show_discount' => array(
  572. 'condition' => !$bFree && $bDiscount,
  573. 'content' => array(
  574. 'discount_single' => $bDiscount ? _t('_adm_str_txt_pv_discount_off_csign', $aProduct['discount_single']['percent'], $aProduct['author_currency_sign'], $aProduct['discount_single']['save']) : ''
  575. )
  576. )
  577. )
  578. ),
  579. 'bx_if:show_price_recurring' => array(
  580. 'condition' => (float)$aProduct['price_recurring'] != 0,
  581. 'content' => array(
  582. 'price_recurring' => _t('_adm_str_txt_price_recurring', $aProduct['author_currency_sign'], $aProduct['price_recurring'], _t('_adm_str_txt_per_' . $aProduct['duration_recurring']))
  583. )
  584. ),
  585. 'bx_if:show_rate' => array(
  586. 'condition' => $bTmplVarsRate,
  587. 'content' => $aTmplVarsRate
  588. ),
  589. 'bx_if:show_votes' => array(
  590. 'condition' => $bTmplVarsVotes,
  591. 'content' => $aTmplVarsVotes
  592. ),
  593. 'category' => $aProduct['category'],
  594. 'category_url' => $aProduct['category_url'],
  595. 'tags' => implode(', ', explode(',', $aProduct['tags'])),
  596. 'reviews' => _t('_adm_str_txt_pv_stats_reviews', $aProduct['reviews_cnt']),
  597. 'reviews_url' => $aProduct['reviews_url'],
  598. 'votes' => _t('_adm_str_txt_pv_stats_votes', $aProduct['votes_cnt']),
  599. 'views' => _t('_adm_str_txt_pv_stats_views', $aProduct['views_cnt']),
  600. 'created' => bx_time_js($aProduct['created']),
  601. 'updated' => bx_time_js($aProduct['updated']),
  602. 'description' => $aProduct['description'],
  603. 'bx_if:show_screenshots' => array(
  604. 'condition' => $bScreenshots,
  605. 'content' => array(
  606. 'width' => 222 * $iScreenshots - 20,
  607. 'bx_repeat:screenshots' => $aScreenshots
  608. )
  609. ),
  610. 'bx_if:show_purchase' => array(
  611. 'condition' => $bPurchaseSingle || $bPurchaseRecurring,
  612. 'content' => array(
  613. 'bx_if:show_purchase_single' => array(
  614. 'condition' => $bPurchaseSingle && !$bInCart,
  615. 'content' => array(
  616. 'js_object' => $sJsObject,
  617. 'id' => $aProduct['id'],
  618. 'vendor_id' => $aProduct['author_id'],
  619. 'price_single' => _t('_adm_str_txt_price_single', $aProduct['author_currency_sign'], $aProduct['price_single'])
  620. )
  621. ),
  622. 'bx_if:show_checkout_single' => array(
  623. 'condition' => $bPurchaseSingle,
  624. 'content' => array(
  625. 'js_object' => $sJsObject,
  626. 'id' => $aProduct['id'],
  627. 'vendor_id' => $aProduct['author_id'],
  628. 'bx_if:show_as_hidden' => array(
  629. 'condition' => !$bInCart,
  630. 'content' => array()
  631. )
  632. )
  633. ),
  634. 'bx_if:show_purchase_recurring' => array(
  635. 'condition' => $bPurchaseRecurring,
  636. 'content' => array(
  637. 'js_object' => $sJsObject,
  638. 'id' => $aProduct['id'],
  639. 'vendor_id' => $aProduct['author_id'],
  640. 'price_recurring' => _t('_adm_str_txt_price_recurring', $aProduct['author_currency_sign'], $aProduct['price_recurring'], _t('_adm_str_txt_per_' . $aProduct['duration_recurring']))
  641. )
  642. )
  643. )
  644. ),
  645. 'bx_if:show_download' => array(
  646. 'condition' => $bDownload && !$bDownloaded,
  647. 'content' => array(
  648. 'js_object' => $sJsObject,
  649. 'file_id' => $aProduct['file_id'],
  650. )
  651. ),
  652. 'bx_if:show_download_disabled' => array(
  653. 'condition' => $bDownload && $bDownloaded,
  654. 'content' => array()
  655. ),
  656. ));
  657. return [
  658. 'code' => BX_DOL_STUDIO_IU_RC_SUCCESS,
  659. 'message' => '',
  660. 'popup' => BxTemplStudioFunctions::getInstance()->popupBox('bx-std-str-popup-product', $aProduct['title'], $sContent, true),
  661. 'screenshots' => $iScreenshots
  662. ];
  663. }
  664. protected function getFile($iFileId)
  665. {
  666. $mixedResult = $this->loadFile($iFileId);
  667. if($mixedResult === true)
  668. return array('code' => BX_DOL_STUDIO_IU_RC_SUCCESS, 'message' => _t('_adm_str_msg_download_successfully'));
  669. if(is_string($mixedResult))
  670. return array('code' => BX_DOL_STUDIO_IU_RC_FAILED, 'message' => (!empty($mixedResult) ? $mixedResult : _t('_adm_str_err_download_failed')));
  671. if(is_array($mixedResult))
  672. return array_merge(array('code' => BX_DOL_STUDIO_IU_RC_FAILED, 'message' => _t('_adm_str_err_download_failed')), $mixedResult);
  673. }
  674. protected function getUpdate($sModuleName, $bApplyUpdate = false)
  675. {
  676. $aResult = array();
  677. $mixedResult = $this->loadUpdate($sModuleName, $bApplyUpdate);
  678. if($mixedResult === true)
  679. $aResult = array('code' => BX_DOL_STUDIO_IU_RC_SUCCESS, 'message' => _t('_adm_str_msg_download' . ($bApplyUpdate ? '_and_install' : '') . '_successfully'));
  680. else if(is_string($mixedResult))
  681. $aResult = array('code' => BX_DOL_STUDIO_IU_RC_FAILED, 'message' => (!empty($mixedResult) ? $mixedResult : _t('_adm_str_err_download_failed')));
  682. else if(is_array($mixedResult))
  683. $aResult = array_merge(array('code' => BX_DOL_STUDIO_IU_RC_FAILED, 'message' => _t('_adm_str_err_download_failed')), $mixedResult);
  684. $aResult['reload'] = 3000;
  685. return $aResult;
  686. }
  687. protected function displayProducts($mixedItems, $aParams = array())
  688. {
  689. $bShowRating = false;
  690. if(!is_array($mixedItems))
  691. return MsgBox($mixedItems);
  692. $sJsObject = $this->getPageJsObject();
  693. $oTemplate = BxDolStudioTemplate::getInstance();
  694. $aDownloaded = $this->getDownloadedModules();
  695. $bShoppingCart = isset($aParams['is_shopping_cart']) && $aParams['is_shopping_cart'];
  696. $sResult = '';
  697. foreach($mixedItems as $aItem) {
  698. $bFree = (int)$aItem['is_free'] == 1;
  699. $bPurchased = (int)$aItem['is_purchased'] == 1;
  700. $bPurchaseSingle = !$bShoppingCart && !$bFree && !$bPurchased && (float)$aItem['price_single'] != 0;
  701. $bInCart = $bPurchaseSingle && BxDolStudioCart::getInstance()->exists($aItem['author_id'], $aItem['id']);
  702. $bPurchaseRecurring = !$bShoppingCart && !$bFree && !$bPurchased && (float)$aItem['price_recurring'] != 0;
  703. $bDownloadable = (int)$aItem['is_file'] == 1;
  704. $bDownloaded = in_array($aItem['name'], $aDownloaded);
  705. $bDownload = !$bShoppingCart && ($bFree || $bPurchased) && $bDownloadable;
  706. $bQueued = $this->oDb->isQueued('download', $aItem['name']);
  707. $sPrice = !$bFree ? _t('_adm_str_txt_price_single', $aItem['author_currency_sign'], $aItem['price_single']) : _t('_adm_str_txt_price_free');
  708. $sDiscount = !$bFree && !empty($aItem['discount_single']) ? _t('_adm_str_txt_discount_csign', $aItem['author_currency_sign'], $aItem['discount_single']['price']) : '';
  709. $sIcon = !empty($aItem['thumbnail']['small']) ? $aItem['thumbnail']['small'] : BxDolStudioUtils::getIconDefault(BX_DOL_MODULE_TYPE_MODULE);
  710. $bIcon = strpos($sIcon, '.') !== false;
  711. $sImage = '';
  712. $bImage = $bImageRaw = false;
  713. if(empty($aItem['cover_raw'])) {
  714. if(!empty($aItem['cover']['medium']))
  715. $sImage = $aItem['cover']['medium'];
  716. else if(!empty($aItem['cover']['large']))
  717. $sImage = $aItem['cover']['large'];
  718. else if(!empty($aItem['cover']['big']))
  719. $sImage = $aItem['cover']['big'];
  720. $bImage = !empty($sImage) && strpos($sImage, '.') !== false;
  721. }
  722. else {
  723. $sImage = $aItem['cover_raw'];
  724. $bImageRaw = true;
  725. }
  726. $aTmplVarsRate = array();
  727. $bTmplVarsRate = $bShowRating && !$bShoppingCart;
  728. if($bTmplVarsRate)
  729. $aTmplVarsRate = array(
  730. 'rate' => $this->getVoteStars($aItem)
  731. );
  732. $aTmplVarsVotes = array();
  733. $bTmplVarsVotes = $bShowRating && !$bShoppingCart && (int)$aItem['votes_cnt'] > 0;
  734. if($bTmplVarsVotes)
  735. $aTmplVarsVotes = array(
  736. 'count' => (int)$aItem['votes_cnt']
  737. );
  738. $sResult .= $oTemplate->parseHtmlByName('str_product_v2.html', array(
  739. 'js_object' => $sJsObject,
  740. 'id' => $aItem['id'],
  741. 'name' => $aItem['name'],
  742. 'url' => $aItem['url'],
  743. 'description_plain_attr' => bx_html_attribute($aItem['description_plain']),
  744. 'bx_if:no_icon' => array (
  745. 'condition' => !$bIcon,
  746. 'content' => array(
  747. 'icon' => $sIcon
  748. ),
  749. ),
  750. 'bx_if:icon' => array (
  751. 'condition' => $bIcon,
  752. 'content' => array(
  753. 'icon_url' => $sIcon,
  754. ),
  755. ),
  756. 'bx_if:no_image' => array (
  757. 'condition' => !$bImage && !$bImageRaw,
  758. 'content' => array(
  759. 'description_plain' => $aItem['description_plain'],
  760. 'strecher' => mb_strlen($aItem['description_plain']) > 240 ? '' : str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ', round((240 - mb_strlen($aItem['description_plain'])) / 6))
  761. ),
  762. ),
  763. 'bx_if:image' => array (
  764. 'condition' => $bImage,
  765. 'content' => array(
  766. 'image_url' => $sImage,
  767. 'strecher' => str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ', 40)
  768. ),
  769. ),
  770. 'bx_if:image_raw' => array (
  771. 'condition' => $bImageRaw,
  772. 'content' => array(
  773. 'image_raw' => $sImage,
  774. ),
  775. ),
  776. 'title' => $aItem['title'],
  777. 'bx_if:show_vendor' => array(
  778. 'condition' => !$bShoppingCart,
  779. 'content' => array(
  780. 'vendor_name' => $aItem['author_name'],
  781. 'vendor_url' => $aItem['author_url'],
  782. 'bx_if:show_version' => array(
  783. 'condition' => !empty($aItem['file_version']),
  784. 'content' => array(
  785. 'version' => $aItem['file_version'],
  786. )
  787. ),
  788. )
  789. ),
  790. 'bx_if:show_count_price' => array(
  791. 'condition' => $bShoppingCart,
  792. 'content' => array(
  793. 'count' => isset($aParams['counts'][$aItem['id']]) ? (int)$aParams['counts'][$aItem['id']] : 1,
  794. 'price_single' => $sPrice,
  795. 'discount_single' => $sDiscount,
  796. )
  797. ),
  798. 'bx_if:show_rate' => array(
  799. 'condition' => $bTmplVarsRate,
  800. 'content' => $aTmplVarsRate
  801. ),
  802. 'bx_if:show_votes' => array(
  803. 'condition' => $bTmplVarsVotes,
  804. 'content' => $aTmplVarsVotes
  805. ),
  806. 'bx_if:show_purchase_single' => array(
  807. 'condition' => $bPurchaseSingle && !$bInCart,
  808. 'content' => array(
  809. 'js_object' => $sJsObject,
  810. 'id' => $aItem['id'],
  811. 'vendor_id' => $aItem['author_id'],
  812. 'price_single' => _t('_adm_str_txt_price_single', $aItem['author_currency_sign'], $aItem['price_single'])
  813. )
  814. ),
  815. 'bx_if:show_checkout_single' => array(
  816. 'condition' => $bPurchaseSingle,
  817. 'content' => array(
  818. 'js_object' => $sJsObject,
  819. 'id' => $aItem['id'],
  820. 'vendor_id' => $aItem['author_id'],
  821. 'bx_if:show_as_hidden' => array(
  822. 'condition' => !$bInCart,
  823. 'content' => array()
  824. )
  825. )
  826. ),
  827. 'bx_if:show_purchase_recurring' => array(
  828. 'condition' => $bPurchaseRecurring,
  829. 'content' => array(
  830. 'js_object' => $sJsObject,
  831. 'id' => $aItem['id'],
  832. 'vendor_id' => $aItem['author_id'],
  833. 'price_recurring' => _t('_adm_str_txt_price_recurring', $aItem['author_currency_sign'], $aItem['price_recurring'], _t('_adm_str_txt_per_' . $aItem['duration_recurring'] . '_short'))
  834. )
  835. ),
  836. 'bx_if:show_download' => array(
  837. 'condition' => $bDownload && !$bQueued && !$bDownloaded,
  838. 'content' => array(
  839. 'js_object' => $sJsObject,
  840. 'file_id' => $aItem['file_id']
  841. )
  842. ),
  843. 'bx_if:show_download_disabled' => array(
  844. 'condition' => $bDownload && !$bQueued && $bDownloaded,
  845. 'content' => array()
  846. ),
  847. 'bx_if:show_queued_disabled' => array(
  848. 'condition' => $bDownload && $bQueued && !$bDownloaded,
  849. 'content' => array()
  850. ),
  851. 'bx_if:show_delete' => array(
  852. 'condition' => $bShoppingCart,
  853. 'content' => array(
  854. 'js_object' => $sJsObject,
  855. 'id' => $aItem['id'],
  856. 'vendor_id' => $aItem['author_id']
  857. )
  858. )
  859. ));
  860. }
  861. return $sResult;
  862. }
  863. protected function displayUpdates($mixedItems, $aParams = array())
  864. {
  865. if(!is_array($mixedItems))
  866. return MsgBox($mixedItems);
  867. if(empty($mixedItems))
  868. return MsgBox(_t('_Empty'));
  869. $sJsObject = $this->getPageJsObject();
  870. $oTemplate = BxDolStudioTemplate::getInstance();
  871. $sResult = '';
  872. foreach($mixedItems as $aItem) {
  873. $bDownloadable = (int)$aItem['is_file'] == 1;
  874. $bQueued = $this->oDb->isQueued('download', $aItem['name']);
  875. $sIcon = !empty($aItem['thumbnail']['big']) ? $aItem['thumbnail']['big'] : BxDolStudioUtils::getIconDefault(BX_DOL_MODULE_TYPE_MODULE);
  876. $bIcon = strpos($sIcon, '.') !== false;
  877. $sImage = !empty($aItem['cover']['big']) ? $aItem['cover']['big'] : '';
  878. $bImage = strpos($sImage, '.') !== false;
  879. $sResult .= $oTemplate->parseHtmlByName('str_update_v2.html', array(
  880. 'js_object' => $sJsObject,
  881. 'id' => $aItem['id'],
  882. 'name' => $aItem['name'],
  883. 'url' => $aItem['url'],
  884. 'bx_if:no_icon' => array (
  885. 'condition' => !$bIcon,
  886. 'content' => array(
  887. 'icon' => $sIcon
  888. ),
  889. ),
  890. 'bx_if:icon' => array (
  891. 'condition' => $bIcon,
  892. 'content' => array(
  893. 'icon_url' => $sIcon,
  894. ),
  895. ),
  896. 'bx_if:no_image' => array (
  897. 'condition' => !$bImage,
  898. 'content' => array(
  899. 'note' => $aItem['description_plain'],
  900. 'strecher' => mb_strlen($aItem['description_plain']) > 240 ? '' : str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ', round((240 - mb_strlen($aItem['description_plain'])) / 6))
  901. ),
  902. ),
  903. 'bx_if:image' => array (
  904. 'condition' => $bImage,
  905. 'content' => array(
  906. 'image_url' => $sImage,
  907. 'strecher' => str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ', 40)
  908. ),
  909. ),
  910. 'title' => $aItem['title'],
  911. 'vendor' => $aItem['author_name'],
  912. 'versions' => _t('_adm_str_txt_update_from_to', $aItem['file_version'], $aItem['file_version_to']),
  913. 'bx_if:show_download' => array(
  914. 'condition' => $bDownloadable && !$bQueued,
  915. 'content' => array(
  916. 'caption' => _t('_adm_btn_install_submit'),
  917. 'on_click' => $sJsObject . ".getUpdateAndInstall('" . $aItem['name'] . "', this)"
  918. )
  919. ),
  920. 'bx_if:show_queued_disabled' => array(
  921. 'condition' => $bDownloadable && $bQueued,
  922. 'content' => array()
  923. )
  924. ));
  925. }
  926. return $sResult;
  927. }
  928. protected function displayCategories($aCategories)
  929. {
  930. foreach($aCategories['bx_repeat:cats'] as $iKey => $aItem)
  931. $aCategories['bx_repeat:cats'][$iKey]['url'] = $this->getBaseUrl(array('page' => 'category', 'value' => $aItem['value'], 'title' => urlencode($aItem['name'])));
  932. return BxDolStudioTemplate::getInstance()->parseHtmlByName('str_lbl_categories.html', $aCategories);
  933. }
  934. protected function displayTags($aTags)
  935. {
  936. foreach($aTags['bx_repeat:units'] as $iKey => $aItem)
  937. $aTags['bx_repeat:units'][$iKey]['href'] = $this->getBaseUrl(array('page' => 'tag', 'value' => $aItem['keyword']));
  938. return BxDolStudioTemplate::getInstance()->parseHtmlByName('str_lbl_tags.html', $aTags);
  939. }
  940. protected function displayNonOwnerNotification()
  941. {
  942. if(BxDolStudioOAuth::isAuthorizedOwner())
  943. return;
  944. $oSession = BxDolSession::getInstance();
  945. if($oSession->getValue($this->sSessionKeyNonOwnerNotified) === true)
  946. return;
  947. $oSession->setValue($this->sSessionKeyNonOwnerNotified, true);
  948. return $this->getJsResultBy(array(
  949. 'message' => '_adm_msg_oauth_non_owner_logged',
  950. 'translate' => array(BX_DOL_MARKET_URL_ROOT),
  951. 'on_page_load' => true
  952. ));
  953. }
  954. private function getDownloadedModules($bNamesOnly = true)
  955. {
  956. $aModules = BxDolStudioInstallerUtils::getInstance()->getModules(false);
  957. return $bNamesOnly ? array_keys($aModules) : $aModules;
  958. }
  959. private function getVoteStars($aItem)
  960. {
  961. $aTmplVarsStars = array();
  962. for($i = (int)$aItem['rate_min']; $i <= (int)$aItem['rate_max']; $i++)
  963. $aTmplVarsStars[] = array('value' => $i);
  964. return BxDolStudioTemplate::getInstance()->parseHtmlByName('str_vote_stars.html', array(
  965. 'id' => $aItem['id'],
  966. 'value' => (float)$aItem['rate'],
  967. 'bx_repeat:stars' => $aTmplVarsStars,
  968. 'bx_repeat:slider' => $aTmplVarsStars,
  969. ));
  970. }
  971. }
  972. /** @} */