<?php
/**
 * @copyright (c) Kufer Software GmbH, Loisachstrasse 4, D-84453 Mühldorf
 */


class DSblaetternAPI
{
  
  public function __construct()
  {
  }

  
  public function getBlaetternAry($pAktds, $pRichtung)
  {
    $retAry = array('', '');

    $aktobjindary = SessionOperations::getVarValueSuche('aktobjindary');
    $retAry[1] = $pRichtung;

    
    

    $aktindex = false;
    if (!empty($aktobjindary)) {
      
      $aktObjIndAryString = array_map(function($aktObjInd) {return (string)$aktObjInd;}, $aktobjindary);
      $aktindex = array_search((string)$pAktds, $aktObjIndAryString, true);
    }

    
    if ($aktindex !== false) {
      
      $retAry[0] = '';
      if ($pRichtung == 'forward') {
        if ($aktindex < count($aktobjindary) - 1) {
          $retAry[0] = $aktobjindary[$aktindex + 1];
        }
      } else {  
        if ($aktindex > 0) {
          $retAry[0] = $aktobjindary[$aktindex - 1];
        }
      }
    } 

    return $retAry;
  }

  
}