ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilSessionFile Class Reference

class ilEvent More...

+ Inheritance diagram for ilSessionFile:
+ Collaboration diagram for ilSessionFile:

Public Member Functions

 ilSessionFile ($a_file_id=null)
 setFileId ($a_id)
 getFileId ()
 getSessionId ()
 setSessionId ($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 smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Member Function Documentation

ilSessionFile::__read ( )

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

References $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, getSessionId(), setFileName(), setFileSize(), setFileType(), and setSessionId().

Referenced by ilSessionFile().

{
global $ilDB;
if(!$this->file_id)
{
return true;
}
// read file data
$query = "SELECT * FROM event_file WHERE file_id = ".$ilDB->quote($this->file_id ,'integer')."";
$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->setSessionId($row->event_id);
}
$this->fss_storage = new ilFSStorageSession($this->getSessionId());
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSessionFile::_deleteByEvent (   $a_event_id)

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

References $ilDB, $query, and $res.

{
global $ilDB;
// delete all event ids and delete assigned files
$query = "DELETE FROM event_file ".
"WHERE event_id = ".$ilDB->quote($a_event_id ,'integer')."";
$res = $ilDB->manipulate($query);
#$this->fss_storage->delete();
return true;
}
ilSessionFile::_readFilesByEvent (   $a_event_id)

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

References $files, $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, and ilSessionFile().

Referenced by ilObjSession\initFiles().

{
global $ilDB;
$query = "SELECT * FROM event_file ".
"WHERE event_id = ".$ilDB->quote($a_event_id ,'integer')."";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$files[] =& new ilSessionFile($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:

ilSessionFile::cloneFiles (   $a_target_event_id)

Clone files.

public

Parameters
intnew event_id

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

References $file, getAbsolutePath(), getFileName(), getFileSize(), getFileType(), getSessionId(), and ilSessionFile().

{
$file->setSessionId($a_target_event_id);
$file->setFileName($this->getFileName());
$file->setFileType($this->getFileType());
$file->setFileSize($this->getFileSize());
$file->create(false);
// Copy file
$source = new ilFSStorageSession($this->getSessionId());
$source->copyFile($this->getAbsolutePath(),$file->getAbsolutePath());
}

+ Here is the call graph for this function:

ilSessionFile::create (   $a_upload = true)

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

References $ilDB, $query, $res, getErrorCode(), getFileId(), getFileName(), getFileSize(), getFileType(), getSessionId(), getTemporaryName(), ilUtil\moveUploadedFile(), and setFileId().

{
global $ilDB;
if($this->getErrorCode() != 0)
{
return false;
}
$next_id = $ilDB->nextId('event_file');
$query = "INSERT INTO event_file (file_id,event_id,file_name,file_size,file_type) ".
"VALUES( ".
$ilDB->quote($next_id ,'integer').", ".
$ilDB->quote($this->getSessionId() ,'integer').", ".
$ilDB->quote($this->getFileName() ,'text').", ".
$ilDB->quote($this->getFileSize() ,'integer').", ".
$ilDB->quote($this->getFileType() ,'text')." ".
")";
$res = $ilDB->manipulate($query);
$this->setFileId($next_id);
$this->fss_storage = new ilFSStorageSession($this->getSessionId());
$this->fss_storage->createDirectory();
if($a_upload)
{
// now create file
$this->getFileName(),
$this->fss_storage->getAbsolutePath().'/'.$this->getFileId());
}
return true;
}

+ Here is the call graph for this function:

ilSessionFile::delete ( )

Definition at line 212 of file class.ilSessionFile.php.

References $ilDB, $query, $res, getAbsolutePath(), and getFileId().

{
global $ilDB;
// Delete db entry
$query = "DELETE FROM event_file ".
"WHERE file_id = ".$ilDB->quote($this->getFileId() ,'integer')." ";
$res = $ilDB->manipulate($query);
// Delete file
$this->fss_storage->deleteFile($this->getAbsolutePath());
return true;
}

+ Here is the call graph for this function:

ilSessionFile::getAbsolutePath ( )

Definition at line 119 of file class.ilSessionFile.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:

ilSessionFile::getErrorCode ( )

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

Referenced by create(), and validate().

{
return $this->error_code;
}

+ Here is the caller graph for this function:

ilSessionFile::getFileId ( )

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

References $file_id.

Referenced by create(), delete(), and getAbsolutePath().

{
}

+ Here is the caller graph for this function:

ilSessionFile::getFileName ( )

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

References $file_name.

Referenced by cloneFiles(), and create().

{
}

+ Here is the caller graph for this function:

ilSessionFile::getFileSize ( )

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

Referenced by cloneFiles(), and create().

{
return $this->file_size;
}

+ Here is the caller graph for this function:

ilSessionFile::getFileType ( )

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

Referenced by cloneFiles(), and create().

{
return $this->file_type;
}

+ Here is the caller graph for this function:

ilSessionFile::getSessionId ( )

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

References $event_id.

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

{
}

+ Here is the caller graph for this function:

ilSessionFile::getTemporaryName ( )

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

Referenced by create().

{
return $this->tmp_name;
}

+ Here is the caller graph for this function:

ilSessionFile::ilSessionFile (   $a_file_id = null)

Definition at line 48 of file class.ilSessionFile.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:

ilSessionFile::setErrorCode (   $a_code)

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

{
$this->error_code = $a_code;
}
ilSessionFile::setFileId (   $a_id)

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

Referenced by create().

{
$this->file_id = $a_id;
}

+ Here is the caller graph for this function:

ilSessionFile::setFileName (   $a_name)

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

Referenced by __read().

{
$this->file_name = $a_name;
}

+ Here is the caller graph for this function:

ilSessionFile::setFileSize (   $a_size)

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

Referenced by __read().

{
$this->file_size = $a_size;
}

+ Here is the caller graph for this function:

ilSessionFile::setFileType (   $a_type)

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

Referenced by __read().

{
$this->file_type = $a_type;
}

+ Here is the caller graph for this function:

ilSessionFile::setSessionId (   $a_event_id)

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

Referenced by __read().

{
$this->event_id = $a_event_id;
}

+ Here is the caller graph for this function:

ilSessionFile::setTemporaryName (   $a_name)

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

{
$this->tmp_name = $a_name;
}
ilSessionFile::validate ( )

Definition at line 124 of file class.ilSessionFile.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

ilSessionFile::$event_id = null

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

Referenced by getSessionId().

ilSessionFile::$file_id = null

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

Referenced by getFileId().

ilSessionFile::$fss_storage = null
private

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

ilSessionFile::$ilDB
ilSessionFile::$ilErr

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

Referenced by ilSessionFile().

ilSessionFile::$lng

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

Referenced by ilSessionFile().

ilSessionFile::$tree

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


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