aiccBlock.class.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Class aiccBlock
  5. * Class defining the Block elements in an AICC Course Structure file.
  6. *
  7. * Container for the aiccResource class that deals with elemens from AICC Course Structure file
  8. * @package chamilo.learnpath
  9. * @author Yannick Warnier <ywarnier@beeznest.org>
  10. * @license GNU/GPL
  11. */
  12. class aiccBlock extends learnpathItem
  13. {
  14. public $identifier = '';
  15. public $members = array();
  16. /**
  17. * Class constructor. Depending of the type of construction called ('db' or 'manifest'), will create a scormResource
  18. * object from database records or from the array given as second param
  19. * @param string $type Type of construction needed ('db' or 'config', default = 'config')
  20. * @param mixed $params Depending on the type given, DB id for the lp_item or parameters array
  21. */
  22. public function __construct($type = 'config', $params)
  23. {
  24. if (isset($params)) {
  25. switch ($type) {
  26. case 'db':
  27. //TODO: Implement this way of object creation.
  28. break;
  29. case 'config': // Do the same as the default.
  30. default:
  31. foreach ($params as $a => $value) {
  32. switch ($a) {
  33. case 'system_id':
  34. $this->identifier = strtolower($value);
  35. break;
  36. case 'member':
  37. if (strstr($value, ',') !== false) {
  38. $temp = explode(',', $value);
  39. foreach ($temp as $val) {
  40. if (!empty($val)) {
  41. $this->members[] = $val;
  42. }
  43. }
  44. }
  45. break;
  46. }
  47. }
  48. }
  49. }
  50. }
  51. }