Status.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. Lib::loadClass('RouteBase');
  3. Lib::loadClass('UI');
  4. class Route_Status extends RouteBase {
  5. public function defaultAction() {
  6. UI::gora();
  7. $_ = array(UI, 'h');
  8. UI::startTag('div', ['class' => "container"]);
  9. echo $_('h1', [], [
  10. $_('a', ['href'=>"index.php"], "SE"),
  11. " &raquo; ",
  12. " Status systemu procesy5"
  13. ]);
  14. try {
  15. DB::getPDO();
  16. if (1 == V::get('event_sheduler_on', '', $_POST)) {
  17. $this->fixEventSheduler();
  18. }
  19. $dbEvents = DB::getPDO()->fetchFirst(" SHOW VARIABLES WHERE VARIABLE_NAME = 'event_scheduler' ");
  20. // DBG::nicePrint($dbEvents, '$dbEvents');
  21. // [Variable_name] => event_scheduler
  22. // [Value] => ON
  23. UI::table([
  24. 'caption' => 'Baza danych',
  25. 'rows' => [
  26. [
  27. 'nazwa' => 'Event Scheduler (generowanie Grafika, itp.)',
  28. 'wartość' => ('ON' == $dbEvents['Value'])
  29. ? $_('span', ['class' => "label label-success"], "ON")
  30. : $_('span', ['class' => "label label-danger"], "OFF"),
  31. '#' => UI::hButtonPost("Włącz", [
  32. 'class' => "btn btn-xs btn-default",
  33. 'data' => [
  34. 'event_sheduler_on' => 1
  35. ]
  36. ])
  37. ]
  38. ]
  39. ]);
  40. // UI::table([
  41. // 'caption' => 'Baza danych',
  42. // 'rows' => DB::getPDO()->fetchAll(" SHOW VARIABLES ")
  43. // ]);
  44. } catch (Exception $e) {
  45. UI::alert('danger', $e->getMessage());
  46. }
  47. UI::endTag('div');// .container
  48. UI::dol();
  49. }
  50. public function fixEventSheduler() {
  51. DB::getPDO()->execSql(" SET GLOBAL event_scheduler='ON' ");
  52. }
  53. }