editcollectconf.html.php 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <style>
  2. #module_chosen {width: 50%!important}
  3. </style>
  4. <tr>
  5. <th class='thWidth'><?php echo $lang->measurement->collectType;?></th>
  6. <td class='w-400px'>
  7. <?php echo html::select('collectType', $lang->measurement->collectTypeList, $measurement->collectType, "class='form-control chosen'");?>
  8. </td><td></td>
  9. </tr>
  10. <tr class='actionConfig <?php if($measurement->collectType == 'crontab') echo "hidden";?>'>
  11. <th><?php echo $lang->measurement->actionConfig;?></th>
  12. <td>
  13. <?php $collectAction = isset($measurement->collectConf->action) ? $measurement->collectConf->action : '';?>
  14. <?php echo html::select('action', $triggerOptions, $collectAction, "class='form-control chosen'");?>
  15. </td>
  16. </tr>
  17. <?php
  18. $weekTabActive = '';
  19. $monthTabActive = '';
  20. if($measurement->collectType == 'crontab')
  21. {
  22. $weekTabActive = zget($measurement->collectConf, 'type', '') == 'week' ? 'active' : '';
  23. $monthTabActive = zget($measurement->collectConf, 'type', '') == 'month' ? 'active' : '';
  24. }
  25. ?>
  26. <tr class='cycleConfig'>
  27. <th><?php echo $lang->measurement->cycleConfig;?></th>
  28. <td colspan='2'>
  29. <ul class="nav nav-tabs">
  30. <li class='<?php echo $weekTabActive?>'><a data-tab data-type='week' href="#week"><?php echo $lang->measurement->cycleWeek;?></a></li>
  31. <li class='<?php echo $monthTabActive?>'><a data-tab data-type='month' href="#month"><?php echo $lang->measurement->cycleMonth;?></a></li>
  32. </ul>
  33. <div class="tab-content">
  34. <div class="tab-pane clearfix <?php echo $weekTabActive?>" id="week">
  35. <?php echo html::checkbox('config[week]', $lang->measurement->dayNames, zget($measurement->collectConf, 'week'))?>
  36. </div>
  37. <div class="tab-pane clearfix <?php echo $monthTabActive?>" id="month">
  38. <?php
  39. $days = array();
  40. for($i = 1; $i <= 10; $i ++) $days[$i] = $i;
  41. echo html::checkbox('config[month]', $days, zget($measurement->collectConf, 'month'));
  42. $days = array();
  43. for($i = 11; $i <= 20; $i ++) $days[$i] = $i;
  44. echo html::checkbox('config[month]', $days, zget($measurement->collectConf, 'month'));
  45. $days = array();
  46. for($i = 21; $i <= 31; $i ++) $days[$i] = $i;
  47. echo html::checkbox('config[month]', $days, zget($measurement->collectConf, 'month'));
  48. ?>
  49. </div>
  50. </div>
  51. <div class='input-group'>
  52. <span class='input-group-addon'><?php echo $lang->measurement->execTime;?></span>
  53. <?php echo html::input('execTime', $measurement->execTime, "class='form-control form-time w-200px'");?>
  54. </div>
  55. <?php if($measurement->collectType == 'crontab') echo html::hidden('config[type]', $measurement->collectConf->type)?>
  56. <?php if($measurement->collectType == 'action') echo html::hidden('config[type]', 'week')?>
  57. </td>
  58. </tr>
  59. <script>
  60. $(function()
  61. {
  62. $(document).on('change', '#collectType', function()
  63. {
  64. var collectType = $('#collectType').val();
  65. if(collectType == 'crontab')
  66. {
  67. $('.cycleConfig').removeClass('hidden');
  68. $('.actionConfig').addClass('hidden');
  69. }
  70. else
  71. {
  72. $('.actionConfig').removeClass('hidden');
  73. $('.cycleConfig').addClass('hidden');
  74. }
  75. })
  76. $('#collectType').change();
  77. $('ul.nav-tabs a').click(function()
  78. {
  79. if($(this).data('type'))$('input[id*=type][id*=config]').val($(this).data('type'));
  80. });
  81. });
  82. </script>