ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules 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. More...
 
 _file2str ($file_name)
 Returns the contents of the given file name as string. More...
 
- Public Member Functions inherited from ilBMFValue
 ilBMFValue ($name='', $type=false, $value=null, $attributes=array())
 Constructor. More...
 
 serialize (&$serializer)
 Serializes this value. More...
 

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

◆ _file2str()

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().

225  {
226  if (!is_readable($file_name)) {
227  return PEAR::raiseError('File is not readable: ' . $file_name);
228  }
229 
230  if (function_exists('file_get_contents')) {
231  return file_get_contents($file_name);
232  }
233 
234  if (!$fd = fopen($file_name, 'rb')) {
235  return PEAR::raiseError('Could not open ' . $file_name);
236  }
237  $cont = fread($fd, filesize($file_name));
238  fclose($fd);
239 
240  return $cont;
241  }
& raiseError($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
This method is a wrapper that returns an instance of the configured error class with this object's de...
Definition: PEAR.php:524
+ Here is the call graph for this function:

◆ SOAP_Attachment()

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, PEAR\isError(), and PEAR\raiseError().

189  {
190  parent::ilBMFValue($name, null, null);
191 
192  if (!isset($GLOBALS['SOAP_options']['Mime'])) {
193  $this->options['attachment'] = PEAR::raiseError('Mail_mime is not installed, unable to support SOAP Attachements');
194  return;
195  }
196 
197  $filedata = ($file === null) ? $this->_file2str($filename) : $file;
198  $filename = basename($filename);
199  if (PEAR::isError($filedata)) {
200  $this->options['attachment'] = $filedata;
201  return;
202  }
203 
204  $cid = md5(uniqid(time()));
205 
206  $this->attributes['href'] = 'cid:' . $cid;
207 
208  $this->options['attachment'] = array('body' => $filedata,
209  'disposition' => $filename,
210  'content_type' => $type,
211  'encoding' => 'base64',
212  'cid' => $cid);
213  }
print $file
_file2str($file_name)
Returns the contents of the given file name as string.
$GLOBALS['ct_recipient']
$filename
Definition: buildRTE.php:89
& raiseError($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
This method is a wrapper that returns an instance of the configured error class with this object&#39;s de...
Definition: PEAR.php:524
isError($data, $code=null)
Tell whether a value is a PEAR error.
Definition: PEAR.php:279
+ Here is the call graph for this function:

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