aiccBlock.class.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. *
  9. * @package chamilo.learnpath
  10. *
  11. * @author Yannick Warnier <ywarnier@beeznest.org>
  12. * @license GNU/GPL
  13. */
  14. class aiccBlock extends learnpathItem
  15. {
  16. public $identifier = '';
  17. public $members = [];
  18. /**
  19. * Class constructor. Depending of the type of construction called ('db' or 'manifest'), will create a scormResource
  20. * object from database records or from the array given as second param.
  21. *
  22. * @param string $type Type of construction needed ('db' or 'config', default = 'config')
  23. * @param mixed $params Depending on the type given, DB id for the lp_item or parameters array
  24. */
  25. public function __construct($type = 'config', $params)
  26. {
  27. if (isset($params)) {
  28. switch ($type) {
  29. case 'db':
  30. //TODO: Implement this way of object creation.
  31. break;
  32. case 'config': // Do the same as the default.
  33. default:
  34. foreach ($params as $a => $value) {
  35. switch ($a) {
  36. case 'system_id':
  37. $this->identifier = strtolower($value);
  38. break;
  39. case 'member':
  40. if (strstr($value, ',') !== false) {
  41. $temp = explode(',', $value);
  42. foreach ($temp as $val) {
  43. if (!empty($val)) {
  44. $this->members[] = $val;
  45. }
  46. }
  47. }
  48. break;
  49. }
  50. }
  51. }
  52. }
  53. }
  54. }