exampletables.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <?php // $Id: exampletables.php,v 1.2 2006/03/15 14:34:45 pcool Exp $
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2004 Dokeos S.A.
  6. Copyright (c) 2003 Ghent University (UGent)
  7. Copyright (c) 2001 Universite catholique de Louvain (UCL)
  8. Copyright (c) Vrije Universiteit Brussel (VUB)
  9. For a full list of contributors, see "credits.txt".
  10. The full license can be read in "license.txt".
  11. This program is free software; you can redistribute it and/or
  12. modify it under the terms of the GNU General Public License
  13. as published by the Free Software Foundation; either version 2
  14. of the License, or (at your option) any later version.
  15. See the GNU General Public License for more details.
  16. Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
  17. ==============================================================================
  18. */
  19. /**
  20. ==============================================================================
  21. * This file is a code template;
  22. * copy the code and paste it in a new file to begin your own work.
  23. *
  24. * @package dokeos.plugin
  25. ==============================================================================
  26. */
  27. /*
  28. ==============================================================================
  29. INIT SECTION
  30. ==============================================================================
  31. */
  32. // global settings initialisation
  33. // also provides access to main api (inc/lib/main_api.lib.php)
  34. include("../inc/global.inc.php");
  35. /*
  36. -----------------------------------------------------------
  37. Libraries
  38. -----------------------------------------------------------
  39. */
  40. //main_api.lib.php by default included
  41. //also the display and database libraries are loaded by default
  42. /*
  43. -----------------------------------------------------------
  44. Header
  45. -----------------------------------------------------------
  46. */
  47. $nameTools = "Table examples (for developers)"; // title of the page (should come from the language file)
  48. Display::display_header($nameTools);
  49. /*
  50. -----------------------------------------------------------
  51. Constants
  52. -----------------------------------------------------------
  53. */
  54. define ("REPEAT_COUNT", "5");
  55. /*
  56. ==============================================================================
  57. FUNCTIONS
  58. ==============================================================================
  59. */
  60. /*
  61. ==============================================================================
  62. MAIN CODE
  63. ==============================================================================
  64. */
  65. api_display_tool_title($nameTools);
  66. $row = 0;
  67. $column_header[$row++] = "Column 1";
  68. $column_header[$row++] = "Column 2";
  69. $column_header[$row++] = "Column 3";
  70. /*
  71. An important parameter for display_complex_table_header
  72. is $properties, an array with elements, all of which have defaults
  73. "width" - the table width, e.g. "85%"
  74. "class" - the class to use for the table, e.g. "class=\"data_table\""
  75. by default class is "class=\"data_table\""
  76. "cellpadding" - the extra border in each cell, e.g. "8"
  77. */
  78. /*
  79. -----------------------------------------------------------
  80. Table that hilites
  81. -----------------------------------------------------------
  82. */
  83. Display::display_normal_message("The following table hilites on mouseover (hover), this is the Display API default.");
  84. Display::display_complex_table_header($properties, $column_header);
  85. for ($i = 0; $i < REPEAT_COUNT; $i++)
  86. {
  87. $row = 0;
  88. $table_row[$row++] = "First";
  89. $table_row[$row++] = "Second";
  90. $table_row[$row++] = "Third";
  91. Display::display_table_row($bgcolor, $table_row, true);
  92. }
  93. Display::display_table_footer();
  94. echo "<br/><br/>";
  95. /*
  96. -----------------------------------------------------------
  97. Table that alternates row colours
  98. -----------------------------------------------------------
  99. */
  100. Display::display_normal_message("The following table has alternating row colours and no hilite");
  101. $properties["class"] = ""; //no hilite
  102. $bgcolour = Display::display_complex_table_header($properties, $column_header);
  103. for ($i = 0; $i < REPEAT_COUNT; $i++)
  104. {
  105. $row = 0;
  106. $table_row[$row++] = "First";
  107. $table_row[$row++] = "Second";
  108. $table_row[$row++] = "Third";
  109. $bgcolour = Display::display_table_row($bgcolour, $table_row, true);
  110. }
  111. Display::display_table_footer();
  112. /*
  113. ==============================================================================
  114. FOOTER
  115. ==============================================================================
  116. */
  117. Display::display_footer();
  118. ?>