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 () | |
| create () | |
| delete () | |
| _deleteByEvent ($a_event_id) | |
| & | _readFilesByEvent ($a_event_id) |
| __getDirectory () | |
| __read () | |
Data Fields | |
| $ilErr | |
| $ilDB | |
| $tree | |
| $lng | |
| $event_id = null | |
| $file_id = null | |
Definition at line 36 of file class.ilEventFile.php.
| ilEventFile::__getDirectory | ( | ) |
Definition at line 222 of file class.ilEventFile.php.
References ilUtil::getDataDir(), and getEventId().
Referenced by create(), and getAbsolutePath().
{
return ilUtil::getDataDir()."/events/event_".$this->getEventId();
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilEventFile::__read | ( | ) |
Definition at line 227 of file class.ilEventFile.php.
References $query, $res, $row, setEventId(), setFileName(), setFileSize(), and setFileType().
Referenced by ilEventFile().
{
if(!$this->file_id)
{
return true;
}
// read file data
$query = "SELECT * FROM event_file WHERE file_id = '".$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);
}
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 191 of file class.ilEventFile.php.
References $ilDB, $query, $res, ilUtil::delDir(), and ilUtil::getDataDir().
Referenced by ilEvent::_delete().
{
global $ilDB;
// delete all event ids and delete assigned files
$query = "DELETE FROM event_file ".
"WHERE event_id = '".$a_event_id."'";
$res = $ilDB->query($query);
ilUtil::delDir(ilUtil::getDataDir()."/events/event_".$a_event_id);
return true;
}
Here is the call graph for this function:
Here is the caller graph for this function:| & ilEventFile::_readFilesByEvent | ( | $ | a_event_id | ) |
Definition at line 205 of file class.ilEventFile.php.
References $files, $ilDB, $query, $res, $row, and ilEventFile().
Referenced by ilEventAdministrationGUI::edit(), and ilEvent::readFiles().
{
global $ilDB;
$query = "SELECT * FROM event_file ".
"WHERE event_id = '".$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::create | ( | ) |
Definition at line 152 of file class.ilEventFile.php.
References $query, $res, __getDirectory(), getErrorCode(), getFileId(), getFileName(), getFileSize(), getFileType(), getTemporaryName(), ilUtil::makeDirParents(), ilUtil::moveUploadedFile(), and setFileId().
{
if($this->getErrorCode() != 0)
{
return false;
}
$query = "INSERT INTO event_file ".
"SET event_id = '".$this->getEventId()."', ".
"file_name = '".ilUtil::prepareDBString($this->getFileName())."', ".
"file_size = '".ilUtil::prepareDBString($this->getFileSize())."', ".
"file_type = '".ilUtil::prepareDBString($this->getFileType())."' ";
$res = $this->db->query($query);
$this->setFileId($this->db->getLastInsertId());
if(!is_dir($this->__getDirectory()))
{
ilUtil::makeDirParents($this->__getDirectory());
}
// now create file
ilUtil::moveUploadedFile($this->getTemporaryName(),$this->getFileName(),$this->__getDirectory().'/'.$this->getFileId());
return true;
}
Here is the call graph for this function:| ilEventFile::delete | ( | ) |
Definition at line 178 of file class.ilEventFile.php.
References $query, and getAbsolutePath().
{
// Delete db entry
$query = "DELETE FROM event_file ".
"WHERE file_id = '".$this->getFileId()."'";
$this->db->query($query);
// Delete file
unlink($this->getAbsolutePath());
return true;
}
Here is the call graph for this function:| ilEventFile::getAbsolutePath | ( | ) |
Definition at line 117 of file class.ilEventFile.php.
References __getDirectory(), and getFileId().
Referenced by delete().
{
return $this->__getDirectory()."/".$this->getFileId();
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilEventFile::getErrorCode | ( | ) |
Definition at line 112 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 67 of file class.ilEventFile.php.
Referenced by __getDirectory().
{
return $this->event_id;
}
Here is the caller graph for this function:| ilEventFile::getFileId | ( | ) |
Definition at line 62 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 80 of file class.ilEventFile.php.
Referenced by create().
{
return $this->file_name;
}
Here is the caller graph for this function:| ilEventFile::getFileSize | ( | ) |
Definition at line 96 of file class.ilEventFile.php.
Referenced by create().
{
return $this->file_size;
}
Here is the caller graph for this function:| ilEventFile::getFileType | ( | ) |
Definition at line 88 of file class.ilEventFile.php.
Referenced by create().
{
return $this->file_type;
}
Here is the caller graph for this function:| ilEventFile::getTemporaryName | ( | ) |
Definition at line 104 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 46 of file class.ilEventFile.php.
References $ilDB, $ilErr, $lng, and __read().
Referenced by _readFilesByEvent().
{
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 108 of file class.ilEventFile.php.
{
$this->error_code = $a_code;
}
| ilEventFile::setEventId | ( | $ | a_event_id | ) |
Definition at line 71 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 58 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 76 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 92 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 84 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 100 of file class.ilEventFile.php.
{
$this->tmp_name = $a_name;
}
| ilEventFile::validate | ( | ) |
Definition at line 122 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:| 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::$ilDB |
Definition at line 39 of file class.ilEventFile.php.
Referenced by _deleteByEvent(), _readFilesByEvent(), and ilEventFile().
| 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.
1.7.1