Public Member Functions

ilBMFAttachment Class Reference

Inheritance diagram for ilBMFAttachment:
Collaboration diagram for ilBMFAttachment:

Public Member Functions

 ilBMFAttachment ($name= '', $type= 'application/octet-stream', $filename, $file=NULL)
 Constructor.
_file2str ($file_name)

Detailed Description

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


Member Function Documentation

& ilBMFAttachment::_file2str ( file_name  ) 

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

References $file_name.

Referenced by ilBMFAttachment().

    {
        if (!is_readable($file_name)) {
            return PEAR::raiseError('File is not readable ' . $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 caller graph for this function:

ilBMFAttachment::ilBMFAttachment ( name = '',
type = 'application/octet-stream',
filename,
file = NULL 
)

Constructor.

Parameters:
string name of the soap-value <value_name>
mixed soap header value
string namespace

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

References $file, ilBMFValue::$name, ilBMFValue::$type, _file2str(), and ilBMFValue::ilBMFValue().

    {
        global $SOAP_options;
        if (!isset($SOAP_options['Mime'])) {
            return PEAR::raiseError('Mail_mime is not installed, unable to support SOAP Attachements');
        }
        parent::ilBMFValue($name, NULL, NULL);
        
        $filedata = ($file === NULL) ? $this->_file2str($filename) : $file;
        $filename = basename($filename);
        if (PEAR::isError($filedata)) {
            return $filedata;
        }
        
        $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: