/**
  * Constructor.
  * Initialize the DBRowIterator
  * @param $records object ADO record set
  * @param $dao object DAO class for factory
  * @param $functionName The function to call on $dao to create an object
  */
 function __construct(&$records, $idFields = array())
 {
     parent::__construct();
     $this->idFields = $idFields;
     if (!$records || $records->EOF) {
         if ($records) {
             $records->Close();
         }
         $this->records = null;
         $this->wasEmpty = true;
         $this->page = 1;
         $this->isFirst = true;
         $this->isLast = true;
         $this->count = 0;
         $this->pageCount = 1;
     } else {
         $this->records =& $records;
         $this->wasEmpty = false;
         $this->page = $records->AbsolutePage();
         $this->isFirst = $records->atFirstPage();
         $this->isLast = $records->atLastPage();
         $this->count = $records->MaxRecordCount();
         $this->pageCount = $records->LastPageNo();
     }
 }
 /**
  * Constructor.
  * @param $theArray array The array of items to iterate through
  * @param $totalItems int The total number of items in the virtual "larger" array
  * @param $page int the current page number
  * @param $itemsPerPage int Number of items to display per page
  */
 function __construct(&$theArray, $totalItems, $page = -1, $itemsPerPage = -1)
 {
     parent::__construct();
     if ($page >= 1 && $itemsPerPage >= 1) {
         $this->page = $page;
     } else {
         $this->page = 1;
         $this->itemsPerPage = max(count($this->theArray), 1);
     }
     $this->theArray =& $theArray;
     $this->count = $totalItems;
     $this->itemsPerPage = $itemsPerPage;
     $this->wasEmpty = count($this->theArray) == 0;
     reset($this->theArray);
 }
 /**
  * Constructor.
  * @param $theArray array The array of items to iterate through
  * @param $page int the current page number
  * @param $itemsPerPage int Number of items to display per page
  */
 function __construct(&$theArray, $page = -1, $itemsPerPage = -1)
 {
     parent::__construct();
     if ($page >= 1 && $itemsPerPage >= 1) {
         $this->theArray = $this->array_slice_key($theArray, ($page - 1) * $itemsPerPage, $itemsPerPage);
         $this->page = $page;
     } else {
         $this->theArray =& $theArray;
         $this->page = 1;
         $this->itemsPerPage = max(count($this->theArray), 1);
     }
     $this->count = count($theArray);
     $this->itemsPerPage = $itemsPerPage;
     $this->wasEmpty = count($this->theArray) == 0;
     reset($this->theArray);
 }
示例#4
0
<?php

require_once 'src/class/filebrowser.php';
require_once 'src/class/FolderReader.php';
require_once 'src/class/ItemIterator.php';
$reader = new FolderReader('nbproject');
$reader->setExtensionFilter(array("ico", "xml"));
if ($reader->readFolder()) {
    // print_r($reader->getAllFiles());
    $itemIterator = new ItemIterator($reader->getAllFiles("files"));
}
$itemIterator1 = new ItemIterator($reader->getAllFiles("folders"));
//print_r($itemIterator);
while ($itemIterator1->valid()) {
    echo "Folder: " . $itemIterator1->current()->getName() . "<br>";
    $itemIterator1->next();
}
while ($itemIterator->valid()) {
    echo "File: " . $itemIterator->current()->getName() . "<br>";
    $itemIterator->next();
}
/*
 * Add your filebrowser definition code here
 */
//function read_all_files($root = '.') {
//    $files = array('files' => array(), 'dirs' => array());
//    $directories = array();
//    $last_letter = $root[strlen($root) - 1];
//    $root = ($last_letter == '\\' || $last_letter == '/') ? $root : $root . DIRECTORY_SEPARATOR;
//
//    $directories[] = $root;
示例#5
0
 * @version    SVN: $Id$
 * @link       http://pear.php.net/package/PackageName
 * @see        NetOther, Net_Sample::Net_Sample()
 * @since      File available since Release 1.2.0
 * @deprecated File deprecated in Release 2.0.0
 */
$defaul = '../';
if (!isset($_POST['dir'])) {
    $fileBrowser = new FileBrowser($defaul);
} else {
    $fileBrowser = new FileBrowser($defaul, $_POST['dir']);
}
$fileBrowser->SetExtensionFilter(array(".DS_Store", ".gitignore", ".version"));
$arrayFiles = $fileBrowser->Get();
@($itratorFiles = new ItemIterator($arrayFiles["files"]));
@($iteratorFolders = new ItemIterator($arrayFiles["folders"]));
?>
<ul class="jqueryFileTree" style="display: none;">
    <?php 
while ($iteratorFolders->valid()) {
    $name = $iteratorFolders->current()->getName();
    $path = $iteratorFolders->current()->getPath();
    ?>
        <li class="directory collapsed"><a href="" rel="<?php 
    echo $path;
    ?>
"><?php 
    echo $name;
    ?>
</a></li>
        <?php