BxDolService.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * @package Dolphin Core
  4. * @copyright Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
  5. * @license CC-BY - http://creativecommons.org/licenses/by/3.0/
  6. */
  7. defined('BX_DOL') or die('hack attempt');
  8. bx_import('BxDolRequest');
  9. /**
  10. * Service calls to modules' methods.
  11. *
  12. * The class has one static method is needed to make service calls
  13. * to module's methods from the Dolphin's core or the other modules.
  14. *
  15. *
  16. * Example of usage:
  17. * @code
  18. * BxDolService::call('payment', 'get_add_to_cart_link', array($iVendorId, $mixedModuleId, $iItemId, $iItemCount));
  19. * @endcode
  20. *
  21. *
  22. * Memberships/ACL:
  23. * Doesn't depend on user's membership.
  24. *
  25. *
  26. * Alerts:
  27. * no alerts available
  28. *
  29. */
  30. class BxDolService extends BxDol {
  31. function BxDolService () {
  32. parent::BxDol();
  33. }
  34. public static function call($mixed, $sMethod, $aParams = array(), $sClass = 'Module') {
  35. bx_import('BxDolModuleQuery');
  36. $oDb = BxDolModuleQuery::getInstance();
  37. $aModule = array();
  38. if(is_string($mixed))
  39. $aModule = $oDb->getModuleByName($mixed);
  40. else
  41. $aModule = $oDb->getModuleById($mixed);
  42. return empty($aModule) ? '' : BxDolRequest::processAsService($aModule, $sMethod, $aParams, $sClass);
  43. }
  44. }