Changeset 873 for trunk/Modules/NetworkTopology
- Timestamp:
- Apr 6, 2020, 11:17:40 PM (5 years ago)
- Location:
- trunk/Modules/NetworkTopology
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/NetworkTopology/NetworkTopology.php
r738 r873 10 10 function Show() 11 11 { 12 if (count($this->System->PathItems) > 1)12 if (count($this->System->PathItems) > 1) 13 13 { 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); 16 16 17 } else return ($this->ShowOverview());17 } else return ($this->ShowOverview()); 18 18 } 19 19 … … 23 23 $this->FormatHTML = false; 24 24 25 if (array_key_exists('debug', $_GET)) $debug = $_GET['debug'];25 if (array_key_exists('debug', $_GET)) $debug = $_GET['debug']; 26 26 else $debug = 0; 27 27 … … 54 54 'FROM NetworkTopology LEFT JOIN NetworkDevice ON NetworkDevice.Id = NetworkTopology.Host '. 55 55 'LEFT JOIN NetworkDeviceType ON NetworkDevice.Type = NetworkDeviceType.Id'); 56 while ($item = $DbResult->fetch_array())56 while ($item = $DbResult->fetch_array()) 57 57 { 58 58 $id = $item['Id']; … … 62 62 $vlast = $item['Last']; 63 63 $xpos = $vleft * $spacex; 64 if (($vtop > 0) or ($item['Name'] == $this->TopHostName))64 if (($vtop > 0) or ($item['Name'] == $this->TopHostName)) 65 65 { 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) 68 68 { 69 69 imageline($im, $vfirst*$spacex + $halfx, $vtop * $spacey + $spacey, $vlast*$spacex + $halfx, $vtop * $spacey + $spacey, $black); … … 71 71 } 72 72 // $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') 75 75 { 76 if ($item['Online'] == 1) $color = $green;76 if ($item['Online'] == 1) $color = $green; 77 77 else $color = $black; 78 78 $image = $im_comp; 79 79 } else $image = $im_dev; 80 if ($item['IconName'] == 'device')80 if ($item['IconName'] == 'device') 81 81 { 82 if ($item['Online'] == 1) $color = $green;82 if ($item['Online'] == 1) $color = $green; 83 83 else $color = $red; 84 84 $image = $im_dev; 85 85 } 86 if ($item['ShowOnline'] == 0)86 if ($item['ShowOnline'] == 0) 87 87 { 88 88 $color = $gray; … … 100 100 101 101 // === Sestavení výsledného souboru ============================================ 102 if ($debug == 0)102 if ($debug == 0) 103 103 { 104 104 Header("Content-type: image/png"); … … 109 109 imagedestroy($im_dev); 110 110 } 111 return ('');111 return (''); 112 112 } 113 113 … … 126 126 zařízení, které jsou přes něj připojeny. U zařízení, kde není stav možné 127 127 zjišťovat je použita <span style="color:gray">šedá barvou</span>.</p>'; 128 return ($Output);128 return ($Output); 129 129 } 130 130 } -
trunk/Modules/NetworkTopology/topologie-gen.php
r548 r873 6 6 global $Database, $debug; 7 7 8 if (array_key_exists('debug', $_GET)) $debug = $_GET['debug'];8 if (array_key_exists('debug', $_GET)) $debug = $_GET['debug']; 9 9 else $debug = 0; 10 10 //$debug = 0; … … 110 110 $markskip = 0; 111 111 } 112 } while ($level >= 1);112 } while ($level >= 1); 113 113 } 114 114 … … 128 128 $Database->query("INSERT INTO NetworkTopology (Host, Depth, Pos, First, Last) '. 129 129 '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) { 131 131 $this->store_node($value); 132 132 } … … 149 149 $this->setborder($node->level, $this->border[$node->level+1]+1); 150 150 } 151 foreach ($node->children as $key => $value) {151 foreach ($node->children as $key => $value) { 152 152 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); 154 154 } 155 155 $this->left_align($value); 156 156 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]) { 158 158 $node->pos = $this->border[$node->level+1]-1; 159 159 $this->setborder($node->level, $this->border[$node->level+1]); … … 174 174 $this->setborder($node->level, $this->border[$node->level+1]+1); 175 175 } 176 for ($key=count($node->children)-1;$key>=0;$key--) {176 for ($key=count($node->children)-1;$key>=0;$key--) { 177 177 $value = $node->children[$key]; 178 178 if ((count($value->children)>0) && count($node->order)>0) { … … 180 180 } 181 181 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); 183 183 } 184 184 $this->right_align($value); 185 185 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]) { 187 187 $node->rpos = $this->border[$node->level+1]-1; 188 188 $this->setborder($node->level, $this->border[$node->level+1]); … … 196 196 /** Reset construction border **/ 197 197 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; 199 199 $this->maxborder = 0; 200 200 } … … 214 214 $target = 0; // Index cílového uzlu 215 215 $lastindex = 0; // Index poslední vydličky 216 foreach ($node->children as $key => $value) {216 foreach ($node->children as $key => $value) { 217 217 if (count($value->children)>0) { 218 218 array_push($forkmap,$value); … … 221 221 } 222 222 } 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++) { 225 225 $this->border = $preborder; 226 226 $this->maxborder = $premax; 227 227 $k = 0; // index zpracovávané vydličky 228 foreach ($node->children as $key => $value) {228 foreach ($node->children as $key => $value) { 229 229 if (count($value->children)>0) { 230 230 if ($order[$value->index]) { … … 241 241 } 242 242 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); 244 244 } 245 245 $this->left_align($value); 246 246 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]) { 248 248 $node->pos = $this->border[$node->level+1]-1; 249 249 $this->setborder($node->level, $this->border[$node->level+1]); … … 272 272 $this->setborder($node->level, $this->border[$node->level+1]+1); 273 273 } 274 foreach ($node->children as $key => $value) {274 foreach ($node->children as $key => $value) { 275 275 if ((count($value->children)>0) && count($order)>0) { 276 276 $value = $order[$value->index]; 277 277 } 278 278 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); 280 280 } 281 281 $this->reorder($value); 282 282 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]) { 284 284 $node->pos = $this->border[$node->level+1]-1; 285 285 $this->setborder($node->level, $this->border[$node->level+1]); … … 301 301 } 302 302 $forkcnt = 0; // Fork counter 303 foreach ($node->children as $key => $value) {303 foreach ($node->children as $key => $value) { 304 304 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); 306 306 } 307 307 if (count($value->children)>0) { 308 308 $this->left_stub($value); 309 309 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]) { 311 311 $node->pos = $this->border[$node->level+1]-1; 312 312 $this->setborder($node->level, $this->border[$node->level+1]); … … 335 335 $lastindex = 0; // Index poslední vydličky 336 336 $fact = 1; // Faktoriál kombinací vydliček 337 foreach ($node->children as $key => $value) {337 foreach ($node->children as $key => $value) { 338 338 if (count($value->children)>0) { 339 339 if ($key>0) $fact = $fact * ($key+1); … … 343 343 } 344 344 } 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++) { 347 347 $this->border = $preborder; 348 348 $this->maxborder = $premax; 349 349 $k = 0; // index zpracovávané vydličky 350 foreach ($node->children as $key => $value) {350 foreach ($node->children as $key => $value) { 351 351 if (count($value->children)>0) { 352 352 if ($order[$value->index]) { … … 363 363 } 364 364 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); 366 366 } 367 367 $this->left_align($value); 368 368 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]) { 370 370 $node->pos = $this->border[$node->level+1]-1; 371 371 $this->setborder($node->level, $this->border[$node->level+1]); … … 395 395 $this->setborder($node->level, $this->border[$node->level+1]+1); 396 396 } 397 foreach ($node->children as $key => $value) {397 foreach ($node->children as $key => $value) { 398 398 if ((count($value->children)>0) && count($order)>0) { 399 399 $value = $order[$value->index]; 400 400 } 401 401 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); 403 403 } 404 404 $this->reorder($value); 405 405 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]) { 407 407 $node->pos = $this->border[$node->level+1]-1; 408 408 $this->setborder($node->level, $this->border[$node->level+1]); -
trunk/Modules/NetworkTopology/topologie-img.php
r738 r873 3 3 include('../global.php'); 4 4 5 if (array_key_exists('debug', $_GET)) $debug = $_GET['debug'];5 if (array_key_exists('debug', $_GET)) $debug = $_GET['debug']; 6 6 else $debug = 0; 7 7 $TopHostName = 'nix-router'; … … 13 13 global $debug, $bbound; 14 14 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]) 17 17 { 18 18 //if ($debug==2) echo $id.':'.@$i.','.@$vpred[$i].'-'.@$vleft[@$vpred[$i]]."\n"; … … 37 37 $vleft[$i]+=$diff; 38 38 $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; 40 40 $i = $vnext[$i]; 41 41 } … … 91 91 $item = $DbResult->fetch_array(); 92 92 //print_r($item); 93 if ($item)93 if ($item) 94 94 { 95 95 // --- Zpracování položky z DB ----------------------------------------------- 96 if ($position[$level] > 0)96 if ($position[$level] > 0) 97 97 { 98 98 $vnext[$curr] = $item['id']; // Neprvní položka, nastav předchozí … … 103 103 $vlast[$parent[$level]] = $curr; 104 104 $vtop[$curr] = $level; 105 if (!array_key_exists($level, $tbound)) $tbound[$level] = 0;105 if (!array_key_exists($level, $tbound)) $tbound[$level] = 0; 106 106 $vleft[$curr] = $tbound[$level]; 107 if (!array_key_exists($level, $tranger)) $tranger[$level] = 0;107 if (!array_key_exists($level, $tranger)) $tranger[$level] = 0; 108 108 $vpred[$curr] = $tranger[$level]; 109 109 $tranger[$level] = $curr; … … 117 117 { 118 118 // 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]; 121 121 } 122 122 $tbound[$level] = $vleft[$curr] + 2; … … 133 133 { 134 134 // --- 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; 137 137 if ($vleft[$vfirst[$parent[$level]]] > $vleft[$parent[$level]]) 138 138 { … … 146 146 } 147 147 $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; 150 150 $curr = $vlast[$parent[$level]]; 151 151 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); 157 157 $data = compact('tbound', 'count', 'tbound', 'vfirst', 'vlast', 'vtop', 'vleft', 'height', 'width', 'index', 'maxindex'); 158 return ($data);158 return ($data); 159 159 }; 160 160 … … 164 164 $data = gentree(1); 165 165 $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;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; 170 170 $vleft[$i] = .2 + ($vleft[$i] + ($datawidth - $data['vleft'][$i])) / 2; 171 171 } … … 179 179 $IconList = array(); 180 180 $DbResult = $Database->query('SELECT * FROM HostType'); 181 while ($HostType = $DbResult->fetch_assoc())181 while ($HostType = $DbResult->fetch_assoc()) 182 182 $IconList[$HostType['Id']] = imagecreatefrompng('images/'.$HostType['IconName'].'.png'); 183 183 … … 194 194 { 195 195 global $vleft, $spacex; 196 return ($vleft[$id] * $spacex);196 return ($vleft[$id] * $spacex); 197 197 } 198 198 199 199 $DbResult = $Database->query('SELECT * FROM hosts JOIN HostType ON HostType.Id = hosts.type WHERE hosts.used=1'); 200 while ($item = $DbResult->fetch_array())200 while ($item = $DbResult->fetch_array()) 201 201 { 202 202 $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)) 205 205 { 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) 209 209 { 210 210 imageline($im, xpos($vfirst[$id]) + $halfx, $vtop[$id] * $spacey + $spacey, xpos($vlast[$id]) + $halfx, $vtop[$id] * $spacey + $spacey, $black); … … 213 213 214 214 $image = $IconList[$item['type']]; 215 if ($item['IP'] == '')215 if ($item['IP'] == '') 216 216 { 217 217 $color = $gray; 218 218 } 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; 225 225 } 226 226 // $text='IP: '.$ip[0]; … … 228 228 imagecopy($im, $image, xpos($id) + $halfx - 15, $vtop[$id] * $spacey + 12, 0, 0, 30, 30); 229 229 // 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) 231 231 { 232 232 imagestring($im, 2, xpos($id) + ($spacex - strlen($item['id']) * imagefontwidth(2)) / 2, $vtop[$id] * $spacey + 31 + imagefontheight(2), $item['id'], $color); … … 237 237 238 238 // === Sestavení výsledného souboru ============================================ 239 if (!($debug > 1))239 if (!($debug > 1)) 240 240 { 241 241 header('Content-type: image/png'); -
trunk/Modules/NetworkTopology/topologie2.php
r858 r873 29 29 $Hosts = array(); 30 30 $DbResult = $Database->select('hosts', 'id, name, ip, parent, online', 'used=1'); 31 while ($DbRow = $DbResult->fetch_array())31 while ($DbRow = $DbResult->fetch_array()) 32 32 { 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()); 34 34 $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()); 36 36 $Hosts[$DbRow['parent']]['subitems'][] = &$Hosts[$DbRow['id']]; 37 37 $Hosts[$DbRow['id']]['parent_node'] = &$Hosts[$DbRow['parent']]; … … 44 44 { 45 45 $Result = array('min' => $Host['displacement'], 'max' => $Host['displacement']); 46 foreach ($Host['subitems'] as $Index => $SubHost)46 foreach ($Host['subitems'] as $Index => $SubHost) 47 47 { 48 48 $SubitemResult = $this->CalculateDimension($Host['subitems'][$Index]); … … 50 50 $Result['max'] = max($SubitemResult['max'], $Result['max']); 51 51 } 52 return ($Result);52 return ($Result); 53 53 } 54 54 55 55 function CalculateDisplacement(&$Host, $Level = 0) 56 56 { 57 if (!array_key_exists('displacement', $Host)) $Host['displacement'] = 0;57 if (!array_key_exists('displacement', $Host)) $Host['displacement'] = 0; 58 58 $Host['level'] = $Level; 59 foreach ($Host['subitems'] as $Index => $SubHost)59 foreach ($Host['subitems'] as $Index => $SubHost) 60 60 { 61 61 $Host['subitems'][$Index]['rel_displacement'] = (-(count($Host['subitems']) - 1) * 0.5 + $Index) * $this->HostWidth; … … 68 68 { 69 69 $Host['displacement'] = $Host['displacement'] + $Displacement; 70 foreach ($Host['subitems'] as $Index => $SubHost)70 foreach ($Host['subitems'] as $Index => $SubHost) 71 71 { 72 72 $this->MoveNode($Host['subitems'][$Index], $Displacement); … … 76 76 function CheckColision() 77 77 { 78 foreach ($this->Levels as $Index => $Level)78 foreach ($this->Levels as $Index => $Level) 79 79 { 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']) 82 82 { 83 83 // Search for common parent 84 84 $LeftHost = $Level[$I]; 85 85 $RightHost = $Level[$I + 1]; 86 while (($LeftHost['level'] > 0) and ($LeftHost['parent'] != $RightHost['parent']))86 while (($LeftHost['level'] > 0) and ($LeftHost['parent'] != $RightHost['parent'])) 87 87 { 88 88 $LeftHost = $LeftHost['parent_node']; … … 91 91 $Host = $RightHost['parent_node']['subitems'][0]; 92 92 $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'])) 95 95 { 96 96 $this->MoveNode($RightHost['parent_node']['subitems'][$II], $Level[$I]['displacement'] - $Level[$I + 1]['displacement']); … … 104 104 { 105 105 $this->Levels[$Host['level']][] = &$Host; 106 foreach ($Host['subitems'] as $Index => $SubHost)106 foreach ($Host['subitems'] as $Index => $SubHost) 107 107 { 108 108 $this->BuildLevels($Host['subitems'][$Index]); … … 113 113 { 114 114 $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) 116 116 { 117 117 $HostPos = array('x' => -$this->RelPos['min'] + $SubHost['displacement'], 'y' => $SubHost['level'] * $this->HostHeight);
Note:
See TracChangeset
for help on using the changeset viewer.