BxBaseStudioStore.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584
  1. <?php
  2. /**
  3. * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
  4. * CC-BY License - http://creativecommons.org/licenses/by/3.0/
  5. *
  6. * @defgroup DolphinView Dolphin Studio Representation classes
  7. * @ingroup DolphinStudio
  8. * @{
  9. */
  10. defined('BX_DOL') or die('hack attempt');
  11. bx_import('BxDolStudioStore');
  12. bx_import('BxTemplStudioFunctions');
  13. class BxBaseStudioStore extends BxDolStudioStore {
  14. protected $iPerPageDefault = 24;
  15. function BxBaseStudioStore($sPage = "") {
  16. parent::BxDolStudioStore($sPage);
  17. }
  18. function getPageCss() {
  19. return array_merge(parent::getPageCss(), array('store.css', 'store-media-tablet.css', 'store-media-desktop.css'));
  20. }
  21. function getPageJs() {
  22. return array_merge(parent::getPageJs(), array('jquery.migrate.js', 'jquery.fancybox.js', 'store.js'));
  23. }
  24. function getPageJsObject() {
  25. return 'oBxDolStudioStore';
  26. }
  27. function getPageMenu($aMenu = array(), $aMarkers = array()) {
  28. $sJsObject = $this->getPageJsObject();
  29. $oTemplate = BxDolStudioTemplate::getInstance();
  30. $aMenu = array();
  31. $aMenuItems = array('goodies', 'featured', 'purchases', 'updates', 'checkout', 'downloaded');
  32. foreach($aMenuItems as $sMenuItem)
  33. $aMenu[] = array(
  34. 'name' => $sMenuItem,
  35. 'icon' => 'mi-str-' . $sMenuItem . '.png',
  36. 'link' => BX_DOL_URL_STUDIO . 'store.php?page=' . $sMenuItem,
  37. 'title' => _t('_adm_lmi_cpt_' . $sMenuItem),
  38. 'selected' => $sMenuItem == $this->sPage
  39. );
  40. bx_import('BxDolStudioCart');
  41. $iCounter = BxDolStudioCart::getInstance()->getCount();
  42. $aMarkers = array(
  43. 'checkout_counter' => $oTemplate->parseHtmlByName('menu_side_counter.html', array(
  44. 'bx_if:hide_counter' => array(
  45. 'condition' => $iCounter <= 0,
  46. 'content' => array()
  47. ),
  48. 'counter' => $iCounter
  49. ))
  50. );
  51. return parent::getPageMenu($aMenu, $aMarkers);
  52. }
  53. function getPageCode($bHidden = false) {
  54. $sMethod = 'get' . ucfirst($this->sPage) . 'List';
  55. if(!method_exists($this, $sMethod))
  56. return '';
  57. return $this->$sMethod();
  58. }
  59. function getPageContent() {
  60. $sMethod = 'get' . ucfirst($this->sPage) . 'List';
  61. if(!method_exists($this, $sMethod))
  62. return '';
  63. return $this->$sMethod(false);
  64. }
  65. protected function getGoodiesList() {
  66. $sJsObject = $this->getPageJsObject();
  67. $oTemplate = BxDolStudioTemplate::getInstance();
  68. $aProducts = $this->loadGoodies();
  69. $aTmplVars = array(
  70. 'js_object' => $sJsObject,
  71. 'bx_repeat:blocks' => array()
  72. );
  73. $sActions = "";
  74. foreach($aProducts as $aBlock) {
  75. $sItems = $oTemplate->parseHtmlByName('str_products.html', array(
  76. 'list' => $this->displayProducts($aBlock['items']),
  77. 'paginate' => ''
  78. ));
  79. $aTmplVars['bx_repeat:blocks'][] = array(
  80. 'caption' => $this->getBlockCaption($aBlock),
  81. 'items' => $sItems
  82. );
  83. }
  84. return $oTemplate->parseHtmlByName('store.html', $aTmplVars);
  85. }
  86. protected function getFeaturedList($bWrapInBlock = true) {
  87. $sJsObject = $this->getPageJsObject();
  88. $oTemplate = BxDolStudioTemplate::getInstance();
  89. $iStart = (int)bx_get('str_start');
  90. $iPerPage = (int)bx_get('str_per_page');
  91. if(empty($iPerPage))
  92. $iPerPage = $this->iPerPageDefault;
  93. $aProducts = $this->loadFeatured($iStart, $iPerPage + 1);
  94. bx_import('BxTemplPaginate');
  95. $oPaginate = new BxTemplPaginate(array(
  96. 'start' => $iStart,
  97. 'per_page' => $iPerPage,
  98. 'on_change_page' => $sJsObject . ".changePagePaginate(this, 'featured', {start}, {per_page})"
  99. ));
  100. $oPaginate->setNumFromDataArray($aProducts);
  101. $sContent = $oTemplate->parseHtmlByName('str_products.html', array(
  102. 'list' => $this->displayProducts($aProducts),
  103. 'paginate' => $oPaginate->getSimplePaginate()
  104. ));
  105. if(!$bWrapInBlock)
  106. return $sContent;
  107. return $oTemplate->parseHtmlByName('store.html', array(
  108. 'js_object' => $sJsObject,
  109. 'bx_repeat:blocks' => array(
  110. array(
  111. 'caption' => $this->getBlockCaption(array('caption' => _t('_adm_block_cpt_featured'), 'actions' => array())),
  112. 'items' => $sContent
  113. )
  114. )
  115. ));
  116. }
  117. protected function getModulesList($bWrapInBlock = true) {
  118. return $this->getTag('modules', $bWrapInBlock);
  119. }
  120. protected function getTemplatesList($bWrapInBlock = true) {
  121. return $this->getTag('templates', $bWrapInBlock);
  122. }
  123. protected function getLanguagesList($bWrapInBlock = true) {
  124. return $this->getTag('languages', $bWrapInBlock);
  125. }
  126. protected function getTag($sTag, $bWrapInBlock = true) {
  127. $sJsObject = $this->getPageJsObject();
  128. $oTemplate = BxDolStudioTemplate::getInstance();
  129. $iStart = (int)bx_get('str_start');
  130. $iPerPage = (int)bx_get('str_per_page');
  131. if(empty($iPerPage))
  132. $iPerPage = $this->iPerPageDefault;
  133. $aProducts = $this->loadTag($sTag, $iStart, $iPerPage + 1);
  134. bx_import('BxTemplPaginate');
  135. $oPaginate = new BxTemplPaginate(array(
  136. 'start' => $iStart,
  137. 'per_page' => $iPerPage,
  138. 'on_change_page' => $sJsObject . ".changePagePaginate(this, '" . $sTag . "', {start}, {per_page})"
  139. ));
  140. $oPaginate->setNumFromDataArray($aProducts);
  141. $sContent = $oTemplate->parseHtmlByName('str_products.html', array(
  142. 'list' => $this->displayProducts($aProducts),
  143. 'paginate' => $oPaginate->getSimplePaginate()
  144. ));
  145. if(!$bWrapInBlock)
  146. return $sContent;
  147. return $oTemplate->parseHtmlByName('store.html', array(
  148. 'js_object' => $sJsObject,
  149. 'bx_repeat:blocks' => array(
  150. array(
  151. 'caption' => $this->getBlockCaption(array('caption' => _t('_adm_block_cpt_' . $sTag), 'actions' => array())),
  152. 'items' => $sContent
  153. )
  154. )
  155. ));
  156. }
  157. protected function getPurchasesList() {
  158. $sJsObject = $this->getPageJsObject();
  159. $oTemplate = BxDolStudioTemplate::getInstance();
  160. $aProducts = $this->loadPurchases();
  161. $aTmplVars = array(
  162. 'js_object' => $sJsObject,
  163. 'bx_repeat:blocks' => array(
  164. array(
  165. 'caption' => $this->getBlockCaption(array('caption' => _t('_adm_block_cpt_purchases'), 'actions' => array())),
  166. 'items' => $this->displayProducts($aProducts)
  167. )
  168. )
  169. );
  170. return $oTemplate->parseHtmlByName('store.html', $aTmplVars);
  171. }
  172. protected function getUpdatesList() {
  173. $sJsObject = $this->getPageJsObject();
  174. $oTemplate = BxDolStudioTemplate::getInstance();
  175. $aUpdates = $this->loadUpdates();
  176. $aTmplVars = array(
  177. 'js_object' => $sJsObject,
  178. 'bx_repeat:blocks' => array(
  179. array(
  180. 'caption' => $this->getBlockCaption(array('caption' => _t('_adm_block_cpt_updates'), 'actions' => array())),
  181. 'items' => $this->displayUpdates($aUpdates)
  182. )
  183. )
  184. );
  185. return $oTemplate->parseHtmlByName('store.html', $aTmplVars);
  186. }
  187. protected function getCheckoutList() {
  188. $sJsObject = $this->getPageJsObject();
  189. $oTemplate = BxDolStudioTemplate::getInstance();
  190. //--- Empty cart by vendor if the payment was accepted.
  191. $mixedVendor = bx_get('vendor');
  192. $mixedProducts = bx_get('products');
  193. if($mixedVendor !== false && $mixedProducts !== false) {
  194. bx_import('BxDolStudioCart');
  195. $oCart = BxDolStudioCart::getInstance();
  196. $aProducts = explode(',', base64_decode($mixedProducts));
  197. foreach($aProducts as $iId)
  198. $oCart->delete($mixedVendor, $iId);
  199. return $this->getMessage('_adm_block_cpt_checkout', '_adm_msg_modules_success_checkouted');
  200. }
  201. $aVendors = $this->loadCheckout();
  202. $aTmplVarsBlocks = array();
  203. foreach($aVendors as $sName => $aInfo) {
  204. $fTotal = 0;
  205. $sCurrency = '';
  206. foreach($aInfo['products'] as $aProduct) {
  207. $iCount = isset($aInfo['counts'][$aProduct['id']]) ? (int)$aInfo['counts'][$aProduct['id']] : 1;
  208. $fTotal += $iCount * $aProduct['price'];
  209. if($sCurrency == '' && isset($aProduct['currency_sign']))
  210. $sCurrency = $aProduct['currency_sign'];
  211. }
  212. $aActions = array(
  213. array('name' => 'checkout-' . $sName, 'caption' => '_adm_action_cpt_checkout', 'url' => 'javascript:void(0)', 'onclick' => $sJsObject . ".checkoutCart('" . $sName . "', this);"),
  214. array('name' => 'delete-all-' . $sName, 'caption' => '_adm_action_cpt_delete_all', 'url' => 'javascript:void(0)', 'onclick' => $sJsObject . ".deleteAllFromCart('" . $sName . "', this)")
  215. );
  216. $aTmplVarsBlocks[] = array(
  217. 'caption' => $this->getBlockCaption(array('caption' => _t('_adm_block_cpt_checkout_by_vendor_csign', $sName, $sCurrency, $fTotal), 'actions' => $aActions)),
  218. 'items' => $this->displayProducts($aInfo['products'], array('is_shopping_cart' => true, 'counts' => $aInfo['counts']))
  219. );
  220. }
  221. if(empty($aTmplVarsBlocks))
  222. return $this->getMessage('_adm_block_cpt_checkout', '_Empty');
  223. return $oTemplate->parseHtmlByName('store.html', array(
  224. 'js_object' => $sJsObject,
  225. 'bx_repeat:blocks' => $aTmplVarsBlocks
  226. ));
  227. }
  228. protected function getDownloadedList() {
  229. $sJsObject = $this->getPageJsObject();
  230. $oTemplate = BxDolStudioTemplate::getInstance();
  231. $sModules = $sUpdates = "";
  232. $aProducts = $this->loadDownloaded();
  233. //--- Prepare modules.
  234. foreach($aProducts['modules'] as $aModule) {
  235. $sIcon = $oTemplate->getIconUrl($aModule['name'] . '@modules/' . $aModule['dir'] . '|std-si.png');
  236. if(empty($sIcon))
  237. $sIcon = $oTemplate->getIconUrl('si-mod-empty.png');
  238. $sModules .= $oTemplate->parseHtmlByName('str_product_v1.html', array(
  239. 'js_object' => $sJsObject,
  240. 'url' => $aModule['link_market'],
  241. 'icon' => $sIcon,
  242. 'title' => $aModule['title'],
  243. 'vendor' => $aModule['vendor'],
  244. 'version' => $aModule['version'],
  245. 'dir' => $aModule['dir'],
  246. 'bx_if:hide_install' => array(
  247. 'condition' => $aModule['installed'],
  248. 'content' => array()
  249. ),
  250. 'bx_if:hide_installed' => array(
  251. 'condition' => !$aModule['installed'],
  252. 'content' => array()
  253. )
  254. ));
  255. }
  256. //--- Prepare updates.
  257. foreach($aProducts['updates'] as $aUpdate) {
  258. $sIcon = $oTemplate->getIconUrl($aUpdate['module_name'] . '@modules/' . $aUpdate['module_dir'] . '|std-si.png');
  259. if(empty($sIcon))
  260. $sIcon = $oTemplate->getIconUrl('si-mod-empty.png');
  261. $sUpdates .= $oTemplate->parseHtmlByName('str_update_v1.html', array(
  262. 'js_object' => $sJsObject,
  263. 'url' => $aUpdate['module_link_market'],
  264. 'icon' => $sIcon,
  265. 'title' => $aUpdate['title'],
  266. 'vendor' => $aUpdate['vendor'],
  267. 'versions' => _t('_adm_str_txt_update_from_to', $aUpdate['version_from'], $aUpdate['version_to']),
  268. 'dir' => $aUpdate['dir']
  269. ));
  270. }
  271. $aTmplVars = array(
  272. 'js_object' => $sJsObject,
  273. 'bx_repeat:blocks' => array(
  274. array(
  275. 'caption' => $this->getBlockCaption(array('caption' => _t('_adm_block_cpt_downloaded_modules'), 'actions' => array())),
  276. 'items' => $sModules
  277. )
  278. )
  279. );
  280. if(!empty($sUpdates))
  281. $aTmplVars['bx_repeat:blocks'][] = array(
  282. 'caption' => $this->getBlockCaption(array('caption' => _t('_adm_block_cpt_downloaded_updates'), 'actions' => array())),
  283. 'items' => $sUpdates
  284. );
  285. return $oTemplate->parseHtmlByName('store.html', $aTmplVars);
  286. }
  287. protected function getMessage($sCaption, $sContent, $aActions = array()) {
  288. $sJsObject = $this->getPageJsObject();
  289. $oTemplate = BxDolStudioTemplate::getInstance();
  290. return $oTemplate->parseHtmlByName('store.html', array(
  291. 'js_object' => $sJsObject,
  292. 'bx_repeat:blocks' => array(
  293. array(
  294. 'caption' => $this->getBlockCaption(array('caption' => _t($sCaption), 'actions' => $aActions)),
  295. 'items' => MsgBox(_t($sContent))
  296. )
  297. )
  298. ));
  299. }
  300. protected function getProduct($iId) {
  301. $sJsObject = $this->getPageJsObject();
  302. $oTemplate = BxDolStudioTemplate::getInstance();
  303. $aProduct = $this->loadProduct($iId);
  304. if(!is_array($aProduct))
  305. return array('code' => 1, 'message' => (!empty($aProduct) ? $aProduct : _t('_adm_str_err_no_product_info')));
  306. $bFree = (int)$aProduct['is_free'] == 1;
  307. $bPurchased = (int)$aProduct['is_purchased'] == 1;
  308. $bDownloadable = (int)$aProduct['is_file'] == 1;
  309. $bDiscount = !empty($aProduct['discount']);
  310. $bScreenshots = is_array($aProduct['screenshots']) && !empty($aProduct['screenshots']);
  311. $iScreenshots = 0;
  312. $aScreenshots = array();
  313. if($bScreenshots) {
  314. $iScreenshots = count($aProduct['screenshots']);
  315. foreach($aProduct['screenshots'] as $aScreenshot)
  316. $aScreenshots[] = array(
  317. 'view_url' => $aProduct['url'],
  318. 'image_url' => $aScreenshot['big']
  319. );
  320. }
  321. $sContent = $oTemplate->parseHtmlByname('str_product_view.html', array(
  322. 'id' => $aProduct['id'],
  323. 'title' => $aProduct['title'],
  324. 'url' => $aProduct['url'],
  325. 'author_name' => $aProduct['author_name'],
  326. 'author_url' => $aProduct['author_url'],
  327. 'version' => $aProduct['version'],
  328. 'price' => !$bFree ? _t('_adm_str_txt_price_csign', $aProduct['author_currency_sign'], $aProduct['price']) : _t('_adm_str_txt_price_free'),
  329. 'bx_if:show_discount' => array(
  330. 'condition' => !$bFree && $bDiscount,
  331. 'content' => array(
  332. 'discount' => $bDiscount ? _t('_adm_str_txt_pv_discount_off_csign', $aProduct['discount']['percent'], $aProduct['author_currency_sign'], $aProduct['discount']['save']) : ''
  333. )
  334. ),
  335. 'category' => $aProduct['category'],
  336. 'category_url' => $aProduct['category_url'],
  337. 'tags' => implode(', ', explode(',', $aProduct['tags'])),
  338. 'reviews' => _t('_adm_str_txt_pv_stats_reviews', $aProduct['reviews_cnt']),
  339. 'reviews_url' => $aProduct['reviews_url'],
  340. 'likes' => _t('_adm_str_txt_pv_stats_likes', $aProduct['likes_cnt']),
  341. 'views' => _t('_adm_str_txt_pv_stats_views', $aProduct['views_cnt']),
  342. 'created' => $aProduct['created'],
  343. 'updated' => $aProduct['updated'],
  344. 'description' => $aProduct['description'],
  345. 'bx_if:show_screenshots' => array(
  346. 'condition' => $bScreenshots,
  347. 'content' => array(
  348. 'width' => 222 * $iScreenshots - 20,
  349. 'bx_repeat:screenshots' => $aScreenshots
  350. )
  351. ),
  352. 'bx_if:show_purchase' => array(
  353. 'condition' => !$bFree && !$bPurchased,
  354. 'content' => array(
  355. 'js_object' => $sJsObject,
  356. 'id' => $aProduct['id'],
  357. 'vendor' => $aProduct['author_name'],
  358. )
  359. ),
  360. 'bx_if:show_download' => array(
  361. 'condition' => ($bFree || $bPurchased) && $bDownloadable,
  362. 'content' => array(
  363. 'js_object' => $sJsObject,
  364. 'id' => $aProduct['id'],
  365. 'file_id' => $aProduct['file_id'],
  366. )
  367. )
  368. ));
  369. return array('code' => 0, 'message' => '', 'popup' => PopupBox('bx-std-str-popup-product', $aProduct['title'], $sContent, true), 'screenshots' => $iScreenshots);
  370. }
  371. /*
  372. * NOTE. Is needed for download popup selector. Isn't used for now.
  373. */
  374. protected function getFiles($iId, $sType) {
  375. $sJsObject = $this->getPageJsObject();
  376. $oTemplate = BxDolStudioTemplate::getInstance();
  377. $aFiles = $this->loadFiles($iId, $sType);
  378. if(!is_array($aFiles))
  379. return array('code' => 1, 'message' => (!empty($aFiles) ? $aFiles : _t('_adm_str_err_no_files')));
  380. $aTmplVarsFiles = array();
  381. foreach($aFiles as $aFile)
  382. $aTmplVarsFiles[] = array(
  383. 'js_object' => $sJsObject,
  384. 'product_id' => $iId,
  385. 'id' => $aFile['id'],
  386. 'title' => $aFile['name'],
  387. 'version' => empty($aFile['version_to']) ? $aFile['version'] : _t('_adm_str_txt_update_from_to', $aFile['version'], $aFile['version_to']),
  388. );
  389. $sContent = $oTemplate->parseHtmlByName('str_files.html', array(
  390. 'bx_repeat:files' => $aTmplVarsFiles
  391. ));
  392. return array('code' => 0, 'message' => $sContent);
  393. }
  394. protected function getFile($iId) {
  395. $mixedResult = $this->loadFile($iId);
  396. if($mixedResult !== true)
  397. return array('code' => 1, 'message' => (!empty($mixedResult) ? $mixedResult : _t('_adm_str_err_download_failed')));
  398. return array('code' => 0, 'message' => _t('_adm_str_msg_download_successfully'));
  399. }
  400. protected function displayProducts($aItems, $aParams = array()) {
  401. if(!is_array($aItems))
  402. return $aItems;
  403. $sJsObject = $this->getPageJsObject();
  404. $oTemplate = BxDolStudioTemplate::getInstance();
  405. $bShoppingCart = isset($aParams['is_shopping_cart']) && $aParams['is_shopping_cart'];
  406. $sResult = '';
  407. foreach($aItems as $aItem) {
  408. $bFree = (int)$aItem['is_free'] == 1;
  409. $bPurchased = (int)$aItem['is_purchased'] == 1;
  410. $bDownloadable = (int)$aItem['is_file'] == 1;
  411. $sPrice = !$bFree ? _t('_adm_str_txt_price_csign', $aItem['currency_sign'], $aItem['price']) : _t('_adm_str_txt_price_free');
  412. $sDiscount = !$bFree && !empty($aItem['discount']) ? _t('_adm_str_txt_discount_csign', $aItem['currency_sign'], $aItem['discount']['price']) : '';
  413. $sResult .= $oTemplate->parseHtmlByName('str_product_v2.html', array(
  414. 'js_object' => $sJsObject,
  415. 'id' => $aItem['id'],
  416. 'url' => $aItem['url'],
  417. 'icon' => !empty($aItem['thumbnail']['big']) ? $aItem['thumbnail']['big'] : $oTemplate->getIconUrl('si-mod-empty.png'),
  418. 'title' => $aItem['title'],
  419. 'bx_if:show_vendor_price' => array(
  420. 'condition' => !$bShoppingCart,
  421. 'content' => array(
  422. 'vendor' => $aItem['author'],
  423. 'price' => $sPrice,
  424. 'discount' => $sDiscount,
  425. )
  426. ),
  427. 'bx_if:show_count_price' => array(
  428. 'condition' => $bShoppingCart,
  429. 'content' => array(
  430. 'count' => isset($aParams['counts'][$aItem['id']]) ? (int)$aParams['counts'][$aItem['id']] : 1,
  431. 'price' => $sPrice,
  432. 'discount' => $sDiscount,
  433. )
  434. ),
  435. 'bx_if:show_purchase' => array(
  436. 'condition' => !$bShoppingCart && !$bFree && !$bPurchased,
  437. 'content' => array(
  438. 'js_object' => $sJsObject,
  439. 'id' => $aItem['id'],
  440. 'vendor' => $aItem['author']
  441. )
  442. ),
  443. 'bx_if:show_download' => array(
  444. 'condition' => !$bShoppingCart && ($bFree || $bPurchased) && $bDownloadable,
  445. 'content' => array(
  446. 'js_object' => $sJsObject,
  447. 'id' => $aItem['id'],
  448. 'file_id' => $aItem['file_id'],
  449. )
  450. ),
  451. 'bx_if:show_delete' => array(
  452. 'condition' => $bShoppingCart,
  453. 'content' => array(
  454. 'js_object' => $sJsObject,
  455. 'id' => $aItem['id'],
  456. 'vendor' => $aItem['author']
  457. )
  458. )
  459. ));
  460. }
  461. return $sResult;
  462. }
  463. protected function displayUpdates($aItems, $aParams = array()) {
  464. if(!is_array($aItems))
  465. return $aItems;
  466. $sJsObject = $this->getPageJsObject();
  467. $oTemplate = BxDolStudioTemplate::getInstance();
  468. $sResult = '';
  469. foreach($aItems as $aItem) {
  470. $bDownloadable = (int)$aItem['is_file'] == 1;
  471. $sResult .= $oTemplate->parseHtmlByName('str_update_v2.html', array(
  472. 'js_object' => $sJsObject,
  473. 'id' => $aItem['id'],
  474. 'url' => $aItem['url'],
  475. 'icon' => !empty($aItem['thumbnail']['big']) ? $aItem['thumbnail']['big'] : $oTemplate->getIconUrl('si-mod-empty.png'),
  476. 'title' => $aItem['title'],
  477. 'vendor' => $aItem['author'],
  478. 'versions' => _t('_adm_str_txt_update_from_to', $aItem['file_version'], $aItem['file_version_to']),
  479. 'bx_if:show_download' => array(
  480. 'condition' => $bDownloadable,
  481. 'content' => array(
  482. 'js_object' => $sJsObject,
  483. 'id' => $aItem['id'],
  484. 'file_id' => $aItem['file_id'],
  485. )
  486. )
  487. ));
  488. }
  489. return $sResult;
  490. }
  491. }
  492. /** @} */