<?php
/**
* $Id$
* $Log$
*/
/****************************************************************************************
*
* La classe suivante sert à générer la liste des fichiers
* Interface:
* InfosPage(String $pwd, String $head, String $body, Array $argv) Constructeur
* boolean makeHtmlHeader()
* boolean makeHtmlBody()
*
***************************************************************************************/
Class FilesPage extends AbstractPage
{
/** Répertoire courant */
var $_pwd = "";
/** Gestionnaire RCS */
var $_rcs = false;
/** Table des fichiers RCS */
var $_RCSfiles = array();
/** Table des fichiers du répertoire */
var $_SYSfiles = array();
/**
* Constructeur de la classe
* @param $pwd répertoire de travail
* @param $head paramètre de l'en-tete
* @param $head paramètre du corps de page
* @param $argv argument de l'URL
*/
function FilesPage($pwd, $body = false, $argv = false)
{
parent::AbstractPage(MyNAME . ":Files", $body, $argv);
$this->_pwd = $pwd;
$this->makeFilesTable();
$this->_rcs = new RCS($this->_pwd);
$this->_RCSfiles = $this->_rcs->getFilesTable();
}/* FilesPage() */
/**
* Génère le corps de la page html
*/
function makeHtmlBody()
{
GLOBAL $icons;
if(!parent::makeHtmlBody())
return(false);
$this->_body->assign("script", BASE_script);
$this->_body->assign("icons", $icons);
// Liste des fichiers
reset($this->_SYSfiles);
while(list($k, $v) = each($this->_SYSfiles))
{
$this->_body->assign("param", $v->getParams());
$this->_body->parse("main.sys_item");
}
// Liste des fichiers RCS
reset($this->_RCSfiles);
while(list($k, $v) = each($this->_RCSfiles))
{
$this->_body->assign("param", $v->getParams());
$this->_body->parse("main.rcs_item");
}
$this->_body->parse("main");
$this->_body->out("main");
return(true);
}/* makeHtmlBody() */
/**
* Génère une table contenant la liste des fichiers du répertoire courant (objet SYSFile)
*/
function makeFilesTable()
{
$realpath = BASE_dir . $this->_pwd;
$mydir = opendir($realpath);
while($entry = readdir($mydir))
{
switch(filetype("$realpath/$entry"))
{
// Fichier à traiter
case "file":
if($entry[0] == ".") break;
if(preg_match("/^.*~$/", $entry)) break;
if(preg_match("/^.*\.bak$/", $entry)) break;
$this->_SYSfiles[$entry] = new SYSFile($entry, $this->_pwd);
break;
// Entré à exclure
default:
break;
}
}
}/* fileListe() */
}/* Class FilesPage */
?>