| @@ 1373-1399 (lines=27) @@ | ||
| 1370 | $str = trim($str, '()"\''); |
|
| 1371 | $docid = $this->getIdFromAlias($str); |
|
| 1372 | break; |
|
| 1373 | case 'prev': |
|
| 1374 | if (!$option) { |
|
| 1375 | $option = 'menuindex,ASC'; |
|
| 1376 | } elseif (strpos($option, ',') === false) { |
|
| 1377 | $option .= ',ASC'; |
|
| 1378 | } |
|
| 1379 | list($by, $dir) = explode(',', $option, 2); |
|
| 1380 | $children = $this->getActiveChildren($parent, $by, $dir); |
|
| 1381 | $find = false; |
|
| 1382 | $prev = false; |
|
| 1383 | foreach ($children as $row) { |
|
| 1384 | if ($row['id'] == $this->documentIdentifier) { |
|
| 1385 | $find = true; |
|
| 1386 | break; |
|
| 1387 | } |
|
| 1388 | $prev = $row; |
|
| 1389 | } |
|
| 1390 | if ($find) { |
|
| 1391 | if (isset($prev[$key])) { |
|
| 1392 | return $prev[$key]; |
|
| 1393 | } else { |
|
| 1394 | $docid = $prev['id']; |
|
| 1395 | } |
|
| 1396 | } else { |
|
| 1397 | $docid = ''; |
|
| 1398 | } |
|
| 1399 | break; |
|
| 1400 | case 'next': |
|
| 1401 | if (!$option) { |
|
| 1402 | $option = 'menuindex,ASC'; |
|
| @@ 1400-1428 (lines=29) @@ | ||
| 1397 | $docid = ''; |
|
| 1398 | } |
|
| 1399 | break; |
|
| 1400 | case 'next': |
|
| 1401 | if (!$option) { |
|
| 1402 | $option = 'menuindex,ASC'; |
|
| 1403 | } elseif (strpos($option, ',') === false) { |
|
| 1404 | $option .= ',ASC'; |
|
| 1405 | } |
|
| 1406 | list($by, $dir) = explode(',', $option, 2); |
|
| 1407 | $children = $this->getActiveChildren($parent, $by, $dir); |
|
| 1408 | $find = false; |
|
| 1409 | $next = false; |
|
| 1410 | foreach ($children as $row) { |
|
| 1411 | if ($find) { |
|
| 1412 | $next = $row; |
|
| 1413 | break; |
|
| 1414 | } |
|
| 1415 | if ($row['id'] == $this->documentIdentifier) { |
|
| 1416 | $find = true; |
|
| 1417 | } |
|
| 1418 | } |
|
| 1419 | if ($find) { |
|
| 1420 | if (isset($next[$key])) { |
|
| 1421 | return $next[$key]; |
|
| 1422 | } else { |
|
| 1423 | $docid = $next['id']; |
|
| 1424 | } |
|
| 1425 | } else { |
|
| 1426 | $docid = ''; |
|
| 1427 | } |
|
| 1428 | break; |
|
| 1429 | default: |
|
| 1430 | $docid = $str; |
|
| 1431 | } |
|