ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilFileDataImportMail Class Reference

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

+ Inheritance diagram for ilFileDataImportMail:
+ Collaboration diagram for ilFileDataImportMail:

Public Member Functions

 ilFileDataImportMail ()
 Constructor call base constructors checks if directory is writable and sets the optional obj_id.
 getFiles ()
 getXMLFile ()
 storeUploadedFile ($a_http_post_file)
 store uploaded file in filesystem
 findXMLFile ($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

 $mail_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:
class.ilFileDataImportMail.php 23143 2010-03-09 12:15:33Z smeyer

Id: class.ilFileDataImportMail.php,v 1.1 2004/03/31 13:42:19 smeyer Exp $

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

Member Function Documentation

ilFileDataImportMail::__checkReadWrite ( )

check if directory is writable overwritten method from base class private

Returns
bool

Reimplemented from ilFileDataImport.

Definition at line 177 of file class.ilFileDataImportMail.php.

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

Definition at line 147 of file class.ilFileDataImportMail.php.

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

Referenced by findXMLFile(), ilFileDataImportMail(), 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:

ilFileDataImportMail::_initDirectory ( )
static

init directory overwritten method public

Returns
boolean

Reimplemented from ilFileDataImport.

Definition at line 195 of file class.ilFileDataImportMail.php.

References ilUtil\makeDir().

Referenced by ilFileDataImportMail().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilFileDataImportMail::findXMLFile (   $a_dir = '')

Definition at line 87 of file class.ilFileDataImportMail.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:

ilFileDataImportMail::getFiles ( )

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

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

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

+ Here is the caller graph for this function:

ilFileDataImportMail::getPath ( )

get exercise path public

Returns
string path

Reimplemented from ilFileDataImport.

Definition at line 126 of file class.ilFileDataImportMail.php.

References $mail_path.

Referenced by __readFiles(), findXMLFile(), ilFileDataImportMail(), and storeUploadedFile().

{
}

+ Here is the caller graph for this function:

ilFileDataImportMail::getXMLFile ( )

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

References $xml_file.

{
}
ilFileDataImportMail::ilFileDataImportMail ( )

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.ilFileDataImportMail.php.

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

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

+ Here is the call graph for this function:

ilFileDataImportMail::storeUploadedFile (   $a_http_post_file)

store uploaded file in filesystem

Parameters
arrayHTTP_POST_FILES public
Returns
bool

Definition at line 62 of file class.ilFileDataImportMail.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();
// CHECK IF FILE WITH SAME NAME EXISTS
ilUtil::moveUploadedFile($a_http_post_file['tmp_name'], $a_http_post_file['name'],
$this->getPath().'/'.$a_http_post_file['name']);
//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:

ilFileDataImportMail::unlinkLast ( )

Definition at line 131 of file class.ilFileDataImportMail.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:

ilFileDataImportMail::unzip ( )

Definition at line 110 of file class.ilFileDataImportMail.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

ilFileDataImportMail::$files

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

ilFileDataImportMail::$mail_path

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

Referenced by getPath().

ilFileDataImportMail::$xml_file

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

Referenced by findXMLFile(), and getXMLFile().


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