Ignore:
Timestamp:
Apr 6, 2020, 11:17:40 PM (5 years ago)
Author:
chronos
Message:
  • Modified: Improved code format.
Location:
trunk/Modules/NetworkTopology
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/NetworkTopology/NetworkTopology.php

    r738 r873  
    1010  function Show()
    1111  {
    12     if(count($this->System->PathItems) > 1)
     12    if (count($this->System->PathItems) > 1)
    1313    {
    14       if($this->System->PathItems[1] == 'topologie.png') return($this->ShowImage());
    15         else return(PAGE_NOT_FOUND);
     14      if ($this->System->PathItems[1] == 'topologie.png') return ($this->ShowImage());
     15        else return (PAGE_NOT_FOUND);
    1616
    17     } else return($this->ShowOverview());
     17    } else return ($this->ShowOverview());
    1818  }
    1919
     
    2323    $this->FormatHTML = false;
    2424
    25     if(array_key_exists('debug', $_GET)) $debug = $_GET['debug'];
     25    if (array_key_exists('debug', $_GET)) $debug = $_GET['debug'];
    2626      else $debug = 0;
    2727
     
    5454      'FROM NetworkTopology LEFT JOIN NetworkDevice ON NetworkDevice.Id = NetworkTopology.Host '.
    5555      'LEFT JOIN NetworkDeviceType ON NetworkDevice.Type = NetworkDeviceType.Id');
    56     while($item = $DbResult->fetch_array())
     56    while ($item = $DbResult->fetch_array())
    5757    {
    5858      $id = $item['Id'];
     
    6262      $vlast = $item['Last'];
    6363      $xpos = $vleft * $spacex;
    64       if(($vtop > 0) or ($item['Name'] == $this->TopHostName))
     64      if (($vtop > 0) or ($item['Name'] == $this->TopHostName))
    6565      {
    66         if($vtop > 0) imageline($im, $xpos + $halfx, $vtop * $spacey, $xpos + $halfx, $vtop * $spacey + 8, $black);
    67         if($vfirst >= 0)
     66        if ($vtop > 0) imageline($im, $xpos + $halfx, $vtop * $spacey, $xpos + $halfx, $vtop * $spacey + 8, $black);
     67        if ($vfirst >= 0)
    6868        {
    6969          imageline($im, $vfirst*$spacex + $halfx, $vtop * $spacey + $spacey, $vlast*$spacex + $halfx, $vtop * $spacey + $spacey, $black);
     
    7171        }
    7272        //    $ip = explode('.',$item['IP']);
    73         //    if(!array_key_exists(3, $ip)) $ip[3] = '';
    74         if($item['IconName'] == 'comp')
     73        //    if (!array_key_exists(3, $ip)) $ip[3] = '';
     74        if ($item['IconName'] == 'comp')
    7575        {
    76           if($item['Online'] == 1) $color = $green;
     76          if ($item['Online'] == 1) $color = $green;
    7777          else $color = $black;
    7878          $image = $im_comp;
    7979        } else $image = $im_dev;
    80         if($item['IconName'] == 'device')
     80        if ($item['IconName'] == 'device')
    8181        {
    82           if($item['Online'] == 1) $color = $green;
     82          if ($item['Online'] == 1) $color = $green;
    8383          else $color = $red;
    8484          $image = $im_dev;
    8585        }
    86         if($item['ShowOnline'] == 0)
     86        if ($item['ShowOnline'] == 0)
    8787        {
    8888          $color = $gray;
     
    100100
    101101    // === Sestavení výsledného souboru ============================================
    102     if($debug == 0)
     102    if ($debug == 0)
    103103    {
    104104      Header("Content-type: image/png");
     
    109109      imagedestroy($im_dev);
    110110    }
    111     return('');
     111    return ('');
    112112  }
    113113
     
    126126zařízení, které jsou přes něj připojeny. U zařízení, kde není stav možné
    127127zjišťovat je použita <span style="color:gray">šedá barvou</span>.</p>';
    128     return($Output);
     128    return ($Output);
    129129  }
    130130}
  • trunk/Modules/NetworkTopology/topologie-gen.php

    r548 r873  
    66global $Database, $debug;
    77
    8 if(array_key_exists('debug', $_GET)) $debug = $_GET['debug'];
     8if (array_key_exists('debug', $_GET)) $debug = $_GET['debug'];
    99else $debug = 0;
    1010//$debug = 0;
     
    110110        $markskip = 0;
    111111      }
    112     } while($level >= 1);
     112    } while ($level >= 1);
    113113  }
    114114
     
    128128      $Database->query("INSERT INTO NetworkTopology (Host, Depth, Pos, First, Last) '.
    129129        'VALUES (".$node->index.','.$node->level.','.$this->calc_pos($node).','.$first.','.$last.");");
    130       foreach($node->children as $key => $value) {
     130      foreach ($node->children as $key => $value) {
    131131        $this->store_node($value);
    132132      }
     
    149149        $this->setborder($node->level, $this->border[$node->level+1]+1);
    150150      }
    151       foreach($node->children as $key => $value) {
     151      foreach ($node->children as $key => $value) {
    152152        if ($key == count($node->children)-1) {
    153           if($this->border[$node->level] > $this->border[$node->level+1]) $this->setborder($node->level+1, $this->border[$node->level]-1);
     153          if ($this->border[$node->level] > $this->border[$node->level+1]) $this->setborder($node->level+1, $this->border[$node->level]-1);
    154154        }
    155155        $this->left_align($value);
    156156        if ($key == 0) {
    157           if($this->border[$node->level] <= $this->border[$node->level+1]) {
     157          if ($this->border[$node->level] <= $this->border[$node->level+1]) {
    158158            $node->pos = $this->border[$node->level+1]-1;
    159159            $this->setborder($node->level, $this->border[$node->level+1]);
     
    174174        $this->setborder($node->level, $this->border[$node->level+1]+1);
    175175      }
    176       for($key=count($node->children)-1;$key>=0;$key--) {
     176      for ($key=count($node->children)-1;$key>=0;$key--) {
    177177        $value = $node->children[$key];
    178178        if ((count($value->children)>0) && count($node->order)>0) {
     
    180180        }
    181181        if ($key == 0) {
    182           if($this->border[$node->level] > $this->border[$node->level+1]) $this->setborder($node->level+1, $this->border[$node->level]-1);
     182          if ($this->border[$node->level] > $this->border[$node->level+1]) $this->setborder($node->level+1, $this->border[$node->level]-1);
    183183        }
    184184        $this->right_align($value);
    185185        if ($key == count($node->children)-1) {
    186           if($this->border[$node->level] <= $this->border[$node->level+1]) {
     186          if ($this->border[$node->level] <= $this->border[$node->level+1]) {
    187187            $node->rpos = $this->border[$node->level+1]-1;
    188188            $this->setborder($node->level, $this->border[$node->level+1]);
     
    196196  /** Reset construction border **/
    197197  function reset_border() {
    198     foreach($this->border as $key => $value) $this->border[$key] = 0;
     198    foreach ($this->border as $key => $value) $this->border[$key] = 0;
    199199    $this->maxborder = 0;
    200200  }
     
    214214      $target = 0; // Index cílového uzlu
    215215      $lastindex = 0; // Index poslední vydličky
    216       foreach($node->children as $key => $value) {
     216      foreach ($node->children as $key => $value) {
    217217        if (count($value->children)>0) {
    218218          array_push($forkmap,$value);
     
    221221        }
    222222      }
    223       for($i=0;$i<$node->forkcnt-1;$i++) {
    224         for($j=0;$j<count($forkmap);$j++) {
     223      for ($i=0;$i<$node->forkcnt-1;$i++) {
     224        for ($j=0;$j<count($forkmap);$j++) {
    225225          $this->border = $preborder;
    226226          $this->maxborder = $premax;
    227227          $k = 0; // index zpracovávané vydličky
    228           foreach($node->children as $key => $value) {
     228          foreach ($node->children as $key => $value) {
    229229            if (count($value->children)>0) {
    230230              if ($order[$value->index]) {
     
    241241            }
    242242            if ($key == count($node->children)-1) {
    243               if($this->border[$node->level] > $this->border[$node->level+1]) $this->setborder($node->level+1, $this->border[$node->level]-1);
     243              if ($this->border[$node->level] > $this->border[$node->level+1]) $this->setborder($node->level+1, $this->border[$node->level]-1);
    244244            }
    245245            $this->left_align($value);
    246246            if ($key == 0) {
    247               if($this->border[$node->level] <= $this->border[$node->level+1]) {
     247              if ($this->border[$node->level] <= $this->border[$node->level+1]) {
    248248                $node->pos = $this->border[$node->level+1]-1;
    249249                $this->setborder($node->level, $this->border[$node->level+1]);
     
    272272        $this->setborder($node->level, $this->border[$node->level+1]+1);
    273273      }
    274       foreach($node->children as $key => $value) {
     274      foreach ($node->children as $key => $value) {
    275275        if ((count($value->children)>0) && count($order)>0) {
    276276          $value = $order[$value->index];
    277277        }
    278278        if ($key == count($node->children)-1) {
    279           if($this->border[$node->level] > $this->border[$node->level+1]) $this->setborder($node->level+1, $this->border[$node->level]-1);
     279          if ($this->border[$node->level] > $this->border[$node->level+1]) $this->setborder($node->level+1, $this->border[$node->level]-1);
    280280        }
    281281        $this->reorder($value);
    282282        if ($key == 0) {
    283           if($this->border[$node->level] <= $this->border[$node->level+1]) {
     283          if ($this->border[$node->level] <= $this->border[$node->level+1]) {
    284284            $node->pos = $this->border[$node->level+1]-1;
    285285            $this->setborder($node->level, $this->border[$node->level+1]);
     
    301301      }
    302302      $forkcnt = 0; // Fork counter
    303       foreach($node->children as $key => $value) {
     303      foreach ($node->children as $key => $value) {
    304304        if ($forkcnt == count($node->children)-1) {
    305           if($this->border[$node->level] > $this->border[$node->level+1]) $this->setborder($node->level+1, $this->border[$node->level]-1);
     305          if ($this->border[$node->level] > $this->border[$node->level+1]) $this->setborder($node->level+1, $this->border[$node->level]-1);
    306306        }
    307307        if (count($value->children)>0) {
    308308          $this->left_stub($value);
    309309          if ($forkcnt == 0) {
    310             if($this->border[$node->level] <= $this->border[$node->level+1]) {
     310            if ($this->border[$node->level] <= $this->border[$node->level+1]) {
    311311              $node->pos = $this->border[$node->level+1]-1;
    312312              $this->setborder($node->level, $this->border[$node->level+1]);
     
    335335      $lastindex = 0; // Index poslední vydličky
    336336      $fact = 1; // Faktoriál kombinací vydliček
    337       foreach($node->children as $key => $value) {
     337      foreach ($node->children as $key => $value) {
    338338        if (count($value->children)>0) {
    339339          if ($key>0) $fact = $fact * ($key+1);
     
    343343        }
    344344      }
    345       for($i=0;$i<$node->forkcnt-1;$i++) {
    346         for($j=0;$j<count($forkmap);$j++) {
     345      for ($i=0;$i<$node->forkcnt-1;$i++) {
     346        for ($j=0;$j<count($forkmap);$j++) {
    347347          $this->border = $preborder;
    348348          $this->maxborder = $premax;
    349349          $k = 0; // index zpracovávané vydličky
    350           foreach($node->children as $key => $value) {
     350          foreach ($node->children as $key => $value) {
    351351            if (count($value->children)>0) {
    352352              if ($order[$value->index]) {
     
    363363            }
    364364            if ($key == count($node->children)-1) {
    365               if($this->border[$node->level] > $this->border[$node->level+1]) $this->setborder($node->level+1, $this->border[$node->level]-1);
     365              if ($this->border[$node->level] > $this->border[$node->level+1]) $this->setborder($node->level+1, $this->border[$node->level]-1);
    366366            }
    367367            $this->left_align($value);
    368368            if ($key == 0) {
    369               if($this->border[$node->level] <= $this->border[$node->level+1]) {
     369              if ($this->border[$node->level] <= $this->border[$node->level+1]) {
    370370                $node->pos = $this->border[$node->level+1]-1;
    371371                $this->setborder($node->level, $this->border[$node->level+1]);
     
    395395        $this->setborder($node->level, $this->border[$node->level+1]+1);
    396396      }
    397       foreach($node->children as $key => $value) {
     397      foreach ($node->children as $key => $value) {
    398398        if ((count($value->children)>0) && count($order)>0) {
    399399          $value = $order[$value->index];
    400400        }
    401401        if ($key == count($node->children)-1) {
    402           if($this->border[$node->level] > $this->border[$node->level+1]) $this->setborder($node->level+1, $this->border[$node->level]-1);
     402          if ($this->border[$node->level] > $this->border[$node->level+1]) $this->setborder($node->level+1, $this->border[$node->level]-1);
    403403        }
    404404        $this->reorder($value);
    405405        if ($key == 0) {
    406           if($this->border[$node->level] <= $this->border[$node->level+1]) {
     406          if ($this->border[$node->level] <= $this->border[$node->level+1]) {
    407407            $node->pos = $this->border[$node->level+1]-1;
    408408            $this->setborder($node->level, $this->border[$node->level+1]);
  • trunk/Modules/NetworkTopology/topologie-img.php

    r738 r873  
    33include('../global.php');
    44
    5 if(array_key_exists('debug', $_GET)) $debug = $_GET['debug'];
     5if (array_key_exists('debug', $_GET)) $debug = $_GET['debug'];
    66else $debug = 0;
    77$TopHostName = 'nix-router';
     
    1313  global $debug, $bbound;
    1414
    15   if(!array_key_exists($id, $vfirst)) $vfirst[$id] = 0;
    16   if($i = $vfirst[$id])
     15  if (!array_key_exists($id, $vfirst)) $vfirst[$id] = 0;
     16  if ($i = $vfirst[$id])
    1717  {
    1818    //if ($debug==2) echo $id.':'.@$i.','.@$vpred[$i].'-'.@$vleft[@$vpred[$i]]."\n";
     
    3737      $vleft[$i]+=$diff;
    3838      $limit = balance($i,$level+1, $vlast,$vleft,$vpred, $vfirst,$vnext,$tbound, $width, $limit) + 2;
    39       if(!array_key_exists($i, $vnext)) $vnext[$i] = 0;
     39      if (!array_key_exists($i, $vnext)) $vnext[$i] = 0;
    4040      $i = $vnext[$i];
    4141    }
     
    9191    $item = $DbResult->fetch_array();
    9292    //print_r($item);
    93     if($item)
     93    if ($item)
    9494    {
    9595  // --- Zpracování položky z DB -----------------------------------------------
    96       if($position[$level] > 0)
     96      if ($position[$level] > 0)
    9797      {
    9898        $vnext[$curr] = $item['id']; // Neprvní položka, nastav předchozí
     
    103103      $vlast[$parent[$level]] = $curr;
    104104      $vtop[$curr] = $level;
    105       if(!array_key_exists($level, $tbound)) $tbound[$level] = 0;
     105      if (!array_key_exists($level, $tbound)) $tbound[$level] = 0;
    106106      $vleft[$curr] = $tbound[$level];
    107       if(!array_key_exists($level, $tranger)) $tranger[$level] = 0;
     107      if (!array_key_exists($level, $tranger)) $tranger[$level] = 0;
    108108      $vpred[$curr] = $tranger[$level];
    109109      $tranger[$level] = $curr;
     
    117117      {
    118118        // Uzelový vrchol
    119         if(array_key_exists($level + 1, $tbound))
    120           if($tbound[$level + 1] > $vleft[$curr]) $vleft[$curr] = $tbound[$level + 1];
     119        if (array_key_exists($level + 1, $tbound))
     120          if ($tbound[$level + 1] > $vleft[$curr]) $vleft[$curr] = $tbound[$level + 1];
    121121      }
    122122      $tbound[$level] = $vleft[$curr] + 2;
     
    133133    {
    134134  // --- Zarovnávání prvků kvůli vzhledu
    135       if(!array_key_exists($vfirst[$parent[$level]], $vleft)) $vleft[$vfirst[$parent[$level]]] = 0;
    136       if(!array_key_exists($parent[$level], $vleft)) $vleft[$parent[$level]] = 0;
     135      if (!array_key_exists($vfirst[$parent[$level]], $vleft)) $vleft[$vfirst[$parent[$level]]] = 0;
     136      if (!array_key_exists($parent[$level], $vleft)) $vleft[$parent[$level]] = 0;
    137137      if ($vleft[$vfirst[$parent[$level]]] > $vleft[$parent[$level]])
    138138      {
     
    146146      }
    147147      $level--;
    148       if(!array_key_exists($level, $parent)) $parent[$level] = 0;
    149       if(!array_key_exists($parent[$level], $vlast)) $vlast[$parent[$level]] = 0;
     148      if (!array_key_exists($level, $parent)) $parent[$level] = 0;
     149      if (!array_key_exists($parent[$level], $vlast)) $vlast[$parent[$level]] = 0;
    150150      $curr = $vlast[$parent[$level]];
    151151
    152       if(!array_key_exists($level, $tbound)) $tbound[$level] = 0;
    153       if(!array_key_exists($level + 1, $tbound)) $tbound[$level + 1] = 0;
    154       if($tbound[$level] > $tbound[$level + 1]) $tbound[$level + 1] = $tbound[$level];
    155     }
    156   } while($level >= 0);
     152      if (!array_key_exists($level, $tbound)) $tbound[$level] = 0;
     153      if (!array_key_exists($level + 1, $tbound)) $tbound[$level + 1] = 0;
     154      if ($tbound[$level] > $tbound[$level + 1]) $tbound[$level + 1] = $tbound[$level];
     155    }
     156  } while ($level >= 0);
    157157  $data = compact('tbound', 'count', 'tbound', 'vfirst', 'vlast', 'vtop', 'vleft', 'height', 'width', 'index', 'maxindex');
    158   return($data);
     158  return ($data);
    159159};
    160160
     
    164164$data = gentree(1);
    165165$datawidth = $data['width'];
    166 for($i = 0; $i <= $maxindex; $i++)
    167 {
    168   if(!array_key_exists($i, $vleft)) $vleft[$i] = 0;
    169   if(!array_key_exists($i, $data['vleft'])) $data['vleft'][$i] = 0;
     166for ($i = 0; $i <= $maxindex; $i++)
     167{
     168  if (!array_key_exists($i, $vleft)) $vleft[$i] = 0;
     169  if (!array_key_exists($i, $data['vleft'])) $data['vleft'][$i] = 0;
    170170  $vleft[$i] = .2 + ($vleft[$i] + ($datawidth - $data['vleft'][$i])) / 2;
    171171}
     
    179179$IconList = array();
    180180$DbResult = $Database->query('SELECT * FROM HostType');
    181 while($HostType = $DbResult->fetch_assoc())
     181while ($HostType = $DbResult->fetch_assoc())
    182182  $IconList[$HostType['Id']] = imagecreatefrompng('images/'.$HostType['IconName'].'.png');
    183183
     
    194194{
    195195  global $vleft, $spacex;
    196   return($vleft[$id] * $spacex);
     196  return ($vleft[$id] * $spacex);
    197197}
    198198
    199199$DbResult = $Database->query('SELECT * FROM hosts JOIN HostType ON HostType.Id = hosts.type WHERE hosts.used=1');
    200 while($item = $DbResult->fetch_array())
     200while ($item = $DbResult->fetch_array())
    201201{
    202202  $id = $item['id'];
    203   if(!array_key_exists($id, $vtop)) $vtop[$id] = 0;
    204   if(($vtop[$id] > 0) || ($item['name'] == $TopHostName))
     203  if (!array_key_exists($id, $vtop)) $vtop[$id] = 0;
     204  if (($vtop[$id] > 0) || ($item['name'] == $TopHostName))
    205205  {
    206     if($vtop[$id] > 0) imageline($im, xpos($id) + $halfx, $vtop[$id] * $spacey, xpos($id) + $halfx, $vtop[$id] * $spacey + 8, $black);
    207     if(!array_key_exists($id, $vfirst)) $vfirst[$id] = 0;
    208     if($vfirst[$id] > 0)
     206    if ($vtop[$id] > 0) imageline($im, xpos($id) + $halfx, $vtop[$id] * $spacey, xpos($id) + $halfx, $vtop[$id] * $spacey + 8, $black);
     207    if (!array_key_exists($id, $vfirst)) $vfirst[$id] = 0;
     208    if ($vfirst[$id] > 0)
    209209    {
    210210      imageline($im, xpos($vfirst[$id]) + $halfx, $vtop[$id] * $spacey + $spacey, xpos($vlast[$id]) + $halfx, $vtop[$id] * $spacey + $spacey, $black);
     
    213213
    214214    $image = $IconList[$item['type']];
    215     if($item['IP'] == '')
     215    if ($item['IP'] == '')
    216216    {
    217217      $color = $gray;
    218218    } else
    219     if($item['ShowOnline'] == 1)
    220     {
    221       if($item['online'] == 1) $color = $green; else $color = $black;
    222     } else
    223     {
    224       if($item['online'] == 1) $color = $green; else $color = $red;
     219    if ($item['ShowOnline'] == 1)
     220    {
     221      if ($item['online'] == 1) $color = $green; else $color = $black;
     222    } else
     223    {
     224      if ($item['online'] == 1) $color = $green; else $color = $red;
    225225    }
    226226//      $text='IP: '.$ip[0];
     
    228228    imagecopy($im, $image, xpos($id) + $halfx - 15, $vtop[$id] * $spacey + 12, 0, 0, 30, 30);
    229229//    imagerectangle($im,xpos($id)+$halfx-6,$vtop[$id]*$spacey+16,xpos($id)+$halfx+6,$vtop[$id]*$spacey+28,$color);
    230     if($debug)
     230    if ($debug)
    231231    {
    232232      imagestring($im, 2, xpos($id) + ($spacex - strlen($item['id']) * imagefontwidth(2)) / 2, $vtop[$id] * $spacey + 31 + imagefontheight(2), $item['id'], $color);
     
    237237
    238238// === Sestavení výsledného souboru ============================================
    239 if(!($debug > 1))
     239if (!($debug > 1))
    240240{
    241241  header('Content-type: image/png');
  • trunk/Modules/NetworkTopology/topologie2.php

    r858 r873  
    2929    $Hosts = array();
    3030    $DbResult = $Database->select('hosts', 'id, name, ip, parent, online', 'used=1');
    31     while($DbRow = $DbResult->fetch_array())
     31    while ($DbRow = $DbResult->fetch_array())
    3232    {
    33       if(!array_key_exists($DbRow['id'], $Hosts)) $Hosts[$DbRow['id']] = array('subitems' => array());
     33      if (!array_key_exists($DbRow['id'], $Hosts)) $Hosts[$DbRow['id']] = array('subitems' => array());
    3434      $Hosts[$DbRow['id']] = array('id' => $DbRow['id'], 'name' => $DbRow['name'], 'parent' => $DbRow['parent'], 'online' => $DbRow['online'], 'subitems' => $Hosts[$DbRow['id']]['subitems']);
    35       if(!array_key_exists($DbRow['parent'], $Hosts)) $Hosts[$DbRow['parent']] = array('subitems' => array());
     35      if (!array_key_exists($DbRow['parent'], $Hosts)) $Hosts[$DbRow['parent']] = array('subitems' => array());
    3636      $Hosts[$DbRow['parent']]['subitems'][] = &$Hosts[$DbRow['id']];
    3737      $Hosts[$DbRow['id']]['parent_node'] = &$Hosts[$DbRow['parent']];
     
    4444  {
    4545    $Result = array('min' => $Host['displacement'], 'max' => $Host['displacement']);
    46     foreach($Host['subitems'] as $Index => $SubHost)
     46    foreach ($Host['subitems'] as $Index => $SubHost)
    4747    {
    4848      $SubitemResult = $this->CalculateDimension($Host['subitems'][$Index]);
     
    5050      $Result['max'] = max($SubitemResult['max'], $Result['max']);
    5151    }
    52     return($Result);
     52    return ($Result);
    5353  }
    5454
    5555  function CalculateDisplacement(&$Host, $Level = 0)
    5656  {
    57     if(!array_key_exists('displacement', $Host)) $Host['displacement'] = 0;
     57    if (!array_key_exists('displacement', $Host)) $Host['displacement'] = 0;
    5858    $Host['level'] = $Level;
    59     foreach($Host['subitems'] as $Index => $SubHost)
     59    foreach ($Host['subitems'] as $Index => $SubHost)
    6060    {
    6161      $Host['subitems'][$Index]['rel_displacement'] = (-(count($Host['subitems']) - 1) * 0.5 + $Index) * $this->HostWidth;
     
    6868  {
    6969    $Host['displacement'] = $Host['displacement'] + $Displacement;
    70     foreach($Host['subitems'] as $Index => $SubHost)
     70    foreach ($Host['subitems'] as $Index => $SubHost)
    7171    {
    7272      $this->MoveNode($Host['subitems'][$Index], $Displacement);
     
    7676  function CheckColision()
    7777  {
    78     foreach($this->Levels as $Index => $Level)
     78    foreach ($this->Levels as $Index => $Level)
    7979    {
    80       for($I = 0; $I < count($Level) - 1; $I++)
    81         if($Level[$I]['displacement'] >= $Level[$I + 1]['displacement'])
     80      for ($I = 0; $I < count($Level) - 1; $I++)
     81        if ($Level[$I]['displacement'] >= $Level[$I + 1]['displacement'])
    8282        {
    8383          // Search for common parent
    8484          $LeftHost = $Level[$I];
    8585          $RightHost = $Level[$I + 1];
    86           while(($LeftHost['level'] > 0) and ($LeftHost['parent'] != $RightHost['parent']))
     86          while (($LeftHost['level'] > 0) and ($LeftHost['parent'] != $RightHost['parent']))
    8787          {
    8888            $LeftHost = $LeftHost['parent_node'];
     
    9191          $Host = $RightHost['parent_node']['subitems'][0];
    9292          $II = 0;
    93           while($RightHost['parent_node']['subitems'][$II]['id'] != $RightHost['id']) $II++;
    94           while($II < count($RightHost['parent_node']['subitems']))
     93          while ($RightHost['parent_node']['subitems'][$II]['id'] != $RightHost['id']) $II++;
     94          while ($II < count($RightHost['parent_node']['subitems']))
    9595          {
    9696            $this->MoveNode($RightHost['parent_node']['subitems'][$II], $Level[$I]['displacement'] - $Level[$I + 1]['displacement']);
     
    104104  {
    105105    $this->Levels[$Host['level']][] = &$Host;
    106     foreach($Host['subitems'] as $Index => $SubHost)
     106    foreach ($Host['subitems'] as $Index => $SubHost)
    107107    {
    108108      $this->BuildLevels($Host['subitems'][$Index]);
     
    113113  {
    114114    $ParentHostPos = array('x' => -$this->RelPos['min'] + $Host['displacement'], 'y' => $Host['level'] * $this->HostHeight);
    115     foreach($Host['subitems'] as $Index => $SubHost)
     115    foreach ($Host['subitems'] as $Index => $SubHost)
    116116    {
    117117      $HostPos = array('x' => -$this->RelPos['min'] + $SubHost['displacement'], 'y' => $SubHost['level'] * $this->HostHeight);
Note: See TracChangeset for help on using the changeset viewer.