ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
OLE_PPS.php
Go to the documentation of this file.
1 <?php
2 /* vim: set expandtab tabstop=4 shiftwidth=4: */
3 // +----------------------------------------------------------------------+
4 // | PHP Version 4 |
5 // +----------------------------------------------------------------------+
6 // | Copyright (c) 1997-2002 The PHP Group |
7 // +----------------------------------------------------------------------+
8 // | This source file is subject to version 2.02 of the PHP license, |
9 // | that is bundled with this package in the file LICENSE, and is |
10 // | available at through the world-wide-web at |
11 // | http://www.php.net/license/2_02.txt. |
12 // | If you did not receive a copy of the PHP license and are unable to |
13 // | obtain it through the world-wide-web, please send a note to |
14 // | license@php.net so we can mail you a copy immediately. |
15 // +----------------------------------------------------------------------+
16 // | Author: Xavier Noguer <xnoguer@php.net> |
17 // | Based on OLE::Storage_Lite by Kawai, Takanori |
18 // +----------------------------------------------------------------------+
19 //
20 // $Id: OLE_PPS.php 21503 2009-09-07 07:33:14Z hschottm $
21 
22 
24 if (!defined('PHPEXCEL_ROOT')) {
28  define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../../');
29 }
30 
31 require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/OLE.php';
32 
41 {
46  public $No;
47 
52  public $Name;
53 
58  public $Type;
59 
64  public $PrevPps;
65 
70  public $NextPps;
71 
76  public $DirPps;
77 
82  public $Time1st;
83 
88  public $Time2nd;
89 
94  public $_StartBlock;
95 
100  public $Size;
101 
106  public $_data;
107 
112  public $children = array();
113 
118  public $ole;
119 
135  public function __construct($No, $name, $type, $prev, $next, $dir, $time_1st, $time_2nd, $data, $children)
136  {
137  $this->No = $No;
138  $this->Name = $name;
139  $this->Type = $type;
140  $this->PrevPps = $prev;
141  $this->NextPps = $next;
142  $this->DirPps = $dir;
143  $this->Time1st = $time_1st;
144  $this->Time2nd = $time_2nd;
145  $this->_data = $data;
146  $this->children = $children;
147  if ($data != '') {
148  $this->Size = strlen($data);
149  } else {
150  $this->Size = 0;
151  }
152  }
153 
160  public function _DataLen()
161  {
162  if (!isset($this->_data)) {
163  return 0;
164  }
165  if (isset($this->_PPS_FILE)) {
166  fseek($this->_PPS_FILE, 0);
167  $stats = fstat($this->_PPS_FILE);
168  return $stats[7];
169  } else {
170  return strlen($this->_data);
171  }
172  }
173 
180  public function _getPpsWk()
181  {
182  $ret = $this->Name;
183  for ($i = 0; $i < (64 - strlen($this->Name)); ++$i) {
184  $ret .= "\x00";
185  }
186  $ret .= pack("v", strlen($this->Name) + 2) // 66
187  . pack("c", $this->Type) // 67
188  . pack("c", 0x00) //UK // 68
189  . pack("V", $this->PrevPps) //Prev // 72
190  . pack("V", $this->NextPps) //Next // 76
191  . pack("V", $this->DirPps) //Dir // 80
192  . "\x00\x09\x02\x00" // 84
193  . "\x00\x00\x00\x00" // 88
194  . "\xc0\x00\x00\x00" // 92
195  . "\x00\x00\x00\x46" // 96 // Seems to be ok only for Root
196  . "\x00\x00\x00\x00" // 100
197  . PHPExcel_Shared_OLE::LocalDate2OLE($this->Time1st) // 108
198  . PHPExcel_Shared_OLE::LocalDate2OLE($this->Time2nd) // 116
199  . pack("V", isset($this->_StartBlock)?
200  $this->_StartBlock:0) // 120
201  . pack("V", $this->Size) // 124
202  . pack("V", 0); // 128
203  return $ret;
204  }
205 
215  public function _savePpsSetPnt(&$pps_array)
216  {
217  $pps_array[count($pps_array)] = &$this;
218  $this->No = count($pps_array) - 1;
219  $this->PrevPps = 0xFFFFFFFF;
220  $this->NextPps = 0xFFFFFFFF;
221  if (count($this->children) > 0) {
222  $this->DirPps = $this->children[0]->_savePpsSetPnt($pps_array);
223  } else {
224  $this->DirPps = 0xFFFFFFFF;
225  }
226  return $this->No;
227  }
228  }