aiccBlock.class.php 2.1 KB

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