Public Member Functions | Static Public Member Functions | Data Fields | Protected Member Functions | Private Attributes

ilFSStorageCourse Class Reference

Inheritance diagram for ilFSStorageCourse:
Collaboration diagram for ilFSStorageCourse:

Public Member Functions

 __construct ($a_container_id=0)
 Constructor.
 initInfoDirectory ()
 init info directory
 getInfoDirectory ()
 Get course info directory.
 initMemberExportDirectory ()
 Init export directory and create it if it does not exist.
 getMemberExportDirectory ()
 Get path of export directory.
 addMemberExportFile ($a_data, $a_rel_name)
 Add new export file.
 getMemberExportFiles ()
 Get all member export files.
 getMemberExportFile ($a_name)
 deleteMemberExportFile ($a_export_name)
 Delete Member Export File.
 initArchiveDirectory ()
 init Archive Directory
 getArchiveDirectory ()
 Get archive directory.
 addArchiveSubDirectory ($a_name)
 Add subdirectory for archives.
 writeArchiveFile ($a_data, $a_rel_name)
 Write archive string to file.
 zipArchive ($a_rel_name, $a_zip_name)
 Zip archive directory.
 deleteArchive ($a_rel_name)
 Delete one archive.
 createArchiveOnlineVersion ($a_rel_name)
 getOnlineLink ($a_rel_name)
 __construct ($a_container_id=0)
 Constructor.
 initInfoDirectory ()
 init info directory
 getInfoDirectory ()
 Get course info directory.
 initMemberExportDirectory ()
 Init export directory and create it if it does not exist.
 getMemberExportDirectory ()
 Get path of export directory.
 addMemberExportFile ($a_data, $a_rel_name)
 Add new export file.
 getMemberExportFiles ()
 Get all member export files.
 getMemberExportFile ($a_name)
 deleteMemberExportFile ($a_export_name)
 Delete Member Export File.
 initArchiveDirectory ()
 init Archive Directory
 getArchiveDirectory ()
 Get archive directory.
 addArchiveSubDirectory ($a_name)
 Add subdirectory for archives.
 writeArchiveFile ($a_data, $a_rel_name)
 Write archive string to file.
 zipArchive ($a_rel_name, $a_zip_name)
 Zip archive directory.
 deleteArchive ($a_rel_name)
 Delete one archive.
 createArchiveOnlineVersion ($a_rel_name)
 getOnlineLink ($a_rel_name)

Static Public Member Functions

static _clone ($a_source_id, $a_target_id)
 Clone course data directory.

Data Fields

const MEMBER_EXPORT_DIR = 'memberExport'
const INFO_DIR = 'info'
const ARCHIVE_DIR = 'archives'

Protected Member Functions

 getPathPostfix ()
 Implementation of abstract method.
 getPathPrefix ()
 Implementation of abstract method.
 getPathPostfix ()
 Implementation of abstract method.
 getPathPrefix ()
 Implementation of abstract method.

Private Attributes

 $log

Detailed Description

Author:
Stefan Meyer <smeyer@databay.de>
Version:
$Id$

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


Constructor & Destructor Documentation

ilFSStorageCourse::__construct ( a_container_id = 0  ) 

Constructor.

public

Definition at line 47 of file class.ilFSStorageCourse.php.

References $log, and ilFileSystemStorage::STORAGE_DATA.

Referenced by __construct().

        {
                global $log;
                
                $this->log = $log;
                parent::__construct(ilFileSystemStorage::STORAGE_DATA,true,$a_container_id);
        }

Here is the caller graph for this function:

ilFSStorageCourse::__construct ( a_container_id = 0  ) 

Constructor.

public

Definition at line 47 of file class.ilFSStorageCourse.php.

References $log, __construct(), and ilFileSystemStorage::STORAGE_DATA.

        {
                global $log;
                
                $this->log = $log;
                parent::__construct(ilFileSystemStorage::STORAGE_DATA,true,$a_container_id);
        }

Here is the call graph for this function:


Member Function Documentation

static ilFSStorageCourse::_clone ( a_source_id,
a_target_id 
) [static]

Clone course data directory.

public

Parameters:
string obj_id source
string obj_id target

Definition at line 64 of file class.ilFSStorageCourse.php.

References ilFileSystemStorage::_copyDirectory().

        {
                $source = new ilFSStorageCourse($a_source_id);
                $target = new ilFSStorageCourse($a_target_id);
                
                $target->create();
                ilFileSystemStorage::_copyDirectory($source->getAbsolutePath(),$target->getAbsolutePath());
                
                // Delete member export files
                $target->deleteDirectory($target->getMemberExportDirectory());
                
                unset($source);
                unset($target);
                return true;
        }

Here is the call graph for this function:

ilFSStorageCourse::addArchiveSubDirectory ( a_name  ) 

Add subdirectory for archives.

public

Parameters:
string archive subdirectory name

Definition at line 239 of file class.ilFSStorageCourse.php.

References getArchiveDirectory(), and ilUtil::makeDirParents().

        {
                ilUtil::makeDirParents($this->getArchiveDirectory().'/'.$a_name);
        }

Here is the call graph for this function:

ilFSStorageCourse::addArchiveSubDirectory ( a_name  ) 

Add subdirectory for archives.

public

Parameters:
string archive subdirectory name

Definition at line 209 of file class.ilFSStorageCourse.php.

References getArchiveDirectory(), and ilUtil::makeDirParents().

        {
                ilUtil::makeDirParents($this->getArchiveDirectory().'/'.$a_name);
        }

Here is the call graph for this function:

ilFSStorageCourse::addMemberExportFile ( a_data,
a_rel_name 
)

Add new export file.

public

Parameters:
string data
string filename

Definition at line 134 of file class.ilFSStorageCourse.php.

References getMemberExportDirectory(), initMemberExportDirectory(), and ilFileSystemStorage::writeToFile().

        {
                $this->initMemberExportDirectory();
                if(!$this->writeToFile($a_data,$this->getMemberExportDirectory().'/'.$a_rel_name))
                {
                        $this->log->write('Cannot write to file: '.$this->getMemberExportDirectory().'/'.$a_rel_name);
                        return false;
                }

                return true;
                
        }

Here is the call graph for this function:

ilFSStorageCourse::addMemberExportFile ( a_data,
a_rel_name 
)

Add new export file.

public

Parameters:
string data
string filename

Definition at line 109 of file class.ilFSStorageCourse.php.

References getMemberExportDirectory(), initMemberExportDirectory(), and ilFileSystemStorage::writeToFile().

        {
                $this->initMemberExportDirectory();
                if(!$this->writeToFile($a_data,$this->getMemberExportDirectory().'/'.$a_rel_name))
                {
                        $this->log->write('Cannot write to file: '.$this->getMemberExportDirectory().'/'.$a_rel_name);
                        return false;
                }

                return true;
                
        }

Here is the call graph for this function:

ilFSStorageCourse::createArchiveOnlineVersion ( a_rel_name  ) 

Definition at line 292 of file class.ilFSStorageCourse.php.

References getArchiveDirectory(), ilUtil::makeDirParents(), and ilUtil::rCopy().

        {
                ilUtil::makeDirParents(CLIENT_WEB_DIR.'/courses/'.$a_rel_name);
                ilUtil::rCopy($this->getArchiveDirectory().'/'.$a_rel_name,CLIENT_WEB_DIR.'/courses/'.$a_rel_name);

                return true;
        }

Here is the call graph for this function:

ilFSStorageCourse::createArchiveOnlineVersion ( a_rel_name  ) 

Definition at line 259 of file class.ilFSStorageCourse.php.

References getArchiveDirectory(), ilUtil::makeDir(), and ilUtil::rCopy().

        {
                ilUtil::makeDir(CLIENT_WEB_DIR.'/courses/'.$a_rel_name);
                ilUtil::rCopy($this->getArchiveDirectory().'/'.$a_rel_name,CLIENT_WEB_DIR.'/courses/'.$a_rel_name);

                return true;
        }

Here is the call graph for this function:

ilFSStorageCourse::deleteArchive ( a_rel_name  ) 

Delete one archive.

public

Parameters:
 

Definition at line 253 of file class.ilFSStorageCourse.php.

References ilFileSystemStorage::deleteDirectory(), ilFileSystemStorage::deleteFile(), and getArchiveDirectory().

        {
                $this->deleteFile($this->getArchiveDirectory().'/'.$a_rel_name.'.zip');
                $this->deleteDirectory($this->getArchiveDirectory().'/'.$a_rel_name);
        }

Here is the call graph for this function:

ilFSStorageCourse::deleteArchive ( a_rel_name  ) 

Delete one archive.

public

Parameters:
 

Definition at line 286 of file class.ilFSStorageCourse.php.

References ilFileSystemStorage::deleteDirectory(), ilFileSystemStorage::deleteFile(), and getArchiveDirectory().

        {
                $this->deleteFile($this->getArchiveDirectory().'/'.$a_rel_name.'.zip');
                $this->deleteDirectory($this->getArchiveDirectory().'/'.$a_rel_name);
        }

Here is the call graph for this function:

ilFSStorageCourse::deleteMemberExportFile ( a_export_name  ) 

Delete Member Export File.

public

Parameters:
 

Definition at line 203 of file class.ilFSStorageCourse.php.

References ilFileSystemStorage::deleteFile(), and getMemberExportDirectory().

        {
                return $this->deleteFile($this->getMemberExportDirectory().'/'.$a_export_name);
        }

Here is the call graph for this function:

ilFSStorageCourse::deleteMemberExportFile ( a_export_name  ) 

Delete Member Export File.

public

Parameters:
 

Definition at line 173 of file class.ilFSStorageCourse.php.

References ilFileSystemStorage::deleteFile(), and getMemberExportDirectory().

        {
                return $this->deleteFile($this->getMemberExportDirectory().'/'.$a_export_name);
        }

Here is the call graph for this function:

ilFSStorageCourse::getArchiveDirectory (  ) 

Get archive directory.

public

Definition at line 227 of file class.ilFSStorageCourse.php.

References ilFileSystemStorage::getAbsolutePath().

Referenced by addArchiveSubDirectory(), createArchiveOnlineVersion(), deleteArchive(), initArchiveDirectory(), writeArchiveFile(), and zipArchive().

        {
                return $this->getAbsolutePath().'/'.self::ARCHIVE_DIR;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilFSStorageCourse::getArchiveDirectory (  ) 

Get archive directory.

public

Definition at line 197 of file class.ilFSStorageCourse.php.

References ilFileSystemStorage::getAbsolutePath().

        {
                return $this->getAbsolutePath().'/'.self::ARCHIVE_DIR;
        }

Here is the call graph for this function:

ilFSStorageCourse::getInfoDirectory (  ) 

Get course info directory.

public

Definition at line 73 of file class.ilFSStorageCourse.php.

References ilFileSystemStorage::getAbsolutePath().

        {
                return $this->getAbsolutePath().'/'.self::INFO_DIR;
        }

Here is the call graph for this function:

ilFSStorageCourse::getInfoDirectory (  ) 

Get course info directory.

public

Definition at line 98 of file class.ilFSStorageCourse.php.

References ilFileSystemStorage::getAbsolutePath().

Referenced by initInfoDirectory().

        {
                return $this->getAbsolutePath().'/'.self::INFO_DIR;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilFSStorageCourse::getMemberExportDirectory (  ) 

Get path of export directory.

public

Definition at line 121 of file class.ilFSStorageCourse.php.

References ilFileSystemStorage::getAbsolutePath().

Referenced by addMemberExportFile(), deleteMemberExportFile(), getMemberExportFile(), getMemberExportFiles(), and initMemberExportDirectory().

        {
                return $this->getAbsolutePath().'/'.self::MEMBER_EXPORT_DIR;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilFSStorageCourse::getMemberExportDirectory (  ) 

Get path of export directory.

public

Definition at line 96 of file class.ilFSStorageCourse.php.

References ilFileSystemStorage::getAbsolutePath().

        {
                return $this->getAbsolutePath().'/'.self::MEMBER_EXPORT_DIR;
        }

Here is the call graph for this function:

ilFSStorageCourse::getMemberExportFile ( a_name  ) 

Definition at line 186 of file class.ilFSStorageCourse.php.

References $file_name, and getMemberExportDirectory().

        {
                $file_name = $this->getMemberExportDirectory().'/'.$a_name;
                
                if(@file_exists($file_name))
                {
                        return file_get_contents($file_name);
                }
        }

Here is the call graph for this function:

ilFSStorageCourse::getMemberExportFile ( a_name  ) 

Definition at line 156 of file class.ilFSStorageCourse.php.

References $file_name, and getMemberExportDirectory().

        {
                $file_name = $this->getMemberExportDirectory().'/'.$a_name;
                
                if(@file_exists($file_name))
                {
                        return file_get_contents($file_name);
                }
        }

Here is the call graph for this function:

ilFSStorageCourse::getMemberExportFiles (  ) 

Get all member export files.

public

Definition at line 128 of file class.ilFSStorageCourse.php.

References $file, $files, ilFileSystemStorage::getContainerId(), and getMemberExportDirectory().

        {
                $files = array();
                $dp = opendir($this->getMemberExportDirectory());

                while($file = readdir($dp))
                {
                        if(is_dir($file))
                        {
                                continue;
                        }
                        
                        if(preg_match("/^([0-9]{10})_[a-zA-Z]*_export_([a-z]+)_([0-9]+)\.[a-z]+$/",$file,$matches) and $matches[3] == $this->getContainerId())
                        {
                                $timest = $matches[1];
                                $file_info['name'] = $matches[0];
                                $file_info['timest'] = $matches[1];
                                $file_info['type'] = $matches[2];
                                $file_info['id'] = $matches[3];
                                $file_info['size'] = filesize($this->getMemberExportDirectory().'/'.$file);
                                
                                $files[$timest] = $file_info;
                        }
                }
                closedir($dp);
                return $files ? $files : array();
        }

Here is the call graph for this function:

ilFSStorageCourse::getMemberExportFiles (  ) 

Get all member export files.

public

Definition at line 153 of file class.ilFSStorageCourse.php.

References $file, $files, ilFileSystemStorage::getContainerId(), and getMemberExportDirectory().

        {
                if(!@is_dir($this->getMemberExportDirectory()))
                {
                        return array();
                }
                
                $files = array();
                $dp = @opendir($this->getMemberExportDirectory());

                while($file = readdir($dp))
                {
                        if(is_dir($file))
                        {
                                continue;
                        }
                        
                        if(preg_match("/^([0-9]{10})_[a-zA-Z]*_export_([a-z]+)_([0-9]+)\.[a-z]+$/",$file,$matches) and $matches[3] == $this->getContainerId())
                        {
                                $timest = $matches[1];
                                $file_info['name'] = $matches[0];
                                $file_info['timest'] = $matches[1];
                                $file_info['type'] = $matches[2];
                                $file_info['id'] = $matches[3];
                                $file_info['size'] = filesize($this->getMemberExportDirectory().'/'.$file);
                                
                                $files[$timest] = $file_info;
                        }
                }
                closedir($dp);
                return $files ? $files : array();
        }

Here is the call graph for this function:

ilFSStorageCourse::getOnlineLink ( a_rel_name  ) 

Definition at line 267 of file class.ilFSStorageCourse.php.

References ilUtil::getWebspaceDir().

        {
                return ilUtil::getWebspaceDir('filesystem').'/courses/'.$a_rel_name.'/index.html';
        }

Here is the call graph for this function:

ilFSStorageCourse::getOnlineLink ( a_rel_name  ) 

Definition at line 300 of file class.ilFSStorageCourse.php.

References ilUtil::getWebspaceDir().

        {
                return ilUtil::getWebspaceDir('filesystem').'/courses/'.$a_rel_name.'/index.html';
        }

Here is the call graph for this function:

ilFSStorageCourse::getPathPostfix (  )  [protected]

Implementation of abstract method.

protected

Reimplemented from ilFileSystemStorage.

Definition at line 312 of file class.ilFSStorageCourse.php.

        {
                return 'course';
        }

ilFSStorageCourse::getPathPostfix (  )  [protected]

Implementation of abstract method.

protected

Reimplemented from ilFileSystemStorage.

Definition at line 279 of file class.ilFSStorageCourse.php.

        {
                return 'course';
        }

ilFSStorageCourse::getPathPrefix (  )  [protected]

Implementation of abstract method.

protected

Reimplemented from ilFileSystemStorage.

Definition at line 290 of file class.ilFSStorageCourse.php.

        {
                return 'ilCourses';
        }

ilFSStorageCourse::getPathPrefix (  )  [protected]

Implementation of abstract method.

protected

Reimplemented from ilFileSystemStorage.

Definition at line 323 of file class.ilFSStorageCourse.php.

        {
                return 'ilCourses';
        }

ilFSStorageCourse::initArchiveDirectory (  ) 

init Archive Directory

public

Parameters:
 

Definition at line 186 of file class.ilFSStorageCourse.php.

References getArchiveDirectory(), and ilUtil::makeDirParents().

Here is the call graph for this function:

ilFSStorageCourse::initArchiveDirectory (  ) 

init Archive Directory

public

Parameters:
 

Definition at line 216 of file class.ilFSStorageCourse.php.

References getArchiveDirectory(), and ilUtil::makeDirParents().

Here is the call graph for this function:

ilFSStorageCourse::initInfoDirectory (  ) 

init info directory

public

Definition at line 87 of file class.ilFSStorageCourse.php.

References getInfoDirectory(), and ilUtil::makeDirParents().

Here is the call graph for this function:

ilFSStorageCourse::initInfoDirectory (  ) 

init info directory

public

Definition at line 62 of file class.ilFSStorageCourse.php.

References getInfoDirectory(), and ilUtil::makeDirParents().

Here is the call graph for this function:

ilFSStorageCourse::initMemberExportDirectory (  ) 

Init export directory and create it if it does not exist.

public

Definition at line 110 of file class.ilFSStorageCourse.php.

References getMemberExportDirectory(), and ilUtil::makeDirParents().

Referenced by addMemberExportFile().

Here is the call graph for this function:

Here is the caller graph for this function:

ilFSStorageCourse::initMemberExportDirectory (  ) 

Init export directory and create it if it does not exist.

public

Definition at line 85 of file class.ilFSStorageCourse.php.

References getMemberExportDirectory(), and ilUtil::makeDirParents().

Here is the call graph for this function:

ilFSStorageCourse::writeArchiveFile ( a_data,
a_rel_name 
)

Write archive string to file.

public

Parameters:
string relative filename

Definition at line 251 of file class.ilFSStorageCourse.php.

References getArchiveDirectory(), and ilFileSystemStorage::writeToFile().

        {
                if(!$this->writeToFile($a_data,$this->getArchiveDirectory().'/'.$a_rel_name))
                {
                        $this->log->write('Cannot write to file: '.$this->getArchiveDirectory().'/'.$a_rel_name);
                        return false;
                }
                return true;
        }

Here is the call graph for this function:

ilFSStorageCourse::writeArchiveFile ( a_data,
a_rel_name 
)

Write archive string to file.

public

Parameters:
string relative filename

Definition at line 221 of file class.ilFSStorageCourse.php.

References getArchiveDirectory(), and ilFileSystemStorage::writeToFile().

        {
                if(!$this->writeToFile($a_data,$this->getArchiveDirectory().'/'.$a_rel_name))
                {
                        $this->log->write('Cannot write to file: '.$this->getArchiveDirectory().'/'.$a_rel_name);
                        return false;
                }
                return true;
        }

Here is the call graph for this function:

ilFSStorageCourse::zipArchive ( a_rel_name,
a_zip_name 
)

Zip archive directory.

public

Parameters:
string relative name of directory to zip
string zip archive name
Returns:
int filesize of zip archive

Definition at line 240 of file class.ilFSStorageCourse.php.

References getArchiveDirectory(), and ilUtil::zip().

        {
                ilUtil::zip($this->getArchiveDirectory().'/'.$a_rel_name,$this->getArchiveDirectory().'/'.$a_zip_name);
                return filesize($this->getArchiveDirectory().'/'.$a_zip_name);
        }

Here is the call graph for this function:

ilFSStorageCourse::zipArchive ( a_rel_name,
a_zip_name 
)

Zip archive directory.

public

Parameters:
string relative name of directory to zip
string zip archive name
Returns:
int filesize of zip archive

Definition at line 270 of file class.ilFSStorageCourse.php.

References getArchiveDirectory(), and ilUtil::zip().

        {
                if(ilUtil::zip($this->getArchiveDirectory().'/'.$a_rel_name,$this->getArchiveDirectory().'/'.$a_zip_name))
                {
                        return filesize($this->getArchiveDirectory().'/'.$a_zip_name);
                }
                return 0;
        }

Here is the call graph for this function:


Field Documentation

ilFSStorageCourse::$log [private]

Definition at line 40 of file class.ilFSStorageCourse.php.

Referenced by __construct().

const ilFSStorageCourse::ARCHIVE_DIR = 'archives'

Definition at line 38 of file class.ilFSStorageCourse.php.

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

const ilFSStorageCourse::MEMBER_EXPORT_DIR = 'memberExport'

Definition at line 36 of file class.ilFSStorageCourse.php.


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