ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilSurveyExport Class Reference

Export class for surveys. More...

+ Collaboration diagram for ilSurveyExport:

Public Member Functions

 ilSurveyExport (&$a_survey_obj, $a_mode="xml")
 Constructor public.
 getInstId ()
 buildExportFile ()
 build export file (complete zip file)
 buildExportFileXML ()
 build xml export file
 exportXHTMLMediaObjects ($a_export_dir)

Data Fields

 $err
 $db
 $ilias
 $survey_obj
 $inst_id
 $mode
 $subdir
 $filename
 $export_dir

Detailed Description

Export class for surveys.

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Version
$Id$

Definition at line 33 of file class.ilSurveyExport.php.

Member Function Documentation

ilSurveyExport::buildExportFile ( )

build export file (complete zip file)

public

Returns

Definition at line 88 of file class.ilSurveyExport.php.

References buildExportFileXML().

{
switch ($this->mode)
{
default:
return $this->buildExportFileXML();
break;
}
}

+ Here is the call graph for this function:

ilSurveyExport::buildExportFileXML ( )

build xml export file

Definition at line 101 of file class.ilSurveyExport.php.

References $ilBench, ilUtil\delDir(), exportXHTMLMediaObjects(), ilUtil\makeDir(), and ilUtil\zip().

Referenced by buildExportFile().

{
global $ilBench;
$ilBench->start("SurveyExport", "buildExportFile");
// create directories
$this->survey_obj->createExportDirectory();
include_once "./Services/Utilities/classes/class.ilUtil.php";
ilUtil::makeDir($this->export_dir."/".$this->subdir);
ilUtil::makeDir($this->export_dir."/".$this->subdir."/objects");
// get Log File
$expDir = $this->survey_obj->getExportDirectory();
include_once "./Services/Logging/classes/class.ilLog.php";
$expLog = new ilLog($expDir, "export.log");
$expLog->delete();
$expLog->setLogFormat("");
$expLog->write(date("[y-m-d H:i:s] ")."Start Export");
// write xml file
$xmlFile = fopen($this->export_dir."/".$this->subdir."/".$this->filename, "w");
fwrite($xmlFile, $this->survey_obj->toXML());
fclose($xmlFile);
// add media objects which were added with tiny mce
$this->exportXHTMLMediaObjects($this->export_dir."/".$this->subdir);
// zip the file
$ilBench->start("SurveyExport", "buildExportFileXML_zipFile");
ilUtil::zip($this->export_dir."/".$this->subdir, $this->export_dir."/".$this->subdir.".zip");
$ilBench->stop("SurveyExport", "buildExportFileXML_zipFile");
if (@file_exists($this->export_dir."/".$this->subdir.".zip"))
{
// remove export directory and contents
if (@is_dir($this->export_dir."/".$this->subdir))
{
ilUtil::delDir($this->export_dir."/".$this->subdir);
}
}
$expLog->write(date("[y-m-d H:i:s] ")."Finished Export");
$ilBench->stop("SurveyExport", "buildExportFile");
return $this->export_dir."/".$this->subdir.".zip";
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSurveyExport::exportXHTMLMediaObjects (   $a_export_dir)

Definition at line 148 of file class.ilSurveyExport.php.

References $ilBench, $mobs, and ilObjMediaObject\_getMobsOfObject().

Referenced by buildExportFileXML().

{
global $ilBench;
$ilBench->start("SurveyExport", "exportXHTMLMediaObjects");
include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
$mobs = ilObjMediaObject::_getMobsOfObject("svy:html", $this->survey_obj->getId());
foreach ($mobs as $mob)
{
$mob_obj =& new ilObjMediaObject($mob);
$mob_obj->exportFiles($a_export_dir);
unset($mob_obj);
}
/* maybe this will be used later
foreach ($this->survey_obj->questions as $question_id)
{
$mobs = ilObjMediaObject::_getMobsOfObject("spl:html", $question_id);
foreach ($mobs as $mob)
{
$mob_obj =& new ilObjMediaObject($mob);
$mob_obj->exportFiles($a_export_dir);
unset($mob_obj);
}
}*/
$ilBench->stop("SurveyExport", "exportXHTMLMediaObjects");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSurveyExport::getInstId ( )

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

References $inst_id.

{
}
ilSurveyExport::ilSurveyExport ( $a_survey_obj,
  $a_mode = "xml" 
)

Constructor public.

Definition at line 49 of file class.ilSurveyExport.php.

References $ilErr, and $ilias.

{
global $ilErr, $ilDB, $ilias;
$this->survey_obj =& $a_survey_obj;
$this->err =& $ilErr;
$this->ilias =& $ilias;
$this->db =& $ilDB;
$this->mode = $a_mode;
$settings = $this->ilias->getAllSettings();
//$this->inst_id = $settings["inst_id"];
$this->inst_id = IL_INST_ID;
$date = time();
switch($this->mode)
{
default:
$this->export_dir = $this->survey_obj->getExportDirectory();
$this->subdir = $date."__".$this->inst_id."__".
"svy"."_".$this->survey_obj->getId();
$this->filename = $this->subdir.".xml";
break;
}
}

Field Documentation

ilSurveyExport::$db

Definition at line 36 of file class.ilSurveyExport.php.

ilSurveyExport::$err

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

ilSurveyExport::$export_dir

Definition at line 43 of file class.ilSurveyExport.php.

ilSurveyExport::$filename

Definition at line 42 of file class.ilSurveyExport.php.

ilSurveyExport::$ilias

Definition at line 37 of file class.ilSurveyExport.php.

Referenced by ilSurveyExport().

ilSurveyExport::$inst_id

Definition at line 39 of file class.ilSurveyExport.php.

Referenced by getInstId().

ilSurveyExport::$mode

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

ilSurveyExport::$subdir

Definition at line 41 of file class.ilSurveyExport.php.

ilSurveyExport::$survey_obj

Definition at line 38 of file class.ilSurveyExport.php.


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