index.php 5.0 KB

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