BxCoursesPageEntry.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 Courses Courses
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. /**
  12. * Profile create/edit/delete pages.
  13. */
  14. class BxCoursesPageEntry extends BxBaseModGroupsPageEntry
  15. {
  16. public function __construct($aObject, $oTemplate = false)
  17. {
  18. $this->MODULE = 'bx_courses';
  19. parent::__construct($aObject, $oTemplate);
  20. $CNF = &$this->_oModule->_oConfig->CNF;
  21. $bLoggedOwner = isset($this->_aContentInfo[$CNF['FIELD_AUTHOR']]) && $this->_aContentInfo[$CNF['FIELD_AUTHOR']] == bx_get_logged_profile_id();
  22. $bLoggedModerator = $this->_oModule->checkAllowedEditAnyEntry() === CHECK_ACTION_RESULT_ALLOWED;
  23. if(($oInformer = BxDolInformer::getInstance($this->_oTemplate)) && ($bLoggedOwner || $bLoggedModerator)) {
  24. $aInformers = [];
  25. if($aInformers)
  26. foreach($aInformers as $aInformer)
  27. $oInformer->add($aInformer['name'], $this->_replaceMarkers($aInformer['msg']), $aInformer['type']);
  28. }
  29. }
  30. public function getCode ()
  31. {
  32. $sResult = parent::getCode();
  33. if(!empty($sResult))
  34. $sResult .= $this->_oModule->_oTemplate->getJsCode('entry');
  35. $this->_oModule->_oTemplate->addJs(['modules/base/groups/js/|entry.js', 'entry.js']);
  36. return $sResult;
  37. }
  38. }
  39. /** @} */