56         final public function init($a_entity, $a_schema_version)
 
   58                 $this->entity = $a_entity;
 
   59                 $this->schema_version = $a_schema_version;
 
   60                 $this->data = array();
 
   78         abstract protected function getTypes($a_entity, $a_version);
 
   84         abstract protected function getXmlNamespace($a_entity, $a_schema_version);
 
   92         abstract function readData($a_entity, $a_version, $a_ids);
 
  102                 $this->relative_export_dir = $a_relative;
 
  103                 $this->absolute_export_dir = $a_absolute;
 
  113                 $this->import_directory = $a_val;
 
  123                 return $this->import_directory;
 
  165                 $set = $ilDB->query($a_query);
 
  166                 $this->data = array();
 
  167                 while ($rec  = $ilDB->fetchAssoc($set))
 
  169                         if ($a_convert_to_leading_upper)
 
  172                                 foreach ($rec as $k => $v)
 
  180                         $this->data[] = $rec;
 
  192                 $a_str = strtoupper(substr($a_str, 0, 1)).substr($a_str, 1);
 
  193                 while (is_int($pos = strpos($a_str, 
"_")))
 
  195                         $a_str = substr($a_str, 0, $pos).
 
  196                                 strtoupper(substr($a_str, $pos+1, 1)).
 
  197                                 substr($a_str, $pos+2);
 
  208                 if ($this->version === 
false)
 
  214                 $arr[
"version"] = $this->version;
 
  215                 $arr[
"install_id"] = IL_INST_ID;
 
  216                 $arr[
"install_url"] = ILIAS_HTTP_PATH;
 
  218                 $arr[
"set"] = array();
 
  219                 foreach ($this->data as 
$d)
 
  224                 include_once(
"./Services/JSON/classes/class.ilJsonUtil.php");
 
  251                 $a_ids, $a_field = 
"", $a_omit_header = 
false, $a_omit_types = 
false)
 
  260                 include_once 
"./Services/Xml/classes/class.ilXmlWriter.php";
 
  264                         $writer->xmlHeader();
 
  268                 $namespaces = $prefixes = array();
 
  269                 $this->
getNamespaces($namespaces, $a_entity, $a_schema_version);
 
  270                 $atts = array(
"InstallationId" => IL_INST_ID,
 
  271                         "InstallationUrl" => ILIAS_HTTP_PATH, 
"TopEntity" => $a_entity);
 
  273                 foreach ($namespaces as $entity => $ns)
 
  276                         $prefixes[$entity] = $prefix; 
 
  286                         $this->
addTypesXml($writer, $a_entity, $a_schema_version);
 
  290                 $this->
addRecordsXml($writer, $prefixes, $a_entity, $a_schema_version, $a_ids, $a_field = 
"");
 
  298                 return $writer->xmlDumpMem(
false);
 
  308         function addRecordsXml($a_writer, $a_prefixes, $a_entity, $a_schema_version, $a_ids, $a_field = 
"")
 
  310                 $types = $this->
getXmlTypes($a_entity, $a_schema_version);
 
  312                 $this->
readData($a_entity, $a_schema_version, $a_ids, $a_field);
 
  313                 if (is_array($this->data))
 
  315                         foreach ($this->data as 
$d)
 
  318                                         array(
"Entity" => $this->getXmlEntityName($a_entity, $a_schema_version)));
 
  321                                 $a_writer->xmlStartTag($this->getXmlEntityTag($a_entity, $a_schema_version));
 
  323                                 $rec = $this->
getXmlRecord($a_entity, $a_schema_version, $d);
 
  324                                 foreach ($rec as $f => $c)
 
  329                                                         if ($this->absolute_export_dir != 
"" && $this->relative_export_dir != 
"")
 
  332                                                                 ilUtil::rCopy($c, $this->absolute_export_dir.
"/dsDir_".$this->dircnt);
 
  342                                         $a_writer->xmlElement($f, array(), $c);
 
  345                                 $a_writer->xmlEndTag($this->getXmlEntityTag($a_entity, $a_schema_version));
 
  352                                 $deps = $this->getDependencies($a_entity, $a_schema_version, $rec, $a_ids);
 
  355                                         foreach ($deps as $dp => $par)
 
  357                                                 $this->
addRecordsXml($a_writer, $a_prefixes, $dp, $a_schema_version, $par[
"ids"], $par[
"field"]);
 
  362                 else if ($this->data === 
false)
 
  365                         $deps = $this->getDependencies($a_entity, $a_schema_version, null, $a_ids);
 
  368                                 foreach ($deps as $dp => $par)
 
  370                                         $this->
addRecordsXml($a_writer, $a_prefixes, $dp, $a_schema_version, $par[
"ids"], $par[
"field"]);
 
  391         private function addTypesXml($a_writer, $a_entity, $a_schema_version)
 
  393                 $types = $this->
getXmlTypes($a_entity, $a_schema_version);
 
  396                 if (is_array($types))
 
  399                                 array(
"Entity" => $this->getXmlEntityName($a_entity, $a_schema_version),
 
  400                                         "SchemaVersion" => $a_schema_version));
 
  401                         foreach ($this->
getXmlTypes($a_entity, $a_schema_version) as $f => 
$t)
 
  404                                         array(
"Name" => $f, 
"Type" => 
$t));
 
  410                 $deps = $this->getDependencies($a_entity, $a_schema_version, null, null);
 
  413                         foreach ($deps as $dp => $w)
 
  415                                 $this->
addTypesXml($a_writer, $dp, $a_schema_version);
 
  433                         $namespaces[$a_entity] = $ns;
 
  436                 $deps = $this->getDependencies($a_entity, $a_schema_version, null, null);
 
  439                         foreach ($deps as $dp => $w)
 
  475                 return $this->
getTypes($a_entity, $a_version);
 
  485                 return $this->
getTypes($a_entity, $a_version);
 
  526                 $this->
import = $a_val;
 
  536                 return $this->import;
 
  548                 return "il_".IL_INST_ID.
"_".$a_type.
"_".$a_id;
 
  561                 if(substr($a_id, 0, 3) == 
"il_")
 
  563                         $parts = explode(
"_", $a_id);
 
  564                         $inst_id = $parts[1];   
 
  569                         if(($inst_id == 0 || IL_INST_ID == 0) && !DEVMODE)
 
  571                                 return array(
"type"=>self::EXPORT_NO_INST_ID, 
"id"=>$a_fallback_id);
 
  575                         if($inst_id == IL_INST_ID)
 
  580                                         return array(
"type"=>self::EXPORT_ID_ILIAS_LOCAL, 
"id"=>$id);
 
  585                                         return array(
"type"=>self::EXPORT_ID_ILIAS_LOCAL_INVALID, 
"id"=>$a_fallback_id);
 
  595                                         return array(
"type"=>self::EXPORT_ID_ILIAS_REMOTE, 
"id"=>$id);
 
  600                                         return array(
"type"=>self::EXPORT_ID_ILIAS_REMOTE_INVALID, 
"id"=>$a_fallback_id);
 
  609                         return array(
"type"=>self::EXPORT_ID, 
"id"=>$id);
 
  613                         return array(
"type"=>self::EXPORT_ID_INVALID, 
"id"=>$a_fallback_id);