PageRenderTime 50ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/app/code/community/Devinc/Groupdeals/controllers/Adminhtml/Groupdeals/WidgetController.php

https://bitbucket.org/acidel/buykoala
PHP | 70 lines | 29 code | 7 blank | 34 comment | 1 complexity | b3b91d4cbf1333a0b15f6973a15e2dd0 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@magentocommerce.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.magentocommerce.com for more information.
  20. *
  21. * @category Mage
  22. * @package Mage_Adminhtml
  23. * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.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 Devinc_Groupdeals_Adminhtml_Groupdeals_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. }