You are here

public static function PHPExcel_Shared_OLE_PPS::_savePpsSetPnt in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/OLE/PPS.php \PHPExcel_Shared_OLE_PPS::_savePpsSetPnt()

* Updates index and pointers to previous, next and children PPS's for this * PPS. I don't think it'll work with Dir PPS's. * * @access public *

Parameters

array &$raList Reference to the array of PPS's for the whole OLE: * container * @return integer The index for this PPS

1 call to PHPExcel_Shared_OLE_PPS::_savePpsSetPnt()
PHPExcel_Shared_OLE_PPS_Root::save in vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/OLE/PPS/Root.php
* Method for saving the whole OLE container (including files). * In fact, if called with an empty argument (or '-'), it saves to a * temporary file and then outputs it's contents to stdout. * If a resource pointer to a stream created…

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/OLE/PPS.php, line 203

Class

PHPExcel_Shared_OLE_PPS
Class for creating PPS's for OLE containers

Code

public static function _savePpsSetPnt(&$raList, $to_save, $depth = 0) {
  if (!is_array($to_save) || empty($to_save)) {
    return 0xffffffff;
  }
  elseif (count($to_save) == 1) {
    $cnt = count($raList);

    // If the first entry, it's the root... Don't clone it!
    $raList[$cnt] = $depth == 0 ? $to_save[0] : clone $to_save[0];
    $raList[$cnt]->No = $cnt;
    $raList[$cnt]->PrevPps = 0xffffffff;
    $raList[$cnt]->NextPps = 0xffffffff;
    $raList[$cnt]->DirPps = self::_savePpsSetPnt($raList, @$raList[$cnt]->children, $depth++);
  }
  else {
    $iPos = floor(count($to_save) / 2);
    $aPrev = array_slice($to_save, 0, $iPos);
    $aNext = array_slice($to_save, $iPos + 1);
    $cnt = count($raList);

    // If the first entry, it's the root... Don't clone it!
    $raList[$cnt] = $depth == 0 ? $to_save[$iPos] : clone $to_save[$iPos];
    $raList[$cnt]->No = $cnt;
    $raList[$cnt]->PrevPps = self::_savePpsSetPnt($raList, $aPrev, $depth++);
    $raList[$cnt]->NextPps = self::_savePpsSetPnt($raList, $aNext, $depth++);
    $raList[$cnt]->DirPps = self::_savePpsSetPnt($raList, @$raList[$cnt]->children, $depth++);
  }
  return $cnt;
}