PageRenderTime 48ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/concreteOLD/tools/marketplace/refresh_block.php

https://bitbucket.org/selfeky/xclusivescardwebsite
PHP | 69 lines | 59 code | 9 blank | 1 comment | 13 complexity | eb24f6ea0ffb65b995a6c40f398c796d MD5 | raw file
  1. <?php defined('C5_EXECUTE') or die("Access Denied.");
  2. $ch = Loader::helper('concrete/interface');
  3. //marketplace
  4. $tp = new TaskPermission();
  5. if(ENABLE_MARKETPLACE_SUPPORT && $tp->canInstallPackages()){
  6. Loader::model('marketplace_remote_item');
  7. $mri = new MarketplaceRemoteItemList();
  8. $mri->filterByIsFeaturedRemotely(1);
  9. $mri->setIncludeInstalledItems(true);
  10. $mri->setType('addons');
  11. $mri->execute();
  12. $marketplaceBlockTypes = $mri->getPage();
  13. }else{
  14. $marketplaceBlockTypes=array();
  15. }
  16. ?>
  17. <script type="text/javascript">
  18. ccm_marketplaceRefreshInstalledBlockTypes = function() {
  19. jQuery.fn.dialog.closeTop();
  20. setTimeout(function() {
  21. <?php if ($_REQUEST['arHandle']) { ?>
  22. ccm_openAreaAddBlock('<?php echo $_REQUEST['arHandle']?>');
  23. <?php } ?>
  24. }, 500);
  25. jQuery.fn.dialog.closeTop();
  26. }
  27. </script>
  28. <?php if (count($marketplaceBlockTypes) > 0) { ?>
  29. <table class="ccm-block-type-table">
  30. <?php foreach($marketplaceBlockTypes as $bt) {
  31. $btIcon = $bt->getRemoteListIconURL();
  32. if ($bt->purchaseRequired()) {
  33. $btButton = t("Purchase");
  34. } else {
  35. $btButton = t("Download");
  36. }
  37. $btClass = "";
  38. $btDesc = $bt->getDescription();
  39. ?>
  40. <tr class="ccm-block-type-row">
  41. <td<?php echo !empty($btDesc)?' valign="top"':''?>><img src="<?php echo $btIcon?>" /></td>
  42. <td><div style="width: 7px">&nbsp;</td>
  43. <td width="90%">
  44. <div class="ccm-block-type-inner" style="border: 0px"><?php echo $bt->getName()?></div>
  45. <?php if (!empty($btDesc)) { ?>
  46. <div class="ccm-block-type-description" id="ccm-bt-help<?php echo $bt->getHandle()?>"><?php echo $btDesc?></div>
  47. <?php } ?>
  48. </td>
  49. <td><div class="ccm-block-price"><?php if ($bt->getPrice() == '0.00') { print t('Free'); } else { print '$' . $bt->getPrice(); } ?></div></td>
  50. <?php if (!$bt->purchaseRequired()) { ?>
  51. <td<?php echo $btClass?>><?php echo $ch->button_js($btButton, 'ccm_getMarketplaceItem({mpID: \'' . $bt->getMarketplaceItemID() . '\', onComplete: function() {ccm_marketplaceRefreshInstalledBlockTypes()}})', "right", NULL);?></td>
  52. <?php } else { ?>
  53. <td<?php echo $btClass?>><?php echo $ch->button_js($btButton, 'window.open(\'' . $bt->getRemoteURL() . '\')', "right", NULL);?></td>
  54. <?php } ?>
  55. </tr>
  56. <?php } ?>
  57. </table>
  58. <?php } else { ?>
  59. <p><?php echo t('Unable to connect to the marketplace.')?></p>
  60. <?php } ?>