ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjSCORMValidator Class Reference

Validation of SCORM-XML Files. More...

+ Collaboration diagram for ilObjSCORMValidator:

Public Member Functions

 validateXML ($file)
 
 searchDir ($dir)
 
 ilObjSCORMValidator ($directory)
 
 validate ()
 
 getSummary ()
 

Data Fields

 $dir
 
 $flag
 
 $summary
 

Detailed Description

Validation of SCORM-XML Files.

Author
Romeo Kienzler conta.nosp@m.ct@k.nosp@m.ienzl.nosp@m.er.b.nosp@m.iz 21 LearnLine AG info@.nosp@m.21ll.nosp@m..com

Definition at line 14 of file class.ilObjSCORMValidator.php.

Member Function Documentation

◆ getSummary()

ilObjSCORMValidator::getSummary ( )

Definition at line 76 of file class.ilObjSCORMValidator.php.

References $summary.

77  {
78  $summary = "";
79 
80  foreach ($this->summary as $line)
81  {
82  $summary .= $line."<br>";
83  }
84 
85  return $summary;
86  }

◆ ilObjSCORMValidator()

ilObjSCORMValidator::ilObjSCORMValidator (   $directory)

Definition at line 58 of file class.ilObjSCORMValidator.php.

58  {
59  $this->dir = $directory.'/';
60  }

◆ searchDir()

ilObjSCORMValidator::searchDir (   $dir)

Definition at line 32 of file class.ilObjSCORMValidator.php.

References $file, and validateXML().

Referenced by validate().

32  {
33  if (is_dir($dir)) {
34  if ($dh = opendir($dir)) {
35  while (($file = readdir($dh)) !== false) {
36  if (!eregi("^[\.]{1,2}",$file)) {
37  //2DO FIXME regex machen dass nur . und .. erkannt werden und nicht .lala. oder so
38  if (is_dir($dir.$file)) {
39  // This is commented because subdirecories of my scromexamples contain xml files which aren't valid!
40  //$this->searchDir($dir.$file."/");
41  }
42  if (eregi("(\.xml)$",$file)) {
43 
44  // we skip index.xml and indexMD.xml which come from the
45  // scorm editor and currently do not validate against anything
46  if ($file != "index.xml" && $file != "indexMD.xml")
47  {
48  $this->validateXML($dir.$file);
49  }
50  }
51  }
52  }
53  }
54  closedir($dh);
55  }
56  }
print $file
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ validate()

ilObjSCORMValidator::validate ( )

Definition at line 62 of file class.ilObjSCORMValidator.php.

References searchDir().

63  {
64  $this->summary = array();
65  $this->searchDir($this->dir);
66  if(count($this->summary) == 0)
67  {
68  return true;
69  }
70  else
71  {
72  return false;
73  }
74  }
+ Here is the call graph for this function:

◆ validateXML()

ilObjSCORMValidator::validateXML (   $file)

Definition at line 17 of file class.ilObjSCORMValidator.php.

References $file, ilUtil\escapeShellArg(), ilUtil\getJavaPath(), and ILIAS_ABSOLUTE_PATH.

Referenced by searchDir().

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 //echo "<br><b>".$line."</b>";
28  }
29  }
30  }
print $file
static getJavaPath()
get full java path (dir + java command)
const ILIAS_ABSOLUTE_PATH
static escapeShellArg($a_arg)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $dir

ilObjSCORMValidator::$dir

Definition at line 15 of file class.ilObjSCORMValidator.php.

◆ $flag

ilObjSCORMValidator::$flag

Definition at line 15 of file class.ilObjSCORMValidator.php.

◆ $summary

ilObjSCORMValidator::$summary

Definition at line 15 of file class.ilObjSCORMValidator.php.

Referenced by getSummary().


The documentation for this class was generated from the following file: