whitespace fixes
[TYPO3CMS/Extensions/dam_ttcontent.git] / class.ux_tx_cms_layout.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28 * Include file extending db_list.inc for use with the web_layout module
29 *
30 * $Id: class.tx_cms_layout.php 1868 2006-12-12 11:24:10Z ingmars $
31 * Revised for TYPO3 3.6 November/2003 by Kasper Skaarhoj
32 * XHTML compliant
33 *
34 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
35 */
36 /**
37 * [CLASS/FUNCTION INDEX of SCRIPT]
38 *
39 *
40 * (This index is automatically created/updated by the extension "extdeveval")
41 *
42 */
43
44
45
46
47 /**
48 * Child class for the Web > Page module
49 *
50 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
51 * @package TYPO3
52 * @subpackage core
53 */
54 class ux_tx_cms_layout extends tx_cms_layout {
55
56
57 /**
58 * Draws the preview content for a content element
59 *
60 * @param string Content element
61 * @param boolean Set if the RTE link can be created.
62 * @return string HTML
63 */
64 function tt_content_drawItem($row, $isRTE=FALSE) {
65 global $TCA;
66
67 $out='';
68 $outHeader='';
69
70 // Make header:
71 if ($row['header'] && $row['header_layout']!=100) {
72 $infoArr = Array();
73 $this->getProcessedValue('tt_content','header_position,header_layout,header_link',$row,$infoArr);
74
75 $outHeader= ($row['date'] ? htmlspecialchars($this->itemLabels['date'].' '.t3lib_BEfunc::date($row['date'])).'<br />':'').
76 $this->infoGif($infoArr).
77 '<b>'.$this->linkEditContent($this->renderText($row['header']),$row).'</b><br />';
78 }
79
80 // Make content:
81 $infoArr=Array();
82 switch($row['CType']) {
83 case 'header':
84 if ($row['subheader']) {
85 $this->getProcessedValue('tt_content','layout',$row,$infoArr);
86 $out.= $this->infoGif($infoArr).
87 $this->linkEditContent($this->renderText($row['subheader']),$row).'<br />';
88 }
89 break;
90 case 'text':
91 case 'textpic':
92 case 'image':
93 if ($row['CType']=='text' || $row['CType']=='textpic') {
94 if ($row['bodytext']) {
95 $this->getProcessedValue('tt_content','text_align,text_face,text_size,text_color,text_properties',$row,$infoArr);
96 $out.= $this->infoGif($infoArr).
97 $this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
98 }
99 }
100 if ($row['CType']=='textpic' || $row['CType']=='image') {
101 if ($row['image']) {
102 $infoArr=Array();
103 $this->getProcessedValue('tt_content','imageorient,imagecols,image_noRows,imageborder,imageheight,image_link,image_zoom,image_compression,image_effects,image_frames',$row,$infoArr);
104 $out.= $this->infoGif($infoArr).
105 $this->thumbCode($row,'tt_content','image').'<br />';
106
107 if ($row['imagecaption']) {
108 $infoArr=Array();
109 $this->getProcessedValue('tt_content','imagecaption_position',$row,$infoArr);
110 $out.= $this->infoGif($infoArr).
111 $this->linkEditContent($this->renderText($row['imagecaption']),$row).'<br />';
112 }
113 }
114 ###########
115 if ($row['tx_damttcontent_files']) {
116 require_once(PATH_txdam.'lib/class.tx_dam_image.php');
117 require_once(PATH_txdam.'lib/class.tx_dam_tcefunc.php');
118 require_once(PATH_txdam.'lib/class.tx_dam_guifunc.php');
119 $config = $TCA['tt_content']['columns']['tx_damttcontent_files']['config'];
120 $filesArray = tx_dam_db::getReferencedFiles('tt_content', $row['uid'], $config['MM_match_fields'], $config['MM'], 'tx_dam.*');
121
122 foreach($filesArray['rows'] as $rowDAM) {
123 $caption = tx_dam_guiFunc::meta_compileInfoData($rowDAM, '_caption:truncate:100', 'value-string');
124
125 #$imgAttributes['title'] = tx_dam_guiFunc::meta_compileHoverText($rowDAM);
126 #$thumb = tx_dam_image::previewImgTag($rowDAM, '', $imgAttributes);
127 $thumb = tx_dam_guiFunc::thumbnail($rowDAM);
128 $thumb = '<div style="float:left;width:56px; overflow:auto; margin: 2px 5px 2px 0; padding: 5px; background-color:#fff; border:solid 1px #ccc;">'.$thumb.'</div>';
129 $thumb = '<div>'.$thumb.$caption.'</div><div style="clear:both"></div>';
130
131 $out.= $thumb;
132 }
133 }
134 #############
135 }
136 break;
137 case 'bullets':
138 if ($row['bodytext']) {
139 $this->getProcessedValue('tt_content','layout,text_align,text_face,text_size,text_color,text_properties',$row,$infoArr);
140 $out.= $this->infoGif($infoArr).
141 $this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
142 }
143 break;
144 case 'table':
145 if ($row['bodytext']) {
146 $this->getProcessedValue('tt_content','table_bgColor,table_border,table_cellspacing,cols,layout,text_align,text_face,text_size,text_color,text_properties',$row,$infoArr);
147 $out.= $this->infoGif($infoArr).
148 $this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
149 }
150 break;
151 case 'uploads':
152 if ($row['media']) {
153 $this->getProcessedValue('tt_content','media,select_key,layout,filelink_size,table_bgColor,table_border,table_cellspacing',$row,$infoArr);
154 $out.= $this->infoGif($infoArr).
155 $this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
156 }
157 break;
158 case 'multimedia':
159 if ($row['multimedia']) {
160 $out.= $this->renderText($row['multimedia']).'<br />';
161 $out.= $this->renderText($row['parameters']).'<br />';
162 }
163 break;
164 case 'mailform':
165 if ($row['bodytext']) {
166 $this->getProcessedValue('tt_content','pages,subheader',$row,$infoArr);
167 $out.= $this->infoGif($infoArr).
168 $this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
169 }
170 break;
171 case 'splash':
172 if ($row['bodytext']) {
173 $out.= $this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
174 }
175 if ($row['image']) {
176 $infoArr=Array();
177 $this->getProcessedValue('tt_content','imagewidth',$row,$infoArr);
178 $out.= $this->infoGif($infoArr).
179 $this->thumbCode($row,'tt_content','image').'<br />';
180 }
181 break;
182 case 'menu':
183 if ($row['pages']) {
184 $this->getProcessedValue('tt_content','menu_type',$row,$infoArr);
185 $out.= $this->infoGif($infoArr).
186 $this->linkEditContent($row['pages'],$row).'<br />';
187 }
188 break;
189 case 'shortcut':
190 if ($row['records']) {
191 $this->getProcessedValue('tt_content','layout',$row,$infoArr);
192 $out.= $this->infoGif($infoArr).
193 $this->linkEditContent($row['shortcut'],$row).'<br />';
194 }
195 break;
196 case 'list':
197 $this->getProcessedValue('tt_content','layout',$row,$infoArr);
198 $out.= $this->infoGif($infoArr).
199 $GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('tt_content','list_type'),1).' '.
200 $GLOBALS['LANG']->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content','list_type',$row['list_type']),1).'<br />';
201
202 $out.= $GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('tt_content','select_key'),1).' '.$row['select_key'].'<br />';
203
204 $infoArr=Array();
205 $this->getProcessedValue('tt_content','recursive',$row,$infoArr);
206 $out.= $this->infoGif($infoArr).
207 $GLOBALS['LANG']->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content','pages',$row['pages']),1).'<br />';
208 break;
209 case 'script':
210 $out.= $GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('tt_content','select_key'),1).' '.$row['select_key'].'<br />';
211 $out.= '<br />'.$this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
212 $out.= '<br />'.$this->linkEditContent($this->renderText($row['imagecaption']),$row).'<br />';
213 break;
214 default:
215 if ($row['bodytext']) {
216 $out.=$this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
217 }
218 break;
219 }
220
221 // Wrap span-tags:
222 $out = '
223 <span class="exampleContent">'.$out.'</span>';
224 // Add header:
225 $out = $outHeader.$out;
226 // Add RTE button:
227 if ($isRTE) {
228 $out.= $this->linkRTEbutton($row);
229 }
230
231 // Return values:
232 if ($this->isDisabled('tt_content',$row)) {
233 return $GLOBALS['TBE_TEMPLATE']->dfw($out);
234 } else {
235 return $out;
236 }
237 }
238
239 }
240
241
242 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dam_ttcontent/class.ux_tx_cms_layout.php']) {
243 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dam_ttcontent/class.ux_tx_cms_layout.php']);
244 }
245
246 ?>