ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
SOAP_Attachment Class Reference
+ Inheritance diagram for SOAP_Attachment:
+ Collaboration diagram for SOAP_Attachment:

Public Member Functions

 SOAP_Attachment ($name= '', $type= 'application/octet-stream', $filename, $file=null)
 Constructor.
 _file2str ($file_name)
 Returns the contents of the given file name as string.
- Public Member Functions inherited from ilBMFValue
 ilBMFValue ($name= '', $type=false, $value=null, $attributes=array())
 Constructor.
 serialize (&$serializer)
 Serializes this value.

Additional Inherited Members

- Data Fields inherited from ilBMFValue
 $value = null
 $name = ''
 $type = ''
 $namespace = ''
 $type_namespace = ''
 $attributes = array()
 $arrayType = ''
 $options = array()
 $nqn
 $tqn

Detailed Description

Definition at line 176 of file class.ilBMFValue.php.

Member Function Documentation

SOAP_Attachment::_file2str (   $file_name)

Returns the contents of the given file name as string.

private

Parameters
string$file_nameThe file location.
Returns
string The file data or a PEAR_Error.

Definition at line 224 of file class.ilBMFValue.php.

References PEAR\raiseError().

Referenced by SOAP_Attachment().

{
if (!is_readable($file_name)) {
return PEAR::raiseError('File is not readable: ' . $file_name);
}
if (function_exists('file_get_contents')) {
return file_get_contents($file_name);
}
if (!$fd = fopen($file_name, 'rb')) {
return PEAR::raiseError('Could not open ' . $file_name);
}
$cont = fread($fd, filesize($file_name));
fclose($fd);
return $cont;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

SOAP_Attachment::SOAP_Attachment (   $name = '',
  $type = 'application/octet-stream',
  $filename,
  $file = null 
)

Constructor.

Parameters
string$nameName of the SOAP value <value_name>
string$typeThe attachment's MIME type.
string$filenameThe attachment's file name. Ignored if $file is provide.
string$fileThe attachment data.

Definition at line 187 of file class.ilBMFValue.php.

References $file, $filename, $GLOBALS, ilBMFValue\$name, ilBMFValue\$type, _file2str(), ilBMFValue\ilBMFValue(), PEAR\isError(), and PEAR\raiseError().

{
parent::ilBMFValue($name, null, null);
if (!isset($GLOBALS['SOAP_options']['Mime'])) {
$this->options['attachment'] = PEAR::raiseError('Mail_mime is not installed, unable to support SOAP Attachements');
return;
}
$filedata = ($file === null) ? $this->_file2str($filename) : $file;
$filename = basename($filename);
if (PEAR::isError($filedata)) {
$this->options['attachment'] = $filedata;
return;
}
$cid = md5(uniqid(time()));
$this->attributes['href'] = 'cid:' . $cid;
$this->options['attachment'] = array('body' => $filedata,
'disposition' => $filename,
'content_type' => $type,
'encoding' => 'base64',
'cid' => $cid);
}

+ Here is the call graph for this function:


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