aiccResource.class.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Container for the aiccResource class that deals with elemens from AICC Descriptor file
  5. * @package chamilo.learnpath
  6. * @author Yannick Warnier <ywarnier@beeznest.org>
  7. * @license GNU/GPL
  8. */
  9. /**
  10. * Class defining the elements from an AICC Descriptor file.
  11. */
  12. class aiccResource {
  13. public $identifier = '';
  14. public $title = '';
  15. public $description = '';
  16. public $developer_id = '';
  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. public function aiccResource($type = 'config', $params) {
  24. if (isset($params)) {
  25. switch ($type) {
  26. case 'db':
  27. // TODO: Implement this way of object creation.
  28. return false;
  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 'title':
  37. $this->title = $value;
  38. case 'description':
  39. $this->description = $value;
  40. break;
  41. case 'developer_id':
  42. $this->developer_id = $value;
  43. break;
  44. }
  45. }
  46. return true;
  47. }
  48. }
  49. return false;
  50. }
  51. }