aiccBlock.class.php 2.1 KB

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