Exemple #1
1
 /**
  * Render the header row
  */
 protected function renderHeader()
 {
     $columnNumber = 0;
     // Headers
     if ($this->templateVariableContainer->exists('listCaptions')) {
         foreach ($this->templateVariableContainer['listCaptions'] as $columnIdentifier => $caption) {
             /* @var $caption Tx_PtExtlist_Domain_Model_List_Cell */
             $this->activeSheet->setCellValueByColumnAndRow($columnNumber, $this->rowNumber, strip_tags($caption->getValue()));
             $excelSettings = $this->getExcelSettingsByColumnIdentifier($columnIdentifier);
             /**
              * Width
              */
             if (is_array($excelSettings) && array_key_exists('width', $excelSettings)) {
                 $this->activeSheet->getColumnDimensionByColumn($columnNumber)->setWidth($excelSettings['width']);
             } else {
                 $this->activeSheet->getColumnDimensionByColumn($columnNumber)->setAutoSize(true);
             }
             $this->doCellStyling($columnNumber, $columnIdentifier, 'header');
             $columnNumber++;
         }
     }
     $this->rowNumber++;
 }
 public function evaluateChildNodes(\TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext)
 {
     $identifiers = $this->variableContainer->getAllIdentifiers();
     $callElement = array();
     foreach ($identifiers as $identifier) {
         $callElement[$identifier] = $this->variableContainer->get($identifier);
     }
     $this->callProtocol[] = $callElement;
 }
 /**
  * On the post parse event, add the "layoutName" variable to the variable container so it can be used by the TemplateView.
  *
  * @param \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ViewHelperNode $syntaxTreeNode
  * @param array $viewHelperArguments
  * @param \TYPO3\CMS\Fluid\Core\ViewHelper\TemplateVariableContainer $variableContainer
  * @return void
  */
 public static function postParseEvent(\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ViewHelperNode $syntaxTreeNode, array $viewHelperArguments, \TYPO3\CMS\Fluid\Core\ViewHelper\TemplateVariableContainer $variableContainer)
 {
     if (isset($viewHelperArguments['name'])) {
         $layoutNameNode = $viewHelperArguments['name'];
     } else {
         $layoutNameNode = new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode('Default');
     }
     $variableContainer->add('layoutName', $layoutNameNode);
 }
 /**
  * Restores $variables in $variableContainer
  *
  * @param TemplateVariableContainer $variableContainer
  * @param array $variables
  * @param array $backups
  * @return void
  */
 public static function restoreVariables(TemplateVariableContainer $variableContainer, array $variables, array $backups)
 {
     foreach ($variables as $variableName => $variableValue) {
         $variableContainer->remove($variableName);
         if (TRUE === isset($backups[$variableName])) {
             $variableContainer->add($variableName, $variableValue);
         }
     }
 }
 /**
  * @test
  * @dataProvider linkedDataProvider
  */
 public function itemsAreAddedToContainer($subject, $predicate, $object, $objectType, $language, $name, $expected)
 {
     $this->fixture->setArguments(['subject' => $subject, 'predicate' => $predicate, 'object' => $object, 'objectType' => $objectType, 'language' => $language, 'name' => $name]);
     $this->templateVariableContainer->expects($this->once())->method('remove')->with($name);
     $this->templateVariableContainer->expects($this->once())->method('add')->with($name)->will($this->returnValue(''));
     ObjectAccess::setProperty($this->fixture, 'templateVariableContainer', $this->templateVariableContainer, true);
     $this->fixture->render();
     $this->markTestIncomplete('Todo');
 }
Exemple #6
0
 /**
  * Render the header
  */
 public function renderHeader()
 {
     // Headers
     if ($this->templateVariableContainer->exists('listCaptions')) {
         $row = array();
         foreach ($this->templateVariableContainer['listCaptions'] as $caption) {
             $row[] = iconv('UTF-8', $this->outputEncoding, $caption);
         }
         fputcsv($this->outputStreamHandle, $row, $this->delimiter, $this->enclosure);
     }
 }
 /**
  * @test
  */
 public function assignMultipleCanOverridePreviouslyAssignedValues()
 {
     $this->templateVariableContainer->expects($this->at(0))->method('exists')->with('foo')->will($this->returnValue(false));
     $this->templateVariableContainer->expects($this->at(1))->method('add')->with('foo', 'FooValue');
     $this->templateVariableContainer->expects($this->at(2))->method('exists')->with('foo')->will($this->returnValue(true));
     $this->templateVariableContainer->expects($this->at(3))->method('remove')->with('foo');
     $this->templateVariableContainer->expects($this->at(4))->method('add')->with('foo', 'FooValueOverridden');
     $this->templateVariableContainer->expects($this->at(5))->method('exists')->with('bar')->will($this->returnValue(false));
     $this->templateVariableContainer->expects($this->at(6))->method('add')->with('bar', 'BarValue');
     $this->view->assign('foo', 'FooValue');
     $this->view->assignMultiple(array('foo' => 'FooValueOverridden', 'bar' => 'BarValue'));
 }
 /**
  * Save the associated view helper node in a static public class variable.
  * called directly after the view helper was built.
  *
  * @param \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ViewHelperNode $syntaxTreeNode
  * @param array $viewHelperArguments
  * @param \TYPO3\CMS\Fluid\Core\ViewHelper\TemplateVariableContainer $variableContainer
  * @return void
  */
 public static function postParseEvent(\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ViewHelperNode $syntaxTreeNode, array $viewHelperArguments, \TYPO3\CMS\Fluid\Core\ViewHelper\TemplateVariableContainer $variableContainer)
 {
     $sectionName = $viewHelperArguments['name']->getText();
     if (!$variableContainer->exists('sections')) {
         $variableContainer->add('sections', array());
     }
     $sections = $variableContainer->get('sections');
     $sections[$sectionName] = $syntaxTreeNode;
     $variableContainer->remove('sections');
     $variableContainer->add('sections', $sections);
 }
 /**
  * @param array $variables
  * @param array $backups
  * @param \TYPO3\CMS\Fluid\Core\ViewHelper\TemplateVariableContainer $templateVariableContainer
  * @return void
  */
 private static function restoreVariables(array $variables, array $backups, $templateVariableContainer)
 {
     foreach ($variables as $variableName => $variableValue) {
         $templateVariableContainer->remove($variableName);
         if (true === isset($backups[$variableName])) {
             $templateVariableContainer->add($variableName, $variableValue);
         }
     }
 }
 /**
  * @test
  * @expectedException \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException
  */
 public function addingVariableNamedAllShouldThrowException()
 {
     $this->variableContainer->add('_all', 'foo');
 }