setsql.html.php 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php include $app->getModuleRoot() . 'common/view/header.html.php';?>
  2. <?php include $app->getModuleRoot() . 'common/view/datepicker.html.php';?>
  3. <?php js::set('measurementID', $measurement->id);?>
  4. <div class='panel'>
  5. <div class='panel-heading'>
  6. <div class='panel-title'>
  7. <span class='text'><?php echo $measurement->name . " $lang->hyphen " . $lang->measurement->setSQL?></span>
  8. <?php if($measurement->deleted):?>
  9. <span class='label label-danger'><?php echo $lang->measurement->deleted;?></span>
  10. <?php endif;?>
  11. </div>
  12. </div>
  13. <form method='post' id='sqlForm'>
  14. <table class='table table-form'>
  15. <tr>
  16. <td colspan="3"> <?php echo html::textarea('sql', $sql, "placeholder='{$lang->measurement->placeholder->sql}' class='form-control' rows='10'");?> </td>
  17. </tr>
  18. </table>
  19. <div class='panel-body' id="paramBox" style='padding-top: 10px'>
  20. <?php if(!empty($measurement->params)):?>
  21. <table class='table'>
  22. <thead>
  23. <tr class='text-center'>
  24. <th class='w-110px'><?php echo $lang->measurement->param->varName?></th>
  25. <th class='w-150px'><?php echo $lang->measurement->param->showName?></th>
  26. <th class='w-200px'><?php echo $lang->measurement->param->varType?></th>
  27. <th class='w-250px'><?php echo $lang->measurement->param->defaultValue?></th>
  28. <th class='w-250px'><?php echo $lang->measurement->param->queryValue?></th>
  29. </tr>
  30. </thead>
  31. <tbody class='text-center'>
  32. <?php $index = 0;?>
  33. <?php foreach($params as $param):?>
  34. <?php $varType = zget($param, 'varType', '');?>
  35. <tr id='<?php echo $param['varName']?>'>
  36. <td><span></span><?php echo $param['varName'] . html::hidden("varName[]", $param['varName'])?></td>
  37. <td><?php echo html::input("showName[]", $param['showName'], "class='form-control'")?></td>
  38. <td>
  39. <div class='col-md-6'>
  40. <?php echo html::select("varType[]", $lang->measurement->param->typeList, zget($param, 'varType'), "class='select form-control chosen' onchange='toggleSelectList(this)'")?>
  41. </div>
  42. <div class='col-md-6'>
  43. <?php
  44. $hidden = ($varType == 'select') ? '' : 'hidden';
  45. echo html::select("options[]", $lang->measurement->param->options, $param['options'], "class='form-control $hidden' onchange='togglParamList(this)'");
  46. ?>
  47. </div>
  48. </td>
  49. <td><?php echo $this->measurement->buildParamControl('defaultValue', $varType, zget($param, 'defaultValue', ''), $param['options']);?></td>
  50. <td><?php echo $this->measurement->buildParamControl('queryValue', $varType, zget($param, 'queryValue', ''), $param['options']);?></td>
  51. </tr>
  52. <?php $index ++;?>
  53. <?php endforeach;?>
  54. </tbody>
  55. </table>
  56. <?php endif;?>
  57. <div id="responseBox" class='alter'></div>
  58. <?php if(!$measurement->deleted):?>
  59. <div class='panel-body'>
  60. <input type='button' value='<?php echo $lang->measurement->test;?>' id='testBtn' class='btn btn-success' onclick='submitForm("test")'/>
  61. <input type='button' value='<?php echo $lang->save;?>' id='submit' class='btn submit' disabled onclick='submitForm("submit")'/>
  62. </div>
  63. <?php endif;?>
  64. </div>
  65. <?php echo html::hidden('action', 'test');?>
  66. </form>
  67. </div>
  68. <?php include $app->getModuleRoot() . 'common/view/footer.html.php';?>