| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 |
|
|---|
| 40 |
class sfPropelActAsNestedSetBehavior |
|---|
| 41 |
{ |
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 |
private static $columns = array(); |
|---|
| 51 |
|
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 |
private $presave_stack = array(); |
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 |
|
|---|
| 63 |
|
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 |
private $predelete_stack = array(); |
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 |
private $node_infos = array() ; |
|---|
| 73 |
|
|---|
| 74 |
|
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 |
|
|---|
| 79 |
|
|---|
| 80 |
|
|---|
| 81 |
|
|---|
| 82 |
public function preSave(BaseObject $node) |
|---|
| 83 |
|
|---|
| 84 |
$this->processPreSaveStack(); |
|---|
| 85 |
|
|---|
| 86 |
|
|---|
| 87 |
|
|---|
| 88 |
|
|---|
| 89 |
|
|---|
| 90 |
public function postDelete () |
|---|
| 91 |
|
|---|
| 92 |
$peer_name = $this->node_infos['peer_name'] ; |
|---|
| 93 |
$stub_name = $this->node_infos['stub_name'] ; |
|---|
| 94 |
$scope_id_value = $this->node_infos['scope_id_value'] ; |
|---|
| 95 |
$right_value = $this->node_infos['right_value'] ; |
|---|
| 96 |
$this->node_infos['delta'])) |
|---|
| 97 |
|
|---|
| 98 |
$delta = $this->node_infos['delta'] ; |
|---|
| 99 |
|
|---|
| 100 |
|
|---|
| 101 |
|
|---|
| 102 |
|
|---|
| 103 |
$delta = 2 ; |
|---|
| 104 |
|
|---|
| 105 |
$con = Propel::getConnection(); |
|---|
| 106 |
|
|---|
| 107 |
|
|---|
| 108 |
|
|---|
| 109 |
$query = sprintf('UPDATE %s SET %s = %s - 2 WHERE %s = %d AND %s > (%d - %d)', |
|---|
| 110 |
constant("$peer_name::TABLE_NAME"), |
|---|
| 111 |
self::getColumnConstant($stub_name, 'left'), |
|---|
| 112 |
self::getColumnConstant($stub_name, 'left'), |
|---|
| 113 |
self::getColumnConstant($stub_name, 'scope'), |
|---|
| 114 |
$scope_id_value, |
|---|
| 115 |
self::getColumnConstant($stub_name, 'left'), |
|---|
| 116 |
$right_value, |
|---|
| 117 |
$delta); |
|---|
| 118 |
$statement = $con->createStatement(); |
|---|
| 119 |
$statement->execute($query); |
|---|
| 120 |
|
|---|
| 121 |
|
|---|
| 122 |
|
|---|
| 123 |
$query = sprintf('UPDATE %s SET %s = %s - 2 WHERE %s = %d AND %s > (%d - %d + 1)', |
|---|
| 124 |
constant("$peer_name::TABLE_NAME"), |
|---|
| 125 |
self::getColumnConstant($stub_name, 'right'), |
|---|
| 126 |
self::getColumnConstant($stub_name, 'right'), |
|---|
| 127 |
self::getColumnConstant($stub_name, 'scope'), |
|---|
| 128 |
$scope_id_value, |
|---|
| 129 |
self::getColumnConstant($stub_name, 'right'), |
|---|
| 130 |
$right_value, |
|---|
| 131 |
$delta); |
|---|
| 132 |
$con = Propel::getConnection(); |
|---|
| 133 |
$statement = $con->createStatement(); |
|---|
| 134 |
$statement->execute($query); |
|---|
| 135 |
|
|---|
| 136 |
|
|---|
| 137 |
|
|---|
| 138 |
|
|---|
| 139 |
|
|---|
| 140 |
|
|---|
| 141 |
public function preDelete (BaseObject $node) |
|---|
| 142 |
|
|---|
| 143 |
$this->node_infos['peer_name'] = get_class($node->getPeer()); |
|---|
| 144 |
$this->node_infos['stub_name'] = get_class($node); |
|---|
| 145 |
$this->node_infos['scope_id_value'] = $node->getScopeIdValue() ; |
|---|
| 146 |
$this->node_infos['right_value'] = $node->getRightValue() ; |
|---|
| 147 |
|
|---|
| 148 |
|
|---|
| 149 |
|
|---|
| 150 |
|
|---|
| 151 |
|
|---|
| 152 |
|
|---|
| 153 |
|
|---|
| 154 |
|
|---|
| 155 |
|
|---|
| 156 |
public function getLeftValue(BaseObject $node) |
|---|
| 157 |
|
|---|
| 158 |
$getter = self::forgeMethodName($node, 'get', 'left'); |
|---|
| 159 |
$node->$getter(); |
|---|
| 160 |
|
|---|
| 161 |
|
|---|
| 162 |
|
|---|
| 163 |
|
|---|
| 164 |
|
|---|
| 165 |
|
|---|
| 166 |
|
|---|
| 167 |
|
|---|
| 168 |
public function setLeftValue(BaseObject $node, $value) |
|---|
| 169 |
|
|---|
| 170 |
$setter = self::forgeMethodName($node, 'set', 'left'); |
|---|
| 171 |
$node->$setter($value); |
|---|
| 172 |
|
|---|
| 173 |
|
|---|
| 174 |
|
|---|
| 175 |
|
|---|
| 176 |
|
|---|
| 177 |
|
|---|
| 178 |
|
|---|
| 179 |
|
|---|
| 180 |
public function setRightValue(BaseObject $node, $value) |
|---|
| 181 |
|
|---|
| 182 |
$setter = self::forgeMethodName($node, 'set', 'right'); |
|---|
| 183 |
$node->$setter($value); |
|---|
| 184 |
|
|---|
| 185 |
|
|---|
| 186 |
|
|---|
| 187 |
|
|---|
| 188 |
|
|---|
| 189 |
|
|---|
| 190 |
|
|---|
| 191 |
public function getRightValue(BaseObject $node) |
|---|
| 192 |
|
|---|
| 193 |
$getter = self::forgeMethodName($node, 'get', 'right'); |
|---|
| 194 |
$node->$getter(); |
|---|
| 195 |
|
|---|
| 196 |
|
|---|
| 197 |
|
|---|
| 198 |
|
|---|
| 199 |
|
|---|
| 200 |
|
|---|
| 201 |
|
|---|
| 202 |
|
|---|
| 203 |
public function setScopeIdValue(BaseObject $node, $value) |
|---|
| 204 |
|
|---|
| 205 |
$setter = self::forgeMethodName($node, 'set', 'scope'); |
|---|
| 206 |
$node->$setter($value); |
|---|
| 207 |
|
|---|
| 208 |
|
|---|
| 209 |
|
|---|
| 210 |
|
|---|
| 211 |
|
|---|
| 212 |
|
|---|
| 213 |
|
|---|
| 214 |
public function getScopeIdValue(BaseObject $node) |
|---|
| 215 |
|
|---|
| 216 |
$getter = self::forgeMethodName($node, 'get', 'scope'); |
|---|
| 217 |
$node->$getter(); |
|---|
| 218 |
|
|---|
| 219 |
|
|---|
| 220 |
|
|---|
| 221 |
|
|---|
| 222 |
|
|---|
| 223 |
|
|---|
| 224 |
|
|---|
| 225 |
|
|---|
| 226 |
public function setParentIdValue(BaseObject $node, $value) |
|---|
| 227 |
|
|---|
| 228 |
$setter = self::forgeMethodName($node, 'set', 'parent'); |
|---|
| 229 |
$node->$setter($value); |
|---|
| 230 |
|
|---|
| 231 |
|
|---|
| 232 |
|
|---|
| 233 |
|
|---|
| 234 |
|
|---|
| 235 |
|
|---|
| 236 |
|
|---|
| 237 |
public function getParentIdValue(BaseObject $node) |
|---|
| 238 |
|
|---|
| 239 |
$getter = self::forgeMethodName($node, 'get', 'parent'); |
|---|
| 240 |
$node->$getter(); |
|---|
| 241 |
|
|---|
| 242 |
|
|---|
| 243 |
|
|---|
| 244 |
|
|---|
| 245 |
|
|---|
| 246 |
|
|---|
| 247 |
|
|---|
| 248 |
|
|---|
| 249 |
|
|---|
| 250 |
|
|---|
| 251 |
public function makeRoot(BaseObject $node) |
|---|
| 252 |
|
|---|
| 253 |
$node->getLeftValue()) |
|---|
| 254 |
|
|---|
| 255 |
Exception('Cannot turn an existing node into a root node.'); |
|---|
| 256 |
|
|---|
| 257 |
|
|---|
| 258 |
$node->setLeftValue(1); |
|---|
| 259 |
$node->setRightValue(2); |
|---|
| 260 |
|
|---|
| 261 |
|
|---|
| 262 |
|
|---|
| 263 |
|
|---|
| 264 |
|
|---|
| 265 |
|
|---|
| 266 |
|
|---|
| 267 |
|
|---|
| 268 |
|
|---|
| 269 |
|
|---|
| 270 |
public function insertAsFirstChildOf(BaseObject $node, BaseObject $dest_node) |
|---|
| 271 |
|
|---|
| 272 |
$node->setLeftValue($dest_node->getLeftValue() + 1); |
|---|
| 273 |
$node->setRightValue($dest_node->getLeftValue() + 2); |
|---|
| 274 |
$node->setScopeIdValue($dest_node->getScopeIdValue()); |
|---|
| 275 |
$node->setParentIdValue($dest_node->getPrimaryKey()); |
|---|
| 276 |
$this->addPreSaveStackEntries($this->shiftRLValues(get_class($node->getPeer()), |
|---|
| 277 |
$node->getLeftValue(), |
|---|
| 278 |
2, |
|---|
| 279 |
$dest_node->getScopeIdValue())); |
|---|
| 280 |
|
|---|
| 281 |
$dest_node->setRightValue($dest_node->getRightValue() + 2); |
|---|
| 282 |
$this->addPreSaveStackEntries(array($dest_node)); |
|---|
| 283 |
|
|---|
| 284 |
|
|---|
| 285 |
|
|---|
| 286 |
|
|---|
| 287 |
|
|---|
| 288 |
|
|---|
| 289 |
|
|---|
| 290 |
|
|---|
| 291 |
public function insertAsLastChildOf(BaseObject $node, BaseObject $dest_node) |
|---|
| 292 |
|
|---|
| 293 |
$node->setLeftValue($dest_node->getRightValue()); |
|---|
| 294 |
$node->setRightValue($dest_node->getRightValue() + 1); |
|---|
| 295 |
$node->setScopeIdValue($dest_node->getScopeIdValue()); |
|---|
| 296 |
$node->setParentIdValue($dest_node->getPrimaryKey()); |
|---|
| 297 |
$this->addPreSaveStackEntries($this->shiftRLValues(get_class($node->getPeer()), |
|---|
| 298 |
$node->getLeftValue(), |
|---|
| 299 |
2, |
|---|
| 300 |
$dest_node->getScopeIdValue())); |
|---|
| 301 |
|
|---|
| 302 |
$dest_node->setRightValue($dest_node->getRightValue() + 2); |
|---|
| 303 |
$this->addPreSaveStackEntries(array($dest_node)); |
|---|
| 304 |
|
|---|
| 305 |
|
|---|
| 306 |
|
|---|
| 307 |
|
|---|
| 308 |
|
|---|
| 309 |
|
|---|
| 310 |
|
|---|
| 311 |
|
|---|
| 312 |
|
|---|
| 313 |
public function insertAsNextSiblingOf(BaseObject $node, BaseObject $dest_node) |
|---|
| 314 |
|
|---|
| 315 |
$dest_node->isRoot()) |
|---|
| 316 |
|
|---|
| 317 |
$msg = 'Root nodes cannot have siblings'; |
|---|
| 318 |
Exception($msg); |
|---|
| 319 |
|
|---|
| 320 |
|
|---|
| 321 |
$node->setLeftValue($dest_node->getRightValue() + 1); |
|---|
| 322 |
$node->setRightValue($dest_node->getRightValue() + 2); |
|---|
| 323 |
$node->setScopeIdValue($dest_node->getScopeIdValue()); |
|---|
| 324 |
$node->setParentIdValue($dest_node->getParentIdValue()); |
|---|
| 325 |
|
|---|
| 326 |
$this->addPreSaveStackEntries($this->shiftRLValues(get_class($node->getPeer()), |
|---|
| 327 |
$node->getLeftValue(), |
|---|
| 328 |
2, |
|---|
| 329 |
$dest_node->getScopeIdValue())); |
|---|
| 330 |
|
|---|
| 331 |
|
|---|
| 332 |
|
|---|
| 333 |
|
|---|
| 334 |
|
|---|
| 335 |
|
|---|
| 336 |
|
|---|
| 337 |
|
|---|
| 338 |
|
|---|
| 339 |
|
|---|
| 340 |
public function insertAsPrevSiblingOf(BaseObject $node, BaseObject $dest_node) |
|---|
| 341 |
|
|---|
| 342 |
$dest_node->isRoot()) |
|---|
| 343 |
|
|---|
| 344 |
$msg = 'Root nodes cannot have siblings'; |
|---|
| 345 |
Exception($msg); |
|---|
| 346 |
|
|---|
| 347 |
|
|---|
| 348 |
$node->setLeftValue($dest_node->getLeftValue()); |
|---|
| 349 |
$node->setRightValue($dest_node->getLeftValue() + 1); |
|---|
| 350 |
$node->setScopeIdValue($dest_node->getScopeIdValue()); |
|---|
| 351 |
$node->setParentIdValue($dest_node->getParentIdValue()); |
|---|
| 352 |
|
|---|
| 353 |
$this->addPreSaveStackEntries($this->shiftRLValues(get_class($node->getPeer()), |
|---|
| 354 |
$node->getLeftValue(), |
|---|
| 355 |
2, |
|---|
| 356 |
$dest_node->getScopeIdValue())); |
|---|
| 357 |
|
|---|
| 358 |
$dest_node->setLeftValue($dest_node->getLeftValue() + 2); |
|---|
| 359 |
$dest_node->setRightValue($dest_node->getRightValue() + 2); |
|---|
| 360 |
$this->addPreSaveStackEntries(array($dest_node)); |
|---|
| 361 |
|
|---|
| 362 |
|
|---|
| 363 |
|
|---|
| 364 |
|
|---|
| 365 |
|
|---|
| 366 |
|
|---|
| 367 |
|
|---|
| 368 |
|
|---|
| 369 |
|
|---|
| 370 |
public function insertAsParentOf(BaseObject $node, BaseObject $dest_node) |
|---|
| 371 |
|
|---|
| 372 |
$dest_node->isRoot()) |
|---|
| 373 |
|
|---|
| 374 |
$msg = 'Impossible to insert a node as parent of a root node'; |
|---|
| 375 |
Exception($msg); |
|---|
| 376 |
|
|---|
| 377 |
|
|---|
| 378 |
$peer_name = get_class($node->getPeer()); |
|---|
| 379 |
|
|---|
| 380 |
$this->addPreSaveStackEntries(self::shiftRLValues($peer_name, $dest_node->getLeftValue(), 1, $dest_node->getScopeIdValue())); |
|---|
| 381 |
$this->addPreSaveStackEntries(self::shiftRLValues($peer_name, $dest_node->getRightValue() + 2, -1, $dest_node->getScopeIdValue())); |
|---|
| 382 |
|
|---|
| 383 |
$node->setLeftValue($dest_node->getLeftValue()); |
|---|
| 384 |
$node->setRightValue($dest_node->getRightValue() + 2); |
|---|
| 385 |
|
|---|
| 386 |
$previous_parent = $dest_node->getParentIdValue(); |
|---|
| 387 |
$node->setParentIdValue($previous_parent); |
|---|
| 388 |
$dest_node->setParentIdValue($node->getPrimaryKey()); |
|---|
| 389 |
|
|---|
| 390 |
$this->addPreSaveStackEntries(array($dest_node)); |
|---|
| 391 |
|
|---|
| 392 |
|
|---|
| 393 |
|
|---|
| 394 |
|
|---|
| 395 |
|
|---|
| 396 |
|
|---|
| 397 |
|
|---|
| 398 |
|
|---|
| 399 |
|
|---|
| 400 |
|
|---|
| 401 |
|
|---|
| 402 |
public function hasChildren(BaseObject $node) |
|---|
| 403 |
|
|---|
| 404 |
$node->getRightValue() - $node->getLeftValue() > 1; |
|---|
| 405 |
|
|---|
| 406 |
|
|---|
| 407 |
|
|---|
| 408 |
|
|---|
| 409 |
|
|---|
| 410 |
|
|---|
| 411 |
|
|---|
| 412 |
|
|---|
| 413 |
public function isRoot(BaseObject $node) |
|---|
| 414 |
|
|---|
| 415 |
$node->getLeftValue() == 1; |
|---|
| 416 |
|
|---|
| 417 |
|
|---|
| 418 |
|
|---|
| 419 |
|
|---|
| 420 |
|
|---|
| 421 |
|
|---|
| 422 |
|
|---|
| 423 |
|
|---|
| 424 |
public function hasParent(BaseObject $node) |
|---|
| 425 |
|
|---|
| 426 |
$node->getParentIdValue(); |
|---|
| 427 |
|
|---|
| 428 |
|
|---|
| 429 |
|
|---|
| 430 |
|
|---|
| 431 |
|
|---|
| 432 |
|
|---|
| 433 |
|
|---|
| 434 |
|
|---|
| 435 |
public function hasNextSibling(BaseObject $node) |
|---|
| 436 |
|
|---|
| 437 |
$node->retrieveNextSibling(); |
|---|
| 438 |
|
|---|
| 439 |
|
|---|
| 440 |
|
|---|
| 441 |
|
|---|
| 442 |
|
|---|
| 443 |
|
|---|
| 444 |
|
|---|
| 445 |
|
|---|
| 446 |
public function hasPrevSibling(BaseObject $node) |
|---|
| 447 |
|
|---|
| 448 |
$node->retrievePrevSibling(); |
|---|
| 449 |
|
|---|
| 450 |
|
|---|
| 451 |
|
|---|
| 452 |
|
|---|
| 453 |
|
|---|
| 454 |
|
|---|
| 455 |
|
|---|
| 456 |
|
|---|
| 457 |
public function isLeaf(BaseObject $node) |
|---|
| 458 |
|
|---|
| 459 |
$node->getRightValue() - $node->getLeftValue() == 1; |
|---|
| 460 |
|
|---|
| 461 |
|
|---|
| 462 |
|
|---|
| 463 |
|
|---|
| 464 |
|
|---|
| 465 |
|
|---|
| 466 |
|
|---|
| 467 |
|
|---|
| 468 |
|
|---|
| 469 |
public function isEqualTo(BaseObject $node, BaseObject $compared_node) |
|---|
| 470 |
|
|---|
| 471 |
$node->getLeftValue() === $compared_node->getLeftValue() |
|---|
| 472 |
$node->getRightValue() === $compared_node->getRightValue() |
|---|
| 473 |
$node->getScopeIdValue() === $compared_node->getScopeIdValue() |
|---|
| 474 |
$node->getParentIdValue() === $compared_node->getParentIdValue()); |
|---|
| 475 |
|
|---|
| 476 |
|
|---|
| 477 |
|
|---|
| 478 |
|
|---|
| 479 |
|
|---|
| 480 |
|
|---|
| 481 |
|
|---|
| 482 |
|
|---|
| 483 |
public function isChildOf(BaseObject $node, BaseObject $parent_node) |
|---|
| 484 |
|
|---|
| 485 |
$node->getParentIdValue() === $parent_node->getPrimaryKey() |
|---|
| 486 |
$node->getScopeIdValue() === $parent_node->getScopeIdValue()); |
|---|
| 487 |
|
|---|
| 488 |
|
|---|
| 489 |
|
|---|
| 490 |
|
|---|
| 491 |
|
|---|
| 492 |
|
|---|
| 493 |
|
|---|
| 494 |
|
|---|
| 495 |
public function getNumberOfChildren(BaseObject $node) |
|---|
| 496 |
|
|---|
| 497 |
$peer_name = get_class($node->getPeer()); |
|---|
| 498 |
$con = Propel::getConnection(); |
|---|
| 499 |
$scope_sql = ''; |
|---|
| 500 |
is_null($node->getScopeIdValue())) |
|---|
| 501 |
|
|---|
| 502 |
$scope_sql = sprintf(' AND %s = %d', |
|---|
| 503 |
self::getColumnConstant(get_class($node), 'scope'), |
|---|
| 504 |
$node->getScopeIdValue()); |
|---|
| 505 |
|
|---|
| 506 |
|
|---|
| 507 |
$sql = sprintf('SELECT COUNT(*) AS num_children FROM %s WHERE %s = %s %s', |
|---|
| 508 |
constant("$peer_name::TABLE_NAME"), |
|---|
| 509 |
self::getColumnConstant(get_class($node), 'parent'), |
|---|
| 510 |
$node->getPrimaryKey(), |
|---|
| 511 |
$scope_sql |
|---|
| 512 |
); |
|---|
| 513 |
|
|---|
| 514 |
$stmt = $con->createStatement(); |
|---|
| 515 |
$rs = $stmt->executeQuery($sql); |
|---|
| 516 |
$rs->next(); |
|---|
| 517 |
|
|---|
| 518 |
$rs->getInt('num_children'); |
|---|
| 519 |
|
|---|
| 520 |
|
|---|
| 521 |
|
|---|
| 522 |
|
|---|
| 523 |
|
|---|
| 524 |
|
|---|
| 525 |
|
|---|
| 526 |
|
|---|
| 527 |
public function getNumberOfDescendants(BaseObject $node) |
|---|
| 528 |
|
|---|
| 529 |
$right = $node->getRightValue(); |
|---|
| 530 |
$left = $node->getLeftValue(); |
|---|
| 531 |
$num = ($right - $left - 1) / 2; |
|---|
| 532 |
|
|---|
| 533 |
$num; |
|---|
| 534 |
|
|---|
| 535 |
|
|---|
| 536 |
|
|---|
| 537 |
|
|---|
| 538 |
|
|---|
| 539 |
|
|---|
| 540 |
|
|---|
| 541 |
|
|---|
| 542 |
public function getLevel(BaseObject $node) |
|---|
| 543 |
|
|---|
| 544 |
$node->level)) |
|---|
| 545 |
|
|---|
| 546 |
$peer_name = get_class($node->getPeer()); |
|---|
| 547 |
|
|---|
| 548 |
$con = Propel::getConnection(); |
|---|
| 549 |
$stmt = $con->createStatement(); |
|---|
| 550 |
|
|---|
| 551 |
$scope_sql = ''; |
|---|
| 552 |
is_null($node->getScopeIdValue())) { |
|---|
| 553 |
$scope_sql = sprintf(' AND %s = %d', self::getColumnConstant(get_class($node), 'scope'), $node->getScopeIdValue()); |
|---|
| 554 |
|
|---|
| 555 |
|
|---|
| 556 |
$sql = sprintf('SELECT COUNT(*) AS level FROM %s WHERE (%s < %d AND %s > %d) %s', |
|---|
| 557 |
constant("$peer_name::TABLE_NAME"), |
|---|
| 558 |
self::getColumnConstant(get_class($node), 'left'), |
|---|
| 559 |
$node->getLeftValue(), |
|---|
| 560 |
self::getColumnConstant(get_class($node), 'right'), |
|---|
| 561 |
$node->getRightValue(), |
|---|
| 562 |
$scope_sql |
|---|
| 563 |
); |
|---|
| 564 |
|
|---|
| 565 |
$rs = $stmt->executeQuery($sql); |
|---|
| 566 |
$rs->next(); |
|---|
| 567 |
|
|---|
| 568 |
$level = $rs->getInt('level'); |
|---|
| 569 |
$this->level = $level; |
|---|
| 570 |
|
|---|
| 571 |
|
|---|
| 572 |
|
|---|
| 573 |
$level = $node->level; |
|---|
| 574 |
|
|---|
| 575 |
|
|---|
| 576 |
$level; |
|---|
| 577 |
|
|---|
| 578 |
|
|---|
| 579 |
|
|---|
| 580 |
|
|---|
| 581 |
|
|---|
| 582 |
|
|---|
| 583 |
|---|