core-bundle/src/Resources/contao/drivers/DC_Table.php
public function show()
	{
		if (!\strlen($this->intId))
		{
			return '';
		}

		$objRow = $this->Database->prepare("SELECT * FROM " . $this->strTable . " WHERE id=?")
								 ->limit(1)
								 ->execute($this->intId);

		if ($objRow->numRows < 1)
		{
			return '';
		}

		$data = array();
		$row = $objRow->row();

		// Get the order fields
		$objDcaExtractor = DcaExtractor::getInstance($this->strTable);
		$arrOrder = $objDcaExtractor->getOrderFields();

		// Get all fields
		$fields = array_keys($row);
		$allowedFields = array('id', 'pid', 'sorting', 'tstamp');

		if (\is_array($GLOBALS['TL_DCA'][$this->strTable]['fields']))
		{
			$allowedFields = array_unique(array_merge($allowedFields, array_keys($GLOBALS['TL_DCA'][$this->strTable]['fields'])));
		}

		// Use the field order of the DCA file
		$fields = array_intersect($allowedFields, $fields);

		// Show all allowed fields
		foreach ($fields as $i)
		{
			if (!\in_array($i, $allowedFields) || $GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['inputType'] == 'password' || $GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['eval']['doNotShow'] || $GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['eval']['hideInput'])
			{
				continue;
			}

			// Special treatment for table tl_undo
			if ($this->strTable == 'tl_undo' && $i == 'data')
			{
				continue;
			}

			$value = StringUtil::deserialize($row[$i]);

			// Decrypt the value
			if ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['eval']['encrypt'])
			{
				$value = Encryption::decrypt($value);
			}

			// Get the field value
			if (isset($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['foreignKey']))
			{
				$temp = array();
				$chunks = explode('.', $GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['foreignKey'], 2);

				foreach ((array) $value as $v)
				{
					$objKey = $this->Database->prepare("SELECT " . Database::quoteIdentifier($chunks[1]) . " AS value FROM " . $chunks[0] . " WHERE id=?")
											 ->limit(1)
											 ->execute($v);

					if ($objKey->numRows)
					{
						$temp[] = $objKey->value;
					}
				}

				$row[$i] = implode(', ', $temp);
			}
			elseif ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['inputType'] == 'fileTree' || \in_array($i, $arrOrder))
			{
				if (\is_array($value))
				{
					foreach ($value as $kk=>$vv)
					{
						if (($objFile = FilesModel::findByUuid($vv)) instanceof FilesModel)
						{
							$value[$kk] = $objFile->path . ' (' . StringUtil::binToUuid($vv) . ')';
						}
						else
						{
							$value[$kk] = '';
						}
					}

					$row[$i] = implode(', ', $value);
				}
				else
				{
					if (($objFile = FilesModel::findByUuid($value)) instanceof FilesModel)
					{
						$row[$i] = $objFile->path . ' (' . StringUtil::binToUuid($value) . ')';
					}
					else
					{
						$row[$i] = '';
					}
				}
			}
			elseif (\is_array($value))
			{
				if (\count($value) == 2 && isset($value['value']) && isset($value['unit']))
				{
					$row[$i] = trim($value['value'] . ' ' . $value['unit']);
				}
				else
				{
					foreach ($value as $kk=>$vv)
					{
						if (\is_array($vv))
						{
							$vals = array_values($vv);
							$value[$kk] = array_shift($vals).' ('.implode(', ', array_filter($vals)).')';
						}
					}

					if (array_is_assoc($value))
					{
						foreach ($value as $kk=>$vv)
						{
							$value[$kk] = $kk . ': ' . $vv;
						}
					}

					$row[$i] = implode(', ', $value);
				}
			}
			elseif ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['eval']['rgxp'] == 'date')
			{
				$row[$i] = $value ? Date::parse(Config::get('dateFormat'), $value) : '-';
			}
			elseif ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['eval']['rgxp'] == 'time')
			{
				$row[$i] = $value ? Date::parse(Config::get('timeFormat'), $value) : '-';
			}
			elseif ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['eval']['rgxp'] == 'datim' || \in_array($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['flag'], array(5, 6, 7, 8, 9, 10)) || $i == 'tstamp')
			{
				$row[$i] = $value ? Date::parse(Config::get('datimFormat'), $value) : '-';
			}
			elseif ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['eval']['isBoolean'] || ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['inputType'] == 'checkbox' && !$GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['eval']['multiple']))
			{
				$row[$i] = $value ? $GLOBALS['TL_LANG']['MSC']['yes'] : $GLOBALS['TL_LANG']['MSC']['no'];
			}
			elseif ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['eval']['rgxp'] == 'email')
			{
				$row[$i] = Idna::decodeEmail($value);
			}
			elseif ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['inputType'] == 'textarea' && ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['eval']['allowHtml'] || $GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['eval']['preserveTags']))
			{
				$row[$i] = StringUtil::specialchars($value);
			}
			elseif (\is_array($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['reference']))
			{
				$row[$i] = isset($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['reference'][$row[$i]]) ? ((\is_array($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['reference'][$row[$i]])) ? $GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['reference'][$row[$i]][0] : $GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['reference'][$row[$i]]) : $row[$i];
			}
			elseif ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['eval']['isAssociative'] || array_is_assoc($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['options']))
			{
				$row[$i] = $GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['options'][$row[$i]];
			}
			else
			{
				$row[$i] = $value;
			}

			// Label
			if (isset($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['label']))
			{
				$label = \is_array($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['label']) ? $GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['label'][0] : $GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['label'];
			}
			else
			{
				$label = \is_array($GLOBALS['TL_LANG']['MSC'][$i]) ? $GLOBALS['TL_LANG']['MSC'][$i][0] : $GLOBALS['TL_LANG']['MSC'][$i];
			}

			if ($label == '')
			{
				$label = $i;
			}

			$data[$this->strTable][0][$label] = $row[$i];
		}

		// Call onshow_callback
		if (\is_array($GLOBALS['TL_DCA'][$this->strTable]['config']['onshow_callback']))
		{
			foreach ($GLOBALS['TL_DCA'][$this->strTable]['config']['onshow_callback'] as $callback)
			{
				if (\is_array($callback))
				{
					$this->import($callback[0]);
					$data = $this->{$callback[0]}->{$callback[1]}($data, $objRow->row(), $this);
				}
				elseif (\is_callable($callback))
				{
					$data = $callback($data, $objRow->row(), $this);
				}
			}
		}

		$separate = false;
		$return = '<table class="tl_show">';

		// Generate table
		foreach ($data as $table=>$rows)
		{
			foreach ($rows as $entries)
			{
				// Separate multiple rows
				if ($separate)
				{
					$return .= '
  <tr>
    <td colspan="2" style="height:1em"></td>
   </tr>';
				}

				$separate = true;
				$index = 1;

				// Add the table name
				$return .= '
  <tr>
    <td class="tl_folder_top"><span class="tl_label">'.$GLOBALS['TL_LANG']['MSC']['table'].' </span></td>
    <td class="tl_folder_top">'.$table.'</td>
  </tr>
';

				foreach ($entries as $lbl=>$val)
				{
					$class = ((++$index % 2) !== 0) ? ' class="tl_bg"' : '';

					// Always encode special characters (thanks to Oliver Klee)
					$return .= '
	  <tr>
		<td'.$class.'><span class="tl_label">'.$lbl.' </span></td>
		<td'.$class.'>'.StringUtil::specialchars($val).'</td>
	  </tr>';
				}
			}
		}

		// Return table
		return $return . '</table>';
	}
public function show()
	{
		if (!\strlen($this->intId))
		{
			return '';
		}

		$objRow = $this->Database->prepare("SELECT * FROM " . $this->strTable . " WHERE id=?")
								 ->limit(1)
								 ->execute($this->intId);

		if ($objRow->numRows < 1)
		{
			return '';
		}

		$data = array();
		$row = $objRow->row();

		// Get the order fields
		$objDcaExtractor = DcaExtractor::getInstance($this->strTable);
		$arrOrder = $objDcaExtractor->getOrderFields();

		// Get all fields
		$fields = array_keys($row);
		$allowedFields = array('id', 'pid', 'sorting', 'tstamp');

		if (\is_array($GLOBALS['TL_DCA'][$this->strTable]['fields']))
		{
			$allowedFields = array_unique(array_merge($allowedFields, array_keys($GLOBALS['TL_DCA'][$this->strTable]['fields'])));
		}

		// Use the field order of the DCA file
		$fields = array_intersect($allowedFields, $fields);

		// Show all allowed fields
		foreach ($fields as $i)
		{
			if (!\in_array($i, $allowedFields) || $GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['inputType'] == 'password' || $GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['eval']['doNotShow'] || $GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['eval']['hideInput'])
			{
				continue;
			}

			// Special treatment for table tl_undo
			if ($this->strTable == 'tl_undo' && $i == 'data')
			{
				continue;
			}

			$value = StringUtil::deserialize($row[$i]);

			// Decrypt the value
			if ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['eval']['encrypt'])
			{
				$value = Encryption::decrypt($value);
			}

			// Get the field value
			if (isset($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['foreignKey']))
			{
				$temp = array();
				$chunks = explode('.', $GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['foreignKey'], 2);

				foreach ((array) $value as $v)
				{
					$objKey = $this->Database->prepare("SELECT " . Database::quoteIdentifier($chunks[1]) . " AS value FROM " . $chunks[0] . " WHERE id=?")
											 ->limit(1)
											 ->execute($v);

					if ($objKey->numRows)
					{
						$temp[] = $objKey->value;
					}
				}

				$row[$i] = implode(', ', $temp);
			}
			elseif ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['inputType'] == 'fileTree' || \in_array($i, $arrOrder))
			{
				if (\is_array($value))
				{
					foreach ($value as $kk=>$vv)
					{
						if (($objFile = FilesModel::findByUuid($vv)) instanceof FilesModel)
						{
							$value[$kk] = $objFile->path . ' (' . StringUtil::binToUuid($vv) . ')';
						}
						else
						{
							$value[$kk] = '';
						}
					}

					$row[$i] = implode(', ', $value);
				}
				else
				{
					if (($objFile = FilesModel::findByUuid($value)) instanceof FilesModel)
					{
						$row[$i] = $objFile->path . ' (' . StringUtil::binToUuid($value) . ')';
					}
					else
					{
						$row[$i] = '';
					}
				}
			}
			elseif (\is_array($value))
			{
				if (\count($value) == 2 && isset($value['value']) && isset($value['unit']))
				{
					$row[$i] = trim($value['value'] . ' ' . $value['unit']);
				}
				else
				{
					foreach ($value as $kk=>$vv)
					{
						if (\is_array($vv))
						{
							$vals = array_values($vv);
							$value[$kk] = array_shift($vals).' ('.implode(', ', array_filter($vals)).')';
						}
					}

					if (array_is_assoc($value))
					{
						foreach ($value as $kk=>$vv)
						{
							$value[$kk] = $kk . ': ' . $vv;
						}
					}

					$row[$i] = implode(', ', $value);
				}
			}
			elseif ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['eval']['rgxp'] == 'date')
			{
				$row[$i] = $value ? Date::parse(Config::get('dateFormat'), $value) : '-';
			}
			elseif ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['eval']['rgxp'] == 'time')
			{
				$row[$i] = $value ? Date::parse(Config::get('timeFormat'), $value) : '-';
			}
			elseif ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['eval']['rgxp'] == 'datim' || \in_array($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['flag'], array(5, 6, 7, 8, 9, 10)) || $i == 'tstamp')
			{
				$row[$i] = $value ? Date::parse(Config::get('datimFormat'), $value) : '-';
			}
			elseif ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['eval']['isBoolean'] || ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['inputType'] == 'checkbox' && !$GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['eval']['multiple']))
			{
				$row[$i] = $value ? $GLOBALS['TL_LANG']['MSC']['yes'] : $GLOBALS['TL_LANG']['MSC']['no'];
			}
			elseif ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['eval']['rgxp'] == 'email')
			{
				$row[$i] = Idna::decodeEmail($value);
			}
			elseif ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['inputType'] == 'textarea' && ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['eval']['allowHtml'] || $GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['eval']['preserveTags']))
			{
				$row[$i] = StringUtil::specialchars($value);
			}
			elseif (\is_array($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['reference']))
			{
				$row[$i] = isset($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['reference'][$row[$i]]) ? ((\is_array($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['reference'][$row[$i]])) ? $GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['reference'][$row[$i]][0] : $GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['reference'][$row[$i]]) : $row[$i];
			}
			elseif ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['eval']['isAssociative'] || array_is_assoc($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['options']))
			{
				$row[$i] = $GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['options'][$row[$i]];
			}
			else
			{
				$row[$i] = $value;
			}

			// Label
			if (isset($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['label']))
			{
				$label = \is_array($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['label']) ? $GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['label'][0] : $GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['label'];
			}
			else
			{
				$label = \is_array($GLOBALS['TL_LANG']['MSC'][$i]) ? $GLOBALS['TL_LANG']['MSC'][$i][0] : $GLOBALS['TL_LANG']['MSC'][$i];
			}

			if ($label == '')
			{
				$label = $i;
			}

			$data[$this->strTable][0][$label] = $row[$i];
		}

		// Call onshow_callback
		if (\is_array($GLOBALS['TL_DCA'][$this->strTable]['config']['onshow_callback']))
		{
			foreach ($GLOBALS['TL_DCA'][$this->strTable]['config']['onshow_callback'] as $callback)
			{
				if (\is_array($callback))
				{
					$this->import($callback[0]);
					$data = $this->{$callback[0]}->{$callback[1]}($data, $objRow->row(), $this);
				}
				elseif (\is_callable($callback))
				{
					$data = $callback($data, $objRow->row(), $this);
				}
			}
		}

		$separate = false;
		$return = '<table class="tl_show">';

		// Generate table
		foreach ($data as $table=>$rows)
		{
			foreach ($rows as $entries)
			{
				// Separate multiple rows
				if ($separate)
				{
					$return .= '
  <tr>
    <td colspan="2" style="height:1em"></td>
   </tr>';
				}

				$separate = true;
				$index = 1;

				// Add the table name
				$return .= '
  <tr>
    <td class="tl_folder_top"><span class="tl_label">'.$GLOBALS['TL_LANG']['MSC']['table'].' </span></td>
    <td class="tl_folder_top">'.$table.'</td>
  </tr>
';

				foreach ($entries as $lbl=>$val)
				{
					$class = ((++$index % 2) !== 0) ? ' class="tl_bg"' : '';

					// Always encode special characters (thanks to Oliver Klee)
					$return .= '
	  <tr>
		<td'.$class.'><span class="tl_label">'.$lbl.' </span></td>
		<td'.$class.'>'.StringUtil::specialchars($val).'</td>
	  </tr>';
				}
			}
		}

		// Return table
		return $return . '</table>';
	}
public function show ( ) { if ( ! \ strlen ( $ this -> intId ) ) { return '' ; } $ objRow = $ this -> Database -> prepare ( "SELECT * FROM " . $ this -> strTable . " WHERE id=?" ) -> limit ( 1 ) -> execute ( $ this -> intId ) ; if ( $ objRow -> numRows < 1 ) { return '' ; } $ data = array ( ) ; $ row = $ objRow -> row ( ) ; // Get the order fields $ objDcaExtractor = DcaExtractor :: getInstance ( $ this -> strTable ) ; $ arrOrder = $ objDcaExtractor -> getOrderFields ( ) ; // Get all fields $ fields = array_keys ( $ row ) ; $ allowedFields = array ( 'id' , 'pid' , 'sorting' , 'tstamp' ) ; if ( \ is_array ( $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'fields' ] ) ) { $ allowedFields = array_unique ( array_merge ( $ allowedFields , array_keys ( $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'fields' ] ) ) ) ; } // Use the field order of the DCA file $ fields = array_intersect ( $ allowedFields , $ fields ) ; // Show all allowed fields foreach ( $ fields as $ i ) { if ( ! \ in_array ( $ i , $ allowedFields ) || $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'fields' ] [ $ i ] [ 'inputType' ] == 'password' || $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'fields' ] [ $ i ] [ 'eval' ] [ 'doNotShow' ] || $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'fields' ] [ $ i ] [ 'eval' ] [ 'hideInput' ] ) { continue ; } // Special treatment for table tl_undo if ( $ this -> strTable == 'tl_undo' && $ i == 'data' ) { continue ; } $ value = StringUtil :: deserialize ( $ row [ $ i ] ) ; // Decrypt the value if ( $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'fields' ] [ $ i ] [ 'eval' ] [ 'encrypt' ] ) { $ value = Encryption :: decrypt ( $ value ) ; } // Get the field value if ( isset ( $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'fields' ] [ $ i ] [ 'foreignKey' ] ) ) { $ temp = array ( ) ; $ chunks = explode ( '.' , $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'fields' ] [ $ i ] [ 'foreignKey' ] , 2 ) ; foreach ( ( array ) $ value as $ v ) { $ objKey = $ this -> Database -> prepare ( "SELECT " . Database :: quoteIdentifier ( $ chunks [ 1 ] ) . " AS value FROM " . $ chunks [ 0 ] . " WHERE id=?" ) -> limit ( 1 ) -> execute ( $ v ) ; if ( $ objKey -> numRows ) { $ temp [ ] = $ objKey -> value ; } } $ row [ $ i ] = implode ( ', ' , $ temp ) ; } elseif ( $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'fields' ] [ $ i ] [ 'inputType' ] == 'fileTree' || \ in_array ( $ i , $ arrOrder ) ) { if ( \ is_array ( $ value ) ) { foreach ( $ value as $ kk => $ vv ) { if ( ( $ objFile = FilesModel :: findByUuid ( $ vv ) ) instanceof FilesModel ) { $ value [ $ kk ] = $ objFile -> path . ' (' . StringUtil :: binToUuid ( $ vv ) . ')' ; } else { $ value [ $ kk ] = '' ; } } $ row [ $ i ] = implode ( ', ' , $ value ) ; } else { if ( ( $ objFile = FilesModel :: findByUuid ( $ value ) ) instanceof FilesModel ) { $ row [ $ i ] = $ objFile -> path . ' (' . StringUtil :: binToUuid ( $ value ) . ')' ; } else { $ row [ $ i ] = '' ; } } } elseif ( \ is_array ( $ value ) ) { if ( \ count ( $ value ) == 2 && isset ( $ value [ 'value' ] ) && isset ( $ value [ 'unit' ] ) ) { $ row [ $ i ] = trim ( $ value [ 'value' ] . ' ' . $ value [ 'unit' ] ) ; } else { foreach ( $ value as $ kk => $ vv ) { if ( \ is_array ( $ vv ) ) { $ vals = array_values ( $ vv ) ; $ value [ $ kk ] = array_shift ( $ vals ) . ' (' . implode ( ', ' , array_filter ( $ vals ) ) . ')' ; } } if ( array_is_assoc ( $ value ) ) { foreach ( $ value as $ kk => $ vv ) { $ value [ $ kk ] = $ kk . ': ' . $ vv ; } } $ row [ $ i ] = implode ( ', ' , $ value ) ; } } elseif ( $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'fields' ] [ $ i ] [ 'eval' ] [ 'rgxp' ] == 'date' ) { $ row [ $ i ] = $ value ? Date :: parse ( Config :: get ( 'dateFormat' ) , $ value ) : '-' ; } elseif ( $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'fields' ] [ $ i ] [ 'eval' ] [ 'rgxp' ] == 'time' ) { $ row [ $ i ] = $ value ? Date :: parse ( Config :: get ( 'timeFormat' ) , $ value ) : '-' ; } elseif ( $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'fields' ] [ $ i ] [ 'eval' ] [ 'rgxp' ] == 'datim' || \ in_array ( $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'fields' ] [ $ i ] [ 'flag' ] , array ( 5 , 6 , 7 , 8 , 9 , 10 ) ) || $ i == 'tstamp' ) { $ row [ $ i ] = $ value ? Date :: parse ( Config :: get ( 'datimFormat' ) , $ value ) : '-' ; } elseif ( $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'fields' ] [ $ i ] [ 'eval' ] [ 'isBoolean' ] || ( $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'fields' ] [ $ i ] [ 'inputType' ] == 'checkbox' && ! $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'fields' ] [ $ i ] [ 'eval' ] [ 'multiple' ] ) ) { $ row [ $ i ] = $ value ? $ GLOBALS [ 'TL_LANG' ] [ 'MSC' ] [ 'yes' ] : $ GLOBALS [ 'TL_LANG' ] [ 'MSC' ] [ 'no' ] ; } elseif ( $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'fields' ] [ $ i ] [ 'eval' ] [ 'rgxp' ] == 'email' ) { $ row [ $ i ] = Idna :: decodeEmail ( $ value ) ; } elseif ( $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'fields' ] [ $ i ] [ 'inputType' ] == 'textarea' && ( $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'fields' ] [ $ i ] [ 'eval' ] [ 'allowHtml' ] || $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'fields' ] [ $ i ] [ 'eval' ] [ 'preserveTags' ] ) ) { $ row [ $ i ] = StringUtil :: specialchars ( $ value ) ; } elseif ( \ is_array ( $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'fields' ] [ $ i ] [ 'reference' ] ) ) { $ row [ $ i ] = isset ( $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'fields' ] [ $ i ] [ 'reference' ] [ $ row [ $ i ] ] ) ? ( ( \ is_array ( $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'fields' ] [ $ i ] [ 'reference' ] [ $ row [ $ i ] ] ) ) ? $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'fields' ] [ $ i ] [ 'reference' ] [ $ row [ $ i ] ] [ 0 ] : $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'fields' ] [ $ i ] [ 'reference' ] [ $ row [ $ i ] ] ) : $ row [ $ i ] ; } elseif ( $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'fields' ] [ $ i ] [ 'eval' ] [ 'isAssociative' ] || array_is_assoc ( $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'fields' ] [ $ i ] [ 'options' ] ) ) { $ row [ $ i ] = $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'fields' ] [ $ i ] [ 'options' ] [ $ row [ $ i ] ] ; } else { $ row [ $ i ] = $ value ; } // Label if ( isset ( $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'fields' ] [ $ i ] [ 'label' ] ) ) { $ label = \ is_array ( $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'fields' ] [ $ i ] [ 'label' ] ) ? $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'fields' ] [ $ i ] [ 'label' ] [ 0 ] : $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'fields' ] [ $ i ] [ 'label' ] ; } else { $ label = \ is_array ( $ GLOBALS [ 'TL_LANG' ] [ 'MSC' ] [ $ i ] ) ? $ GLOBALS [ 'TL_LANG' ] [ 'MSC' ] [ $ i ] [ 0 ] : $ GLOBALS [ 'TL_LANG' ] [ 'MSC' ] [ $ i ] ; } if ( $ label == '' ) { $ label = $ i ; } $ data [ $ this -> strTable ] [ 0 ] [ $ label ] = $ row [ $ i ] ; } // Call onshow_callback if ( \ is_array ( $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'config' ] [ 'onshow_callback' ] ) ) { foreach ( $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'config' ] [ 'onshow_callback' ] as $ callback ) { if ( \ is_array ( $ callback ) ) { $ this -> import ( $ callback [ 0 ] ) ; $ data = $ this -> { $ callback [ 0 ] } -> { $ callback [ 1 ] } ( $ data , $ objRow -> row ( ) , $ this ) ; } elseif ( \ is_callable ( $ callback ) ) { $ data = $ callback ( $ data , $ objRow -> row ( ) , $ this ) ; } } } $ separate = false ; $ return = '<table class="tl_show">' ; // Generate table foreach ( $ data as $ table => $ rows ) { foreach ( $ rows as $ entries ) { // Separate multiple rows if ( $ separate ) { $ return .= '
  <tr>
    <td colspan="2" style="height:1em"></td>
   </tr>' ; } $ separate = true ; $ index = 1 ; // Add the table name $ return .= '
  <tr>
    <td class="tl_folder_top"><span class="tl_label">' . $ GLOBALS [ 'TL_LANG' ] [ 'MSC' ] [ 'table' ] . ' </span></td>
    <td class="tl_folder_top">' . $ table . '</td>
  </tr>
' ; foreach ( $ entries as $ lbl => $ val ) { $ class = ( ( ++ $ index % 2 ) !== 0 ) ? ' class="tl_bg"' : '' ; // Always encode special characters (thanks to Oliver Klee) $ return .= '
	  <tr>
		<td' . $ class . '><span class="tl_label">' . $ lbl . ' </span></td>
		<td' . $ class . '>' . StringUtil :: specialchars ( $ val ) . '</td>
	  </tr>' ; } } } // Return table return $ return . '</table>' ; }
Return all non-excluded fields of a record as HTML table

@return string
Return all non - excluded fields of a record as HTML table