ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 4249 2004-06-16 14:14:02Z hschottm $
21 
22 
23 require_once('PEAR.php');
24 require_once('classes/OLE/OLE.php');
25 
33 class OLE_PPS extends PEAR
34 {
39  var $No;
40 
45  var $Name;
46 
51  var $Type;
52 
57  var $PrevPps;
58 
63  var $NextPps;
64 
69  var $DirPps;
70 
75  var $Time1st;
76 
81  var $Time2nd;
82 
88 
93  var $Size;
94 
99  var $_data;
100 
105  var $children = array();
106 
121  function OLE_PPS($No, $name, $type, $prev, $next, $dir, $time_1st, $time_2nd, $data, $children)
122  {
123  $this->No = $No;
124  $this->Name = $name;
125  $this->Type = $type;
126  $this->PrevPps = $prev;
127  $this->NextPps = $next;
128  $this->DirPps = $dir;
129  $this->Time1st = $time_1st;
130  $this->Time2nd = $time_2nd;
131  $this->_data = $data;
132  $this->children = $children;
133  if ($data != '') {
134  $this->Size = strlen($data);
135  }
136  else {
137  $this->Size = 0;
138  }
139  }
140 
147  function _DataLen()
148  {
149  if (!isset($this->_data)) {
150  return 0;
151  }
152  if (isset($this->_PPS_FILE))
153  {
154  fseek($this->_PPS_FILE, 0);
155  $stats = fstat($this->_PPS_FILE);
156  return $stats[7];
157  }
158  else {
159  return strlen($this->_data);
160  }
161  }
162 
169  function _getPpsWk()
170  {
171  $ret = $this->Name;
172  for ($i = 0; $i < (64 - strlen($this->Name)); $i++) {
173  $ret .= "\x00";
174  }
175  $ret .= pack("v", strlen($this->Name) + 2) // 66
176  . pack("c", $this->Type) // 67
177  . pack("c", 0x00) //UK // 68
178  . pack("V", $this->PrevPps) //Prev // 72
179  . pack("V", $this->NextPps) //Next // 76
180  . pack("V", $this->DirPps) //Dir // 80
181  . "\x00\x09\x02\x00" // 84
182  . "\x00\x00\x00\x00" // 88
183  . "\xc0\x00\x00\x00" // 92
184  . "\x00\x00\x00\x46" // 96 // Seems to be ok only for Root
185  . "\x00\x00\x00\x00" // 100
186  . OLE::LocalDate2OLE($this->Time1st) // 108
187  . OLE::LocalDate2OLE($this->Time2nd) // 116
188  . pack("V", isset($this->_StartBlock)?
189  $this->_StartBlock:0) // 120
190  . pack("V", $this->Size) // 124
191  . pack("V", 0); // 128
192  return $ret;
193  }
194 
204  function _savePpsSetPnt(&$pps_array)
205  {
206  $pps_array[count($pps_array)] = &$this;
207  $this->No = count($pps_array) - 1;
208  $this->PrevPps = 0xFFFFFFFF;
209  $this->NextPps = 0xFFFFFFFF;
210  if (count($this->children) > 0) {
211  $this->DirPps = $this->children[0]->_savePpsSetPnt($pps_array);
212  }
213  else {
214  $this->DirPps = 0xFFFFFFFF;
215  }
216  return $this->No;
217  }
218 }
219 ?>