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

namespace Kufer\KuferTools\Ausgaben\SammelSms;

abstract class SendSammelSmsPresenter extends \Kufer\KuferTools\Basis\Presenter\MitRahmenPresenter
{
  protected function getContent()
  {
    if ($this->useCaseResponse->smsVersandt) {
      return parent::getContent();
    }
    
    $view = $this->getView();
    
    if ($this->useCaseResponse->noData) {
      return $view->getNoData();
    }
    
    return $view->getNoColumn();
    
  }

  protected function getViewModelCommonPart($pViewModel)
  {
    $pViewModel->kurs = $this->useCaseResponse->kurs;
    
    $pViewModel->toolId = $this->useCaseResponse->toolId;
    $pViewModel->kurs->errorMessage = $this->useCaseResponse->errorMessage;
  }

  
  protected function getKontakteMitSmsStatus()
  {
    
    
    $kontakte = array();
    foreach ($this->useCaseResponse->kontakte as $kontakt) {
      if (isset($this->useCaseResponse->sendSmsStatus[$kontakt->id])) {
        $kontakt->sms_status = $this->useCaseResponse->sendSmsStatus[$kontakt->id];
      } else {
        $kontakt->sms_status = SendSammelSmsUseCase::SMSVERSAND_FEHLER_BEIM_VERSENDEN;
      }
      $kontakte[] = $kontakt;
    }

    return $kontakte;
  }

  protected function getJsFilesSrcAryWeitere()
  {
    return array(
      $this->getJsFileFromSys('kontaktformular.js')
    );
  }
}