ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilFileDataGroup Class Reference
+ Inheritance diagram for ilFileDataGroup:
+ Collaboration diagram for ilFileDataGroup:

Public Member Functions

 ilFileDataGroup ($group_obj)
 Constructor call base constructors checks if directory is writable and sets the optional obj_id.
 createImportFile ($a_tmp_name, $a_name)
 unpackImportFile ()
 validateImportFile ()
 getImportFile ()
 getExportFile ($a_rel_name)
 getExportFiles ()
 deleteFile ($a_rel_name)
 deleteDirectory ($a_rel_dir)
 _deleteAll ($a_obj_id)
 addGroupDirectory ()
 addImportDirectory ()
 addDirectory ($a_rel_name)
 writeToFile ($a_data, $a_rel_name)
 zipFile ($a_rel_name, $a_zip_name)
 getGroupPath ()
 get exercise path public
 __checkPath ()
 __checkReadWrite ()
 check if directory is writable overwritten method from base class private
 __initDirectory ()
 init directory overwritten method public
- 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
 getPath ()
 get Path public
- Public Member Functions inherited from ilFile
 ilFile ()
 Constructor get ilias object public.
 deleteTrailingSlash ($a_path)
 delete trailing slash of path variables

Data Fields

 $group_path
 $group_obj = null

Detailed Description

Definition at line 16 of file class.ilFileDataGroup.php.

Member Function Documentation

ilFileDataGroup::__checkPath ( )

Definition at line 225 of file class.ilFileDataGroup.php.

References __checkReadWrite(), and getGroupPath().

Referenced by ilFileDataGroup().

{
if(!@file_exists($this->getGroupPath()))
{
return false;
}
$this->__checkReadWrite();
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilFileDataGroup::__checkReadWrite ( )

check if directory is writable overwritten method from base class private

Returns
bool

Definition at line 243 of file class.ilFileDataGroup.php.

Referenced by __checkPath().

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

+ Here is the caller graph for this function:

ilFileDataGroup::__initDirectory ( )

init directory overwritten method public

Returns
string path

Definition at line 260 of file class.ilFileDataGroup.php.

References ilFileData\getPath(), GROUP_PATH, and ilUtil\makeDir().

Referenced by ilFileDataGroup().

{
if(is_writable($this->getPath()))
{
$this->group_path = $this->getPath().'/'.GROUP_PATH;
return true;
}
return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilFileDataGroup::_deleteAll (   $a_obj_id)

Definition at line 152 of file class.ilFileDataGroup.php.

References ilUtil\delDir(), and GROUP_PATH.

{
ilUtil::delDir(CLIENT_DATA_DIR.'/'.GROUP_PATH.'/grp_'.$a_obj_id);
return true;
}

+ Here is the call graph for this function:

ilFileDataGroup::addDirectory (   $a_rel_name)

Definition at line 182 of file class.ilFileDataGroup.php.

References getGroupPath(), and ilUtil\makeDir().

{
if(@file_exists($this->getGroupPath().'/grp_'.$this->group_obj->getId().'/'.$a_rel_name))
{
return false;
}
ilUtil::makeDir($this->getGroupPath().'/grp_'.$this->group_obj->getId().'/'.$a_rel_name);
return true;
}

+ Here is the call graph for this function:

ilFileDataGroup::addGroupDirectory ( )

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

References getGroupPath(), and ilUtil\makeDir().

{
if(@file_exists($this->getGroupPath().'/grp_'.$this->group_obj->getId()))
{
return false;
}
ilUtil::makeDir($this->getGroupPath().'/grp_'.$this->group_obj->getId());
return true;
}

+ Here is the call graph for this function:

ilFileDataGroup::addImportDirectory ( )

Definition at line 170 of file class.ilFileDataGroup.php.

References getGroupPath(), and ilUtil\makeDir().

{
if(@file_exists($this->getGroupPath().'/import'))
{
return false;
}
ilUtil::makeDir($this->getGroupPath().'/import');
return true;
}

+ Here is the call graph for this function:

ilFileDataGroup::createImportFile (   $a_tmp_name,
  $a_name 
)

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

References getGroupPath(), and ilUtil\moveUploadedFile().

{
$a_name,
$this->getGroupPath().'/import/'.$a_name);
$this->import_file_info = pathinfo($this->getGroupPath().'/import/'.$a_name);
}

+ Here is the call graph for this function:

ilFileDataGroup::deleteDirectory (   $a_rel_dir)

Definition at line 140 of file class.ilFileDataGroup.php.

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

{
if(!@file_exists($abs = $this->getGroupPath().'/grp_'.$this->group_obj->getId().'/'.$a_rel_dir))
{
return false;
}
return true;
}

+ Here is the call graph for this function:

ilFileDataGroup::deleteFile (   $a_rel_name)

Definition at line 129 of file class.ilFileDataGroup.php.

{
if(@file_exists($abs = $this->group_path.'/grp_'.$this->group_obj->getId().'/'.$a_rel_name))
{
@unlink($abs);
return true;
}
return false;
}
ilFileDataGroup::getExportFile (   $a_rel_name)

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

{
if(@file_exists($abs = $this->group_path.'/grp_'.$this->group_obj->getId().'/'.$a_rel_name))
{
return $abs;
}
return false;
}
ilFileDataGroup::getExportFiles ( )

Definition at line 102 of file class.ilFileDataGroup.php.

References ilFile\$path, and getGroupPath().

{
$path = $this->getGroupPath().'/grp_'.$this->group_obj->getId();
if(!@file_exists($path) or !is_readable($path))
{
return array();
}
$dp = dir($path);
// Get file
while($entry = $dp->read())
{
if ($entry != "." and
$entry != ".." and
substr($entry, -4) == ".zip" and
ereg("^[0-9]{10}_{2}[0-9]+_{2}(grp_)*[0-9]+\.zip\$", $entry))
{
$files[$entry] = array("file" => $entry,
"size" => filesize($path."/".$entry),
'type' => "XML");
}
}
return $files ? $files : array();
}

+ Here is the call graph for this function:

ilFileDataGroup::getGroupPath ( )

get exercise path public

Returns
string path

Definition at line 218 of file class.ilFileDataGroup.php.

References $group_path.

Referenced by __checkPath(), addDirectory(), addGroupDirectory(), addImportDirectory(), createImportFile(), deleteDirectory(), getExportFiles(), getImportFile(), unpackImportFile(), validateImportFile(), writeToFile(), and zipFile().

{
}

+ Here is the caller graph for this function:

ilFileDataGroup::getImportFile ( )

Definition at line 83 of file class.ilFileDataGroup.php.

References getGroupPath().

{
return $this->getGroupPath().'/import'
.'/'.basename($this->import_file_info['basename'],'.zip')
.'/'.basename($this->import_file_info['basename'],'.zip').'.xml';
}

+ Here is the call graph for this function:

ilFileDataGroup::ilFileDataGroup (   $group_obj)

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

References $group_obj, ilFile\$ilias, __checkPath(), __initDirectory(), ilFileData\getPath(), GROUP_PATH, and ilFileData\ilFileData().

{
global $ilias;
$this->ilias =& $ilias;
$this->group_path = parent::getPath()."/".GROUP_PATH;
$this->group_obj =& $group_obj;
// IF DIRECTORY ISN'T CREATED CREATE IT
if(!$this->__checkPath())
{
$this->__initDirectory();
}
// Check import dir
#$this->__checkImportPath();
}

+ Here is the call graph for this function:

ilFileDataGroup::unpackImportFile ( )

Definition at line 63 of file class.ilFileDataGroup.php.

References getGroupPath(), and ilUtil\unzip().

{
return ilUtil::unzip($this->getGroupPath().'/import/'.$this->import_file_info['basename']);
}

+ Here is the call graph for this function:

ilFileDataGroup::validateImportFile ( )

Definition at line 68 of file class.ilFileDataGroup.php.

References getGroupPath().

{
if(!is_dir($this->getGroupPath().'/import/'.basename($this->import_file_info['basename'],'.zip')))
{
return false;
}
if(!file_exists($this->getGroupPath().'/import'.
'/'.basename($this->import_file_info['basename'],'.zip').
'/'.basename($this->import_file_info['basename'],'.zip').'.xml'))
{
return false;
}
return true;
}

+ Here is the call graph for this function:

ilFileDataGroup::writeToFile (   $a_data,
  $a_rel_name 
)

Definition at line 193 of file class.ilFileDataGroup.php.

References getGroupPath().

{
if(!$fp = @fopen($this->getGroupPath().'/grp_'.$this->group_obj->getId().'/'.$a_rel_name,'w+'))
{
die("Cannot open file: ".$this->getGroupPath().'/'.$a_rel_name);
}
@fwrite($fp,$a_data);
return true;
}

+ Here is the call graph for this function:

ilFileDataGroup::zipFile (   $a_rel_name,
  $a_zip_name 
)

Definition at line 204 of file class.ilFileDataGroup.php.

References getGroupPath(), and ilUtil\zip().

{
ilUtil::zip($this->getGroupPath().'/grp_'.$this->group_obj->getId().'/'.$a_rel_name,
$this->getGroupPath().'/grp_'.$this->group_obj->getId().'/'.$a_zip_name);
return true;
}

+ Here is the call graph for this function:

Field Documentation

ilFileDataGroup::$group_obj = null

Definition at line 25 of file class.ilFileDataGroup.php.

Referenced by ilFileDataGroup().

ilFileDataGroup::$group_path

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

Referenced by getGroupPath().


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