Public Member Functions | Data Fields | Private Attributes

ilEventFile Class Reference

class ilEvent More...

Inheritance diagram for ilEventFile:
Collaboration diagram for ilEventFile:

Public Member Functions

 ilEventFile ($a_file_id=null)
 setFileId ($a_id)
 getFileId ()
 getEventId ()
 setEventId ($a_event_id)
 setFileName ($a_name)
 getFileName ()
 setFileType ($a_type)
 getFileType ()
 setFileSize ($a_size)
 getFileSize ()
 setTemporaryName ($a_name)
 getTemporaryName ()
 setErrorCode ($a_code)
 getErrorCode ()
 getAbsolutePath ()
 validate ()
 cloneFiles ($a_target_event_id)
 Clone files.
 create ($a_upload=true)
 delete ()
 _deleteByEvent ($a_event_id)
_readFilesByEvent ($a_event_id)
 __read ()

Data Fields

 $ilErr
 $ilDB
 $tree
 $lng
 $event_id = null
 $file_id = null

Private Attributes

 $fss_storage = null

Detailed Description

class ilEvent

Author:
Stefan Meyer <smeyer@databay.de>
Version:
Id:
class.ilEventFile.php 13361 2007-02-27 11:09:23Z smeyer

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


Member Function Documentation

ilEventFile::__read (  ) 

Definition at line 250 of file class.ilEventFile.php.

References $ilDB, $res, getEventId(), setEventId(), setFileName(), setFileSize(), and setFileType().

Referenced by ilEventFile().

        {
                global $ilDB;
                
                if(!$this->file_id)
                {
                        return true;
                }

                // read file data
                $query = "SELECT * FROM event_file WHERE file_id = ".$ilDB->quote($this->file_id)."";
                $res = $this->db->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $this->setFileName($row->file_name);
                        $this->setFileSize($row->file_size);
                        $this->setFileType($row->file_type);
                        $this->setEventId($row->event_id);
                }
                $this->fss_storage = new ilFSStorageEvent($this->getEventId());
                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilEventFile::_deleteByEvent ( a_event_id  ) 

Definition at line 222 of file class.ilEventFile.php.

References $ilDB, and $res.

Referenced by ilEvent::_delete().

        {
                global $ilDB;

                // delete all event ids and delete assigned files
                $query = "DELETE FROM event_file ".
                        "WHERE event_id = ".$ilDB->quote($a_event_id)."";
                $res = $ilDB->query($query);

                #$this->fss_storage->delete();
                return true;
        }

Here is the caller graph for this function:

& ilEventFile::_readFilesByEvent ( a_event_id  ) 

Definition at line 235 of file class.ilEventFile.php.

References $files, $ilDB, $res, and ilEventFile().

Referenced by ilEventAdministrationGUI::edit(), and ilEvent::readFiles().

        {
                global $ilDB;

                $query = "SELECT * FROM event_file ".
                        "WHERE event_id = ".$ilDB->quote($a_event_id)."";

                $res = $ilDB->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $files[] =& new ilEventFile($row->file_id);
                }
                return is_array($files) ? $files : array();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilEventFile::cloneFiles ( a_target_event_id  ) 

Clone files.

public

Parameters:
int new event_id

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

References $file, getAbsolutePath(), getEventId(), getFileName(), getFileSize(), getFileType(), and ilEventFile().

        {
                $file = new ilEventFile();
                $file->setEventId($a_target_event_id);
                $file->setFileName($this->getFileName());
                $file->setFileType($this->getFileType());
                $file->setFileSize($this->getFileSize());
                $file->create(false);
                
                // Copy file
                $source = new ilFSStorageEvent($this->getEventId());
                $source->copyFile($this->getAbsolutePath(),$file->getAbsolutePath());           
        }

Here is the call graph for this function:

ilEventFile::create ( a_upload = true  ) 

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

References $ilDB, $res, getErrorCode(), getEventId(), getFileId(), getFileName(), getFileSize(), getFileType(), getTemporaryName(), ilUtil::moveUploadedFile(), and setFileId().

        {
                global $ilDB;
                
                if($this->getErrorCode() != 0)
                {
                        return false;
                }

                $query = "INSERT INTO event_file ".
                        "SET event_id = ".$ilDB->quote($this->getEventId()).", ".
                        "file_name = ".$ilDB->quote($this->getFileName()).", ".
                        "file_size = ".$ilDB->quote($this->getFileSize()).", ".
                        "file_type = ".$ilDB->quote($this->getFileType())." ";
                
                $res = $this->db->query($query);
                $this->setFileId($this->db->getLastInsertId());

                $this->fss_storage = new ilFSStorageEvent($this->getEventId());
                $this->fss_storage->createDirectory();

                if($a_upload)
                {
                        // now create file
                        ilUtil::moveUploadedFile($this->getTemporaryName(),
                                $this->getFileName(),
                                $this->fss_storage->getAbsolutePath().'/'.$this->getFileId());
                        
                }

                return true;
        }

Here is the call graph for this function:

ilEventFile::delete (  ) 

Definition at line 208 of file class.ilEventFile.php.

References $ilDB, and getAbsolutePath().

        {
                global $ilDB;
                
                // Delete db entry
                $query = "DELETE FROM event_file ".
                        "WHERE file_id = ".$this->getFileId()." ";
                $this->db->query($query);

                // Delete file
                $this->fss_storage->deleteFile($this->getAbsolutePath());
                return true;
        }

Here is the call graph for this function:

ilEventFile::getAbsolutePath (  ) 

Definition at line 119 of file class.ilEventFile.php.

References getFileId().

Referenced by cloneFiles(), and delete().

        {
                return $this->fss_storage->getAbsolutePath()."/".$this->getFileId();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilEventFile::getErrorCode (  ) 

Definition at line 114 of file class.ilEventFile.php.

Referenced by create(), and validate().

        {
                return $this->error_code;
        }

Here is the caller graph for this function:

ilEventFile::getEventId (  ) 

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

Referenced by __read(), cloneFiles(), and create().

        {
                return $this->event_id;
        }

Here is the caller graph for this function:

ilEventFile::getFileId (  ) 

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

Referenced by create(), and getAbsolutePath().

        {
                return $this->file_id;
        }

Here is the caller graph for this function:

ilEventFile::getFileName (  ) 

Definition at line 82 of file class.ilEventFile.php.

Referenced by cloneFiles(), and create().

        {
                return $this->file_name;
        }

Here is the caller graph for this function:

ilEventFile::getFileSize (  ) 

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

Referenced by cloneFiles(), and create().

        {
                return $this->file_size;
        }

Here is the caller graph for this function:

ilEventFile::getFileType (  ) 

Definition at line 90 of file class.ilEventFile.php.

Referenced by cloneFiles(), and create().

        {
                return $this->file_type;
        }

Here is the caller graph for this function:

ilEventFile::getTemporaryName (  ) 

Definition at line 106 of file class.ilEventFile.php.

Referenced by create().

        {
                return $this->tmp_name;
        }

Here is the caller graph for this function:

ilEventFile::ilEventFile ( a_file_id = null  ) 

Definition at line 48 of file class.ilEventFile.php.

References $ilDB, $ilErr, $lng, and __read().

Referenced by _readFilesByEvent(), and cloneFiles().

        {
                global $ilErr,$ilDB,$lng;

                $this->ilErr =& $ilErr;
                $this->db  =& $ilDB;
                $this->lng =& $lng;

                $this->file_id = $a_file_id;
                $this->__read();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilEventFile::setErrorCode ( a_code  ) 

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

        {
                $this->error_code = $a_code;
        }

ilEventFile::setEventId ( a_event_id  ) 

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

Referenced by __read().

        {
                $this->event_id = $a_event_id;
        }

Here is the caller graph for this function:

ilEventFile::setFileId ( a_id  ) 

Definition at line 60 of file class.ilEventFile.php.

Referenced by create().

        {
                $this->file_id = $a_id;
        }

Here is the caller graph for this function:

ilEventFile::setFileName ( a_name  ) 

Definition at line 78 of file class.ilEventFile.php.

Referenced by __read().

        {
                $this->file_name = $a_name;
        }

Here is the caller graph for this function:

ilEventFile::setFileSize ( a_size  ) 

Definition at line 94 of file class.ilEventFile.php.

Referenced by __read().

        {
                $this->file_size = $a_size;
        }

Here is the caller graph for this function:

ilEventFile::setFileType ( a_type  ) 

Definition at line 86 of file class.ilEventFile.php.

Referenced by __read().

        {
                $this->file_type = $a_type;
        }

Here is the caller graph for this function:

ilEventFile::setTemporaryName ( a_name  ) 

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

        {
                $this->tmp_name = $a_name;
        }

ilEventFile::validate (  ) 

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

References getErrorCode().

        {
                switch($this->getErrorCode())
                {
                        case UPLOAD_ERR_INI_SIZE:
                                $this->ilErr->appendMessage($this->lng->txt('file_upload_ini_size'));
                                break;
                        case UPLOAD_ERR_FORM_SIZE:
                                $this->ilErr->appendMessage($this->lng->txt('file_upload_form_size'));
                                break;

                        case UPLOAD_ERR_PARTIAL:
                                $this->ilErr->appendMessage($this->lng->txt('file_upload_only_partial'));
                                break;

                        case UPLOAD_ERR_NO_TMP_DIR:
                                $this->ilErr->appendMessage($this->lng->txt('file_upload_no_tmp_dir'));
                                break;

                        #case UPLOAD_ERR_CANT_WRITE:
                        #       $this->ilErr->appendMessage($this->lng->txt('file_upload_no_write'));
                        #       break;

                        case UPLOAD_ERR_OK:
                        case UPLOAD_ERR_NO_FILE:
                        default:
                                return true;
                }
        }

Here is the call graph for this function:


Field Documentation

ilEventFile::$event_id = null

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

ilEventFile::$file_id = null

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

ilEventFile::$fss_storage = null [private]

Definition at line 46 of file class.ilEventFile.php.

ilEventFile::$ilDB
ilEventFile::$ilErr

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

Referenced by ilEventFile().

ilEventFile::$lng

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

Referenced by ilEventFile().

ilEventFile::$tree

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


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