PageRenderTime 40ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/WidgetController.php

https://bitbucket.org/ttphong2612/billigastamplar-new.se
PHP | 80 lines | 33 code | 8 blank | 39 comment | 1 complexity | ccacb960146224f12e3439fb8d97a1f1 MD5 | raw file
  1. <?php
  2. /**
  3. * Magento
  4. *
  5. * NOTICE OF LICENSE
  6. *
  7. * This source file is subject to the Open Software License (OSL 3.0)
  8. * that is bundled with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://opensource.org/licenses/osl-3.0.php
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@magento.com so we can send you a copy immediately.
  14. *
  15. * DISCLAIMER
  16. *
  17. * Do not edit or add to this file if you wish to upgrade Magento to newer
  18. * versions in the future. If you wish to customize Magento for your
  19. * needs please refer to http://www.magento.com for more information.
  20. *
  21. * @category Mage
  22. * @package Mage_Adminhtml
  23. * @copyright Copyright (c) 2006-2018 Magento, Inc. (http://www.magento.com)
  24. * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
  25. */
  26. /**
  27. * Catalog Product widgets controller for CMS WYSIWYG
  28. *
  29. * @category Mage
  30. * @package Mage_Adminhtml
  31. * @author Magento Core Team <core@magentocommerce.com>
  32. */
  33. class Mage_Adminhtml_Catalog_Product_WidgetController extends Mage_Adminhtml_Controller_Action
  34. {
  35. /**
  36. * Chooser Source action
  37. */
  38. public function chooserAction()
  39. {
  40. $uniqId = $this->getRequest()->getParam('uniq_id');
  41. $massAction = $this->getRequest()->getParam('use_massaction', false);
  42. $productTypeId = $this->getRequest()->getParam('product_type_id', null);
  43. $productsGrid = $this->getLayout()->createBlock('adminhtml/catalog_product_widget_chooser', '', array(
  44. 'id' => $uniqId,
  45. 'use_massaction' => $massAction,
  46. 'product_type_id' => $productTypeId,
  47. 'category_id' => $this->getRequest()->getParam('category_id')
  48. ));
  49. $html = $productsGrid->toHtml();
  50. if (!$this->getRequest()->getParam('products_grid')) {
  51. $categoriesTree = $this->getLayout()->createBlock('adminhtml/catalog_category_widget_chooser', '', array(
  52. 'id' => $uniqId.'Tree',
  53. 'node_click_listener' => $productsGrid->getCategoryClickListenerJs(),
  54. 'with_empty_node' => true
  55. ));
  56. $html = $this->getLayout()->createBlock('adminhtml/catalog_product_widget_chooser_container')
  57. ->setTreeHtml($categoriesTree->toHtml())
  58. ->setGridHtml($html)
  59. ->toHtml();
  60. }
  61. $this->getResponse()->setBody($html);
  62. }
  63. /**
  64. * Check is allowed access to action
  65. *
  66. * @return bool
  67. */
  68. protected function _isAllowed()
  69. {
  70. return Mage::getSingleton('admin/session')->isAllowed('cms/widget_instance');
  71. }
  72. }