index.php 5.3 KB

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