Esempio n. 1
0
 /**
  * This method exports the data.
  *
  * @access public
  * @param Core\IMessage $message                            the message container
  */
 public function export(Core\IMessage $message = null)
 {
     if (empty($this->file_name)) {
         date_default_timezone_set('America/Denver');
         $this->file_name = date('YmdHis') . '.xml';
     }
     $uri = preg_split('!(\\?.*|/)!', $this->file_name, -1, PREG_SPLIT_NO_EMPTY);
     $uri = $uri[count($uri) - 1];
     $charset = isset($this->encoding[1]) ? $this->encoding[1] : Core\Data\Charset::UTF_8_ENCODING;
     if ($message === null) {
         $message = new Core\Message();
         $send = true;
     } else {
         $send = false;
     }
     $buffer = new IO\StringBuffer($this->render());
     $message->setHeader('content-disposition', 'attachment; filename="' . $uri . '"');
     $message->setHeader('content-type', 'text/xml; charset=' . $charset);
     $message->setBody($buffer);
     if ($send) {
         $message->send();
     }
 }
Esempio n. 2
0
 /**
  * This function exports the barcode image.
  *
  * @access public
  * @param Core\IMessage $message                            the message container
  */
 public function export(Core\IMessage $message = null)
 {
     $uri = (string) $this->file;
     if ($message === null) {
         $message = new Core\Message();
         $send = true;
     } else {
         $send = false;
     }
     $buffer = new IO\ImageBuffer($this->render());
     $message->setHeader('content-disposition', 'attachment; filename="' . $uri . '"');
     $message->setHeader('content-type', $buffer->getContentType());
     $message->setBody($buffer);
     if ($send) {
         $message->send();
     }
 }