Skip to content

Instantly share code, notes, and snippets.

@tomasnorre
Created April 25, 2019 09:48
Show Gist options
  • Save tomasnorre/ab08be61c567e4cd1c9fef952c9cbc91 to your computer and use it in GitHub Desktop.
Save tomasnorre/ab08be61c567e4cd1c9fef952c9cbc91 to your computer and use it in GitHub Desktop.
<?php
namespace AOE\SchedulerTimeline\ViewHelpers;
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
/**
* Class IncreaseViewHelper
*
*/
class IncreaseViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper
{
use CompileWithRenderStatic;
protected $escapeOutput = false;
/**
* Render
*
* @param string $start
* @param string $end
* @param string $interval
* @param string $iterator
* @return string
*/
public function render($start, $end, $interval = '1', $iterator = 'i')
{
$escapingEnabled = $this->isChildrenEscapingEnabled();
$result = '';
for ($i = $start; $i < $end; $i += $interval) {
$this->templateVariableContainer->add($iterator, $i);
$result .= $this->renderChildren();
$this->templateVariableContainer->remove($iterator);
}
return $result;
}
}
<div class="row hours">
<div class="timeline">
<s:increase start="{starttime}" end="{endtime}" interval="3600">
<div class="hour"><s:format.speakingDate timestamp="{i}" /></div>
</s:increase>
</div>
</div>
@tomasnorre
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment