Public Member Functions | Data Fields

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

Data Fields

 $group_path
 $group_obj = null

Detailed Description

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


Member Function Documentation

ilFileDataGroup::__checkPath (  ) 

Definition at line 246 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 264 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 281 of file class.ilFileDataGroup.php.

References ilFileData::getPath(), and ilUtil::makeDir().

Referenced by ilFileDataGroup().

        {
                if(is_writable($this->getPath()))
                {
                        ilUtil::makeDir($this->getPath().'/'.GROUP_PATH);
                        $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 173 of file class.ilFileDataGroup.php.

References ilUtil::delDir().

        {
                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 203 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 180 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 191 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 75 of file class.ilFileDataGroup.php.

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

        {
                ilUtil::moveUploadedFile($a_tmp_name,
                                                                 $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 161 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;
                }
                ilUtil::delDir($abs);

                return true;
        }

Here is the call graph for this function:

ilFileDataGroup::deleteFile ( a_rel_name  ) 

Definition at line 150 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 114 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 123 of file class.ilFileDataGroup.php.

References $files, 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 239 of file class.ilFileDataGroup.php.

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

        {
                return $this->group_path;
        }

Here is the caller graph for this function:

ilFileDataGroup::getImportFile (  ) 

Definition at line 104 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:
integereger obj_id public

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

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

        {
                global $ilias;

                parent::ilFileData();

                $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 84 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 89 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 214 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 225 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 46 of file class.ilFileDataGroup.php.

Referenced by ilFileDataGroup().

ilFileDataGroup::$group_path

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


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