ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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: PPS.php,v 1.7 2007/02/13 21:00:42 schmidt Exp $
21 
22 
31 {
36  public $No;
37 
42  public $Name;
43 
48  public $Type;
49 
54  public $PrevPps;
55 
60  public $NextPps;
61 
66  public $DirPps;
67 
72  public $Time1st;
73 
78  public $Time2nd;
79 
84  public $_StartBlock;
85 
90  public $Size;
91 
96  public $_data;
97 
102  public $children = array();
103 
108  public $ole;
109 
125  public function __construct($No, $name, $type, $prev, $next, $dir, $time_1st, $time_2nd, $data, $children)
126  {
127  $this->No = $No;
128  $this->Name = $name;
129  $this->Type = $type;
130  $this->PrevPps = $prev;
131  $this->NextPps = $next;
132  $this->DirPps = $dir;
133  $this->Time1st = $time_1st;
134  $this->Time2nd = $time_2nd;
135  $this->_data = $data;
136  $this->children = $children;
137  if ($data != '') {
138  $this->Size = strlen($data);
139  } else {
140  $this->Size = 0;
141  }
142  }
143 
150  public function _DataLen()
151  {
152  if (!isset($this->_data)) {
153  return 0;
154  }
155  //if (isset($this->_PPS_FILE)) {
156  // fseek($this->_PPS_FILE, 0);
157  // $stats = fstat($this->_PPS_FILE);
158  // return $stats[7];
159  //} else {
160  return strlen($this->_data);
161  //}
162  }
163 
170  public function _getPpsWk()
171  {
172  $ret = str_pad($this->Name,64,"\x00");
173 
174  $ret .= pack("v", strlen($this->Name) + 2) // 66
175  . pack("c", $this->Type) // 67
176  . pack("c", 0x00) //UK // 68
177  . pack("V", $this->PrevPps) //Prev // 72
178  . pack("V", $this->NextPps) //Next // 76
179  . pack("V", $this->DirPps) //Dir // 80
180  . "\x00\x09\x02\x00" // 84
181  . "\x00\x00\x00\x00" // 88
182  . "\xc0\x00\x00\x00" // 92
183  . "\x00\x00\x00\x46" // 96 // Seems to be ok only for Root
184  . "\x00\x00\x00\x00" // 100
185  . PHPExcel_Shared_OLE::LocalDate2OLE($this->Time1st) // 108
186  . PHPExcel_Shared_OLE::LocalDate2OLE($this->Time2nd) // 116
187  . pack("V", isset($this->_StartBlock)?
188  $this->_StartBlock:0) // 120
189  . pack("V", $this->Size) // 124
190  . pack("V", 0); // 128
191  return $ret;
192  }
193 
203  public static function _savePpsSetPnt(&$raList, $to_save, $depth = 0)
204  {
205  if ( !is_array($to_save) || (empty($to_save)) ) {
206  return 0xFFFFFFFF;
207  } elseif( count($to_save) == 1 ) {
208  $cnt = count($raList);
209  // If the first entry, it's the root... Don't clone it!
210  $raList[$cnt] = ( $depth == 0 ) ? $to_save[0] : clone $to_save[0];
211  $raList[$cnt]->No = $cnt;
212  $raList[$cnt]->PrevPps = 0xFFFFFFFF;
213  $raList[$cnt]->NextPps = 0xFFFFFFFF;
214  $raList[$cnt]->DirPps = self::_savePpsSetPnt($raList, @$raList[$cnt]->children, $depth++);
215  } else {
216  $iPos = floor(count($to_save) / 2);
217  $aPrev = array_slice($to_save, 0, $iPos);
218  $aNext = array_slice($to_save, $iPos + 1);
219  $cnt = count($raList);
220  // If the first entry, it's the root... Don't clone it!
221  $raList[$cnt] = ( $depth == 0 ) ? $to_save[$iPos] : clone $to_save[$iPos];
222  $raList[$cnt]->No = $cnt;
223  $raList[$cnt]->PrevPps = self::_savePpsSetPnt($raList, $aPrev, $depth++);
224  $raList[$cnt]->NextPps = self::_savePpsSetPnt($raList, $aNext, $depth++);
225  $raList[$cnt]->DirPps = self::_savePpsSetPnt($raList, @$raList[$cnt]->children, $depth++);
226 
227  }
228  return $cnt;
229  }
230 }
_DataLen()
Returns the amount of data saved for this PPS.
Definition: PPS.php:150
__construct($No, $name, $type, $prev, $next, $dir, $time_1st, $time_2nd, $data, $children)
The constructor.
Definition: PPS.php:125
_getPpsWk()
Returns a string with the PPS&#39;s WK (What is a WK?)
Definition: PPS.php:170
Create styles array
The data for the language used.
$ret
Definition: parser.php:6
static LocalDate2OLE($date=null)
Utility function Returns a string for the OLE container with the date given.
Definition: OLE.php:464
static _savePpsSetPnt(&$raList, $to_save, $depth=0)
Updates index and pointers to previous, next and children PPS&#39;s for this PPS.
Definition: PPS.php:203