[ Index ]
 

Code source de phpMyVisites 2.3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/core/include/ -> ArchiveCategory.class.php (source)

   1  <?php
   2  /* 
   3   * phpMyVisites : website statistics and audience measurements
   4   * Copyright (C) 2002 - 2006
   5   * http://www.phpmyvisites.net/ 
   6   * phpMyVisites is free software (license GNU/GPL)
   7   * Authors : phpMyVisites team
   8  */
   9  
  10  // $Id: ArchiveCategory.class.php 29 2006-08-18 07:35:21Z matthieu_ $
  11  
  12  
  13  
  14  /**
  15   * Class used during pages/groups/files processing.
  16   * This class can give levels, Name, Ids, of pages from their Id (base logs)
  17   */
  18  class ArchiveCategory
  19  {
  20      /**
  21       * @var array contains IdToName 
  22       */
  23      var $content;
  24      
  25      /**
  26       * Constructor
  27       */
  28  	function ArchiveCategory()
  29      {
  30      }
  31  
  32  	function loadInfo()
  33      {
  34          if(!isset($this->content))
  35          {
  36              // select all categories today and their parent and level
  37              $r = query("SELECT idcategory, level, idparent, name " .
  38              " FROM ".T_CATEGORY
  39              );
  40              
  41              while($l = mysql_fetch_assoc($r))
  42              {
  43                  $this->content[$l['idcategory']] = array( 
  44                  0 => $l['idparent'], 
  45                  1 => $l['level'], 
  46                  2 => $l['name']
  47                  );
  48              }
  49          }
  50      }
  51      /**
  52       * returns name of idcategory $id in base logs
  53       * 
  54       * @param int $id
  55       * 
  56       * @return string name
  57       */
  58  	function getName($id)
  59      {
  60          $this->loadInfo();
  61          return $this->content[$id][2];
  62      }
  63      
  64      /**
  65       * returns the array containing the a_toAdd array
  66       * following the tree of idCategory
  67       * 
  68       * @param int $idCategory
  69       * @param array $a_toAdd
  70       * 
  71       * @return array
  72       */
  73  	function getTreeCompleted($idCategory, $a_toAdd)
  74      {
  75          $this->loadInfo();
  76          
  77          //printDebug("getTreecompleter id: $idCategory arr: $a_toAdd");
  78          $currentLevel = $this->content[$idCategory][1]; // getLevel
  79          $currentId = $idCategory;
  80          
  81          
  82          while($currentId != 0)
  83          {
  84              //printDebug("currentId $currentId level $currentLevel <br>");
  85              //printDebug("id : $currentId level $currentLevel");
  86              $key = 'c'.$currentId;
  87              $a_toAdd = array( $key => $a_toAdd);
  88              //exit();
  89              $currentId = $this->content[$currentId][0];
  90              if($currentId != 0)
  91              {
  92                  $currentLevel = $this->content[$currentId][1];
  93              }
  94              
  95          }
  96          return $a_toAdd;
  97      }
  98  }
  99  
 100  ?>


Généré le : Mon Nov 26 14:10:01 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics