block.class.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Class Block
  5. * This file contains class used parent class for blocks plugins
  6. * Parent class for controller Blocks from dashboard plugin.
  7. *
  8. * @author Christian Fasanando <christian1827@gmail.com>
  9. *
  10. * @package chamilo.dashboard
  11. */
  12. class Block
  13. {
  14. protected $path;
  15. /**
  16. * Constructor.
  17. */
  18. public function __construct()
  19. {
  20. }
  21. /**
  22. * @return string
  23. */
  24. public function getDeleteLink(): string
  25. {
  26. global $charset;
  27. $closeLink = '<a class="btn btn-danger btn-xs" onclick="javascript:if(!confirm(\''.addslashes(
  28. api_htmlentities(
  29. get_lang('Please confirm your choice'),
  30. ENT_QUOTES,
  31. $charset
  32. )
  33. ).'\')) return false;" href="index.php?action=disable_block&path='.$this->path.'">
  34. <em class="fa fa-times"></em>
  35. </a>';
  36. return $closeLink;
  37. }
  38. /**
  39. * @param string $title
  40. * @param string $content
  41. *
  42. * @return string
  43. */
  44. public function getBlockCard($title, $content): string
  45. {
  46. $html = Display::panel(
  47. $title,
  48. $content,
  49. '',
  50. 'default',
  51. '',
  52. '',
  53. '',
  54. $this->getDeleteLink()
  55. );
  56. return $html;
  57. }
  58. }