<?php

class Agro_View_Helper_FooterProposta extends Zend_View_Helper_Abstract {
    
	public function footerProposta($proposta, $isPdf = false)
    {
		return $this->_renderFooterProposta($proposta, $isPdf);
	}

	private function _renderFooterProposta($proposta, $isPdf)
    {
		$produto = $proposta->produto();
		ob_start();
		if($produto['id_safra'] >= 25 && !$isPdf) {
			$dtTransmissaoMae = ($proposta['dt_transmissao']) ? $proposta['dt_transmissao'] : $proposta['dt_criacao'];
			$formato = ($proposta['dt_transmissao']) ? 'Y-m-d H:i:s' : 'Y-m-d H:i:s-s';
			$date = DateTime::createFromFormat($formato, $dtTransmissaoMae);
			if($date > DateTime::createFromFormat('d/m/Y', DATA_ALTERACAO_PDF_PROPOSTA)){
				echo "
				<table style='height: 33px; vertical-align:top' align='right' class='no-view'>
					<tr valign='top'>
						<td style='height: 33px; width: 200px; '><b>Rubrica do Proponente: </b></td>
						<td style='height: 33px; width: 15px;'></td>
						<td style='height: 33px; width: 200px; '><b>Rubrica do Corretor: </b></td>
					</tr>
				</table>";
			}else{
				echo "
				<table style='height: 33px; vertical-align:top' align='right' class='no-view'>
					<tr valign='top'>
						<td style='height: 33px; width: 200px; border: 1px solid black;'><b>Rubrica do Proponente</b></td>
						<td style='height: 33px; width: 15px;'></td>
						<td style='height: 33px; width: 200px; border: 1px solid black;'><b>Rubrica do Corretor</b></td>
					</tr>
				</table>";
			}
		}
	        $html = ob_get_contents();
			ob_end_clean();
			return $html;
	}
}
