Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 require_once dirname(__FILE__).'/class.ilBMFBase.php';
00023
00036 class ilBMFValue
00037 {
00043 var $value = NULL;
00044
00049 var $name = '';
00050
00055 var $type = '';
00056
00062 var $namespace = '';
00063 var $type_namespace = '';
00064
00065 var $attributes = array();
00066
00071 var $arrayType = '';
00072
00073 var $options = array();
00074
00075 var $nqn;
00076 var $tqn;
00084 function ilBMFValue($name = '', $type = false, $value, $attributes = array())
00085 {
00086
00087 $this->nqn = new QName($name);
00088 $this->name = $this->nqn->name;
00089 $this->namespace = $this->nqn->namespace;
00090 $this->tqn = new QName($type);
00091 $this->type = $this->tqn->name;
00092 $this->type_prefix = $this->tqn->ns;
00093 $this->type_namespace = $this->tqn->namespace;
00094 $this->value = $value;
00095 $this->attributes = $attributes;
00096 }
00097
00098
00104 function &serialize(&$serializer)
00105 {
00106 return $serializer->_serializeValue($this->value, $this->name, $this->type, $this->namespace, $this->type_namespace, $this->options, $this->attributes, $this->arrayType);
00107 }
00108 }
00109
00110
00125 class ilBMFHeader extends ilBMFValue
00126 {
00127
00137 function ilBMFHeader($name = '', $type, $value = NULL,
00138 $mustunderstand = 0,
00139 $actor = 'http://schemas.xmlsoap.org/soap/actor/next')
00140 {
00141 parent::ilBMFValue($name, $type, $value);
00142 $this->attributes['SOAP-ENV:actor'] = $actor;
00143 $this->attributes['SOAP-ENV:mustUnderstand'] = (int)$mustunderstand;
00144 }
00145 }
00146
00158 class ilBMFAttachment extends ilBMFValue
00159 {
00160
00168 function ilBMFAttachment($name = '', $type = 'application/octet-stream',
00169 $filename, $file=NULL)
00170 {
00171 global $SOAP_options;
00172 if (!isset($SOAP_options['Mime'])) {
00173 return PEAR::raiseError('Mail_mime is not installed, unable to support SOAP Attachements');
00174 }
00175 parent::ilBMFValue($name, NULL, NULL);
00176
00177 $filedata = ($file === NULL) ? $this->_file2str($filename) : $file;
00178 $filename = basename($filename);
00179 if (PEAR::isError($filedata)) {
00180 return $filedata;
00181 }
00182
00183 $cid = md5(uniqid(time()));
00184
00185 $this->attributes['href'] = 'cid:'.$cid;
00186
00187 $this->options['attachment'] = array(
00188 'body' => $filedata,
00189 'disposition' => $filename,
00190 'content_type' => $type,
00191 'encoding' => 'base64',
00192 'cid' => $cid
00193 );
00194 }
00195
00196
00197
00198
00199
00200
00201
00202 function & _file2str($file_name)
00203 {
00204 if (!is_readable($file_name)) {
00205 return PEAR::raiseError('File is not readable ' . $file_name);
00206 }
00207 if (!$fd = fopen($file_name, 'rb')) {
00208 return PEAR::raiseError('Could not open ' . $file_name);
00209 }
00210 $cont = fread($fd, filesize($file_name));
00211 fclose($fd);
00212 return $cont;
00213 }
00214 }
00215 ?>