md_scorm.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <?php
  2. /**
  3. * md_scorm.php for Chamilo metadata/*.php
  4. * 2006/12/15
  5. * @copyright 2005 rene.haentjens@UGent.be - see metadata/md_funcs.php
  6. * @package chamilo.metadata
  7. */
  8. /**
  9. * Chamilo Metadata: class mdobject for Scorm-type objects
  10. * @package chamilo.metadata
  11. */
  12. class mdobject
  13. {
  14. var $mdo_course;
  15. var $mdo_type;
  16. var $mdo_id;
  17. var $mdo_eid;
  18. var $mdo_dcmap_e;
  19. var $mdo_dcmap_v;
  20. var $mdo_path;
  21. var $mdo_comment;
  22. var $mdo_filetype;
  23. var $mdo_url;
  24. function mdo_define_htt() { return new xhtdoc(<<<EOD
  25. <!-- {-INDEXABLETEXT-} -->
  26. {-D scormlevel {-V @level-}-}{-D two 2-}
  27. Title: {-V metadata/lom/general/title/string-} txt-sep
  28. {-T scormlevel == two Author(s): {-V metadata/lom/lifeCycle/contribute[1]/entity-} txt-sep-}
  29. Keyword(s): {-R metadata/lom/general/keyword C KWTEXT-} txt-sep
  30. {-V metadata/lom/general/description[1]/string-}
  31. {-V metadata/lom/technical/location-} txt-end
  32. {-V metadata/lom/general/description[2]/string-} scorm-level-{-P scormlevel-}
  33. {-V metadata/lom/lifeCycle/contribute[1]/entity-}
  34. {-V metadata/lom/lifeCycle/contribute[1]/date/dateTime-}
  35. <!-- {-KWTEXT-} -->
  36. {-V string-}-kw
  37. <!-- {--} -->
  38. EOD
  39. );
  40. }
  41. function mdo_generate_default_xml_metadata()
  42. {
  43. return '<empty/>';
  44. }
  45. function mdo_add_breadcrump_nav()
  46. {
  47. global $interbreadcrumb;
  48. $regs = array(); // for use with ereg()
  49. $docurl = api_get_self(); // should be .../main/xxx/yyy.php
  50. if (ereg('^(.+[^/\.]+)/[^/\.]+/[^/\.]+.[^/\.]+$', $docurl, $regs))
  51. $docurl = $regs[1] . '/newscorm/index.php';
  52. $interbreadcrumb[] = array ('url' => $docurl,
  53. 'name' => get_lang('MdCallingTool'));
  54. }
  55. function mdobject($_course, $id)
  56. {
  57. global $ieee_dcmap_e, $ieee_dcmap_v; // md_funcs
  58. $scormdocument = Database::get_course_table(TABLE_LP_MAIN);
  59. $this->mdo_course = $_course; $this->mdo_type = 'Scorm';
  60. $this->mdo_id = $id; $this->mdo_eid = $this->mdo_type . '.' . $id;
  61. $this->mdo_dcmap_e = $ieee_dcmap_e; $this->mdo_dcmap_v = $ieee_dcmap_v;
  62. $sql = "SELECT path,description,lp_type FROM $scormdocument WHERE id='" . addslashes($id) . "'";
  63. if (($docinfo = @Database::fetch_array(Database::query($sql))))
  64. {
  65. $this->mdo_path = $docinfo['path'];
  66. //Sometimes the new scorm-tool adds '/.' at the end of a directory name, so remove this before continue
  67. //the process -- bmol
  68. if(substr($this->mdo_path,-2) == '/.')
  69. {
  70. $this->mdo_path = substr($this->mdo_path,0, strlen($this->mdo_path)-2);
  71. }
  72. $this->mdo_comment = $docinfo['description'];
  73. //Don't think the next line is correct. There used to be a 'type' field in the scormdocument table.
  74. //This metadata tool only works on folder types -- bmol
  75. $this->mdo_filetype = ($docinfo['lp_type'] == 2 ? 'folder' : 'xxx');
  76. $this->mdo_url = get_course_web() . $this->mdo_course['path'] .
  77. '/scorm/' . $this->mdo_path . '/index.php';
  78. }
  79. }
  80. }
  81. ?>