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

This class handles all operations on files for the exercise object. More...

+ Inheritance diagram for ilFileDataImportGroup:
+ Collaboration diagram for ilFileDataImportGroup:

Public Member Functions

 ilFileDataImportGroup ()
 Constructor call base constructors checks if directory is writable and sets the optional obj_id.
 getFiles ()
 getXMLFile ()
 getObjectFile ()
 storeUploadedFile ($a_http_post_file)
 store uploaded file in filesystem
 findXMLFile ($a_dir= '')
 findObjectFile ($a_file, $a_dir= '')
 unzip ()
 getPath ()
 get exercise path public
 unlinkLast ()
 __readFiles ($a_dir= '')
 __checkReadWrite ()
 check if directory is writable overwritten method from base class private
- Public Member Functions inherited from ilFileDataImport
 ilFileDataImport ()
 Constructor call base constructors checks if directory is writable and sets the optional obj_id.
 __checkPath ()
- Public Member Functions inherited from ilFileData
 ilFileData ()
 Constructor class bas constructor and read path of directory from ilias.ini setup an mail object public.
 checkPath ($a_path)
 check if path exists and is writable
- Public Member Functions inherited from ilFile
 ilFile ()
 Constructor get ilias object public.
 deleteTrailingSlash ($a_path)
 delete trailing slash of path variables

Static Public Member Functions

 _initDirectory ()
 init directory overwritten method public

Data Fields

 $group_path
 $files
 $xml_file
- Data Fields inherited from ilFileDataImport
 $import_path

Detailed Description

This class handles all operations on files for the exercise object.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

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

Member Function Documentation

ilFileDataImportGroup::__checkReadWrite ( )

check if directory is writable overwritten method from base class private

Returns
bool

Reimplemented from ilFileDataImport.

Definition at line 205 of file class.ilFileDataImportGroup.php.

{
if(is_writable($this->group_path) && is_readable($this->group_path))
{
return true;
}
else
{
$this->ilias->raiseError("Group import directory is not readable/writable by webserver",$this->ilias->error_obj->FATAL);
}
}
ilFileDataImportGroup::__readFiles (   $a_dir = '')

Definition at line 175 of file class.ilFileDataImportGroup.php.

References $file, ilFormat\formatDate(), and getPath().

Referenced by findObjectFile(), findXMLFile(), ilFileDataImportGroup(), and storeUploadedFile().

{
$a_dir = $a_dir ? $a_dir : $this->getPath();
$this->files = array();
$dp = opendir($a_dir);
while($file = readdir($dp))
{
if($file == "." or $file == "..")
{
continue;
}
$this->files[] = array(
'name' => $file,
'abs_path' => $a_dir."/".$file,
'size' => filesize($a_dir."/".$file),
'ctime' => ilFormat::formatDate(date('Y-m-d H:i:s',filectime($a_dir.'/'.$file))));
}
closedir($dp);
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilFileDataImportGroup::_initDirectory ( )
static

init directory overwritten method public

Returns
boolean

Reimplemented from ilFileDataImport.

Definition at line 223 of file class.ilFileDataImportGroup.php.

References ilUtil\makeDir().

Referenced by ilFileDataImportGroup().

{
if(!@file_exists($this->group_path))
{
ilUtil::makeDir($this->group_path);
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilFileDataImportGroup::findObjectFile (   $a_file,
  $a_dir = '' 
)

Definition at line 116 of file class.ilFileDataImportGroup.php.

References __readFiles(), getFiles(), and getPath().

{
$a_dir = $a_dir ? $a_dir : $this->getPath();
$this->__readFiles($a_dir);
foreach($this->getFiles() as $file_data)
{
if(is_dir($file_data["abs_path"]))
{
$this->findObjectFile($a_file,$file_data["abs_path"]);
}
if($file_data["name"] == $a_file)
{
return $this->object_file = $file_data["abs_path"];
}
}
return $this->object_file;
}

+ Here is the call graph for this function:

ilFileDataImportGroup::findXMLFile (   $a_dir = '')

Definition at line 93 of file class.ilFileDataImportGroup.php.

References $xml_file, __readFiles(), getFiles(), and getPath().

{
$a_dir = $a_dir ? $a_dir : $this->getPath();
$this->__readFiles($a_dir);
foreach($this->getFiles() as $file_data)
{
if(is_dir($file_data["abs_path"]))
{
$this->findXMLFile($file_data["abs_path"]);
}
if(($tmp = explode(".",$file_data["name"])) !== false)
{
if($tmp[count($tmp) - 1] == "xml")
{
return $this->xml_file = $file_data["abs_path"];
}
}
}
}

+ Here is the call graph for this function:

ilFileDataImportGroup::getFiles ( )

Definition at line 46 of file class.ilFileDataImportGroup.php.

Referenced by findObjectFile(), findXMLFile(), unlinkLast(), and unzip().

{
return $this->files ? $this->files : array();
}

+ Here is the caller graph for this function:

ilFileDataImportGroup::getObjectFile ( )

Definition at line 56 of file class.ilFileDataImportGroup.php.

{
return $this->object_file;
}
ilFileDataImportGroup::getPath ( )

get exercise path public

Returns
string path

Reimplemented from ilFileDataImport.

Definition at line 154 of file class.ilFileDataImportGroup.php.

References $group_path.

Referenced by __readFiles(), findObjectFile(), findXMLFile(), ilFileDataImportGroup(), and storeUploadedFile().

{
}

+ Here is the caller graph for this function:

ilFileDataImportGroup::getXMLFile ( )

Definition at line 51 of file class.ilFileDataImportGroup.php.

References $xml_file.

{
}
ilFileDataImportGroup::ilFileDataImportGroup ( )

Constructor call base constructors checks if directory is writable and sets the optional obj_id.

Parameters
integeregerobj_id public

Definition at line 34 of file class.ilFileDataImportGroup.php.

References __readFiles(), _initDirectory(), getPath(), and ilFileDataImport\ilFileDataImport().

{
define('GROUP_IMPORT_PATH','group');
$this->group_path = parent::getPath()."/".GROUP_IMPORT_PATH;
// IF DIRECTORY ISN'T CREATED CREATE IT
// CALL STATIC TO AVOID OVERWRITE PROBLEMS
$this->__readFiles();
}

+ Here is the call graph for this function:

ilFileDataImportGroup::storeUploadedFile (   $a_http_post_file)

store uploaded file in filesystem

Parameters
arrayHTTP_POST_FILES public
Returns
bool

Definition at line 67 of file class.ilFileDataImportGroup.php.

References __readFiles(), getPath(), ilUtil\moveUploadedFile(), and unlinkLast().

{
// TODO:
// CHECK UPLOAD LIMIT
//
if(isset($a_http_post_file) && $a_http_post_file['size'])
{
// DELETE OLD FILES
$this->unlinkLast();
ilUtil::moveUploadedFile($a_http_post_file['tmp_name'],
$a_http_post_file['name'], $this->getPath().'/'.$a_http_post_file['name']);
// CHECK IF FILE WITH SAME NAME EXISTS
//move_uploaded_file($a_http_post_file['tmp_name'],$this->getPath().'/'.$a_http_post_file['name']);
// UPDATE FILES LIST
$this->__readFiles();
return true;
}
else
{
return false;
}
}

+ Here is the call graph for this function:

ilFileDataImportGroup::unlinkLast ( )

Definition at line 159 of file class.ilFileDataImportGroup.php.

References ilUtil\delDir(), and getFiles().

Referenced by storeUploadedFile().

{
foreach($this->getFiles() as $file_data)
{
if(is_dir($file_data["abs_path"]))
{
ilUtil::delDir($file_data["abs_path"]);
}
else
{
unlink($file_data["abs_path"]);
}
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilFileDataImportGroup::unzip ( )

Definition at line 138 of file class.ilFileDataImportGroup.php.

References getFiles().

{
foreach($this->getFiles() as $file_data)
{
ilUtil::unzip($file_data["abs_path"]);
return true;
}
return false;
}

+ Here is the call graph for this function:

Field Documentation

ilFileDataImportGroup::$files

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

ilFileDataImportGroup::$group_path

Definition at line 21 of file class.ilFileDataImportGroup.php.

Referenced by getPath().

ilFileDataImportGroup::$xml_file

Definition at line 24 of file class.ilFileDataImportGroup.php.

Referenced by findXMLFile(), and getXMLFile().


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