BxBaseStudioAudit.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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 UnaView UNA Studio Representation classes
  7. * @ingroup UnaStudio
  8. * @{
  9. */
  10. class BxBaseStudioAudit extends BxDolStudioAudit
  11. {
  12. protected $sSubpageUrl;
  13. protected $aMenuItems;
  14. protected $aGridObjects;
  15. function __construct($sPage = '')
  16. {
  17. parent::__construct($sPage);
  18. $this->sSubpageUrl = BX_DOL_URL_STUDIO . 'audit.php?page=';
  19. $this->aMenuItems = array(
  20. BX_DOL_STUDIO_AUD_TYPE_GENERAL => array('icon' => 'search'),
  21. BX_DOL_STUDIO_AUD_TYPE_SETTINGS => array('icon' => 'cogs'),
  22. );
  23. }
  24. function getPageCss()
  25. {
  26. return array_merge(parent::getPageCss(), array('forms.css', 'paginate.css'));
  27. }
  28. function getPageJs()
  29. {
  30. return array_merge(parent::getPageJs(), array('settings.js'));
  31. }
  32. function getPageJsCode($aOptions = array(), $bWrap = true)
  33. {
  34. $aOptions = array_merge($aOptions, array(
  35. 'sActionUrl' => BX_DOL_URL_STUDIO . 'audit.php'
  36. ));
  37. return parent::getPageJsCode($aOptions, $bWrap);
  38. }
  39. function getPageMenu($aMenu = array(), $aMarkers = array())
  40. {
  41. $sJsObject = $this->getPageJsObject();
  42. $aMenu = array();
  43. foreach($this->aMenuItems as $sMenuItem => $aItem)
  44. $aMenu[] = array(
  45. 'name' => $sMenuItem,
  46. 'icon' => $aItem['icon'],
  47. 'link' => $this->sSubpageUrl . $sMenuItem,
  48. 'title' => _t('_adm_lmi_cpt_' . $sMenuItem),
  49. 'selected' => $sMenuItem == $this->sPage
  50. );
  51. return parent::getPageMenu($aMenu);
  52. }
  53. function getPageCode()
  54. {
  55. $sResult = parent::getPageCode();
  56. if($sResult === false)
  57. return false;
  58. $sMethod = 'get' . bx_gen_method_name($this->sPage);
  59. if(!method_exists($this, $sMethod))
  60. return '';
  61. return $sResult . $this->$sMethod();
  62. }
  63. protected function getGeneral()
  64. {
  65. return $this->getGrid();
  66. }
  67. protected function getSettings()
  68. {
  69. $oPage = new BxTemplStudioSettings(BX_DOL_STUDIO_STG_TYPE_SYSTEM, BX_DOL_STUDIO_STG_CATEGORY_AUDIT);
  70. return BxDolStudioTemplate::getInstance()->parseHtmlByName('audit.html', array(
  71. 'content' => $oPage->getFormCode(),
  72. 'js_content' => ''
  73. ));
  74. }
  75. protected function getGrid()
  76. {
  77. $oGrid = BxDolGrid::getObjectInstance('sys_audit_administration');
  78. if(!$oGrid)
  79. return '';
  80. $oTemplate = BxDolStudioTemplate::getInstance();
  81. $oTemplate->addJs(array('BxDolAuditManageTools.js', 'BxDolGrid.js', 'jquery.form.min.js', 'jquery-ui/jquery-ui.custom.min.js' , 'jquery-ui/jquery.ui.sortable.min.js'));
  82. //$oForm = new BxTemplStudioFormView(array());
  83. $oTemplate->addCss('grid.css');
  84. $oTemplate->addJsTranslation(array('_sys_grid_search'));
  85. return BxDolStudioTemplate::getInstance()->parseHtmlByName('audit.html', array(
  86. 'content' => $this->getBlockCode(array(
  87. 'items' =>$oGrid->getCode()
  88. )),
  89. 'js_content' => ''
  90. ));
  91. }
  92. }
  93. /** @} */