index.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Reports
  5. * @author Arnaud Ligot <arnaud@cblue.be>
  6. * @copyrights CBLUE SPRL 2011
  7. * @package chamilo.reports
  8. */
  9. //exit;
  10. $cidReset = true;
  11. // including files
  12. //require_once '../inc/global.inc.php';
  13. require_once 'reports.lib.php';
  14. // protect script
  15. api_block_anonymous_users();
  16. // defining constants
  17. // current section
  18. $this_section = SECTION_REPORTS;
  19. // setting the name of the tool
  20. $tool_name=get_lang('Reports');
  21. // Displaying the header
  22. foreach (array('jquery.ba-bbq.min.js', 'jquery.validate.js', 'jquery.form.js', 'jquery.form.wizard.js', 'jquery.dataTables.min.js') as $js)
  23. $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/'.$js.'" type="text/javascript" language="javascript"></script>'."\n";
  24. // FIXME
  25. $htmlHeadXtra[] = ' <style type="text/css">
  26. #reportsBuilderWizard {
  27. padding : 1em;
  28. width : 500px;
  29. border-style: solid;
  30. border-color: #0daee4;
  31. }
  32. #fieldWrapper {
  33. }
  34. #wizardNavigation {
  35. margin-top : 0.5em;
  36. margin-right : 1em;
  37. text-align: right;
  38. }
  39. #data {
  40. font-size : 0.7em;
  41. }
  42. input {
  43. margin-right: 0.1em;
  44. margin-bottom: 0.5em;
  45. }
  46. .input_field_25em {
  47. width: 2.5em;
  48. }
  49. .input_field_3em {
  50. width: 3em;
  51. }
  52. .input_field_35em {
  53. width: 3.5em;
  54. }
  55. .input_field_12em {
  56. width: 12em;
  57. }
  58. label {
  59. margin-bottom: 0.2em;
  60. font-weight: bold;
  61. font-size: 0.8em;
  62. }
  63. label.error {
  64. color: red;
  65. font-size: 0.8em;
  66. margin-left : 0.5em;
  67. }
  68. .step span {
  69. float: right;
  70. font-weight: bold;
  71. padding-right: 0.8em;
  72. }
  73. .navigation_button {
  74. width : 70px;
  75. }
  76. #data {
  77. overflow : auto;
  78. display: none;
  79. }
  80. .result {
  81. padding-top: 15px;
  82. }
  83. #result2 {
  84. margin: 50px;
  85. }
  86. #result3 {
  87. margin: 100px;
  88. }
  89. #result4 {
  90. margin: 150px;
  91. }
  92. select.link, select.link:hover {
  93. color: black;
  94. }
  95. </style>';
  96. $htmlCSSXtra[] = 'dataTable.css';
  97. reports_loadTemplates();
  98. Display::display_header($tool_name);
  99. ?>
  100. <div id="reportsBuilderWizard">
  101. <h3><?php get_lang('Reports'); ?></h3>
  102. <div id='wizardContent'>
  103. <p><?php echo get_lang('PleaseFillFormToBuildReport'); ?></p>
  104. <h5 id="status"></h5>
  105. <form id="reportsBuilderWizardForm" method="post" action="reports.php" class="bbq">
  106. <div id="fieldWrapper">
  107. <span class="step" id="first">
  108. <span class="font_normal_07em_black"><?php echo get_lang('PleaseChooseReportType'); ?></span><br />
  109. <label for="type"><?php echo get_lang('ReportType'); ?></label><br />
  110. <select class="input_field_12em link required" name="type" id="type">
  111. <?php
  112. foreach ($reports_template as $key => $value) {
  113. echo '<option value="'.$key.'">'.$value['description'].'</option>';
  114. }
  115. ?>
  116. </select><br />
  117. </span>
  118. <?php
  119. foreach ($reports_template as $key => $value) {
  120. echo $value['wizard'];
  121. }
  122. ?>
  123. <span id="format" class="step submit_step">
  124. <span class="font_normal_07em_black"><?php echo get_lang('ReportFormat'); ?></span><br />
  125. <select name="format" id="format">
  126. <option value="html">HTML</option>
  127. <option value="csv">CSV</option>
  128. <option value="sql">SQL</option>
  129. <option value="link"><?php echo get_lang('ReportTypeLink'); ?></option>
  130. </select><br />
  131. </span>
  132. </div>
  133. <div id="wizardNavigation">
  134. <input class="navigation_button" id="back" value="<?php echo get_lang('Back'); ?>" type="reset" />
  135. <input class="navigation_button" id="next" value="<?php echo get_lang('Next'); ?>" type="submit" />
  136. </div>
  137. </form>
  138. <hr />
  139. </div>
  140. <div id="wizardShowButton">
  141. <?php echo get_lang('ShowWizard'); ?>
  142. </div>
  143. <p id="data"></p>
  144. </div>
  145. <div id="result" class="result">
  146. </div>
  147. <div id="result2" class="result">
  148. </div>
  149. <div id="result3" class="result">
  150. </div>
  151. <div id="result4" class="result">
  152. </div>
  153. <script type="text/javascript">
  154. $(function(){
  155. $("#wizardShowButton").hide();
  156. $("#wizardShowButton").click(function() {
  157. $("#wizardContent").show();
  158. $("#wizardShowButton").hide();
  159. });
  160. $("#reportsBuilderWizardForm").formwizard({
  161. formPluginEnabled: true,
  162. validationEnabled: true,
  163. focusFirstInput : true,
  164. formOptions :{
  165. success: function(data){
  166. $("#wizardContent").hide();
  167. $("#wizardShowButton").show();
  168. $(".result").html('');
  169. $("#result").html(data);
  170. },
  171. beforeSubmit: function(data){$("#data").html("data sent to the server: " + $.param(data));},
  172. resetForm: false
  173. }
  174. }
  175. );
  176. });
  177. function setSubDataUri(elem, uri) {
  178. $.ajax({
  179. url: uri,
  180. success: function(data) {
  181. $(elem).closest('.result').nextAll().html('');
  182. $(elem).closest('.result').next().html(data);
  183. }
  184. });
  185. }
  186. </script>
  187. <?
  188. // Footer
  189. Display::display_footer();