ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilObjSCORMValidator.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2011 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5
16
18 {
19 // exec(ilUtil::getJavaPath()." -jar ".ilUtil::escapeShellArg(ILIAS_ABSOLUTE_PATH."/Modules/ScormAicc/validation/vali.jar")." ".ilUtil::escapeShellArg($file)." 2>&1", $error);
20 // if (count($error) != 0)
21 // {
22 // $this->summary[] = "";
23 // $this->summary[] = "<b>File: $file</b>";
24 // foreach($error as $line)
25 // {
26 // $this->summary[] = $line;
27 // }
28 // }
29 }
30
31 function searchDir($dir) {
32 if (is_dir($dir)) {
33 if ($dh = opendir($dir)) {
34 while (($file = readdir($dh)) !== false) {
35 if (!preg_match("~^[\.]{1,2}~i",$file)) {
36 //2DO FIXME regex machen dass nur . und .. erkannt werden und nicht .lala. oder so
37 if (is_dir($dir.$file)) {
38 // This is commented because subdirecories of my scromexamples contain xml files which aren't valid!
39 //$this->searchDir($dir.$file."/");
40 }
41 if (preg_match("~(\.xml)$~i",$file)) {
42
43 // we skip index.xml and indexMD.xml which come from the
44 // scorm editor and currently do not validate against anything
45 if ($file != "index.xml" && $file != "indexMD.xml")
46 {
47 $this->validateXML($dir.$file);
48 }
49 }
50 }
51 }
52 }
53 closedir($dh);
54 }
55 }
56
57 function __construct($directory) {
58 $this->dir = $directory.'/';
59 }
60
61 function validate()
62 {
63 $this->summary = array();
64 $this->searchDir($this->dir);
65 if(count($this->summary) == 0)
66 {
67 return true;
68 }
69 else
70 {
71 return false;
72 }
73 }
74
75 function getSummary()
76 {
77 $summary = "";
78
79 foreach ($this->summary as $line)
80 {
81 $summary .= $line."<br>";
82 }
83
84 return $summary;
85 }
86}
87
88?>
An exception for terminatinating execution or to throw for unit testing.
Validation of SCORM-XML Files.
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file