Source for file CLIENT_DEP_TREE.phpclass

Documentation is available at CLIENT_DEP_TREE.phpclass

  1. <?php
  2. /**
  3.   * Class file CLIENT_DEP_TREE.phpclass
  4.   *
  5.   * @project    Open CSP-Management
  6.   * @package    client
  7.   *
  8.   * @author     Peter Krebs (pk) <p.krebs@lvus.at>
  9.   * @copyright  (c) 2002-2003 by Peter Krebs and Landesverlag Unternehmensservice
  10.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  11.   *
  12.   * @since pk-05-03-30
  13.   *
  14.   ***/
  15.  
  16. require_once $GLOBALS['DEFAULTCONFPATH']."client.conf.phpinc";
  17. require_once $GLOBALS['OCSP']['PHPINCPATH']."db/dbms_tree.phpclass";
  18. require_once $GLOBALS['CLIENT']['PHPINCPATH']."CLIENT_DEP_TREE_NODE.phpclass";
  19. require_once $GLOBALS['CLIENT']['PHPINCPATH']."CLIENT.phpclass";
  20.  
  21. class CLIENT_DEP_TREE extends DBMS_TREE {
  22.     /**
  23.       * @var  string  $myGlobalTreeKey      index in $GLOABLS['DBMS_TREE'][]
  24.       ***/
  25.     var $myGlobalTreeKey = "T_CLI_DEPARTMENT";
  26.  
  27.     /**
  28.       * @staticvar string $myTable 
  29.       */
  30.     var $myTable="T_CLI_DEPARTMENT";
  31.  
  32.     /**
  33.       * @staticvar  string  $myIdFld        id column = root
  34.       ***/
  35.     var $myIdFld        ="CDEP_ID";
  36.  
  37.     /**
  38.       * @staticvar  string  $myParentFld    name of the parent column
  39.       ***/
  40.     var $myParentFld    ="CDEP_PARENT";
  41.  
  42.     /**
  43.       * @staticvar  string  $mySortFld      name of the sort field
  44.       ***/
  45.     var $mySortFld      ="CDEP_NAME";
  46.  
  47.     /**
  48.       * @var  string  $myChildClass 
  49.       ***/
  50.     var $myChildClass = "CLIENT_DEP_TREE_NODE";
  51.  
  52.     var $myClassSrcFile=__FILE__;
  53.  
  54.     /**
  55.       * wether getname should only return
  56.       * CDEP_NAME or CDEP_LONGNAME (CDEP_NAME)
  57.       *
  58.       * @var boolean $getFullName 
  59.       * @since pk-05-04-08
  60.       *
  61.       ***/
  62.     var $getFullName=FALSE;
  63.  
  64.     /**
  65.       * @var CLIENT $myCliObj 
  66.       * @since pk-07-01-12
  67.       ***/
  68.     var $myCliObj=NULL;
  69.  
  70.     /**
  71.       * @var int $myCliId 
  72.       * @since pk-07-01-12
  73.       ***/
  74.     var $myCliId=0;
  75.  
  76.     // ~~~~~~~~~~~~~~~ Cunstructor ~~~~~~~~~~~~~~~~~~~~~~~~
  77.  
  78.     /**
  79.       * constructor
  80.       * @since pk-07-01-12
  81.       ***/
  82.     function CLIENT_DEP_TREE($cliId=0,$gDBIDX="USRDB",$debug=FALSE{
  83.         $this->set_gDBIDX($gDBIDX);
  84.         if (intval($cliId)) {
  85.             $this->myCliId=intval($cliId);
  86.         }
  87.     }
  88.  
  89.     // ~~~~~~~~~~~~~~~ child methods ~~~~~~~~~~~~~~~~~~~~~~~~
  90.  
  91.     /**
  92.       * sets child class vars
  93.       *
  94.       * @param &DBMS_TREE_NODE $child 
  95.       *
  96.       * @since pk-07-01-12
  97.       *
  98.       ***/
  99.     function setChildClassVar(&$child{
  100.         parent::setChildClassVar($child);
  101.         $child->myCliId =&$this->myCliId;
  102.         $child->myCliObj=&$this->myCliObj;
  103.     }
  104.  
  105.     // ~~~~~~~~~~~~~~~ client methods ~~~~~~~~~~~~~~~~~~~~~~~~
  106.  
  107.     /**
  108.       * sets the client object
  109.       *
  110.       * @param CLIENT aClient
  111.       *
  112.       * @since pk-07-01-13
  113.       *
  114.       ***/
  115.     function setClientObj(&$aClient,$debug=FALSE{
  116.  
  117.     }
  118.  
  119.     // ######################################
  120.  
  121.  
  122.     /**
  123.       * sets $this->getFullName
  124.       *
  125.       * @param boolean $onOff 
  126.       *
  127.       * @since pk-05-04-08
  128.       *
  129.       ***/
  130.     function setGetFullName($onOff=FALSE{
  131.         $this->getFullName=$onOff;
  132.     }
  133.  
  134.     /**
  135.       * echos the tree within a table
  136.       *
  137.       * @param int $aktNode 
  138.       * @param string $link 
  139.       * @param boolean $debug 
  140.       *
  141.       ***/
  142.     function writeTree($aktNode=0,$link="index.php?",$debug=FALSE{
  143.         if ($debugecho "<p><b>DEP_TREE::wirteTree($aktNode,$link,...)</b> (".get_class($this).")</p>";
  144.  
  145.         $rootPath=$this->getRootPath($aktNode,FALSE,$debug);
  146.         if ($debug{
  147.             echo "<blockquote>ROOTPATH:<pre>";
  148.             foreach($rootPath as $idx => $obj{
  149.                 echo "$idx".$obj->getName()." (".$obj->getId()."/".get_class($obj).") \n";
  150.             }
  151.             echo "</pre></blockquote>";
  152.         }
  153.  
  154.         $border=($debug "1" "0");
  155.  
  156.         foreach($this->myChildren as $orderNr => $id{
  157.             if (!is_object($rootPath[0]|| $id != $rootPath[0]->getId()) {
  158.                 echo "<tr><td class=\"treeNode\"><a name=\"CDEP_ID".$id."\" href=\"".pcf_HTML_changeURI_GetValue($link,'CDEP_ID',$id)."\">";
  159.                 $GLOBALS['DBMS_TREE'][$this->getGlobalTreeKey()][$id]->getFullName=$this->getFullName;
  160.                 echo $GLOBALS['DBMS_TREE'][$this->getGlobalTreeKey()][$id]->getName();
  161.                 echo "</a></td></tr>\n";
  162.             else {
  163.                 echo "<tr><td class=\"treeNodeOn\"><a href=\"".pcf_HTML_changeURI_GetValue($link,'CDEP_ID',$id)."\">";
  164.                 $GLOBALS['DBMS_TREE'][$this->getGlobalTreeKey()][$id]->getFullName=$this->getFullName;
  165.                 echo $GLOBALS['DBMS_TREE'][$this->getGlobalTreeKey()][$id]->getName();
  166.                 echo "</a></td></tr>\n";
  167.                 echo "<tr><td class=\"treeIntend\" align=\"right\"><table width=\"95%\" border=\"$border\">";
  168.                 $GLOBALS['DBMS_TREE'][$this->getGlobalTreeKey()][$id]->writeTree(1,$rootPath,$link,$debug);
  169.                 echo "</table></td></tr>\n";
  170.             }
  171.         }
  172.  
  173.     }
  174.  
  175. }
  176.  
  177. ?>

Documentation generated on Thu, 08 Jan 2009 17:37:50 +0100 by phpDocumentor 1.4.0a2