Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00033 class ilObjSCORMValidator {
00034 var $dir,$flag,$summary;
00035
00036 function validateXML($file)
00037 {
00038
00039 exec(ilUtil::getJavaPath()." -jar ".ilUtil::escapeShellArg(ILIAS_ABSOLUTE_PATH."/java/vali.jar")." ".ilUtil::escapeShellArg($file)." 2>&1", $error);
00040 if (count($error) != 0)
00041 {
00042 $this->summary[] = "";
00043 $this->summary[] = "<b>File: $file</b>";
00044 foreach($error as $line)
00045 {
00046 $this->summary[] = $line;
00047
00048 }
00049 }
00050 }
00051
00052 function searchDir($dir) {
00053 if (is_dir($dir)) {
00054 if ($dh = opendir($dir)) {
00055 while (($file = readdir($dh)) !== false) {
00056 if (!eregi("^[\.]{1,2}",$file)) {
00057
00058 if (is_dir($dir.$file)) {
00059
00060
00061 }
00062 if (eregi("(\.xml)$",$file)) {
00063 $this->validateXML($dir.$file);
00064 }
00065 }
00066 }
00067 }
00068 closedir($dh);
00069 }
00070 }
00071
00072 function ilObjSCORMValidator($directory) {
00073 $this->dir = $directory.'/';
00074 }
00075
00076 function validate()
00077 {
00078 $this->summary = array();
00079 $this->searchDir($this->dir);
00080 if(count($this->summary) == 0)
00081 {
00082 return true;
00083 }
00084 else
00085 {
00086 return false;
00087 }
00088 }
00089
00090 function getSummary()
00091 {
00092 $summary = "";
00093
00094 foreach ($this->summary as $line)
00095 {
00096 $summary .= $line."<br>";
00097 }
00098
00099 return $summary;
00100 }
00101 }
00102
00103 ?>