BxGitHubDb.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup GitHub GitHub
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxGitHubDb extends BxDolModuleDb
  12. {
  13. protected $_oConfig;
  14. public function __construct(&$oConfig)
  15. {
  16. parent::__construct($oConfig);
  17. $this->_oConfig = $oConfig;
  18. }
  19. public function getSettings($aParams = [])
  20. {
  21. $CNF = &$this->_oConfig->CNF;
  22. $aMethod = ['name' => 'getAll', 'params' => [0 => 'query']];
  23. $sSelectClause = "*";
  24. $sWhereClause = $sOrderByClause = "";
  25. switch($aParams['sample']) {
  26. case 'id':
  27. $aMethod['name'] = 'getRow';
  28. $aMethod['params'][1] = [
  29. 'id' => $aParams['id']
  30. ];
  31. $sWhereClause .= " AND `id`=:id";
  32. break;
  33. case 'profile_id':
  34. $aMethod['name'] = 'getRow';
  35. $aMethod['params'][1] = [
  36. 'profile_id' => $aParams['profile_id']
  37. ];
  38. $sWhereClause .= " AND `profile_id`=:profile_id";
  39. break;
  40. }
  41. $aMethod['params'][0] = "SELECT " . $sSelectClause . " FROM `" . $CNF['TABLE_SETTINGS'] . "` WHERE 1 " . $sWhereClause;
  42. return call_user_func_array([$this, $aMethod['name']], $aMethod['params']);
  43. }
  44. }
  45. /** @} */