/**
  * Renders captions
  *
  * @param Tx_PtExtlist_Domain_Model_List_Header_ListHeader $listHeader
  * @return Tx_PtExtlist_Domain_Model_List_Header_ListHeader $listHeader
  */
 public function renderCaptions(Tx_PtExtlist_Domain_Model_List_Header_ListHeader $listHeader)
 {
     Tx_PtExtbase_Assertions_Assert::isNotNull($listHeader, array('message' => 'No header data available. 1280408235'));
     $renderedListHeader = new Tx_PtExtlist_Domain_Model_List_Header_ListHeader($listHeader->getListIdentifier());
     foreach ($listHeader as $headerColumn) {
         /* @var $headerColumn Tx_PtExtlist_Domain_Model_List_Header_HeaderColumn */
         if ($headerColumn->getColumnConfig()->isAccessable() && $headerColumn->getIsVisible()) {
             $label = $this->renderColumnLabel($headerColumn);
             $renderedListHeader->createAndAddCell($label, $headerColumn->getColumnIdentifier());
         }
     }
     return $renderedListHeader;
 }
 /**
  * Returns list data structure for given domain objects.
  * Uses configuration currently set in mapper.
  *
  * @param mixed $domainObjects
  * @return Tx_PtExtlist_Domain_Model_List_ListData List data generated for given mapping configuration
  */
 public function getMappedListData($domainObjects)
 {
     Tx_PtExtbase_Assertions_Assert::isNotNull($this->fieldConfigurationCollection, array('message' => 'No mapper configuration has been set for domain object mapper! 1281635601'));
     $listData = new Tx_PtExtlist_Domain_Model_List_ListData();
     foreach ($domainObjects as $domainObject) {
         $listDataRow = new Tx_PtExtlist_Domain_Model_List_Row();
         foreach ($this->fieldConfigurationCollection as $fieldConfiguration) {
             /* @var $fieldConfiguration Tx_PtExtlist_Domain_Configuration_Data_Fields_FieldConfig */
             $property = $this->getPropertyNameByFieldConfig($fieldConfiguration);
             if ($property == '__object__') {
                 $value = $domainObject;
             } else {
                 $value = $this->getObjectPropertyValueByProperty($domainObject, $property);
             }
             $listDataRow->createAndAddCell($value, $fieldConfiguration->getIdentifier());
         }
         $listData->addRow($listDataRow);
     }
     return $listData;
 }
Esempio n. 3
0
 /**
  * Renders list data
  *
  * @param Tx_PtExtlist_Domain_Model_List_ListData $listData
  * @return Tx_PtExtlist_Domain_Model_List_ListData
  */
 public function renderList(Tx_PtExtlist_Domain_Model_List_ListData $listData)
 {
     Tx_PtExtbase_Assertions_Assert::isNotNull($listData, array(message => 'No list data found in list. 1280405145'));
     // We could get another type of list data here, so we have to instantiate this class
     $listDataClassName = get_class($listData);
     $renderedList = new $listDataClassName();
     // We need some generic way to copy non-standard data from "old" list data to "new" list data
     if (method_exists($renderedList, 'copyListData')) {
         // TODO refactor this by using a getEmptyInstance method on the list data we want to copy.
         $renderedList->copyListData($listData);
     }
     foreach ($listData as $rowIndex => $row) {
         $renderedList->addRow($this->rowRenderer->renderRow($row, $rowIndex));
     }
     unset($listData);
     return $renderedList;
 }