/** * {@inheritDoc} * * @SuppressWarnings(PHPMD.Superglobals) * @SuppressWarnings(PHPMD.CamelCaseVariableName) */ public function render(ViewTemplateInterface $objTemplate) { $arrOptions = array(array('value' => 'tl_limit', 'attributes' => '', 'content' => $GLOBALS['TL_LANG']['MSC']['filterRecords'])); $optionsTotal = ceil($this->intTotal / $GLOBALS['TL_CONFIG']['resultsPerPage']); for ($i = 0; $i < $optionsTotal; $i++) { $first = $i * $GLOBALS['TL_CONFIG']['resultsPerPage']; $thisLimit = $first . ',' . $GLOBALS['TL_CONFIG']['resultsPerPage']; $upperLimit = $first + $GLOBALS['TL_CONFIG']['resultsPerPage']; if ($upperLimit > $this->intTotal) { $upperLimit = $this->intTotal; } $arrOptions[] = array('value' => $thisLimit, 'attributes' => $this->getOffset() == $first ? ' selected="selected"' : '', 'content' => $first + 1 . ' - ' . $upperLimit); } if ($this->intTotal > $GLOBALS['TL_CONFIG']['resultsPerPage']) { $arrOptions[] = array('value' => 'all', 'attributes' => $this->getOffset() == 0 && $this->getAmount() == $this->intTotal ? ' selected="selected"' : '', 'content' => $GLOBALS['TL_LANG']['MSC']['filterAll']); } $objTemplate->set('options', $arrOptions); return $this; }
/** * {@inheritDoc} */ public function render(ViewTemplateInterface $objTemplate) { $arrOptions = array(); foreach ($this->getPropertyNames() as $field) { $arrLabel = $this->getEnvironment()->getDataDefinition()->getPropertiesDefinition()->getProperty($field)->getLabel(); $arrOptions[] = array('value' => $field, 'content' => is_array($arrLabel) ? $arrLabel[0] : $arrLabel, 'attributes' => $field == $this->getSelectedProperty() ? ' selected' : ''); } $objTemplate->set('class', 'tl_select' . ($this->getValue() !== null ? ' active' : '')); $objTemplate->set('options', $arrOptions); $objTemplate->set('value', $this->getValue()); return $this; }
/** * {@inheritDoc} */ public function render(ViewTemplateInterface $objTemplate) { $arrLabel = $this->getEnvironment()->getDataDefinition()->getPropertiesDefinition()->getProperty($this->getPropertyName())->getLabel(); $arrOptions = array(array('value' => 'tl_' . $this->getPropertyName(), 'content' => is_array($arrLabel) ? $arrLabel[0] : $arrLabel, 'attributes' => ''), array('value' => 'tl_' . $this->getPropertyName(), 'content' => '---', 'attributes' => '')); foreach ($this->arrfilterOptions as $key => $value) { $arrOptions[] = array('value' => $key, 'content' => $value, 'attributes' => $key === $this->getValue() ? ' selected="selected"' : ''); } $objTemplate->set('name', $this->getPropertyName()); $objTemplate->set('id', $this->getPropertyName()); $objTemplate->set('class', 'tl_select' . ($this->getValue() !== null ? ' active' : '')); $objTemplate->set('options', $arrOptions); $objTemplate->set('active', $this->getValue()); return $this; }