Location: PHPKode > projects > RCS Man on the Web > RCSManager-0.2/classes/AbstractFile.php
<?php
/** 
 * $Id$
 * $Log$
 */

/****************************************************************************************
 *
 * This class is an abstract of what is a file
 *
 * Methods:
 *
 * AbstractFile(String $name, String $type, String $location, Array $attribut)
 *   Builder
 *
 * Array getParams()
 *   Give a table of the file attribut
 *
 ***************************************************************************************/
Class AbstractFile
{
  /** this files's name */
  var $_name;

  /** location of this file */
  var $_location;

  /** Type of this file (folder, sysfile, rcsfile) */
  var $_type;

  /** Information conexe, au minimum ["status"] */
  var $_attribut;

  /**
   * Builder of this class
   * @param $name       name of this file
   * @param $location   location of this file
   * @param $type       type of this file (sysfile, ou rcsfile)
   * @param $attribut   status of this file
   */
  function AbstractFile($name, $type, $location, $attribut = false)
  {
    $this->_name     = $name;
    $this->_type     = $type;
    $this->_location = $location;
    $this->_attribut = $attribut;
  }/* AbstractFile() */

  /**
   * Give a table of the file attribut
   * @return the Table: {name, location, icon, type}
   */
  function getParams()
  {
    // selection de l'icon
    GLOBAL $icons;
    $icon = $icons["$this->_type." . $this->_attribut["status"]];

    // cas de la racine
    if($this->_attribut["status"] == "root")
    {
      $name = BASE_name;
      $location = "/";
    }else{
      $name = $this->_name;
      if($this->_location == "/") 
	$location = "/$this->_name"; 
      else 
	$location = "$this->_location/$this->_name";
    }

    return(array("location" => urlencode($location), "name" => $name, "icon" => $icon, "type" => $this->_type));

  }/* getParams() */

}/* Class AbstractFile */

?>
Return current item: RCS Man on the Web