ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilFileDataImportForum Class Reference

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

+ Inheritance diagram for ilFileDataImportForum:
+ Collaboration diagram for ilFileDataImportForum:

Public Member Functions

 ilFileDataImportForum ()
 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

 $forum_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 smeye.nosp@m.r@da.nosp@m.tabay.nosp@m..de
Version
Id:
class.ilFileDataImportForum.php 12808 2006-12-08 18:04:21Z akill

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

Member Function Documentation

ilFileDataImportForum::__checkReadWrite ( )

check if directory is writable overwritten method from base class private

Returns
bool

Reimplemented from ilFileDataImport.

Definition at line 197 of file class.ilFileDataImportForum.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);
}
}
ilFileDataImportForum::__readFiles (   $a_dir = '')

Definition at line 167 of file class.ilFileDataImportForum.php.

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

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

ilFileDataImportForum::_initDirectory ( )
static

init directory overwritten method public

Returns
boolean

Reimplemented from ilFileDataImport.

Definition at line 215 of file class.ilFileDataImportForum.php.

References ilUtil\makeDir().

Referenced by ilFileDataImportForum().

{
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:

ilFileDataImportForum::findXMLFile (   $a_dir = '')

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

ilFileDataImportForum::getFiles ( )

Definition at line 66 of file class.ilFileDataImportForum.php.

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

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

+ Here is the caller graph for this function:

ilFileDataImportForum::getPath ( )

get exercise path public

Returns
string path

Reimplemented from ilFileDataImport.

Definition at line 146 of file class.ilFileDataImportForum.php.

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

{
return $this->mail_path;
}

+ Here is the caller graph for this function:

ilFileDataImportForum::getXMLFile ( )

Definition at line 71 of file class.ilFileDataImportForum.php.

References $xml_file.

{
}
ilFileDataImportForum::ilFileDataImportForum ( )

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

Parameters
integeregerobj_id public

Definition at line 54 of file class.ilFileDataImportForum.php.

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

{
define('FORUM_IMPORT_PATH','forum');
$this->mail_path = parent::getPath()."/".FORUM_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:

ilFileDataImportForum::storeUploadedFile (   $a_http_post_file)

store uploaded file in filesystem

Parameters
arrayHTTP_POST_FILES public
Returns
bool

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

ilFileDataImportForum::unlinkLast ( )

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

ilFileDataImportForum::unzip ( )

Definition at line 130 of file class.ilFileDataImportForum.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

ilFileDataImportForum::$files

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

ilFileDataImportForum::$forum_path

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

ilFileDataImportForum::$xml_file

Definition at line 44 of file class.ilFileDataImportForum.php.

Referenced by findXMLFile(), and getXMLFile().


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