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

namespace Kufer\KuferTools\Utils\DatamodulHelper\DozentenHelper;

class FirmaAusbilderDozenten extends DozentenHelper
{
  private function getFirmaId()
  {
    return $this->user->tnr;
  }
  
  protected function getDozentenNummern($dbwDozenten)
  {
    $dnrs = $dbwDozenten->getDozentenIdsbyFilter();
    return $dnrs;
  }
  
  protected function setzeFilter($dbwDozenten, $pToolId)
  {
    $searchAPI = new \DozentensuchAPI();
    $dbwDozenten->fromobject = $searchAPI->getFromObjectBySession($dbwDozenten->fromobject,'tool'.$pToolId);
    $dbwDozenten->toobject = $searchAPI->getToObjectBySession($dbwDozenten->toobject,'tool'.$pToolId);
    return $dbwDozenten;
  }
  
  protected function setzeSortierung($dbwDozenten)
  {
    $dbwDozenten->orderby = $this->toolSettings->sortdoz;
    $dbwDozenten->orderbyasc = $this->toolSettings->sortdozasc;
    return $dbwDozenten;
  }
  
  protected function setzeEinstellungen($dbwDozenten)
  {
    if (!isset($dbwDozenten->fromobject->firmenIds)) {
      $dbwDozenten->fromobject->firmenIds = array();
    }
    $dbwDozenten->fromobject->firmenIds = \array_merge($dbwDozenten->fromobject->firmenIds,
        array($this->getFirmaId()));
    return $dbwDozenten;
  }
}