BxAccntSearchResult.php 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 Accounts Accounts
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxAccntSearchResult extends BxBaseModGeneralSearchResult
  12. {
  13. function __construct($sMode = '', $aParams = false)
  14. {
  15. parent::__construct($sMode, $aParams);
  16. $aConfirmed = array();
  17. $aUnConfirmed = array();
  18. $sCnfnType = getParam('sys_account_confirmation_type');
  19. switch($sCnfnType) {
  20. case 'email':
  21. $aConfirmed = array('value' => '', 'field' => 'email_confirmed', 'operator' => '=');
  22. $aUnConfirmed = array('value' => '', 'field' => 'email_confirmed', 'operator' => '<>');
  23. break;
  24. case 'phone':
  25. $aConfirmed = array('value' => '', 'field' => 'phone_confirmed', 'operator' => '=');
  26. $aUnConfirmed = array('value' => '', 'field' => 'phone_confirmed', 'operator' => '<>');
  27. break;
  28. case 'email_and_phone':
  29. $aConfirmed = array('value' => '', 'field' => 'phone_confirmed` * `email_confirmed', 'operator' => '=');
  30. $aUnConfirmed = array('value' => '', 'field' => 'phone_confirmed` * `email_confirmed', 'operator' => '<>');
  31. break;
  32. }
  33. $this->aCurrent = array(
  34. 'name' => 'bx_accounts',
  35. 'module_name' => 'bx_accounts',
  36. 'object_metatags' => '',
  37. 'title' => _t('_bx_accnt_page_title_browse'),
  38. 'table' => 'sys_accounts',
  39. 'tableSearch' => 'sys_accounts',
  40. 'ownFields' => array(),
  41. 'searchFields' => array('name', 'email'),
  42. 'restriction' => array(
  43. 'confirmed' => $aConfirmed,
  44. 'unconfirmed' => $aUnConfirmed,
  45. 'non_robot' => array('value' => '', 'field' => 'name', 'operator' => '<>'),
  46. ),
  47. 'join' => array (),
  48. 'paginate' => array('perPage' => 20, 'start' => 0),
  49. 'sorting' => 'none',
  50. 'rss' => array(
  51. 'title' => '',
  52. 'link' => '',
  53. 'image' => '',
  54. 'profile' => 0,
  55. 'fields' => array (
  56. 'Guid' => 'link',
  57. 'Link' => 'link',
  58. 'Title' => 'fullname',
  59. 'DateTimeUTS' => 'added',
  60. 'Desc' => 'fullname',
  61. 'Picture' => 'picture',
  62. ),
  63. ),
  64. 'ident' => 'id'
  65. );
  66. $this->sFilterName = 'bx_accounts_filter';
  67. $this->oModule = $this->getMain();
  68. switch ($sMode) {
  69. case '': // search results
  70. $this->sBrowseUrl = BX_DOL_SEARCH_KEYWORD_PAGE;
  71. $this->aCurrent['title'] = _t('_bx_accnt');
  72. unset($this->aCurrent['paginate']['perPage'], $this->aCurrent['rss']);
  73. break;
  74. default:
  75. $this->isError = true;
  76. }
  77. parent::__construct();
  78. }
  79. }
  80. /** @} */