ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilNestedSetXML Class Reference

Class NestedSetXML functions for storing XML-Data into nested-set-database-strcture. More...

+ Collaboration diagram for ilNestedSetXML:

Public Member Functions

 ilNestedSetXML ()
 Constructor initilize netsed-set variables public.
 startElement ($parser, $name, $attrs)
 Method is called, at an introductory TAG private.
 endElement ($parser, $name)
 method called at a closing tag private
 import ($xmldata, $obj_id, $obj_type)
 Import-Function.
 setParameterModifier (&$a_object, $a_method)
 export ($obj_id, $type)
 Export-Function.
 init ($obj_id, $obj_type)
 initilialize Nested-Set-Structur
 getTagName ()
 find first tag-name
 setTagName ($tagName)
 set tag-name
 getTagValue ()
 get tag content
 setTagValue ($value)
 set tag-content
 getXpathNodes (&$doc, $qry)
 get node in dom-structure
 initDom ()
 inits dom-object from given xml-content
 addXMLNode ($xPath, $xml, $index=0)
 parse XML code and add it to a given DOM object as a new node
 getFirstDomContent ($xPath)
 returns first content of this node
 deleteDomNode ($xPath, $name, $index=0)
 deletes node
 addDomNode ($xPath, $name, $value="", $attributes="", $index=0)
 adds node to DOM-Structure
 clean (&$meta)
 updateDomNode ($xPath, $meta, $no=0)
 updates dom node
 getDomContent ($xPath, $name="", $index=0)
 returns all contents of this node
 replaceDomContent ($xPath, $name="", $index=0, $newNode)
 updates content of this node
 replace_content (&$node, &$new_content)
 Replace node contents.
 updateDomContent ($xPath, $name="", $index=0, $newNode)
 updates content of this node
 getFirstDomNode ($xPath)
 first dom-node
 updateFromDom ()
 
imports new xml-data from dom into nested set

public

 deleteAllDbData ()
 
deletes current db-data of $this->obj_id and $this->obj_type

private

 _deleteAllChildMetaData ($a_ids)
 
Delete meta data of a content object (pages, chapters)

public

 _getAllChildIds ($a_obj_id)
 
Get all child ids of a content object

public

 ilNestedSetXML ()
 Constructor initilize netsed-set variables public.
 startElement ($parser, $name, $attrs)
 Method is called, at an introductory TAG private.
 endElement ($parser, $name)
 method called at a closing tag private
 import ($xmldata, $obj_id, $obj_type)
 Import-Function.
 setParameterModifier (&$a_object, $a_method)
 export ($obj_id, $type)
 Export-Function.
 init ($obj_id, $obj_type)
 initilialize Nested-Set-Structur
 getTagName ()
 find first tag-name
 setTagName ($tagName)
 set tag-name
 getTagValue ()
 get tag content
 setTagValue ($value)
 set tag-content
 getXpathNodes (&$doc, $qry)
 get node in dom-structure
 initDom ()
 inits dom-object from given xml-content
 addXMLNode ($xPath, $xml, $index=0)
 parse XML code and add it to a given DOM object as a new node
 getFirstDomContent ($xPath)
 returns first content of this node
 deleteDomNode ($xPath, $name, $index=0)
 deletes node
 addDomNode ($xPath, $name, $value="", $attributes="", $index=0)
 adds node to DOM-Structure
 clean (&$meta)
 updateDomNode ($xPath, $meta, $no=0)
 updates dom node
 getDomContent ($xPath, $name="", $index=0)
 returns all contents of this node
 replaceDomContent ($xPath, $name="", $index=0, $newNode)
 updates content of this node
 replace_content (&$node, &$new_content)
 Replace node contents.
 updateDomContent ($xPath, $name="", $index=0, $newNode)
 updates content of this node
 getFirstDomNode ($xPath)
 first dom-node
 updateFromDom ()
 
imports new xml-data from dom into nested set

public

 deleteAllDbData ()
 
deletes current db-data of $this->obj_id and $this->obj_type

private

 _deleteAllChildMetaData ($a_ids)
 
Delete meta data of a content object (pages, chapters)

public

 _getAllChildIds ($a_obj_id)
 
Get all child ids of a content object

public

Data Fields

 $db
 Datenbank-handle.
 $LEFT = 0
 Left and right edge tags.
 $RIGHT = 0
 $DEPTH = 0
 Nesting level of the tags.
 $obj_id
 book-Obj-ID
 $obj_type
 The type of the data to those this entry belongs.
 $xml_parser
 SAX-Parser-Handle.
 $lastTag = ""
 last Tag-Name found
 $ilias
 $dom

Private Attributes

 $unique_import_id = ''

Detailed Description

Class NestedSetXML functions for storing XML-Data into nested-set-database-strcture.

Author
Aresch Yavari ay@da.nosp@m.taba.nosp@m.y.de
Jens Conze jc@da.nosp@m.taba.nosp@m.y.de
Version
$Id: class.ilNestedSetXML.php

public

Definition at line 16 of file class.ilNestedSetXML.php.

Member Function Documentation

ilNestedSetXML::_deleteAllChildMetaData (   $a_ids)

Delete meta data of a content object (pages, chapters)

public

Parameters
arrayof child ids
See Also
_getAllChildIds()
Returns
boolean

Definition at line 1410 of file class.ilNestedSetXML.php.

References $ilBench, $ilDB, $in, $query, $res, $row, DB_FETCHMODE_OBJECT, and ilUtil\quoteArray().

{
global $ilBench, $ilDB;
#$ilBench->start('NestedSet','deleteAllChildMetaData');
// STEP TWO: DELETE ENTRIES IN xmlnestedset GET ALL tag_fks
$in = " IN (";
$in .= implode(",", ilUtil::quoteArray($a_ids));
$in .= ")";
$query = "SELECT ns_tag_fk FROM xmlnestedset ".
"WHERE ns_book_fk ".$in;
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$tag_fks[$row->ns_tag_fk] = $row->ns_tag_fk;
}
$ilDB->query("DELETE FROM xmlnestedset WHERE ns_book_fk ".$in);
// FINALLY DELETE
$in = " IN (";
$in .= implode(",", ilUtil::quoteArray($tag_fks));
$in .= ")";
$ilDB->query("DELETE FROM xmlparam WHERE tag_fk ".$in);
$ilDB->query("DELETE FROM xmlvalue WHERE tag_fk ".$in);
$ilDB->query("DELETE FROM xmltags WHERE tag_pk ".$in);
#$ilBench->stop('NestedSet','deleteAllChildMetaData');
return true;
}

+ Here is the call graph for this function:

ilNestedSetXML::_deleteAllChildMetaData (   $a_ids)

Delete meta data of a content object (pages, chapters)

public

Parameters
arrayof child ids
See Also
_getAllChildIds()
Returns
boolean

Definition at line 1441 of file class.ilNestedSetXML.php.

References $ilBench, $ilDB, $in, $query, $res, and $row.

{
global $ilBench,$ilDB;
#$ilBench->start('NestedSet','deleteAllChildMetaData');
// STEP TWO: DELETE ENTRIES IN xmlnestedset GET ALL tag_fks
$in = " IN ('";
$in .= implode("','", $a_ids);
$in .= "')";
$query = "SELECT ns_tag_fk FROM xmlnestedset ".
"WHERE ns_book_fk ".$in;
$res = $ilDB->query($query);
while($row = $ilDB->fetchObject($res))
{
$tag_fks[$row->ns_tag_fk] = $row->ns_tag_fk;
}
$ilDB->manipulate("DELETE FROM xmlnestedset WHERE ns_book_fk ".$in);
// FINALLY DELETE
// BEGIN WebDAV: Object deletion failed if no tag_fks was present.
if ($tag_fks != null)
{
$in = " IN ('";
$in .= implode("','", $tag_fks);
$in .= "')";
$ilDB->manipulate("DELETE FROM xmlparam WHERE tag_fk ".$in);
$ilDB->manipulate("DELETE FROM xmlvalue WHERE tag_fk ".$in);
$ilDB->manipulate("DELETE FROM xmltags WHERE tag_pk ".$in);
}
// END WebDAV Object deletion failed if no tag_fks was present.
#$ilBench->stop('NestedSet','deleteAllChildMetaData');
return true;
}
ilNestedSetXML::_getAllChildIds (   $a_obj_id)

Get all child ids of a content object

public

Parameters
intobj_id
Returns
boolean

Definition at line 1450 of file class.ilNestedSetXML.php.

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

{
global $ilDB;
$query = "SELECT obj_id FROM lm_data WHERE lm_id = ".$ilDB->quote($a_obj_id)." ";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$ids[$row->obj_id] = $row->obj_id;
}
$ids[$a_obj_id] = $a_obj_id;
return $ids ? $ids : array();
}
ilNestedSetXML::_getAllChildIds (   $a_obj_id)

Get all child ids of a content object

public

Parameters
intobj_id
Returns
boolean

Definition at line 1486 of file class.ilNestedSetXML.php.

References $ilDB, $res, and $row.

{
global $ilDB;
$res = $ilDB->queryF('SELECT obj_id FROM lm_data WHERE lm_id = %s',array('integer'),array($a_obj_id));
while($row = $ilDB->fetchObject($res))
{
$ids[$row->obj_id] = $row->obj_id;
}
$ids[$a_obj_id] = $a_obj_id;
return $ids ? $ids : array();
}
ilNestedSetXML::addDomNode (   $xPath,
  $name,
  $value = "",
  $attributes = "",
  $index = 0 
)

adds node to DOM-Structure

Parameters
stringxPath
stringname
stringvalue
arrayattributes
integerindex
Returns
boolean public

Definition at line 741 of file class.ilNestedSetXML.php.

References getXpathNodes().

{
$nodes = $this->getXpathNodes($this->dom, $xPath);
if (count($nodes) > 0)
{
$node = $this->dom->create_element($name);
if ($value != "")
{
$node->set_content(utf8_encode($value));
}
if (is_array($attributes))
{
for ($i = 0; $i < count($attributes); $i++)
{
$node->set_attribute($attributes[$i]["name"], utf8_encode($attributes[$i]["value"]));
}
}
$nodes[$index]->append_child($node);
return true;
}
else
{
return false;
}
}

+ Here is the call graph for this function:

ilNestedSetXML::addDomNode (   $xPath,
  $name,
  $value = "",
  $attributes = "",
  $index = 0 
)

adds node to DOM-Structure

Parameters
stringxPath
stringname
stringvalue
arrayattributes
integerindex
Returns
boolean public

Definition at line 767 of file class.ilNestedSetXML.php.

References getXpathNodes().

{
$nodes = $this->getXpathNodes($this->dom, $xPath);
if (count($nodes) > 0)
{
$node = $this->dom->create_element($name);
if ($value != "")
{
$node->set_content(utf8_encode($value));
}
if (is_array($attributes))
{
for ($i = 0; $i < count($attributes); $i++)
{
$node->set_attribute($attributes[$i]["name"], utf8_encode($attributes[$i]["value"]));
}
}
$nodes[$index]->append_child($node);
return true;
}
else
{
return false;
}
}

+ Here is the call graph for this function:

ilNestedSetXML::addXMLNode (   $xPath,
  $xml,
  $index = 0 
)

parse XML code and add it to a given DOM object as a new node

Parameters
stringxPath path
stringxml xml to add
integerindex index to add
Returns
boolean public

Definition at line 628 of file class.ilNestedSetXML.php.

References getXpathNodes().

{
include_once "./classes/class.ilXML2DOM.php";
$newDOM = new XML2DOM($xml);
//echo "<br>addXMLNode:-".htmlspecialchars($this->dom->dump_mem(0));
$nodes = $this->getXpathNodes($this->dom, $xPath);
if (count($nodes) > 0)
{
$newDOM->insertNode($this->dom, $nodes[$index]);
return true;
}
else
{
return false;
}
}

+ Here is the call graph for this function:

ilNestedSetXML::addXMLNode (   $xPath,
  $xml,
  $index = 0 
)

parse XML code and add it to a given DOM object as a new node

Parameters
stringxPath path
stringxml xml to add
integerindex index to add
Returns
boolean public

Definition at line 653 of file class.ilNestedSetXML.php.

References getXpathNodes().

Referenced by updateDomNode().

{
$newDOM = new XML2DOM($xml);
//echo "<br>addXMLNode:-".htmlspecialchars($this->dom->dump_mem(0));
$nodes = $this->getXpathNodes($this->dom, $xPath);
if (count($nodes) > 0)
{
$newDOM->insertNode($this->dom, $nodes[$index]);
return true;
}
else
{
return false;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilNestedSetXML::clean ( $meta)

Definition at line 767 of file class.ilNestedSetXML.php.

References clean().

{
if(is_array($meta))
{
foreach($meta as $key => $value)
{
if(is_array($meta[$key]))
{
$this->clean($meta[$key]);
}
else
{
$meta[$key] = preg_replace("/&(?!amp;|lt;|gt;|quot;)/","&amp;",$meta[$key]);
$meta[$key] = preg_replace("/\"/","&quot;",$meta[$key]);
$meta[$key] = preg_replace("/</","&lt;",$meta[$key]);
$meta[$key] = preg_replace("/>/","&gt;",$meta[$key]);
}
}
}
return true;
}

+ Here is the call graph for this function:

ilNestedSetXML::clean ( $meta)

Definition at line 793 of file class.ilNestedSetXML.php.

References ilUtil\stripSlashes().

Referenced by clean(), startElement(), and updateDomNode().

{
if(is_array($meta))
{
foreach($meta as $key => $value)
{
if(is_array($meta[$key]))
{
$this->clean($meta[$key]);
}
else
{
$meta[$key] = ilUtil::stripSlashes($meta[$key]);
$meta[$key] = preg_replace("/&(?!amp;|lt;|gt;|quot;)/","&amp;",$meta[$key]);
$meta[$key] = preg_replace("/\"/","&quot;",$meta[$key]);
$meta[$key] = preg_replace("/</","&lt;",$meta[$key]);
$meta[$key] = preg_replace("/>/","&gt;",$meta[$key]);
}
}
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilNestedSetXML::deleteAllDbData ( )

deletes current db-data of $this->obj_id and $this->obj_type

private

Definition at line 1386 of file class.ilNestedSetXML.php.

References $ilBench, $ilDB, $res, $row, and DB_FETCHMODE_ASSOC.

{
global $ilBench, $ilDB;
#$ilBench->start('NestedSet','deleteAllDBData');
$res = $this->db->query("SELECT * FROM xmlnestedset WHERE ns_book_fk = ".$ilDB->quote($this->obj_id)." AND ns_type = ".$ilDB->quote($this->obj_type)." ");
while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
{
$this->db->query("DELETE FROM xmlparam WHERE tag_fk = ".$ilDB->quote($row["ns_tag_fk"])." ");
$this->db->query("DELETE FROM xmlvalue WHERE tag_fk = ".$ilDB->quote($row["ns_tag_fk"])." ");
$this->db->query("DELETE FROM xmltags WHERE tag_pk = ".$ilDB->quote($row["ns_tag_fk"])." ");
}
$this->db->query("DELETE FROM xmlnestedset WHERE ns_book_fk = ".$ilDB->quote($this->obj_id)." AND ns_type = ".$ilDB->quote($this->obj_type)." ");
#$ilBench->stop('NestedSet','deleteAllDBData');
}
ilNestedSetXML::deleteAllDbData ( )

deletes current db-data of $this->obj_id and $this->obj_type

private

Definition at line 1413 of file class.ilNestedSetXML.php.

References $ilBench, $res, and $row.

Referenced by import(), and updateFromDom().

{
global $ilBench;
#$ilBench->start('NestedSet','deleteAllDBData');
$res = $this->db->queryF('
SELECT * FROM xmlnestedset WHERE ns_book_fk = %s AND ns_type = %s ',
array('integer','text'), array($this->obj_id,$this->obj_type));
while ($row = $this->db->fetchAssoc($res))
{
$this->db->manipulateF('DELETE FROM xmlparam WHERE tag_fk = %s',array('integer'), array($row["ns_tag_fk"]));
$this->db->manipulateF('DELETE FROM xmlvalue WHERE tag_fk = %s',array('integer'), array($row["ns_tag_fk"]));
$this->db->manipulateF('DELETE FROM xmltags WHERE tag_pk = %s',array('integer'), array($row["ns_tag_fk"]));
}
$this->db->manipulateF('DELETE FROM xmlnestedset WHERE ns_book_fk = %s AND ns_type = %s',
array('integer','text'), array($this->obj_id,$this->obj_type));
#$ilBench->stop('NestedSet','deleteAllDBData');
}

+ Here is the caller graph for this function:

ilNestedSetXML::deleteDomNode (   $xPath,
  $name,
  $index = 0 
)

deletes node

Parameters
stringxPath path
stringname name
integerindex index
Returns
boolean public

Definition at line 686 of file class.ilNestedSetXML.php.

References getXpathNodes().

{
if ($index == "")
{
$index = 0;
}
if (strpos($index, ","))
{
$indices = explode(",", $index);
$nodes = $this->getXpathNodes($this->dom, $xPath);
if (count($nodes) > 0)
{
$children = $nodes[$indices[0]]->child_nodes();
if (count($children) > 0)
{
$j = 0;
for ($i = 0; $i < count($children); $i++)
{
if ($children[$i]->node_name() == $name)
{
if ($j == $indices[1])
{
$children[$i]->unlink_node();
return true;
}
$j++;
}
}
}
}
}
else
{
$nodes = $this->getXpathNodes($this->dom, $xPath . "/" . $name);
if (count($nodes) > 0)
{
$nodes[$index]->unlink_node();
return true;
}
}
return false;
}

+ Here is the call graph for this function:

ilNestedSetXML::deleteDomNode (   $xPath,
  $name,
  $index = 0 
)

deletes node

Parameters
stringxPath path
stringname name
integerindex index
Returns
boolean public

Definition at line 712 of file class.ilNestedSetXML.php.

References getXpathNodes().

{
if ($index == "")
{
$index = 0;
}
if (strpos($index, ","))
{
$indices = explode(",", $index);
$nodes = $this->getXpathNodes($this->dom, $xPath);
if (count($nodes) > 0)
{
$children = $nodes[$indices[0]]->child_nodes();
if (count($children) > 0)
{
$j = 0;
for ($i = 0; $i < count($children); $i++)
{
if ($children[$i]->node_name() == $name)
{
if ($j == $indices[1])
{
$children[$i]->unlink_node();
return true;
}
$j++;
}
}
}
}
}
else
{
$nodes = $this->getXpathNodes($this->dom, $xPath . "/" . $name);
if (count($nodes) > 0)
{
$nodes[$index]->unlink_node();
return true;
}
}
return false;
}

+ Here is the call graph for this function:

ilNestedSetXML::endElement (   $parser,
  $name 
)

method called at a closing tag private

Parameters
parserparser xml-parser-handle
stringname name of the closing tag

Definition at line 209 of file class.ilNestedSetXML.php.

{
// {{{
$this->DEPTH--;
$this->LEFT += 1;
$this->lastTag = "";
// }}}
}
ilNestedSetXML::endElement (   $parser,
  $name 
)

method called at a closing tag private

Parameters
parserparser xml-parser-handle
stringname name of the closing tag

Definition at line 219 of file class.ilNestedSetXML.php.

{
// {{{
$this->DEPTH--;
$this->LEFT += 1;
$this->lastTag = "";
// }}}
}
ilNestedSetXML::export (   $obj_id,
  $type 
)

Export-Function.

creates xml out of nested-set-structure

Parameters
intobj_id book-id
stringtype Object-Type of XML-Struktur
Returns
String xml-Structur
@access    public

Definition at line 304 of file class.ilNestedSetXML.php.

References $obj_id, $result, $row, and ilDB\isDbError().

Referenced by initDom().

{
// {{{
$result = $this->db->queryF('
SELECT * FROM xmlnestedset,xmltags
WHERE ns_tag_fk = tag_pk
AND ns_book_fk = %s
AND ns_type = %s
ORDER BY ns_l',
array('integer','text'),
array($obj_id,$type));
{
die($this->className."::checkTable(): ".$result->getMessage().":<br>".$q);
}
$xml = "";
$lastDepth = -1;
while (is_array($row = $this->db->fetchAssoc($result)))
{
// {{{ tags
$Anfang = "<".$row[tag_name];
$result_param = $this->db->queryF('SELECT * FROM xmlparam WHERE tag_fk = %s',array('integer'),array($row[tag_pk]));
while (is_array($row_param = $this->db->fetchAssoc($result_param)))
{
$param_value = $row_param[param_value];
if (is_object($this->param_modifier))
{
$obj =& $this->param_modifier;
$method = $this->param_modifier_method;
$param_value = $obj->$method($row[tag_name], $row_param[param_name], $param_value);
}
$Anfang .= " ".$row_param[param_name]."=\"".$param_value."\"";
}
$Anfang .= ">";
$Ende = "</".$row[tag_name].">";
// }}}
// {{{ TagValue
if ($row[tag_name]=="TAGVALUE")
{
$result_value = $this->db->queryF('SELECT * FROM xmlvalue WHERE tag_fk = %s', array('integer'),array($row[tag_pk]));
$row_value = $this->db->fetchAssoc($result_value);
$Anfang = $row_value["tag_value"];
$Ende = "";
$Anfang = htmlspecialchars($Anfang);
// $Anfang = utf8_encode($Anfang);
}
// }}}
$D = $row[tag_depth];
if ($D==$lastDepth)
{
$xml .= $xmlE[$D];
$xml .= $Anfang;
$xmlE[$D] = $Ende;
}
else if ($D>$lastDepth)
{
$xml .= $Anfang;
$xmlE[$D] = $Ende;
}
else
{
for ($i=$lastDepth;$i>=$D;$i--)
{
$xml .= $xmlE[$i];
}
$xml .= $Anfang;
$xmlE[$D] = $Ende;
}
$lastDepth = $D;
}
for ($i=$lastDepth;$i>0;$i--)
{
$xml .= $xmlE[$i];
}
return($xml);
// }}}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilNestedSetXML::export (   $obj_id,
  $type 
)

Export-Function.

creates xml out of nested-set-structure

Parameters
intobj_id book-id
stringtype Object-Type of XML-Struktur
Returns
String xml-Structur
@access    public

Definition at line 315 of file class.ilNestedSetXML.php.

References $ilDB, $obj_id, $query, $result, $row, and DB_FETCHMODE_ASSOC.

{
// {{{
global $ilDB;
$query = "SELECT * FROM xmlnestedset,xmltags WHERE ns_tag_fk = tag_pk AND ns_book_fk = ".$ilDB->quote($obj_id)." AND ns_type = ".$ilDB->quote($type)." ORDER BY ns_l";
$result = $this->db->query($query);
if (DB::isError($result))
{
die($this->className."::checkTable(): ".$result->getMessage().":<br>".$query);
}
$xml = "";
$lastDepth = -1;
while (is_array($row = $result->fetchRow(DB_FETCHMODE_ASSOC) ) )
{
// {{{ tags
$Anfang = "<".$row[tag_name];
$query = "SELECT * FROM xmlparam WHERE tag_fk = ".$ilDB->quote($row[tag_pk])." ";
$result_param = $this->db->query($query);
while (is_array($row_param = $result_param->fetchRow(DB_FETCHMODE_ASSOC) ) )
{
$param_value = $row_param[param_value];
if (is_object($this->param_modifier))
{
$obj =& $this->param_modifier;
$method = $this->param_modifier_method;
$param_value = $obj->$method($row[tag_name], $row_param[param_name], $param_value);
}
$Anfang .= " ".$row_param[param_name]."=\"".$param_value."\"";
}
$Anfang .= ">";
$Ende = "</".$row[tag_name].">";
// }}}
// {{{ TagValue
if ($row[tag_name]=="TAGVALUE")
{
$query = "SELECT * FROM xmlvalue WHERE tag_fk = ".$ilDB->quote($row[tag_pk])." ";
$result_value = $this->db->query($query);
$row_value = $result_value->fetchRow(DB_FETCHMODE_ASSOC);
$Anfang = $row_value["tag_value"];
$Ende = "";
$Anfang = htmlspecialchars($Anfang);
// $Anfang = utf8_encode($Anfang);
}
// }}}
$D = $row[tag_depth];
if ($D==$lastDepth)
{
$xml .= $xmlE[$D];
$xml .= $Anfang;
$xmlE[$D] = $Ende;
}
else if ($D>$lastDepth)
{
$xml .= $Anfang;
$xmlE[$D] = $Ende;
}
else
{
for ($i=$lastDepth;$i>=$D;$i--)
{
$xml .= $xmlE[$i];
}
$xml .= $Anfang;
$xmlE[$D] = $Ende;
}
$lastDepth = $D;
}
for ($i=$lastDepth;$i>0;$i--)
{
$xml .= $xmlE[$i];
}
return($xml);
// }}}
}
ilNestedSetXML::getDomContent (   $xPath,
  $name = "",
  $index = 0 
)

returns all contents of this node

Parameters
stringxPath
stringname
integerindex
Returns
string content public

Definition at line 1213 of file class.ilNestedSetXML.php.

References getXpathNodes().

{
if ($index == "")
{
$index = 0;
}
# echo "Index: " . $index . " | Path: " . $xPath . " | Name: " . $name . "<br>\n";
$nodes = $this->getXpathNodes($this->dom, $xPath);
if (count($nodes) > 0)
{
$children = $nodes[$index]->child_nodes();
if (count($children) > 0)
{
$k = 0;
for ($i = 0; $i < count($children); $i++)
{
//echo "<br>ilNestedSetXML::getDomContent-".$children[$i]->node_name()."-".$name;
if ($name == "" ||
$children[$i]->node_name() == $name)
{
$content[$k]["value"] = $children[$i]->get_content();
$a = $children[$i]->attributes();
for ($j = 0; $j < count($a); $j++)
{
$content[$k][$a[$j]->name()] = $a[$j]->value();
}
$k++;
}
}
# vd($content);
return($content);
}
}
return false;
}

+ Here is the call graph for this function:

ilNestedSetXML::getDomContent (   $xPath,
  $name = "",
  $index = 0 
)

returns all contents of this node

Parameters
stringxPath
stringname
integerindex
Returns
string content public

Definition at line 1240 of file class.ilNestedSetXML.php.

References getXpathNodes().

{
if ($index == "")
{
$index = 0;
}
# echo "Index: " . $index . " | Path: " . $xPath . " | Name: " . $name . "<br>\n";
$nodes = $this->getXpathNodes($this->dom, $xPath);
if (count($nodes) > 0)
{
$children = $nodes[$index]->child_nodes();
if (count($children) > 0)
{
$k = 0;
for ($i = 0; $i < count($children); $i++)
{
//echo "<br>ilNestedSetXML::getDomContent-".$children[$i]->node_name()."-".$name;
if ($name == "" ||
$children[$i]->node_name() == $name)
{
$content[$k]["value"] = $children[$i]->get_content();
$a = $children[$i]->attributes();
for ($j = 0; $j < count($a); $j++)
{
$content[$k][$a[$j]->name()] = $a[$j]->value();
}
$k++;
}
}
# vd($content);
return($content);
}
}
return false;
}

+ Here is the call graph for this function:

ilNestedSetXML::getFirstDomContent (   $xPath)

returns first content of this node

Parameters
stringxPath path
Returns
string content of node public

Definition at line 655 of file class.ilNestedSetXML.php.

References getXpathNodes().

{
//echo "<br>ilNestedSetXML::getFirstDomContent-start-$xPath-"; flush();
$content = "";
if (is_object($this->dom))
{
$node = $this->getXpathNodes($this->dom,$xPath);
if (is_array($node))
{
$c = $node[0]->children();
//$content = $c[0]->content; // ## changed
if (is_object($c[0]))
{
$content = $c[0]->get_content(); // ## changed
}
}
}
//echo "<br>ilNestedSetXML::getFirstDomContent-stop-$content-"; flush();
return($content);
}

+ Here is the call graph for this function:

ilNestedSetXML::getFirstDomContent (   $xPath)

returns first content of this node

Parameters
stringxPath path
Returns
string content of node public

Definition at line 678 of file class.ilNestedSetXML.php.

References getXpathNodes().

{
//echo "<br>ilNestedSetXML::getFirstDomContent-start-$xPath-"; flush();
$content = "";
if (is_object($this->dom))
{
$node = $this->getXpathNodes($this->dom,$xPath);
if (is_array($node))
{
if (is_object($node[0]))
{
$c = $node[0]->children();
//$content = $c[0]->content; // ## changed
if (is_object($c[0]))
{
$content = $c[0]->get_content(); // ## changed
}
}
}
}
//echo "<br>ilNestedSetXML::getFirstDomContent-stop-$content-"; flush();
return($content);
}

+ Here is the call graph for this function:

ilNestedSetXML::getFirstDomNode (   $xPath)

first dom-node

Parameters
stringxPath path
Returns
object node first node public

Definition at line 1364 of file class.ilNestedSetXML.php.

References getXpathNodes().

{
$node = $this->getXpathNodes($this->dom,$xPath);
return($node[0]);
}

+ Here is the call graph for this function:

ilNestedSetXML::getFirstDomNode (   $xPath)

first dom-node

Parameters
stringxPath path
Returns
object node first node public

Definition at line 1391 of file class.ilNestedSetXML.php.

References getXpathNodes().

{
$node = $this->getXpathNodes($this->dom,$xPath);
return($node[0]);
}

+ Here is the call graph for this function:

ilNestedSetXML::getTagName ( )

find first tag-name

Returns
string tagname

public

Definition at line 436 of file class.ilNestedSetXML.php.

References $result, and $row.

{
$this->db->setLimit(1);
$result = $this->db->queryF('
SELECT * FROM xmlnestedset,xmltags
WHERE ns_book_fk = %s
AND ns_type = %s
AND ns_l = %s
AND ns_r = %s
AND ns_tag_fk = tag_pk',
array('integer','text','integer','integer'),
array($this->obj_id,$this->obj_type,$this->LEFT,$this->RIGHT));
$row = $this->db->fetchAssoc($result);
return($row["tag_name"]);
}
ilNestedSetXML::getTagName ( )

find first tag-name

Returns
string tagname

public

Definition at line 436 of file class.ilNestedSetXML.php.

References $ilDB, $query, $result, $row, and DB_FETCHMODE_ASSOC.

{
global $ilDB;
$this->db->setLimit(1);
$query = "SELECT * FROM xmlnestedset,xmltags WHERE ns_book_fk = ".$ilDB->quote($this->obj_id)." AND ns_type = ".$ilDB->quote($this->obj_type)." AND ns_l = ".$ilDB->quote($this->LEFT)." AND ns_r = ".$ilDB->quote($this->RIGHT)." AND ns_tag_fk = tag_pk";
$result = $this->db->query($query);
return($row["tag_name"]);
}
ilNestedSetXML::getTagValue ( )

get tag content

Returns
array Content or sub-tags inbetween $this->LEFT and $this->RIGHT. public

Definition at line 481 of file class.ilNestedSetXML.php.

References $ilDB, $obj_id, $obj_type, $query, $result, $row, and DB_FETCHMODE_ASSOC.

{
global $ilDB;
$V = array();
$query = "SELECT * FROM xmlnestedset,xmltags WHERE ns_tag_fk = tag_pk AND ns_book_fk = ".$ilDB->quote($this->obj_id)." AND ns_type = ".$ilDB->quote($this->obj_type)." AND ns_l >= ".$ilDB->quote($this->LEFT)." AND ns_r <= ".$ilDB->quote($this->RIGHT)." AND tag_depth = ".$ilDB->quote(($this->DEPTH+1))." ORDER BY ns_l";
$result = $this->db->query($query);
while (is_array($row = $result->fetchRow(DB_FETCHMODE_ASSOC) ) )
{
if ($row[tag_name]=="TAGVALUE")
{
$query = "SELECT * FROM xmlvalue WHERE tag_fk = ".$ilDB->quote($row[tag_pk])." ";
$result2 = $this->db->query($query);
$row2 = $result2->fetchRow(DB_FETCHMODE_ASSOC);
$V[] = $row2[tag_value];
}
else
{
$xml = new ilNestedSetXml();
$xml->LEFT = $row["ns_l"];
$xml->RIGHT = $row["ns_r"];
$xml->DEPTH = $row["tag_depth"];
$xml->obj_id = $obj_id;
$xml->obj_type = $obj_type;
$V[] = $xml;
}
}
return($V);
}
ilNestedSetXML::getTagValue ( )

get tag content

Returns
array Content or sub-tags inbetween $this->LEFT and $this->RIGHT. public

Definition at line 497 of file class.ilNestedSetXML.php.

References $obj_id, $obj_type, $result, and $row.

{
$V = array();
$result = $this->db->queryF('
SELECT * FROM xmlnestedset,xmltags
WHERE ns_tag_fk = tag_pk
AND ns_book_fk = %s
AND ns_type = %s
AND ns_l >= %s
AND ns_r <= %s
AND tag_depth = %s
ORDER BY ns_l',
array('integer','text','integer','integer','integer'),
array($this->obj_id,$this->obj_type,$this->LEFT,$this->RIGHT,$this->DEPTH+1));
while (is_array($row = $this->db->fetchAssoc($result) ) )
{
if ($row[tag_name]=="TAGVALUE")
{
$result2 = $this->db->queryF('SELECT * FROM xmlvalue WHERE tag_fk = %s', array('integer'),array($row[tag_pk]));
$row2 = $this->db->fetchAssoc($result2);
$V[] = $row2[tag_value];
}
else
{
$xml = new ilNestedSetXml();
$xml->LEFT = $row["ns_l"];
$xml->RIGHT = $row["ns_r"];
$xml->DEPTH = $row["tag_depth"];
$xml->obj_id = $obj_id;
$xml->obj_type = $obj_type;
$V[] = $xml;
}
}
return($V);
}
ilNestedSetXML::getXpathNodes ( $doc,
  $qry 
)

get node in dom-structure

Parameters
objectdoc
stringqry path to node
Returns
object nodeset public

Definition at line 566 of file class.ilNestedSetXML.php.

References $result.

{
if (is_object($doc))
{
$xpath = $doc->xpath_init();
$ctx = $doc->xpath_new_context();
//echo "<br><b>ilNestedSetXML::getXpathNodes</b>";
$result = $ctx->xpath_eval($qry);
if (is_array($result->nodeset))
{
return($result->nodeset);
}
}
return Null;
}
ilNestedSetXML::getXpathNodes ( $doc,
  $qry 
)

get node in dom-structure

Parameters
objectdoc
stringqry path to node
Returns
object nodeset public

Definition at line 591 of file class.ilNestedSetXML.php.

References $result.

Referenced by addDomNode(), addXMLNode(), deleteDomNode(), getDomContent(), getFirstDomContent(), getFirstDomNode(), replaceDomContent(), updateDomContent(), and updateDomNode().

{
if (is_object($doc))
{
$xpath = $doc->xpath_init();
$ctx = $doc->xpath_new_context();
//echo "<br><b>ilNestedSetXML::getXpathNodes</b>";
$result = $ctx->xpath_eval($qry);
if (is_array($result->nodeset))
{
return($result->nodeset);
}
}
return Null;
}

+ Here is the caller graph for this function:

ilNestedSetXML::ilNestedSetXML ( )

Constructor initilize netsed-set variables public.

Definition at line 85 of file class.ilNestedSetXML.php.

References $ilDB, and $ilias.

{
global $ilias,$ilDB;
$this->ilias =& $ilias;
$this->db =& $ilDB;
$this->LEFT = 0;
$this->RIGHT = 0;
$this->DEPTH = 0;
$this->unique_import_id = '';
$this->param_modifier = "";
}
ilNestedSetXML::ilNestedSetXML ( )

Constructor initilize netsed-set variables public.

Definition at line 98 of file class.ilNestedSetXML.php.

References $ilDB, and $ilias.

{
global $ilias,$ilDB;
$this->ilias =& $ilias;
$this->db =& $ilDB;
$this->LEFT = 0;
$this->RIGHT = 0;
$this->DEPTH = 0;
$this->param_modifier = "";
}
ilNestedSetXML::import (   $xmldata,
  $obj_id,
  $obj_type 
)

Import-Function.

Parameters
Stringxmldata xml-structure
intobj_id book-ID
stringobj_type Object-Type
@access     public

drop temporary table

initialize XML-Parser

transfer nested-set-structure ito table and drop temp-Table

Definition at line 226 of file class.ilNestedSetXML.php.

References $obj_id, $obj_type, and deleteAllDbData().

{
global $ilUser;
// {{{
$this->obj_id = $obj_id;
$this->obj_type = $obj_type;
$this->DEPTH = 0;
$this->LEFT = 0;
$this->RIGHT = 0;
$this->unique_import_id = $ilUser->getId();
$this->db->manipulateF(
"DELETE FROM xmlnestedsettmp WHERE ns_unique_id = %s",
array('text'),
array($this->unique_import_id)
);
$this->xml_parser = xml_parser_create("UTF-8");
xml_parser_set_option($this->xml_parser, XML_OPTION_CASE_FOLDING, false);
xml_set_object($this->xml_parser,$this);
xml_set_element_handler($this->xml_parser, "startElement", "endElement");
xml_set_character_data_handler($this->xml_parser, "characterData");
if (!xml_parse($this->xml_parser, $xmldata)) {
die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($this->xml_parser)),xml_get_current_line_number($this->xml_parser)));
}
xml_parser_free($this->xml_parser);
$this->deleteAllDbData();
$this->db->manipulateF(
"INSERT INTO xmlnestedset (SELECT ns_book_fk, ns_type, ns_tag_fk, ns_l, ns_r FROM xmlnestedsettmp WHERE ns_unique_id = %s)",
array('text'),
array($this->unique_import_id)
);
$this->db->manipulateF(
"DELETE FROM xmlnestedsettmp WHERE ns_unique_id = %s",
array('text'),
array($this->unique_import_id)
);
// }}}
}

+ Here is the call graph for this function:

ilNestedSetXML::import (   $xmldata,
  $obj_id,
  $obj_type 
)

Import-Function.

Parameters
Stringxmldata xml-structure
intobj_id book-ID
stringobj_type Object-Type
@access     public

drop temporary table

create new temp-Table

initialize XML-Parser

transfer nested-set-structure ito table and drop temp-Table

Definition at line 236 of file class.ilNestedSetXML.php.

References $obj_id, $obj_type, and deleteAllDbData().

{
// {{{
$this->db->query("DROP TABLE IF EXISTS NestedSetTemp");
$Q = "CREATE TEMPORARY TABLE NestedSetTemp (
ns_book_fk int(11) NOT NULL,
ns_type char(50) NOT NULL,
ns_tag_fk int(11) NOT NULL,
ns_l int(11) NOT NULL,
ns_r int(11) NOT NULL,
KEY ns_tag_fk (ns_tag_fk),
KEY ns_l (ns_l),
KEY ns_r (ns_r),
KEY ns_book_fk (ns_book_fk)
) TYPE=MyISAM ";
$this->db->query($Q);
$this->obj_id = $obj_id;
$this->obj_type = $obj_type;
$this->DEPTH = 0;
$this->LEFT = 0;
$this->RIGHT = 0;
$this->db->query("DELETE FROM NestedSetTemp");
$this->xml_parser = xml_parser_create("UTF-8");
xml_parser_set_option($this->xml_parser, XML_OPTION_CASE_FOLDING, false);
xml_set_object($this->xml_parser,$this);
xml_set_element_handler($this->xml_parser, "startElement", "endElement");
xml_set_character_data_handler($this->xml_parser, "characterData");
if (!xml_parse($this->xml_parser, $xmldata)) {
die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($this->xml_parser)),xml_get_current_line_number($this->xml_parser)));
}
xml_parser_free($this->xml_parser);
$this->deleteAllDbData();
$this->db->query("INSERT INTO xmlnestedset SELECT * FROM NestedSetTemp");
$this->db->query("DROP TABLE IF EXISTS NestedSetTemp");
// }}}
}

+ Here is the call graph for this function:

ilNestedSetXML::init (   $obj_id,
  $obj_type 
)

initilialize Nested-Set-Structur

Parameters
integerobj_id object-id
stringobj_type type of object public

Definition at line 405 of file class.ilNestedSetXML.php.

References $obj_id, $obj_type, $result, and $row.

{
// {{{
$this->db->setLimit(1);
$result = $this->db->queryF('
SELECT * FROM xmlnestedset,xmltags
WHERE ns_book_fk = %s
AND ns_type = %s
AND ns_tag_fk = tag_pk
ORDER BY ns_l',
array('integer','text'),
array($obj_id, $obj_type));
$row = $this->db->fetchAssoc($result);
$this->LEFT = $row["ns_l"];
$this->RIGHT = $row["ns_r"];
$this->DEPTH = $row["tag_depth"];
$this->obj_id = $obj_id;
$this->obj_type = $obj_type;
// }}}
}
ilNestedSetXML::init (   $obj_id,
  $obj_type 
)

initilialize Nested-Set-Structur

Parameters
integerobj_id object-id
stringobj_type type of object public

Definition at line 410 of file class.ilNestedSetXML.php.

References $ilDB, $obj_id, $obj_type, $query, $result, $row, and DB_FETCHMODE_ASSOC.

{
global $ilDB;
// {{{
$this->db->setLimit(1);
$query = "SELECT * FROM xmlnestedset,xmltags WHERE ns_book_fk = ".$ilDB->quote($obj_id)." AND ns_type =".
$ilDB->quote($obj_type)." AND ns_tag_fk=tag_pk ORDER BY ns_l";
$result = $this->db->query($query);
$this->LEFT = $row["ns_l"];
$this->RIGHT = $row["ns_r"];
$this->DEPTH = $row["tag_depth"];
$this->obj_id = $obj_id;
$this->obj_type = $obj_type;
// }}}
}
ilNestedSetXML::initDom ( )

inits dom-object from given xml-content

Returns
boolean public

Definition at line 588 of file class.ilNestedSetXML.php.

References domxml_open_mem(), and export().

{
$xml = $this->export($this->obj_id, $this->obj_type);
/*
for testing
$xml_test = '
<MetaData>
<General Structure="Atomic">
<Identifier Catalog="ILIAS" Entry="34">Identifier 34 in ILIAS</Identifier>
<Identifier Catalog="ILIAS" Entry="45">Identifier 45 in ILIAS</Identifier>
<Identifier Catalog="ILIAS" Entry="67">Identifier 67 in ILIAS</Identifier>
</General>
</MetaData>
';
$xml = $xml_test;
*/
if ($xml=="")
{
return(false);
}
else
{
$this->dom = domxml_open_mem($xml);
return(true);
}
}

+ Here is the call graph for this function:

ilNestedSetXML::initDom ( )

inits dom-object from given xml-content

Returns
boolean public

Definition at line 613 of file class.ilNestedSetXML.php.

References domxml_open_mem(), and export().

{
$xml = $this->export($this->obj_id, $this->obj_type);
/*
for testing
$xml_test = '
<MetaData>
<General Structure="Atomic">
<Identifier Catalog="ILIAS" Entry="34">Identifier 34 in ILIAS</Identifier>
<Identifier Catalog="ILIAS" Entry="45">Identifier 45 in ILIAS</Identifier>
<Identifier Catalog="ILIAS" Entry="67">Identifier 67 in ILIAS</Identifier>
</General>
</MetaData>
';
$xml = $xml_test;
*/
if ($xml=="")
{
return(false);
}
else
{
$this->dom = domxml_open_mem($xml);
return(true);
}
}

+ Here is the call graph for this function:

ilNestedSetXML::replace_content ( $node,
$new_content 
)

Replace node contents.

Needed as a workaround for bug/feature of set_content This version puts the content as the first child of the new node. If you need it somewhere else, simply move $newnode->set_content() where you want it.

Definition at line 1298 of file class.ilNestedSetXML.php.

{
$newnode =& $this->dom->create_element( $node->tagname() );
$newnode->set_content( $new_content );
$atts =& $node->attributes();
foreach ( $atts as $att )
{
$newnode->set_attribute( $att->name(), $att->value() );
}
$kids =& $node->child_nodes();
foreach ( $kids as $kid )
{
if ( $kid->node_type() != XML_TEXT_NODE )
{
$newnode->append_child( $kid );
}
}
$node->replace_node( $newnode );
}
ilNestedSetXML::replace_content ( $node,
$new_content 
)

Replace node contents.

Needed as a workaround for bug/feature of set_content This version puts the content as the first child of the new node. If you need it somewhere else, simply move $newnode->set_content() where you want it.

Definition at line 1325 of file class.ilNestedSetXML.php.

Referenced by replaceDomContent().

{
$newnode =& $this->dom->create_element( $node->tagname() );
$newnode->set_content( $new_content );
$atts =& $node->attributes();
foreach ( $atts as $att )
{
$newnode->set_attribute( $att->name(), $att->value() );
}
$kids =& $node->child_nodes();
foreach ( $kids as $kid )
{
if ( $kid->node_type() != XML_TEXT_NODE )
{
$newnode->append_child( $kid );
}
}
$node->replace_node( $newnode );
}

+ Here is the caller graph for this function:

ilNestedSetXML::replaceDomContent (   $xPath,
  $name = "",
  $index = 0,
  $newNode 
)

updates content of this node

Parameters
stringxPath
stringname
integerindex
arraynewNode public

Definition at line 1257 of file class.ilNestedSetXML.php.

References getXpathNodes(), and replace_content().

{
# echo "Index: " . $index . " | Path: " . $xPath . " | Name: " . $name . "<br>\n";
$nodes = $this->getXpathNodes($this->dom, $xPath);
if (count($nodes) > 0)
{
$children = $nodes[$index]->child_nodes();
if (count($children) > 0)
{
for ($i = 0; $i < count($children); $i++)
{
if ($children[$i]->node_name() == $name &&
is_array($newNode))
{
foreach ($newNode as $key => $val)
{
if ($key == "value")
{
$this->replace_content($children[$i], $val);
}
else
{
$children[$i]->set_attribute($key, $val);
}
}
}
}
}
}
}

+ Here is the call graph for this function:

ilNestedSetXML::replaceDomContent (   $xPath,
  $name = "",
  $index = 0,
  $newNode 
)

updates content of this node

Parameters
stringxPath
stringname
integerindex
arraynewNode public

Definition at line 1284 of file class.ilNestedSetXML.php.

References getXpathNodes(), and replace_content().

{
# echo "Index: " . $index . " | Path: " . $xPath . " | Name: " . $name . "<br>\n";
$nodes = $this->getXpathNodes($this->dom, $xPath);
if (count($nodes) > 0)
{
$children = $nodes[$index]->child_nodes();
if (count($children) > 0)
{
for ($i = 0; $i < count($children); $i++)
{
if ($children[$i]->node_name() == $name &&
is_array($newNode))
{
foreach ($newNode as $key => $val)
{
if ($key == "value")
{
$this->replace_content($children[$i], $val);
}
else
{
$children[$i]->set_attribute($key, $val);
}
}
}
}
}
}
}

+ Here is the call graph for this function:

ilNestedSetXML::setParameterModifier ( $a_object,
  $a_method 
)
Parameters
obja_object
Stringa_method Function-Name

Definition at line 287 of file class.ilNestedSetXML.php.

{
$this->param_modifier =& $a_object;
$this->param_modifier_method = $a_method;
}
ilNestedSetXML::setParameterModifier ( $a_object,
  $a_method 
)
Parameters
obja_object
Stringa_method Function-Name

Definition at line 298 of file class.ilNestedSetXML.php.

{
$this->param_modifier =& $a_object;
$this->param_modifier_method = $a_method;
}
ilNestedSetXML::setTagName (   $tagName)

set tag-name

Parameters
stringtagName name of tag to be changed
Returns
string old tagname

public

Definition at line 458 of file class.ilNestedSetXML.php.

References $ilDB, $query, $result, $row, and DB_FETCHMODE_ASSOC.

{
global $ilDB;
$this->db->setLimit(1);
$query = "SELECT * FROM xmlnestedset WHERE ns_book_fk = ".$ilDB->quote($this->obj_id)." AND ns_type = ".$ilDB->quote($this->obj_type)." AND ns_l = ".$ilDB->quote($this->LEFT)." AND ns_r = ".$ilDB->quote($this->RIGHT);
$result = $this->db->query($query);
$query = "UPDATE xmltags SET tag_name= ".$ilDB->quote($tagName)." WHERE tag_pk = ".$ilDB->quote($row["ns_tag_fk"]);
$this->db->query($query);
return($row["tagName"]);
}
ilNestedSetXML::setTagName (   $tagName)

set tag-name

Parameters
stringtagName name of tag to be changed
Returns
string old tagname

public

Definition at line 466 of file class.ilNestedSetXML.php.

References $result, and $row.

{
$this->db->setLimit(1);
$result = $this->db->queryF('
SELECT * FROM xmlnestedset
WHERE ns_book_fk = %s
AND ns_type = %s
AND ns_l = %s
AND ns_r = %s',
array('integer','text','integer','integer'),
array($this->obj_id,$this->obj_type,$this->LEFT,$this->RIGHT));
$row = $this->db->fetchAssoc($result);
$this->db->manipulateF('UPDATE xmltags SET tag_name = %s WHERE tag_pk = %s',
array('text','integer'), array($tagName,$row["ns_tag_fk"]));
return($row["tagName"]);
}
ilNestedSetXML::setTagValue (   $value)

set tag-content

Parameters
stringvalue public

add new

Definition at line 522 of file class.ilNestedSetXML.php.

References $ilDB, $query, $result, $row, and DB_FETCHMODE_ASSOC.

{
global $ilDB;
$V = array();
$query = "SELECT * FROM xmlnestedset,xmltags
LEFT JOIN xmlvalue ON xmltags.tag_pk=xmlvalue.tag_fk
WHERE ns_tag_fk = tag_pk AND
ns_book_fk = ".$ilDB->quote($this->obj_id)." AND
ns_type = ".$ilDB->quote($this->obj_type)." AND
ns_l >= ".$ilDB->quote($this->LEFT)." AND
ns_r <= ".$ilDB->quote($this->RIGHT)." AND
tag_depth = ".$ilDB->quote(($this->DEPTH+1))." AND
tag_name = 'TAGVALUE'
ORDER BY ns_l";
$result = $this->db->query($query);
if (is_array($row = $result->fetchRow(DB_FETCHMODE_ASSOC) ) )
{
$query = "UPDATE xmlvalue SET tag_value = ".$ilDB->quote($value)." WHERE tag_value_pk = ".$ilDB->quote($row["tag_value_pk"])." ";
$this->db->query($query);
}
else
{
}
}
ilNestedSetXML::setTagValue (   $value)

set tag-content

Parameters
stringvalue public

add new

Definition at line 546 of file class.ilNestedSetXML.php.

References $result, and $row.

{
$V = array();
$result = $this->db->queryF('
SELECT * FROM xmlnestedset,xmltags
LEFT JOIN xmlvalue ON xmltags.tag_pk = xmlvalue.tag_fk
WHERE ns_tag_fk = tag_pk
AND ns_book_fk = %s
AND ns_type = %s
AND ns_l >= %s
AND ns_r <= %s
AND tag_depth = %s
AND tag_name = %s
AND ORDER BY ns_l',
array('integer','text','integer','integer','integer','text'),
array($this->obj_id, $this->obj_type, $this->LEFT, $this->RIGHT, $this->DEPTH+1,'TAGVALUE')
);
if (is_array($row = $this->db->fetchAssoc($result) ) )
{
$this->db->manipulateF('UPDATE xmlvalue SET tag_value = %s WHERE tag_value_pk = %s',
array('text','integer'), array($value, $row["tag_value_pk"]));
}
else
{
}
}
ilNestedSetXML::startElement (   $parser,
  $name,
  $attrs 
)

Method is called, at an introductory TAG private.

Parameters
parserparser xml-parser-handle
stringname the tag-name
arrayattrs assoziativ-array of all attributes inside the tag
Returns
integer pk Primary-Key of inserted xmltag

Insert Tag-Name

Definition at line 111 of file class.ilNestedSetXML.php.

References clean().

{
// {{{
$this->lastTag = $name;
$this->LEFT += 1;
$this->RIGHT = $this->LEFT + 1;
$this->DEPTH++;
$nextId = $this->db->nextId('xmltags');
$this->db->manipulateF('INSERT INTO xmltags ( tag_pk,tag_name,tag_depth ) VALUES (%s,%s,%s)',
array('integer','text','integer'), array($nextId, $name, $this->DEPTH));
$pk = $nextId;
$this->db->manipulateF('
UPDATE xmlnestedsettmp SET ns_r = ns_r+2
WHERE ns_r >= %s AND ns_book_fk = %s AND ns_unique_id = %s',
array('integer','integer', 'text'), array($this->LEFT, $this->obj_id, $this->unique_import_id));
$this->db->manipulateF('
INSERT INTO xmlnestedsettmp (ns_unique_id, ns_book_fk, ns_type, ns_tag_fk, ns_l, ns_r) VALUES (%s,%s,%s,%s,%s,%s)',
array('text','integer','text','integer','integer','integer'),
array($this->unique_import_id, $this->obj_id, $this->obj_type, $pk, $this->LEFT, $this->RIGHT));
$this->clean($attrs);
if (is_array($attrs) && count($attrs)>0)
{
reset ($attrs);
while (list ($key, $val) = each ($attrs))
{
$this->db->manipulateF('INSERT INTO xmlparam ( tag_fk,param_name,param_value ) VALUES (%s,%s,%s)',
array('integer','text','text'),
array($pk,$key,addslashes($val)));
}
}
return($pk);
// }}}
}

+ Here is the call graph for this function:

ilNestedSetXML::startElement (   $parser,
  $name,
  $attrs 
)

Method is called, at an introductory TAG private.

Parameters
parserparser xml-parser-handle
stringname the tag-name
arrayattrs assoziativ-array of all attributes inside the tag
Returns
integer pk Primary-Key of inserted xmltag

Insert Tag-Name

Definition at line 123 of file class.ilNestedSetXML.php.

References $ilDB, $row, and clean().

{
// {{{
global $ilDB;
$this->lastTag = $name;
$this->LEFT += 1;
$this->RIGHT = $this->LEFT + 1;
$this->DEPTH++;
$this->db->query("INSERT INTO xmltags ( tag_name,tag_depth ) VALUES (".$ilDB->quote($name).",".$ilDB->quote($this->DEPTH).") ");
// $pk = mysql_insert_id();
$r = $this->db->query("SELECT LAST_INSERT_ID()");
$row = $r->fetchRow();
$pk = $row[0];
$Q = "UPDATE NestedSetTemp SET ns_r=ns_r+2 WHERE ns_r >= ".$ilDB->quote($this->LEFT)." AND ns_book_fk = ".$ilDB->quote($this->obj_id)." ";
$this->db->query($Q);
$Q = "INSERT INTO NestedSetTemp (ns_book_fk,ns_type,ns_tag_fk,ns_l,ns_r) VALUES (".$ilDB->quote($this->obj_id).",".$ilDB->quote($this->obj_type).",".$ilDB->quote($pk).",".$ilDB->quote($this->LEFT).",".$ilDB->quote($this->RIGHT).") ";
$this->db->query($Q);
$this->clean($attrs);
if (is_array($attrs) && count($attrs)>0)
{
reset ($attrs);
while (list ($key, $val) = each ($attrs))
{
$this->db->query("INSERT INTO xmlparam ( tag_fk,param_name,param_value ) VALUES (".$ilDB->quote($pk).",".$ilDB->quote($key).",".$ilDB->quote($val).") ");
}
}
return($pk);
// }}}
}

+ Here is the call graph for this function:

ilNestedSetXML::updateDomContent (   $xPath,
  $name = "",
  $index = 0,
  $newNode 
)

updates content of this node

Parameters
stringxPath
stringname
integerindex
arraynewNode public

Definition at line 1326 of file class.ilNestedSetXML.php.

References getXpathNodes().

{
// echo "Index: " . $index . " | Path: " . $xPath . " | Name: " . $name . "<br>\n";
$nodes = $this->getXpathNodes($this->dom, $xPath);
if (count($nodes) > 0)
{
$children = $nodes[$index]->child_nodes();
if (count($children) > 0)
{
for ($i = 0; $i < count($children); $i++)
{
if ($children[$i]->node_name() == $name &&
is_array($newNode))
{
foreach ($newNode as $key => $val)
{
if ($key == "value")
{
$children[$i]->set_content($val);
}
else
{
$children[$i]->set_attribute($key, $val);
}
}
}
}
}
}
}

+ Here is the call graph for this function:

ilNestedSetXML::updateDomContent (   $xPath,
  $name = "",
  $index = 0,
  $newNode 
)

updates content of this node

Parameters
stringxPath
stringname
integerindex
arraynewNode public

Definition at line 1353 of file class.ilNestedSetXML.php.

References getXpathNodes().

{
// echo "Index: " . $index . " | Path: " . $xPath . " | Name: " . $name . "<br>\n";
$nodes = $this->getXpathNodes($this->dom, $xPath);
if (count($nodes) > 0)
{
$children = $nodes[$index]->child_nodes();
if (count($children) > 0)
{
for ($i = 0; $i < count($children); $i++)
{
if ($children[$i]->node_name() == $name &&
is_array($newNode))
{
foreach ($newNode as $key => $val)
{
if ($key == "value")
{
$children[$i]->set_content($val);
}
else
{
$children[$i]->set_attribute($key, $val);
}
}
}
}
}
}
}

+ Here is the call graph for this function:

ilNestedSetXML::updateDomNode (   $xPath,
  $meta,
  $no = 0 
)

updates dom node

Parameters
stringxPath
stringmeta
integerno public

Definition at line 796 of file class.ilNestedSetXML.php.

References addXMLNode(), clean(), getXpathNodes(), and ilUtil\stripSlashes().

{
$this->clean($meta);
$update = false;
if ($xPath == "//Bibliography")
{
$nodes = $this->getXpathNodes($this->dom, $xPath . "/BibItem[" . ($no+1) . "]");
}
else
{
$nodes = $this->getXpathNodes($this->dom, $xPath);
}
if (count($nodes) > 0)
{
/* BibItem */
if ($nodes[0]->node_name() == "BibItem")
{
$xml = '<BibItem Type="' . ilUtil::stripSlashes($meta["Type"]) . '" Label="' . ilUtil::stripSlashes($meta["Label"]["Value"]) . '">';
$xml .= '<Identifier Catalog="' . ilUtil::stripSlashes($meta["Identifier"]["Catalog"]) . '" Entry="' . str_replace("\"", "", ilUtil::stripSlashes($meta["Identifier"]["Entry"])) . '"/>';
for ($i = 0; $i < count($meta["Language"]); $i++)
{
$xml .= '<Language Language="' . ilUtil::stripSlashes($meta["Language"][$i]["Language"]) . '"/>';
}
for ($i = 0; $i < count($meta["Author"]); $i++)
{
$xml .= '<Author>';
# for ($j = 0; $j < count($meta["Author"][$i]["FirstName"]); $j++)
# {
$xml .= '<FirstName>' . ilUtil::stripSlashes($meta["Author"][$i]["FirstName"]) . '</FirstName>';
# }
# for ($j = 0; $j < count($meta["Author"][$i]["MiddleName"]); $j++)
# {
$xml .= '<MiddleName>' . ilUtil::stripSlashes($meta["Author"][$i]["MiddleName"]) . '</MiddleName>';
# }
# for ($j = 0; $j < count($meta["Author"][$i]["LastName"]); $j++)
# {
$xml .= '<LastName>' . ilUtil::stripSlashes($meta["Author"][$i]["LastName"]) . '</LastName>';
# }
$xml .= '</Author>';
}
$xml .= '<Booktitle Language="' . ilUtil::stripSlashes($meta["Booktitle"]["Language"]) . '">' . ilUtil::stripSlashes($meta["Booktitle"]["Value"]) . '</Booktitle>';
for ($i = 0; $i < count($meta["CrossRef"]); $i++)
{
$xml .= '<CrossRef>' . ilUtil::stripSlashes($meta["CrossRef"][$i]["Value"]) . '</CrossRef>';
}
$xml .= '<Edition>' . ilUtil::stripSlashes($meta["Edition"]["Value"]) . '</Edition>';
for ($i = 0; $i < count($meta["Editor"]); $i++)
{
$xml .= '<Editor>' . ilUtil::stripSlashes($meta["Editor"][$i]["Value"]) . '</Editor>';
}
$xml .= '<HowPublished Type="' . ilUtil::stripSlashes($meta["HowPublished"]["Type"]) . '"/>';
for ($i = 0; $i < count($meta["WherePublished"]); $i++)
{
$xml .= '<WherePublished>' . ilUtil::stripSlashes($meta["WherePublished"][$i]["Value"]) . '</WherePublished>';
}
for ($i = 0; $i < count($meta["Institution"]); $i++)
{
$xml .= '<Institution>' . ilUtil::stripSlashes($meta["Institution"][$i]["Value"]) . '</Institution>';
}
if (is_array($meta["Journal"]))
{
$xml .= '<Journal Note="' . ilUtil::stripSlashes($meta["Journal"]["Note"]) . '" Number="' . ilUtil::stripSlashes($meta["Journal"]["Number"]) . '" Organization="' . ilUtil::stripSlashes($meta["Journal"]["Organization"]) . '"/>';
}
for ($i = 0; $i < count($meta["Keyword"]); $i++)
{
$xml .= '<Keyword Language="' . ilUtil::stripSlashes($meta["Keyword"][$i]["Language"]) . '">' . ilUtil::stripSlashes($meta["Keyword"][$i]["Value"]) . '</Keyword>';
}
if (is_array($meta["Month"]))
{
$xml .= '<Month>' . ilUtil::stripSlashes($meta["Month"]["Value"]) . '</Month>';
}
if (is_array($meta["Pages"]))
{
$xml .= '<Pages>' . ilUtil::stripSlashes($meta["Pages"]["Value"]) . '</Pages>';
}
$xml .= '<Publisher>' . ilUtil::stripSlashes($meta["Publisher"]["Value"]) . '</Publisher>';
for ($i = 0; $i < count($meta["School"]); $i++)
{
$xml .= '<School>' . ilUtil::stripSlashes($meta["School"][$i]["Value"]) . '</School>';
}
if (is_array($meta["Series"]))
{
$xml .= '<Series>';
$xml .= '<SeriesTitle>' . ilUtil::stripSlashes($meta["Series"]["SeriesTitle"]) . '</SeriesTitle>';
# for ($i = 0; $i < count($meta["Series"]["SeriesEditor"]); $i++)
if (isset($meta["Series"]["SeriesEditor"]))
{
# $xml .= '<SeriesEditor>' . ilUtil::stripSlashes($meta["Series"]["SeriesEditor"][$i]) . '</SeriesEditor>';
$xml .= '<SeriesEditor>' . ilUtil::stripSlashes($meta["Series"]["SeriesEditor"]) . '</SeriesEditor>';
}
if (isset($meta["Series"]["SeriesVolume"]))
{
$xml .= '<SeriesVolume>' . ilUtil::stripSlashes($meta["Series"]["SeriesVolume"]) . '</SeriesVolume>';
}
$xml .= '</Series>';
}
$xml .= '<Year>' . ilUtil::stripSlashes($meta["Year"]["Value"]) . '</Year>';
if ($meta["URL_ISBN_ISSN"]["Type"] == "URL")
{
$xml .= '<URL>' . ilUtil::stripSlashes($meta["URL_ISBN_ISSN"]["Value"]) . '</URL>';
}
else if ($meta["URL_ISBN_ISSN"]["Type"] == "ISBN")
{
$xml .= '<ISBN>' . ilUtil::stripSlashes($meta["URL_ISBN_ISSN"]["Value"]) . '</ISBN>';
}
else if ($meta["URL_ISBN_ISSN"]["Type"] == "ISSN")
{
$xml .= '<ISSN>' . ilUtil::stripSlashes($meta["URL_ISBN_ISSN"]["Value"]) . '</ISSN>';
}
$xml .= '</BibItem>';
# echo htmlspecialchars($xml);
$update = true;
}
/* General */
else if ($nodes[0]->node_name() == "General")
{
$xml = '<General Structure="' . ilUtil::stripSlashes($meta["Structure"]) . '">';
for ($i = 0; $i < count($meta["Identifier"]); $i++)
{
$xml .= '<Identifier Catalog="' . ilUtil::stripSlashes($meta["Identifier"][$i]["Catalog"]) . '" Entry="' .
str_replace("\"", "", ilUtil::stripSlashes($meta["Identifier"][$i]["Entry"])) . '"/>';
}
$xml .= '<Title Language="' .
ilUtil::stripSlashes($meta["Title"]["Language"]) . '">' .
ilUtil::stripSlashes($meta["Title"]["Value"]) . '</Title>';
for ($i = 0; $i < count($meta["Language"]); $i++)
{
$xml .= '<Language Language="' . ilUtil::stripSlashes($meta["Language"][$i]["Language"]) . '"/>';
}
for ($i = 0; $i < count($meta["Description"]); $i++)
{
$xml .= '<Description Language="' . ilUtil::stripSlashes($meta["Description"][$i]["Language"]) . '">' . ilUtil::stripSlashes($meta["Description"][$i]["Value"]) . '</Description>';
}
for ($i = 0; $i < count($meta["Keyword"]); $i++)
{
$xml .= '<Keyword Language="' . ilUtil::stripSlashes($meta["Keyword"][$i]["Language"]) . '">' . ilUtil::stripSlashes($meta["Keyword"][$i]["Value"]) . '</Keyword>';
}
if ($meta["Coverage"] != "")
{
$xml .= '<Coverage Language="' . ilUtil::stripSlashes($meta["Coverage"]["Language"]) . '">' . ilUtil::stripSlashes($meta["Coverage"]["Value"]) . '</Coverage>';
}
$xml .= '</General>';
//echo "<br><br>".htmlspecialchars($xml);
$update = true;
}
/* Lifecycle */
else if ($nodes[0]->node_name() == "Lifecycle")
{
$xml = '<Lifecycle Status="' . $meta["Status"] . '">';
$xml .= '<Version Language="' . ilUtil::stripSlashes($meta["Version"]["Language"]) . '">' . ilUtil::stripSlashes($meta["Version"]["Value"]) . '</Version>';
for ($i = 0; $i < count($meta["Contribute"]); $i++)
{
$xml .= '<Contribute Role="' . ilUtil::stripSlashes($meta["Contribute"][$i]["Role"]) . '">';
$xml .= '<Date>' . ilUtil::stripSlashes($meta["Contribute"][$i]["Date"]) . '</Date>';
for ($j = 0; $j < count($meta["Contribute"][$i]["Entity"]); $j++)
{
$xml .= '<Entity>' . ilUtil::stripSlashes($meta["Contribute"][$i]["Entity"][$j]) . '</Entity>';
}
$xml .= '</Contribute>';
}
$xml .= '</Lifecycle>';
# echo htmlspecialchars($xml);
$update = true;
}
/* Meta-Metadata */
else if ($nodes[0]->node_name() == "Meta-Metadata")
{
$xml = '<Meta-Metadata MetadataScheme="LOM v 1.0" Language="' . ilUtil::stripSlashes($meta["Language"]) . '">';
for ($i = 0; $i < count($meta["Identifier"]); $i++)
{
$xml .= '<Identifier Catalog="' . ilUtil::stripSlashes($meta["Identifier"][$i]["Catalog"]) . '" Entry="' . str_replace("\"", "", ilUtil::stripSlashes($meta["Identifier"][$i]["Entry"])) . '"/>';
}
for ($i = 0; $i < count($meta["Contribute"]); $i++)
{
$xml .= '<Contribute Role="' . ilUtil::stripSlashes($meta["Contribute"][$i]["Role"]) . '">';
$xml .= '<Date>' . ilUtil::stripSlashes($meta["Contribute"][$i]["Date"]) . '</Date>';
for ($j = 0; $j < count($meta["Contribute"][$i]["Entity"]); $j++)
{
$xml .= '<Entity>' . ilUtil::stripSlashes($meta["Contribute"][$i]["Entity"][$j]) . '</Entity>';
}
$xml .= '</Contribute>';
}
$xml .= '</Meta-Metadata>';
# echo htmlspecialchars($xml);
$update = true;
}
/* Technical */
else if ($nodes[0]->node_name() == "Technical")
{
$xml = '<Technical>';
for ($i = 0; $i < count($meta["Format"]); $i++)
{
$xml .= '<Format>' . ilUtil::stripSlashes($meta["Format"][$i]) . '</Format>';
}
if ($meta["Size"] != "")
{
$xml .= '<Size>' . ilUtil::stripSlashes($meta["Size"]) . '</Size>';
}
for ($i = 0; $i < count($meta["Location"]); $i++)
{
$xml .= '<Location Type="' . ilUtil::stripSlashes($meta["Location"][$i]["Type"]) . '">' . ilUtil::stripSlashes($meta["Location"][$i]["Value"]) . '</Location>';
}
if (is_array($meta["Requirement"]))
{
for ($i = 0; $i < count($meta["Requirement"]); $i++)
{
$xml .= '<Requirement>';
$xml .= '<Type>';
if (is_array($meta["Requirement"][$i]["Type"]["OperatingSystem"]))
{
$xml .= '<OperatingSystem Name="' . ilUtil::stripSlashes($meta["Requirement"][$i]["Type"]["OperatingSystem"]["Name"]) . '" MinimumVersion="' . str_replace("\"", "", ilUtil::stripSlashes($meta["Requirement"][$i]["Type"]["OperatingSystem"]["MinimumVersion"])) . '" MaximumVersion="' . str_replace("\"", "", ilUtil::stripSlashes($meta["Requirement"][$i]["Type"]["OperatingSystem"]["MaximumVersion"])) . '"/>';
}
if (is_array($meta["Requirement"][$i]["Type"]["Browser"]))
{
$xml .= '<Browser Name="' . ilUtil::stripSlashes($meta["Requirement"][$i]["Type"]["Browser"]["Name"]) . '" MinimumVersion="' . str_replace("\"", "", ilUtil::stripSlashes($meta["Requirement"][$i]["Type"]["Browser"]["MinimumVersion"])) . '" MaximumVersion="' . str_replace("\"", "", ilUtil::stripSlashes($meta["Requirement"][$i]["Type"]["Browser"]["MaximumVersion"])) . '"/>';
}
$xml .= '</Type>';
$xml .= '</Requirement>';
}
}
else if (is_array($meta["OrComposite"]))
{
for ($j = 0; $j < count($meta["OrComposite"]); $j++)
{
$xml .= '<OrComposite>';
for ($i = 0; $i < count($meta["OrComposite"][$j]["Requirement"]); $i++)
{
$xml .= '<Requirement>';
$xml .= '<Type>';
if (is_array($meta["OrComposite"][$j]["Requirement"][$i]["Type"]["OperatingSystem"]))
{
$xml .= '<OperatingSystem Name="' . ilUtil::stripSlashes($meta["OrComposite"][$j]["Requirement"][$i]["Type"]["OperatingSystem"]["Name"]) . '" MinimumVersion="' . str_replace("\"", "", ilUtil::stripSlashes($meta["OrComposite"][$j]["Requirement"][$i]["Type"]["OperatingSystem"]["MinimumVersion"])) . '" MaximumVersion="' . str_replace("\"", "", ilUtil::stripSlashes($meta["OrComposite"][$j]["Requirement"][$i]["Type"]["OperatingSystem"]["MaximumVersion"])) . '"/>';
}
if (is_array($meta["OrComposite"][$j]["Requirement"][$i]["Type"]["Browser"]))
{
$xml .= '<Browser Name="' . ilUtil::stripSlashes($meta["OrComposite"][$j]["Requirement"][$i]["Type"]["Browser"]["Name"]) . '" MinimumVersion="' . str_replace("\"", "", ilUtil::stripSlashes($meta["OrComposite"][$j]["Requirement"][$i]["Type"]["Browser"]["MinimumVersion"])) . '" MaximumVersion="' . str_replace("\"", "", ilUtil::stripSlashes($meta["OrComposite"][$j]["Requirement"][$i]["Type"]["Browser"]["MaximumVersion"])) . '"/>';
}
$xml .= '</Type>';
$xml .= '</Requirement>';
}
$xml .= '</OrComposite>';
}
}
if (is_array($meta["InstallationRemarks"]))
{
$xml .= '<InstallationRemarks Language="' . ilUtil::stripSlashes($meta["InstallationRemarks"]["Language"]) . '">' . ilUtil::stripSlashes($meta["InstallationRemarks"]["Value"]) . '</InstallationRemarks>';
}
if (is_array($meta["OtherPlattformRequirements"]))
{
$xml .= '<OtherPlattformRequirements Language="' . ilUtil::stripSlashes($meta["OtherPlattformRequirements"]["Language"]) . '">' . ilUtil::stripSlashes($meta["OtherPlattformRequirements"]["Value"]) . '</OtherPlattformRequirements>';
}
if ($meta["Duration"] != "")
{
$xml .= '<Duration>' . ilUtil::stripSlashes($meta["Duration"]) . '</Duration>';
}
$xml .= '</Technical>';
# echo htmlspecialchars($xml);
$update = true;
}
/* Educational */
else if ($nodes[0]->node_name() == "Educational")
{
$xml = '<Educational InteractivityType="' . ilUtil::stripSlashes($meta["InteractivityType"]) . '" LearningResourceType="' . ilUtil::stripSlashes($meta["LearningResourceType"]) . '" InteractivityLevel="' . ilUtil::stripSlashes($meta["InteractivityLevel"]) . '" SemanticDensity="' . ilUtil::stripSlashes($meta["SemanticDensity"]) . '" IntendedEndUserRole="' . ilUtil::stripSlashes($meta["IntendedEndUserRole"]) . '" Context="' . ilUtil::stripSlashes($meta["Context"]) . '" Difficulty="' . ilUtil::stripSlashes($meta["Difficulty"]) . '">';
$xml .= '<TypicalLearningTime>' . ilUtil::stripSlashes($meta["TypicalLearningTime"]) . '</TypicalLearningTime>';
for ($i = 0; $i < count($meta["TypicalAgeRange"]); $i++)
{
$xml .= '<TypicalAgeRange Language="' . ilUtil::stripSlashes($meta["TypicalAgeRange"][$i]["Language"]) . '">' . ilUtil::stripSlashes($meta["TypicalAgeRange"][$i]["Value"]) . '</TypicalAgeRange>';
}
for ($i = 0; $i < count($meta["Description"]); $i++)
{
$xml .= '<Description Language="' . ilUtil::stripSlashes($meta["Description"][$i]["Language"]) . '">' . ilUtil::stripSlashes($meta["Description"][$i]["Value"]) . '</Description>';
}
for ($i = 0; $i < count($meta["Language"]); $i++)
{
$xml .= '<Language Language="' . ilUtil::stripSlashes($meta["Language"][$i]["Language"]) . '"/>';
}
$xml .= '</Educational>';
$update = true;
}
/* Rights */
else if ($nodes[0]->node_name() == "Rights")
{
$xml = '<Rights Cost="' . ilUtil::stripSlashes($meta["Cost"]) . '" CopyrightAndOtherRestrictions="' . ilUtil::stripSlashes($meta["CopyrightAndOtherRestrictions"]) . '">';
for ($i = 0; $i < count($meta["Description"]); $i++)
{
$xml .= '<Description Language="' . ilUtil::stripSlashes($meta["Description"][$i]["Language"]) . '">' . ilUtil::stripSlashes($meta["Description"][$i]["Value"]) . '</Description>';
}
$xml .= '</Rights>';
$update = true;
}
/* Relation */
else if ($nodes[0]->node_name() == "Relation")
{
# for ($j = 0; $j < count($meta["Relation"]); $j++)
# {
$meta["Relation"][0] = $meta;
$j = 0;
$xml = '<Relation Kind="' . ilUtil::stripSlashes($meta["Relation"][$j]["Kind"]) . '">';
$xml .= '<Resource>';
for ($i = 0; $i < count($meta["Relation"][$j]["Resource"]["Identifier"]); $i++)
{
$xml .= '<Identifier_ Catalog="' . ilUtil::stripSlashes($meta["Relation"][$j]["Resource"]["Identifier"][$i]["Catalog"]) . '" Entry="' . str_replace("\"", "", ilUtil::stripSlashes($meta["Relation"][$j]["Resource"]["Identifier"][$i]["Entry"])) . '"/>';
}
for ($i = 0; $i < count($meta["Relation"][$j]["Resource"]["Description"]); $i++)
{
$xml .= '<Description Language="' . ilUtil::stripSlashes($meta["Relation"][$j]["Resource"]["Description"][$i]["Language"]) . '">' . ilUtil::stripSlashes($meta["Relation"][$j]["Resource"]["Description"][$i]["Value"]) . '</Description>';
}
$xml .= '</Resource>';
$xml .= '</Relation>';
# echo htmlspecialchars($xml);
# }
$update = true;
}
/* Annotation */
else if ($nodes[0]->node_name() == "Annotation")
{
# for ($i = 0; $i < count($meta["Annotation"]); $i++)
# {
$meta["Annotation"][0] = $meta;
$i = 0;
$xml = '<Annotation>';
$xml .= '<Entity>' . ilUtil::stripSlashes($meta["Annotation"][$i]["Entity"]) . '</Entity>';
$xml .= '<Date>' . ilUtil::stripSlashes($meta["Annotation"][$i]["Date"]) . '</Date>';
$xml .= '<Description Language="' . ilUtil::stripSlashes($meta["Annotation"][$i]["Description"]["Language"]) . '">' . ilUtil::stripSlashes($meta["Annotation"][$i]["Description"]["Value"]) . '</Description>';
$xml .= '</Annotation>';
# echo htmlspecialchars($xml);
# }
$update = true;
}
/* Classification */
else if ($nodes[0]->node_name() == "Classification")
{
# for ($j = 0; $j < count($meta["Classification"]); $j++)
# {
$meta["Classification"][0] = $meta;
$j = 0;
$xml = '<Classification Purpose="' . ilUtil::stripSlashes($meta["Classification"][$j]["Purpose"]) . '">';
for ($k = 0; $k < count($meta["Classification"][$j]["TaxonPath"]); $k++)
{
$xml .= '<TaxonPath>';
$xml .= '<Source Language="' . ilUtil::stripSlashes($meta["Classification"][$j]["TaxonPath"][$k]["Source"]["Language"]) . '">' . ilUtil::stripSlashes($meta["Classification"][$j]["TaxonPath"][$k]["Source"]["Value"]) . '</Source>';
for ($i = 0; $i < count($meta["Classification"][$j]["TaxonPath"][$k]["Taxon"]); $i++)
{
$xml .= '<Taxon Language="' . ilUtil::stripSlashes($meta["Classification"][$j]["TaxonPath"][$k]["Taxon"][$i]["Language"]) . '" Id="' . str_replace("\"", "", ilUtil::stripSlashes($meta["Classification"][$j]["TaxonPath"][$k]["Taxon"][$i]["Id"])) . '">' . ilUtil::stripSlashes($meta["Classification"][$j]["TaxonPath"][$k]["Taxon"][$i]["Value"]) . '</Taxon>';
}
$xml .= '</TaxonPath>';
}
$xml .= '<Description Language="' . ilUtil::stripSlashes($meta["Classification"][$j]["Description"]["Language"]) . '">' . ilUtil::stripSlashes($meta["Classification"][$j]["Description"]["Value"]) . '</Description>';
for ($i = 0; $i < count($meta["Classification"][$j]["Keyword"]); $i++)
{
$xml .= '<Keyword Language="' . ilUtil::stripSlashes($meta["Classification"][$j]["Keyword"][$i]["Language"]) . '">' . ilUtil::stripSlashes($meta["Classification"][$j]["Keyword"][$i]["Value"]) . '</Keyword>';
}
$xml .= '</Classification>';
# echo htmlspecialchars($xml);
# }
$update = true;
}
if ($update)
{
$nodes[0]->unlink_node();
if ($xPath != "//Bibliography")
{
$xPath = "//MetaData";
}
//echo "<br><br>savedA:".htmlspecialchars($this->dom->dump_mem(0));
$this->addXMLNode($xPath, $xml);
//echo "<br><br>savedB:".htmlspecialchars($this->dom->dump_mem(0));
}
return true;
}
else
{
return false;
}
}

+ Here is the call graph for this function:

ilNestedSetXML::updateDomNode (   $xPath,
  $meta,
  $no = 0 
)

updates dom node

Parameters
stringxPath
stringmeta
integerno public

Definition at line 823 of file class.ilNestedSetXML.php.

References addXMLNode(), clean(), getXpathNodes(), and ilUtil\stripSlashes().

{
$this->clean($meta);
$update = false;
if ($xPath == "//Bibliography")
{
$nodes = $this->getXpathNodes($this->dom, $xPath . "/BibItem[" . ($no+1) . "]");
}
else
{
$nodes = $this->getXpathNodes($this->dom, $xPath);
}
if (count($nodes) > 0)
{
/* BibItem */
if ($nodes[0]->node_name() == "BibItem")
{
$xml = '<BibItem Type="' . ilUtil::stripSlashes($meta["Type"]) . '" Label="' . ilUtil::stripSlashes($meta["Label"]["Value"]) . '">';
$xml .= '<Identifier Catalog="' . ilUtil::stripSlashes($meta["Identifier"]["Catalog"]) . '" Entry="' . str_replace("\"", "", ilUtil::stripSlashes($meta["Identifier"]["Entry"])) . '"/>';
for ($i = 0; $i < count($meta["Language"]); $i++)
{
$xml .= '<Language Language="' . ilUtil::stripSlashes($meta["Language"][$i]["Language"]) . '"/>';
}
for ($i = 0; $i < count($meta["Author"]); $i++)
{
$xml .= '<Author>';
# for ($j = 0; $j < count($meta["Author"][$i]["FirstName"]); $j++)
# {
$xml .= '<FirstName>' . ilUtil::stripSlashes($meta["Author"][$i]["FirstName"]) . '</FirstName>';
# }
# for ($j = 0; $j < count($meta["Author"][$i]["MiddleName"]); $j++)
# {
$xml .= '<MiddleName>' . ilUtil::stripSlashes($meta["Author"][$i]["MiddleName"]) . '</MiddleName>';
# }
# for ($j = 0; $j < count($meta["Author"][$i]["LastName"]); $j++)
# {
$xml .= '<LastName>' . ilUtil::stripSlashes($meta["Author"][$i]["LastName"]) . '</LastName>';
# }
$xml .= '</Author>';
}
$xml .= '<Booktitle Language="' . ilUtil::stripSlashes($meta["Booktitle"]["Language"]) . '">' . ilUtil::stripSlashes($meta["Booktitle"]["Value"]) . '</Booktitle>';
for ($i = 0; $i < count($meta["CrossRef"]); $i++)
{
$xml .= '<CrossRef>' . ilUtil::stripSlashes($meta["CrossRef"][$i]["Value"]) . '</CrossRef>';
}
$xml .= '<Edition>' . ilUtil::stripSlashes($meta["Edition"]["Value"]) . '</Edition>';
for ($i = 0; $i < count($meta["Editor"]); $i++)
{
$xml .= '<Editor>' . ilUtil::stripSlashes($meta["Editor"][$i]["Value"]) . '</Editor>';
}
$xml .= '<HowPublished Type="' . ilUtil::stripSlashes($meta["HowPublished"]["Type"]) . '"/>';
for ($i = 0; $i < count($meta["WherePublished"]); $i++)
{
$xml .= '<WherePublished>' . ilUtil::stripSlashes($meta["WherePublished"][$i]["Value"]) . '</WherePublished>';
}
for ($i = 0; $i < count($meta["Institution"]); $i++)
{
$xml .= '<Institution>' . ilUtil::stripSlashes($meta["Institution"][$i]["Value"]) . '</Institution>';
}
if (is_array($meta["Journal"]))
{
$xml .= '<Journal Note="' . ilUtil::stripSlashes($meta["Journal"]["Note"]) . '" Number="' . ilUtil::stripSlashes($meta["Journal"]["Number"]) . '" Organization="' . ilUtil::stripSlashes($meta["Journal"]["Organization"]) . '"/>';
}
for ($i = 0; $i < count($meta["Keyword"]); $i++)
{
$xml .= '<Keyword Language="' . ilUtil::stripSlashes($meta["Keyword"][$i]["Language"]) . '">' . ilUtil::stripSlashes($meta["Keyword"][$i]["Value"]) . '</Keyword>';
}
if (is_array($meta["Month"]))
{
$xml .= '<Month>' . ilUtil::stripSlashes($meta["Month"]["Value"]) . '</Month>';
}
if (is_array($meta["Pages"]))
{
$xml .= '<Pages>' . ilUtil::stripSlashes($meta["Pages"]["Value"]) . '</Pages>';
}
$xml .= '<Publisher>' . ilUtil::stripSlashes($meta["Publisher"]["Value"]) . '</Publisher>';
for ($i = 0; $i < count($meta["School"]); $i++)
{
$xml .= '<School>' . ilUtil::stripSlashes($meta["School"][$i]["Value"]) . '</School>';
}
if (is_array($meta["Series"]))
{
$xml .= '<Series>';
$xml .= '<SeriesTitle>' . ilUtil::stripSlashes($meta["Series"]["SeriesTitle"]) . '</SeriesTitle>';
# for ($i = 0; $i < count($meta["Series"]["SeriesEditor"]); $i++)
if (isset($meta["Series"]["SeriesEditor"]))
{
# $xml .= '<SeriesEditor>' . ilUtil::stripSlashes($meta["Series"]["SeriesEditor"][$i]) . '</SeriesEditor>';
$xml .= '<SeriesEditor>' . ilUtil::stripSlashes($meta["Series"]["SeriesEditor"]) . '</SeriesEditor>';
}
if (isset($meta["Series"]["SeriesVolume"]))
{
$xml .= '<SeriesVolume>' . ilUtil::stripSlashes($meta["Series"]["SeriesVolume"]) . '</SeriesVolume>';
}
$xml .= '</Series>';
}
$xml .= '<Year>' . ilUtil::stripSlashes($meta["Year"]["Value"]) . '</Year>';
if ($meta["URL_ISBN_ISSN"]["Type"] == "URL")
{
$xml .= '<URL>' . ilUtil::stripSlashes($meta["URL_ISBN_ISSN"]["Value"]) . '</URL>';
}
else if ($meta["URL_ISBN_ISSN"]["Type"] == "ISBN")
{
$xml .= '<ISBN>' . ilUtil::stripSlashes($meta["URL_ISBN_ISSN"]["Value"]) . '</ISBN>';
}
else if ($meta["URL_ISBN_ISSN"]["Type"] == "ISSN")
{
$xml .= '<ISSN>' . ilUtil::stripSlashes($meta["URL_ISBN_ISSN"]["Value"]) . '</ISSN>';
}
$xml .= '</BibItem>';
# echo htmlspecialchars($xml);
$update = true;
}
/* General */
else if ($nodes[0]->node_name() == "General")
{
$xml = '<General Structure="' . ilUtil::stripSlashes($meta["Structure"]) . '">';
for ($i = 0; $i < count($meta["Identifier"]); $i++)
{
$xml .= '<Identifier Catalog="' . ilUtil::stripSlashes($meta["Identifier"][$i]["Catalog"]) . '" Entry="' .
str_replace("\"", "", ilUtil::stripSlashes($meta["Identifier"][$i]["Entry"])) . '"/>';
}
$xml .= '<Title Language="' .
ilUtil::stripSlashes($meta["Title"]["Language"]) . '">' .
ilUtil::stripSlashes($meta["Title"]["Value"]) . '</Title>';
for ($i = 0; $i < count($meta["Language"]); $i++)
{
$xml .= '<Language Language="' . ilUtil::stripSlashes($meta["Language"][$i]["Language"]) . '"/>';
}
for ($i = 0; $i < count($meta["Description"]); $i++)
{
$xml .= '<Description Language="' . ilUtil::stripSlashes($meta["Description"][$i]["Language"]) . '">' . ilUtil::stripSlashes($meta["Description"][$i]["Value"]) . '</Description>';
}
for ($i = 0; $i < count($meta["Keyword"]); $i++)
{
$xml .= '<Keyword Language="' . ilUtil::stripSlashes($meta["Keyword"][$i]["Language"]) . '">' . ilUtil::stripSlashes($meta["Keyword"][$i]["Value"]) . '</Keyword>';
}
if ($meta["Coverage"] != "")
{
$xml .= '<Coverage Language="' . ilUtil::stripSlashes($meta["Coverage"]["Language"]) . '">' . ilUtil::stripSlashes($meta["Coverage"]["Value"]) . '</Coverage>';
}
$xml .= '</General>';
//echo "<br><br>".htmlspecialchars($xml);
$update = true;
}
/* Lifecycle */
else if ($nodes[0]->node_name() == "Lifecycle")
{
$xml = '<Lifecycle Status="' . $meta["Status"] . '">';
$xml .= '<Version Language="' . ilUtil::stripSlashes($meta["Version"]["Language"]) . '">' . ilUtil::stripSlashes($meta["Version"]["Value"]) . '</Version>';
for ($i = 0; $i < count($meta["Contribute"]); $i++)
{
$xml .= '<Contribute Role="' . ilUtil::stripSlashes($meta["Contribute"][$i]["Role"]) . '">';
$xml .= '<Date>' . ilUtil::stripSlashes($meta["Contribute"][$i]["Date"]) . '</Date>';
for ($j = 0; $j < count($meta["Contribute"][$i]["Entity"]); $j++)
{
$xml .= '<Entity>' . ilUtil::stripSlashes($meta["Contribute"][$i]["Entity"][$j]) . '</Entity>';
}
$xml .= '</Contribute>';
}
$xml .= '</Lifecycle>';
# echo htmlspecialchars($xml);
$update = true;
}
/* Meta-Metadata */
else if ($nodes[0]->node_name() == "Meta-Metadata")
{
$xml = '<Meta-Metadata MetadataScheme="LOM v 1.0" Language="' . ilUtil::stripSlashes($meta["Language"]) . '">';
for ($i = 0; $i < count($meta["Identifier"]); $i++)
{
$xml .= '<Identifier Catalog="' . ilUtil::stripSlashes($meta["Identifier"][$i]["Catalog"]) . '" Entry="' . str_replace("\"", "", ilUtil::stripSlashes($meta["Identifier"][$i]["Entry"])) . '"/>';
}
for ($i = 0; $i < count($meta["Contribute"]); $i++)
{
$xml .= '<Contribute Role="' . ilUtil::stripSlashes($meta["Contribute"][$i]["Role"]) . '">';
$xml .= '<Date>' . ilUtil::stripSlashes($meta["Contribute"][$i]["Date"]) . '</Date>';
for ($j = 0; $j < count($meta["Contribute"][$i]["Entity"]); $j++)
{
$xml .= '<Entity>' . ilUtil::stripSlashes($meta["Contribute"][$i]["Entity"][$j]) . '</Entity>';
}
$xml .= '</Contribute>';
}
$xml .= '</Meta-Metadata>';
# echo htmlspecialchars($xml);
$update = true;
}
/* Technical */
else if ($nodes[0]->node_name() == "Technical")
{
$xml = '<Technical>';
for ($i = 0; $i < count($meta["Format"]); $i++)
{
$xml .= '<Format>' . ilUtil::stripSlashes($meta["Format"][$i]) . '</Format>';
}
if ($meta["Size"] != "")
{
$xml .= '<Size>' . ilUtil::stripSlashes($meta["Size"]) . '</Size>';
}
for ($i = 0; $i < count($meta["Location"]); $i++)
{
$xml .= '<Location Type="' . ilUtil::stripSlashes($meta["Location"][$i]["Type"]) . '">' . ilUtil::stripSlashes($meta["Location"][$i]["Value"]) . '</Location>';
}
if (is_array($meta["Requirement"]))
{
for ($i = 0; $i < count($meta["Requirement"]); $i++)
{
$xml .= '<Requirement>';
$xml .= '<Type>';
if (is_array($meta["Requirement"][$i]["Type"]["OperatingSystem"]))
{
$xml .= '<OperatingSystem Name="' . ilUtil::stripSlashes($meta["Requirement"][$i]["Type"]["OperatingSystem"]["Name"]) . '" MinimumVersion="' . str_replace("\"", "", ilUtil::stripSlashes($meta["Requirement"][$i]["Type"]["OperatingSystem"]["MinimumVersion"])) . '" MaximumVersion="' . str_replace("\"", "", ilUtil::stripSlashes($meta["Requirement"][$i]["Type"]["OperatingSystem"]["MaximumVersion"])) . '"/>';
}
if (is_array($meta["Requirement"][$i]["Type"]["Browser"]))
{
$xml .= '<Browser Name="' . ilUtil::stripSlashes($meta["Requirement"][$i]["Type"]["Browser"]["Name"]) . '" MinimumVersion="' . str_replace("\"", "", ilUtil::stripSlashes($meta["Requirement"][$i]["Type"]["Browser"]["MinimumVersion"])) . '" MaximumVersion="' . str_replace("\"", "", ilUtil::stripSlashes($meta["Requirement"][$i]["Type"]["Browser"]["MaximumVersion"])) . '"/>';
}
$xml .= '</Type>';
$xml .= '</Requirement>';
}
}
else if (is_array($meta["OrComposite"]))
{
for ($j = 0; $j < count($meta["OrComposite"]); $j++)
{
$xml .= '<OrComposite>';
for ($i = 0; $i < count($meta["OrComposite"][$j]["Requirement"]); $i++)
{
$xml .= '<Requirement>';
$xml .= '<Type>';
if (is_array($meta["OrComposite"][$j]["Requirement"][$i]["Type"]["OperatingSystem"]))
{
$xml .= '<OperatingSystem Name="' . ilUtil::stripSlashes($meta["OrComposite"][$j]["Requirement"][$i]["Type"]["OperatingSystem"]["Name"]) . '" MinimumVersion="' . str_replace("\"", "", ilUtil::stripSlashes($meta["OrComposite"][$j]["Requirement"][$i]["Type"]["OperatingSystem"]["MinimumVersion"])) . '" MaximumVersion="' . str_replace("\"", "", ilUtil::stripSlashes($meta["OrComposite"][$j]["Requirement"][$i]["Type"]["OperatingSystem"]["MaximumVersion"])) . '"/>';
}
if (is_array($meta["OrComposite"][$j]["Requirement"][$i]["Type"]["Browser"]))
{
$xml .= '<Browser Name="' . ilUtil::stripSlashes($meta["OrComposite"][$j]["Requirement"][$i]["Type"]["Browser"]["Name"]) . '" MinimumVersion="' . str_replace("\"", "", ilUtil::stripSlashes($meta["OrComposite"][$j]["Requirement"][$i]["Type"]["Browser"]["MinimumVersion"])) . '" MaximumVersion="' . str_replace("\"", "", ilUtil::stripSlashes($meta["OrComposite"][$j]["Requirement"][$i]["Type"]["Browser"]["MaximumVersion"])) . '"/>';
}
$xml .= '</Type>';
$xml .= '</Requirement>';
}
$xml .= '</OrComposite>';
}
}
if (is_array($meta["InstallationRemarks"]))
{
$xml .= '<InstallationRemarks Language="' . ilUtil::stripSlashes($meta["InstallationRemarks"]["Language"]) . '">' . ilUtil::stripSlashes($meta["InstallationRemarks"]["Value"]) . '</InstallationRemarks>';
}
if (is_array($meta["OtherPlattformRequirements"]))
{
$xml .= '<OtherPlattformRequirements Language="' . ilUtil::stripSlashes($meta["OtherPlattformRequirements"]["Language"]) . '">' . ilUtil::stripSlashes($meta["OtherPlattformRequirements"]["Value"]) . '</OtherPlattformRequirements>';
}
if ($meta["Duration"] != "")
{
$xml .= '<Duration>' . ilUtil::stripSlashes($meta["Duration"]) . '</Duration>';
}
$xml .= '</Technical>';
# echo htmlspecialchars($xml);
$update = true;
}
/* Educational */
else if ($nodes[0]->node_name() == "Educational")
{
$xml = '<Educational InteractivityType="' . ilUtil::stripSlashes($meta["InteractivityType"]) . '" LearningResourceType="' . ilUtil::stripSlashes($meta["LearningResourceType"]) . '" InteractivityLevel="' . ilUtil::stripSlashes($meta["InteractivityLevel"]) . '" SemanticDensity="' . ilUtil::stripSlashes($meta["SemanticDensity"]) . '" IntendedEndUserRole="' . ilUtil::stripSlashes($meta["IntendedEndUserRole"]) . '" Context="' . ilUtil::stripSlashes($meta["Context"]) . '" Difficulty="' . ilUtil::stripSlashes($meta["Difficulty"]) . '">';
$xml .= '<TypicalLearningTime>' . ilUtil::stripSlashes($meta["TypicalLearningTime"]) . '</TypicalLearningTime>';
for ($i = 0; $i < count($meta["TypicalAgeRange"]); $i++)
{
$xml .= '<TypicalAgeRange Language="' . ilUtil::stripSlashes($meta["TypicalAgeRange"][$i]["Language"]) . '">' . ilUtil::stripSlashes($meta["TypicalAgeRange"][$i]["Value"]) . '</TypicalAgeRange>';
}
for ($i = 0; $i < count($meta["Description"]); $i++)
{
$xml .= '<Description Language="' . ilUtil::stripSlashes($meta["Description"][$i]["Language"]) . '">' . ilUtil::stripSlashes($meta["Description"][$i]["Value"]) . '</Description>';
}
for ($i = 0; $i < count($meta["Language"]); $i++)
{
$xml .= '<Language Language="' . ilUtil::stripSlashes($meta["Language"][$i]["Language"]) . '"/>';
}
$xml .= '</Educational>';
$update = true;
}
/* Rights */
else if ($nodes[0]->node_name() == "Rights")
{
$xml = '<Rights Cost="' . ilUtil::stripSlashes($meta["Cost"]) . '" CopyrightAndOtherRestrictions="' . ilUtil::stripSlashes($meta["CopyrightAndOtherRestrictions"]) . '">';
for ($i = 0; $i < count($meta["Description"]); $i++)
{
$xml .= '<Description Language="' . ilUtil::stripSlashes($meta["Description"][$i]["Language"]) . '">' . ilUtil::stripSlashes($meta["Description"][$i]["Value"]) . '</Description>';
}
$xml .= '</Rights>';
$update = true;
}
/* Relation */
else if ($nodes[0]->node_name() == "Relation")
{
# for ($j = 0; $j < count($meta["Relation"]); $j++)
# {
$meta["Relation"][0] = $meta;
$j = 0;
$xml = '<Relation Kind="' . ilUtil::stripSlashes($meta["Relation"][$j]["Kind"]) . '">';
$xml .= '<Resource>';
for ($i = 0; $i < count($meta["Relation"][$j]["Resource"]["Identifier"]); $i++)
{
$xml .= '<Identifier_ Catalog="' . ilUtil::stripSlashes($meta["Relation"][$j]["Resource"]["Identifier"][$i]["Catalog"]) . '" Entry="' . str_replace("\"", "", ilUtil::stripSlashes($meta["Relation"][$j]["Resource"]["Identifier"][$i]["Entry"])) . '"/>';
}
for ($i = 0; $i < count($meta["Relation"][$j]["Resource"]["Description"]); $i++)
{
$xml .= '<Description Language="' . ilUtil::stripSlashes($meta["Relation"][$j]["Resource"]["Description"][$i]["Language"]) . '">' . ilUtil::stripSlashes($meta["Relation"][$j]["Resource"]["Description"][$i]["Value"]) . '</Description>';
}
$xml .= '</Resource>';
$xml .= '</Relation>';
# echo htmlspecialchars($xml);
# }
$update = true;
}
/* Annotation */
else if ($nodes[0]->node_name() == "Annotation")
{
# for ($i = 0; $i < count($meta["Annotation"]); $i++)
# {
$meta["Annotation"][0] = $meta;
$i = 0;
$xml = '<Annotation>';
$xml .= '<Entity>' . ilUtil::stripSlashes($meta["Annotation"][$i]["Entity"]) . '</Entity>';
$xml .= '<Date>' . ilUtil::stripSlashes($meta["Annotation"][$i]["Date"]) . '</Date>';
$xml .= '<Description Language="' . ilUtil::stripSlashes($meta["Annotation"][$i]["Description"]["Language"]) . '">' . ilUtil::stripSlashes($meta["Annotation"][$i]["Description"]["Value"]) . '</Description>';
$xml .= '</Annotation>';
# echo htmlspecialchars($xml);
# }
$update = true;
}
/* Classification */
else if ($nodes[0]->node_name() == "Classification")
{
# for ($j = 0; $j < count($meta["Classification"]); $j++)
# {
$meta["Classification"][0] = $meta;
$j = 0;
$xml = '<Classification Purpose="' . ilUtil::stripSlashes($meta["Classification"][$j]["Purpose"]) . '">';
for ($k = 0; $k < count($meta["Classification"][$j]["TaxonPath"]); $k++)
{
$xml .= '<TaxonPath>';
$xml .= '<Source Language="' . ilUtil::stripSlashes($meta["Classification"][$j]["TaxonPath"][$k]["Source"]["Language"]) . '">' . ilUtil::stripSlashes($meta["Classification"][$j]["TaxonPath"][$k]["Source"]["Value"]) . '</Source>';
for ($i = 0; $i < count($meta["Classification"][$j]["TaxonPath"][$k]["Taxon"]); $i++)
{
$xml .= '<Taxon Language="' . ilUtil::stripSlashes($meta["Classification"][$j]["TaxonPath"][$k]["Taxon"][$i]["Language"]) . '" Id="' . str_replace("\"", "", ilUtil::stripSlashes($meta["Classification"][$j]["TaxonPath"][$k]["Taxon"][$i]["Id"])) . '">' . ilUtil::stripSlashes($meta["Classification"][$j]["TaxonPath"][$k]["Taxon"][$i]["Value"]) . '</Taxon>';
}
$xml .= '</TaxonPath>';
}
$xml .= '<Description Language="' . ilUtil::stripSlashes($meta["Classification"][$j]["Description"]["Language"]) . '">' . ilUtil::stripSlashes($meta["Classification"][$j]["Description"]["Value"]) . '</Description>';
for ($i = 0; $i < count($meta["Classification"][$j]["Keyword"]); $i++)
{
$xml .= '<Keyword Language="' . ilUtil::stripSlashes($meta["Classification"][$j]["Keyword"][$i]["Language"]) . '">' . ilUtil::stripSlashes($meta["Classification"][$j]["Keyword"][$i]["Value"]) . '</Keyword>';
}
$xml .= '</Classification>';
# echo htmlspecialchars($xml);
# }
$update = true;
}
if ($update)
{
$nodes[0]->unlink_node();
if ($xPath != "//Bibliography")
{
$xPath = "//MetaData";
}
//echo "<br><br>savedA:".htmlspecialchars($this->dom->dump_mem(0));
$this->addXMLNode($xPath, $xml);
//echo "<br><br>savedB:".htmlspecialchars($this->dom->dump_mem(0));
}
return true;
}
else
{
return false;
}
}

+ Here is the call graph for this function:

ilNestedSetXML::updateFromDom ( )

imports new xml-data from dom into nested set

public

Definition at line 1374 of file class.ilNestedSetXML.php.

References $obj_id, $obj_type, and deleteAllDbData().

{
$this->deleteAllDbData();
$xml = $this->dom->dump_mem(0);
$this->import($xml,$this->obj_id,$this->obj_type);
}

+ Here is the call graph for this function:

ilNestedSetXML::updateFromDom ( )

imports new xml-data from dom into nested set

public

Definition at line 1401 of file class.ilNestedSetXML.php.

References $obj_id, $obj_type, and deleteAllDbData().

{
$this->deleteAllDbData();
$xml = $this->dom->dump_mem(0);
$this->import($xml,$this->obj_id,$this->obj_type);
}

+ Here is the call graph for this function:

Field Documentation

ilNestedSetXML::$db

Datenbank-handle.

Definition at line 23 of file class.ilNestedSetXML.php.

ilNestedSetXML::$DEPTH = 0

Nesting level of the tags.

stored in database

Definition at line 35 of file class.ilNestedSetXML.php.

ilNestedSetXML::$dom

Definition at line 69 of file class.ilNestedSetXML.php.

ilNestedSetXML::$ilias

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

Referenced by ilNestedSetXML().

ilNestedSetXML::$lastTag = ""

last Tag-Name found

Definition at line 55 of file class.ilNestedSetXML.php.

ilNestedSetXML::$LEFT = 0

Left and right edge tags.

Definition at line 28 of file class.ilNestedSetXML.php.

ilNestedSetXML::$obj_id

book-Obj-ID

Definition at line 40 of file class.ilNestedSetXML.php.

Referenced by export(), getTagValue(), import(), init(), and updateFromDom().

ilNestedSetXML::$obj_type

The type of the data to those this entry belongs.

Definition at line 45 of file class.ilNestedSetXML.php.

Referenced by getTagValue(), import(), init(), and updateFromDom().

ilNestedSetXML::$RIGHT = 0

Definition at line 29 of file class.ilNestedSetXML.php.

ilNestedSetXML::$unique_import_id = ''
private

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

ilNestedSetXML::$xml_parser

SAX-Parser-Handle.

Definition at line 50 of file class.ilNestedSetXML.php.


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