Module.php 1008 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php declare(strict_types = 0);
  2. /*
  3. ** WeCom Center - a portable, multi-language Zabbix frontend module.
  4. ** Adds an administration page for alert optimization, WeCom robot/key/media
  5. ** configuration, template import and map coordinate adjustment.
  6. */
  7. namespace Modules\WecomCenter;
  8. use Zabbix\Core\CModule;
  9. use APP;
  10. use CMenuItem;
  11. use CView;
  12. use Modules\WecomCenter\Lib\I18n;
  13. class Module extends CModule {
  14. public function init(): void {
  15. // Register this module's own view directory so CView can find:
  16. // modules/WecomCenter/views/wecom.center.view.php
  17. CView::registerDirectory($this->getRelativePath().'/views');
  18. // Load translations for the current language (falls back to English).
  19. I18n::init($this->getRelativePath().'/locale');
  20. // Add "WeCom Center" as a submenu item under Administration.
  21. APP::Component()->get('menu.main')
  22. ->findOrAdd(_('Administration'))
  23. ->getSubMenu()
  24. ->add(
  25. (new CMenuItem(I18n::t('menu.title')))
  26. ->setAction('wecom.center.view')
  27. );
  28. }
  29. }