phpUserTrack
[ class tree: phpUserTrack ] [ index: phpUserTrack ] [ all elements ]

Source for file freqmatrix.php

Documentation is available at freqmatrix.php

  1. <?php
  2.  
  3. //require_once('libdb.php');
  4. //require_once('libtree.php');
  5.  
  6. class freqMatrix extends phpusertrack_db {
  7.     var $_matrix = null;
  8.     var $site_id;
  9.  
  10.     function freqMatrix($site_id null{
  11.         $this->site_id = $site_id;
  12.         $this->build();
  13.     }
  14.  
  15.     function build({
  16.         $sql 'Select phpusertrack_data.path, phpusertrack_ip.session_id From phpusertrack_data Inner Join phpusertrack_ip ON phpusertrack_data.ip_id = phpusertrack_ip.id
  17. Where phpusertrack_data.site_id = \'' $this->site_id . '\' Order By phpusertrack_ip.ip Asc, phpusertrack_data.`timestamp` Asc';
  18.         $sessions $this->_query($sql);
  19.  
  20.         if (@include_once('Structures/Graph.php')) {
  21.         $directedGraph =new Structures_Graph(true);
  22.  
  23.         foreach ($sessions as $session{
  24.             if ((isset($oldNode)) && ($oldNode->getData(== $session['path'])) {
  25.                 $newNode $oldNode;
  26.                 $newNode->setMetadata('freq'$newNode->getMetadata('freq')+1);
  27.             else {
  28.                 $newNode =new Structures_Graph_Node();
  29.                 $newNode->setData($session['path']);
  30.                 $newNode->setMetadata('freq'1);
  31.                 $directedGraph->addNode(&$newNode);
  32.                 if ($session['session_id'== $oldSessID{
  33.                     $oldNode->connectTo($newNode);
  34.                 }
  35.             }
  36.             $oldSessID $session['session_id'];
  37.             $oldNode $newNode;
  38.         }
  39.         $this->_matrix = $directedGraph;
  40.         else {
  41.             global $smarty;
  42.             $smarty->assign('notifMsg''Structures Graph package not installed. Fix with \'<code>pear install Structures_Graph</code>\'');
  43.             return false;
  44.         }
  45.     }
  46.  
  47.     function getMatrix({
  48.         return $this->_matrix;
  49.     }
  50. }
  51.  
  52. ?>

Documentation generated on Tue, 06 Nov 2007 09:21:38 -0800 by phpDocumentor 1.4.0a2