BxBaseModGroupsFormEntry.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 BaseGroups Base classes for groups modules
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. /**
  12. * Create/Edit Group Form.
  13. */
  14. class BxBaseModGroupsFormEntry extends BxBaseModProfileFormEntry
  15. {
  16. public function __construct($aInfo, $oTemplate = false)
  17. {
  18. parent::__construct($aInfo, $oTemplate);
  19. $CNF = &$this->_oModule->_oConfig->CNF;
  20. if (isset($this->aInputs['initial_members']) && !isset($this->aInputs['initial_members']['value'])) {
  21. $this->aInputs['initial_members']['value'] = isset($CNF['OBJECT_FORM_ENTRY_DISPLAY_INVITE']) && $CNF['OBJECT_FORM_ENTRY_DISPLAY_INVITE'] == $this->aParams['display'] ? array() : array(bx_get_logged_profile_id());
  22. }
  23. }
  24. protected function genCustomInputInitialMembers ($aInput)
  25. {
  26. $aInput['ajax_get_suggestions'] = BX_DOL_URL_ROOT . "modules/?r=" . $this->_oModule->_oConfig->getUri() . "/ajax_get_initial_members";
  27. return $this->genCustomInputUsernamesSuggestions($aInput);
  28. }
  29. protected function _isAdmin ($iContentId = 0)
  30. {
  31. if (parent::_isAdmin ($iContentId))
  32. return true;
  33. if (!$iContentId || !($aDataEntry = $this->_oModule->_oDb->getContentInfoById((int)$iContentId)))
  34. return false;
  35. return CHECK_ACTION_RESULT_ALLOWED == $this->_oModule->checkAllowedEdit ($aDataEntry);
  36. }
  37. }
  38. /** @} */