Learnpath.class.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <?php // $Id: Learnpath.class.php 11364 2007-03-03 10:48:36Z yannoo $
  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) Bart Mollet (bart.mollet@hogent.be)
  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 address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
  17. Mail: info@dokeos.com
  18. ==============================================================================
  19. */
  20. /**
  21. * A learnpath
  22. * @author Bart Mollet <bart.mollet@hogent.be>
  23. * @package dokeos.backup
  24. */
  25. class Learnpath extends Resource
  26. {
  27. /**
  28. * Type of learnpath (can be dokeos (1), scorm (2), aicc (3))
  29. */
  30. var $lp_type;
  31. /**
  32. * The name
  33. */
  34. var $name;
  35. /**
  36. * The reference
  37. */
  38. var $ref;
  39. /**
  40. * The description
  41. */
  42. var $description;
  43. /**
  44. * Path to the learning path files
  45. */
  46. var $path;
  47. /**
  48. * Whether additional commits should be forced or not
  49. */
  50. var $force_commit;
  51. /**
  52. * View mode by default ('embedded' or 'fullscreen')
  53. */
  54. var $default_view_mod;
  55. /**
  56. * Default character encoding
  57. */
  58. var $default_encoding;
  59. /**
  60. * Display order
  61. */
  62. var $display_order;
  63. /**
  64. * Content editor/publisher
  65. */
  66. var $content_maker;
  67. /**
  68. * Location of the content (local or remote)
  69. */
  70. var $content_local;
  71. /**
  72. * License of the content
  73. */
  74. var $content_license;
  75. /**
  76. * Whether to prevent reinitialisation or not
  77. */
  78. var $prevent_reinit;
  79. /**
  80. * JavaScript library used
  81. */
  82. var $js_lib;
  83. /**
  84. * Debug level for this lp
  85. */
  86. var $debug;
  87. /**
  88. * The items
  89. */
  90. var $items;
  91. /**
  92. * The learnpath visibility on the homepage
  93. */
  94. var $visibility;
  95. /**
  96. * Create a new learnpath
  97. * @param integer ID
  98. * @param integer Type (1,2,3,...)
  99. * @param string $name
  100. * @param string $path
  101. * @param string $ref
  102. * @param string $description
  103. * @param string $content_local
  104. * @param string $default_encoding
  105. * @param string $default_view_mode
  106. * @param bool $prevent_reinit
  107. * @param bool $force_commit
  108. * @param string $content_maker
  109. * @param integer $display_order
  110. * @param string $js_lib
  111. * @param string $content_license
  112. * @param integer $debug
  113. * @param string $visibility
  114. * @param array $items
  115. */
  116. function Learnpath($id,$type,$name,$path,$ref,$description,$content_local,$default_encoding,$default_view_mode,$prevent_reinit,$force_commit,$content_maker,$display_order,$js_lib,$content_license,$debug,$visibility,$items)
  117. {
  118. parent::Resource($id,RESOURCE_LEARNPATH);
  119. $this->lp_type = $type;
  120. $this->name = $name;
  121. $this->path = $path;
  122. $this->ref = $ref;
  123. $this->description = $description;
  124. $this->content_local = $content_local;
  125. $this->default_encoding = $default_encoding;
  126. $this->default_view_mod = $default_view_mode;
  127. $this->prevent_reinit = $prevent_reinit;
  128. $this->force_commit = $force_commit;
  129. $this->content_maker = $content_maker;
  130. $this->display_order = $display_order;
  131. $this->js_lib = $js_lib;
  132. $this->content_license = $content_license;
  133. $this->debug = $debug;
  134. $this->visibility=$visibility;
  135. $this->items = $items;
  136. }
  137. /**
  138. * Get the items
  139. */
  140. function get_items()
  141. {
  142. return $this->items;
  143. }
  144. /**
  145. * Check if a given resource is used as an item in this chapter
  146. */
  147. function has_item($resource)
  148. {
  149. foreach($this->items as $index => $item)
  150. {
  151. if( $item['id'] == $resource->get_id() && $item['type'] == $resource->get_type())
  152. {
  153. return true;
  154. }
  155. }
  156. return false;
  157. }
  158. /**
  159. * Show this learnpath
  160. */
  161. function show()
  162. {
  163. parent::show();
  164. echo $this->name;
  165. }
  166. }
  167. ?>