Public Member Functions | Data Fields

ilFileDataCourse Class Reference

Inheritance diagram for ilFileDataCourse:
Collaboration diagram for ilFileDataCourse:

Public Member Functions

 ilFileDataCourse (&$course_obj)
 Constructor call base constructors checks if directory is writable and sets the optional obj_id.
 getArchiveFile ($a_rel_name)
 deleteArchive ($a_rel_name)
 deleteZipFile ($a_abs_name)
 deleteDirectory ($a_abs_name)
 deletePdf ($a_abs_name)
 copy ($a_from, $a_to)
 rCopy ($a_from, $a_to)
 addDirectory ($a_rel_name)
 writeToFile ($a_data, $a_rel_name)
 zipFile ($a_rel_name, $a_zip_name)
 getCoursePath ()
 get exercise path public
 createOnlineVersion ($a_rel_name)
 getOnlineLink ($a_rel_name)
 createImportFile ($a_tmp_name, $a_name)
 unpackImportFile ()
 validateImportFile ()
 getImportFile ()
 __checkPath ()
 __checkImportPath ()
 __checkReadWrite ()
 check if directory is writable overwritten method from base class private
 __initDirectory ()
 init directory overwritten method public

Data Fields

 $course_path
 $course_obj = null

Detailed Description

Definition at line 35 of file class.ilFileDataCourse.php.


Member Function Documentation

ilFileDataCourse::__checkImportPath (  ) 

Definition at line 254 of file class.ilFileDataCourse.php.

References getCoursePath(), and ilUtil::makeDir().

Referenced by ilFileDataCourse().

        {
                if(!@file_exists($this->getCoursePath().'/import'))
                {
                        ilUtil::makeDir($this->getCoursePath().'/import');
                }

                if(!is_writable($this->getCoursePath().'/import') or !is_readable($this->getCoursePath().'/import'))
                {
                        $this->ilias->raiseError("Course import path is not readable/writable by webserver",$this->ilias->error_obj->FATAL);
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilFileDataCourse::__checkPath (  ) 

Definition at line 237 of file class.ilFileDataCourse.php.

References __checkReadWrite(), getCoursePath(), and ilUtil::makeDir().

Referenced by ilFileDataCourse().

        {
                if(!@file_exists($this->getCoursePath()))
                {
                        return false;
                }
                if(!@file_exists(CLIENT_WEB_DIR.'/courses'))
                {
                        ilUtil::makeDir(CLIENT_WEB_DIR.'/courses');
                }

                        
                $this->__checkReadWrite();

                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilFileDataCourse::__checkReadWrite (  ) 

check if directory is writable overwritten method from base class private

Returns:
bool

Definition at line 273 of file class.ilFileDataCourse.php.

Referenced by __checkPath().

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

Here is the caller graph for this function:

ilFileDataCourse::__initDirectory (  ) 

init directory overwritten method public

Returns:
string path

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

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

Referenced by ilFileDataCourse().

        {
                if(is_writable($this->getPath()))
                {
                        ilUtil::makeDir($this->getPath().'/'.COURSE_PATH);
                        $this->course_path = $this->getPath().'/'.COURSE_PATH;
                        
                        return true;
                }
                return false;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilFileDataCourse::addDirectory ( a_rel_name  ) 

Definition at line 143 of file class.ilFileDataCourse.php.

References getCoursePath(), and ilUtil::makeDir().

        {
                ilUtil::makeDir($this->getCoursePath().'/'.$a_rel_name);

                return true;
        }

Here is the call graph for this function:

ilFileDataCourse::copy ( a_from,
a_to 
)

Definition at line 124 of file class.ilFileDataCourse.php.

References getCoursePath().

        {
                if(@file_exists($a_from))
                {
                        @copy($a_from,$this->getCoursePath().'/'.$a_to);

                        return true;
                }
                return false;
        }

Here is the call graph for this function:

ilFileDataCourse::createImportFile ( a_tmp_name,
a_name 
)

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

References getCoursePath(), ilUtil::makeDir(), and ilUtil::moveUploadedFile().

        {
                ilUtil::makeDir($this->getCoursePath().'/import/crs_'.$this->course_obj->getId());

                ilUtil::moveUploadedFile($a_tmp_name,
                                                                 $a_name, 
                                                                 $this->getCoursePath().'/import/crs_'.$this->course_obj->getId().'/'.$a_name);
                $this->import_file_info = pathinfo($this->getCoursePath().'/import/crs_'.$this->course_obj->getId().'/'.$a_name);

        }

Here is the call graph for this function:

ilFileDataCourse::createOnlineVersion ( a_rel_name  ) 

Definition at line 180 of file class.ilFileDataCourse.php.

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

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

                return true;
        }

Here is the call graph for this function:

ilFileDataCourse::deleteArchive ( a_rel_name  ) 

Definition at line 84 of file class.ilFileDataCourse.php.

References deleteDirectory(), deletePdf(), and deleteZipFile().

        {
                $this->deleteZipFile($this->course_path.'/'.$a_rel_name.'.zip');
                $this->deleteDirectory($this->course_path.'/'.$a_rel_name);
                $this->deleteDirectory(CLIENT_WEB_DIR.'/courses/'.$a_rel_name);
                $this->deletePdf($this->course_path.'/'.$a_rel_name.'.pdf');

                return true;
        }

Here is the call graph for this function:

ilFileDataCourse::deleteDirectory ( a_abs_name  ) 

Definition at line 103 of file class.ilFileDataCourse.php.

References ilUtil::delDir().

Referenced by deleteArchive().

        {
                if(file_exists($a_abs_name))
                {
                        ilUtil::delDir($a_abs_name);
                        
                        return true;
                }
                return false;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilFileDataCourse::deletePdf ( a_abs_name  ) 

Definition at line 113 of file class.ilFileDataCourse.php.

Referenced by deleteArchive().

        {
                if(@file_exists($a_abs_name))
                {
                        @unlink($a_abs_name);

                        return true;
                }
                return false;
        }

Here is the caller graph for this function:

ilFileDataCourse::deleteZipFile ( a_abs_name  ) 

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

Referenced by deleteArchive().

        {
                if(@file_exists($a_abs_name))
                {
                        @unlink($a_abs_name);

                        return true;
                }
                return false;
        }

Here is the caller graph for this function:

ilFileDataCourse::getArchiveFile ( a_rel_name  ) 

Definition at line 69 of file class.ilFileDataCourse.php.

        {
                if(@file_exists($this->course_path.'/'.$a_rel_name.'.zip'))
                {
                        return $this->course_path.'/'.$a_rel_name.'.zip';
                }
                if(@file_exists($this->course_path.'/'.$a_rel_name.'.pdf'))
                {
                        return $this->course_path.'/'.$a_rel_name.'.pdf';
                }
                return false;
        }

ilFileDataCourse::getCoursePath (  ) 

get exercise path public

Returns:
string path

Definition at line 175 of file class.ilFileDataCourse.php.

Referenced by __checkImportPath(), __checkPath(), addDirectory(), copy(), createImportFile(), createOnlineVersion(), getImportFile(), rCopy(), unpackImportFile(), validateImportFile(), writeToFile(), and zipFile().

        {
                return $this->course_path;
        }

Here is the caller graph for this function:

ilFileDataCourse::getImportFile (  ) 

Definition at line 226 of file class.ilFileDataCourse.php.

References getCoursePath().

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

Here is the call graph for this function:

ilFileDataCourse::getOnlineLink ( a_rel_name  ) 

Definition at line 188 of file class.ilFileDataCourse.php.

References ilUtil::getWebspaceDir().

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

Here is the call graph for this function:

ilFileDataCourse::ilFileDataCourse ( &$  course_obj  ) 

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

Parameters:
integereger obj_id public

Definition at line 53 of file class.ilFileDataCourse.php.

References $course_obj, __checkImportPath(), __checkPath(), __initDirectory(), ilFileData::getPath(), and ilFileData::ilFileData().

        {
                define('COURSE_PATH','course');
                parent::ilFileData();
                $this->course_path = parent::getPath()."/".COURSE_PATH;
                $this->course_obj =& $course_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:

ilFileDataCourse::rCopy ( a_from,
a_to 
)

Definition at line 135 of file class.ilFileDataCourse.php.

References getCoursePath().

Referenced by createOnlineVersion().

        {
                ilUtil::rCopy($a_from,$this->getCoursePath().'/'.$a_to);

                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilFileDataCourse::unpackImportFile (  ) 

Definition at line 206 of file class.ilFileDataCourse.php.

References getCoursePath(), and ilUtil::unzip().

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

Here is the call graph for this function:

ilFileDataCourse::validateImportFile (  ) 

Definition at line 211 of file class.ilFileDataCourse.php.

References getCoursePath().

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

Here is the call graph for this function:

ilFileDataCourse::writeToFile ( a_data,
a_rel_name 
)

Definition at line 150 of file class.ilFileDataCourse.php.

References getCoursePath().

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

                return true;
        }

Here is the call graph for this function:

ilFileDataCourse::zipFile ( a_rel_name,
a_zip_name 
)

Definition at line 161 of file class.ilFileDataCourse.php.

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

        {
                ilUtil::zip($this->getCoursePath().'/'.$a_rel_name,$this->getCoursePath().'/'.$a_zip_name);

                // RETURN filesize
                return filesize($this->getCoursePath().'/'.$a_zip_name);
        }

Here is the call graph for this function:


Field Documentation

ilFileDataCourse::$course_obj = null

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

Referenced by ilFileDataCourse().

ilFileDataCourse::$course_path

Definition at line 42 of file class.ilFileDataCourse.php.


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