[FEATURE] Add wincache as a cache backend
[Packages/TYPO3.CMS.git] / t3lib / class.t3lib_positionmap.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2011 Kasper Skårhøj (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 * Contains class for creating a position map.
29 *
30 * Revised for TYPO3 3.6 November/2003 by Kasper Skårhøj
31 * XHTML compliant (should be)
32 *
33 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
34 */
35
36 /**
37 * Position map class - generating a page tree / content element list which links for inserting (copy/move) of records.
38 * Used for pages / tt_content element wizards of various kinds.
39 *
40 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
41 * @package TYPO3
42 * @subpackage t3lib
43 */
44 class t3lib_positionMap {
45
46 // EXTERNAL, static:
47 var $moveOrCopy = 'move';
48 var $dontPrintPageInsertIcons = 0;
49 var $backPath = '';
50 // How deep the position page tree will go.
51 var $depth = 2;
52 // Can be set to the sys_language uid to select content elements for.
53 var $cur_sys_language;
54
55
56 // INTERNAL, dynamic:
57 // Request uri
58 var $R_URI = '';
59 // Element id.
60 var $elUid = '';
61 // tt_content element uid to move.
62 var $moveUid = '';
63
64 // Caching arrays:
65 var $getModConfigCache = array();
66 var $checkNewPageCache = Array();
67
68 // Label keys:
69 var $l_insertNewPageHere = 'insertNewPageHere';
70 var $l_insertNewRecordHere = 'insertNewRecordHere';
71
72 var $modConfigStr = 'mod.web_list.newPageWiz';
73
74 /*************************************
75 *
76 * Page position map:
77 *
78 **************************************/
79
80 /**
81 * Creates a "position tree" based on the page tree.
82 * Notice: A class, "localPageTree" must exist and probably it is an extension class of the t3lib_pageTree class. See "db_new.php" in the core for an example.
83 *
84 * @param integer $id Current page id
85 * @param array $pageinfo Current page record.
86 * @param string $perms_clause Page selection permission clause.
87 * @param string $R_URI Current REQUEST_URI
88 * @return string HTML code for the tree.
89 */
90 function positionTree($id, $pageinfo, $perms_clause, $R_URI) {
91 $code = '';
92 // Make page tree object:
93 /** @var $t3lib_pageTree localPageTree */
94 $t3lib_pageTree = t3lib_div::makeInstance('localPageTree');
95 $t3lib_pageTree->init(' AND ' . $perms_clause);
96 $t3lib_pageTree->addField('pid');
97
98 // Initialize variables:
99 $this->R_URI = $R_URI;
100 $this->elUid = $id;
101
102 // Create page tree, in $this->depth levels.
103 $t3lib_pageTree->getTree($pageinfo['pid'], $this->depth);
104 if (!$this->dontPrintPageInsertIcons) {
105 $code .= $this->JSimgFunc();
106 }
107
108 // Initialize variables:
109 $saveBlankLineState = array();
110 $saveLatestUid = array();
111 $latestInvDepth = $this->depth;
112
113 // Traverse the tree:
114 foreach ($t3lib_pageTree->tree as $cc => $dat) {
115
116 // Make link + parameters.
117 $latestInvDepth = $dat['invertedDepth'];
118 $saveLatestUid[$latestInvDepth] = $dat;
119 if (isset($t3lib_pageTree->tree[$cc - 1])) {
120 $prev_dat = $t3lib_pageTree->tree[$cc - 1];
121
122 // If current page, subpage?
123 if ($prev_dat['row']['uid'] == $id) {
124 // 1) It must be allowed to create a new page and 2) If there are subpages there is no need to render a subpage icon here - it'll be done over the subpages...
125 if (!$this->dontPrintPageInsertIcons && $this->checkNewPageInPid($id) && !($prev_dat['invertedDepth'] > $t3lib_pageTree->tree[$cc]['invertedDepth'])) {
126 $code .= '<span class="nobr">' .
127 $this->insertQuadLines($dat['blankLineCode']) .
128 '<img src="clear.gif" width="18" height="8" align="top" alt="" />' .
129 '<a href="#" onclick="' . htmlspecialchars($this->onClickEvent($id, $id, 1)) . '" onmouseover="' . htmlspecialchars('changeImg(\'mImgSubpage' . $cc . '\',0);') . '" onmouseout="' . htmlspecialchars('changeImg(\'mImgSubpage' . $cc . '\',1);') . '">' .
130 '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/newrecord_marker_d.gif', 'width="281" height="8"') . ' name="mImgSubpage' . $cc . '" border="0" align="top" title="' . $this->insertlabel() . '" alt="" />' .
131 '</a></span><br />';
132 }
133 }
134
135 // If going down
136 if ($prev_dat['invertedDepth'] > $t3lib_pageTree->tree[$cc]['invertedDepth']) {
137 $prevPid = $t3lib_pageTree->tree[$cc]['row']['pid'];
138 } elseif ($prev_dat['invertedDepth'] < $t3lib_pageTree->tree[$cc]['invertedDepth']) { // If going up
139 // First of all the previous level should have an icon:
140 if (!$this->dontPrintPageInsertIcons && $this->checkNewPageInPid($prev_dat['row']['pid'])) {
141 $prevPid = (-$prev_dat['row']['uid']);
142 $code .= '<span class="nobr">' .
143 $this->insertQuadLines($dat['blankLineCode']) .
144 '<img src="clear.gif" width="18" height="1" align="top" alt="" />' .
145 '<a href="#" onclick="' . htmlspecialchars($this->onClickEvent($prevPid, $prev_dat['row']['pid'], 2)) . '" onmouseover="' . htmlspecialchars('changeImg(\'mImgAfter' . $cc . '\',0);') . '" onmouseout="' . htmlspecialchars('changeImg(\'mImgAfter' . $cc . '\',1);') . '">' .
146 '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/newrecord_marker_d.gif', 'width="281" height="8"') . ' name="mImgAfter' . $cc . '" border="0" align="top" title="' . $this->insertlabel() . '" alt="" />' .
147 '</a></span><br />';
148 }
149
150 // Then set the current prevPid
151 $prevPid = -$prev_dat['row']['pid'];
152 } else {
153 // In on the same level
154 $prevPid = -$prev_dat['row']['uid'];
155 }
156 } else {
157 // First in the tree
158 $prevPid = $dat['row']['pid'];
159 }
160 if (!$this->dontPrintPageInsertIcons && $this->checkNewPageInPid($dat['row']['pid'])) {
161 $code .= '<span class="nobr">' .
162 $this->insertQuadLines($dat['blankLineCode']) .
163 '<a href="#" onclick="' . htmlspecialchars($this->onClickEvent($prevPid, $dat['row']['pid'], 3)) . '" onmouseover="' . htmlspecialchars('changeImg(\'mImg' . $cc . '\',0);') . '" onmouseout="' . htmlspecialchars('changeImg(\'mImg' . $cc . '\',1);') . '">' .
164 '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/newrecord_marker_d.gif', 'width="281" height="8"') . ' name="mImg' . $cc . '" border="0" align="top" title="' . $this->insertlabel() . '" alt="" />' .
165 '</a></span><br />';
166 }
167
168 // The line with the icon and title:
169 $t_code = '<span class="nobr">' .
170 $dat['HTML'] .
171 $this->linkPageTitle(
172 $this->boldTitle(
173 htmlspecialchars(t3lib_div::fixed_lgd_cs($dat['row']['title'], $GLOBALS['BE_USER']->uc['titleLen'])),
174 $dat,
175 $id),
176 $dat['row']
177 ) . '</span><br />';
178 $code .= $t_code;
179 }
180
181 // If the current page was the last in the tree:
182 $prev_dat = end($t3lib_pageTree->tree);
183 if ($prev_dat['row']['uid'] == $id) {
184 if (!$this->dontPrintPageInsertIcons && $this->checkNewPageInPid($id)) {
185 $code .= '<span class="nobr">' .
186 $this->insertQuadLines($saveLatestUid[$latestInvDepth]['blankLineCode'], 1) .
187 '<img src="clear.gif" width="18" height="8" align="top" alt="" />' .
188 '<a href="#" onclick="' . $this->onClickEvent($id, $id, 4) . '" onmouseover="' . htmlspecialchars('changeImg(\'mImgSubpage' . $cc . '\',0);') . '" onmouseout="' . htmlspecialchars('changeImg(\'mImgSubpage' . $cc . '\',1);') . '">' .
189 '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/newrecord_marker_d.gif', 'width="281" height="8"') . ' name="mImgSubpage' . $cc . '" border="0" align="top" title="' . $this->insertlabel() . '" alt="" />' .
190 '</a></span><br />';
191 }
192 }
193
194 for ($a = $latestInvDepth; $a <= $this->depth; $a++) {
195 $dat = $saveLatestUid[$a];
196 $prevPid = (-$dat['row']['uid']);
197 if (!$this->dontPrintPageInsertIcons && $this->checkNewPageInPid($dat['row']['pid'])) {
198 $code .= '<span class="nobr">' .
199 $this->insertQuadLines($dat['blankLineCode'], 1) .
200 '<a href="#" onclick="' . htmlspecialchars($this->onClickEvent($prevPid, $dat['row']['pid'], 5)) . '" onmouseover="' . htmlspecialchars('changeImg(\'mImgEnd' . $a . '\',0);') . '" onmouseout="' . htmlspecialchars('changeImg(\'mImgEnd' . $a . '\',1);') . '">' .
201 '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/newrecord_marker_d.gif', 'width="281" height="8"') . ' name="mImgEnd' . $a . '" border="0" align="top" title="' . $this->insertlabel() . '" alt="" />' .
202 '</a></span><br />';
203 }
204 }
205
206 return $code;
207 }
208
209 /**
210 * Creates the JavaScritp for insert new-record rollover image
211 *
212 * @param string $prefix Insert record image prefix.
213 * @return string <script> section
214 */
215 function JSimgFunc($prefix = '') {
216 $code = $GLOBALS['TBE_TEMPLATE']->wrapScriptTags('
217
218 var img_newrecord_marker=new Image();
219 img_newrecord_marker.src = "' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/newrecord' . $prefix . '_marker.gif', '', 1) . '";
220
221 var img_newrecord_marker_d=new Image();
222 img_newrecord_marker_d.src = "' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/newrecord' . $prefix . '_marker_d.gif', '', 1) . '";
223
224 function changeImg(name,d) { //
225 if (document[name]) {
226 if (d) {
227 document[name].src = img_newrecord_marker_d.src;
228 } else {
229 document[name].src = img_newrecord_marker.src;
230 }
231 }
232 }
233 ');
234 return $code;
235 }
236
237 /**
238 * Wrap $t_code in bold IF the $dat uid matches $id
239 *
240 * @param string $t_code Title string
241 * @param array $dat Infomation array with record array inside.
242 * @param integer $id The current id.
243 * @return string The title string.
244 */
245 function boldTitle($t_code, $dat, $id) {
246 if ($dat['row']['uid'] == $id) {
247 $t_code = '<strong>' . $t_code . '</strong>';
248 }
249 return $t_code;
250 }
251
252 /**
253 * Creates the onclick event for the insert-icons.
254 *
255 * TSconfig mod.web_list.newPageWiz.overrideWithExtension may contain an extension which provides a module
256 * to be used instead of the normal create new page wizard.
257 *
258 * @param integer $pid The pid.
259 * @param integer $newPagePID New page id.
260 * @return string Onclick attribute content
261 */
262 function onClickEvent($pid, $newPagePID) {
263 $TSconfigProp = $this->getModConfig($newPagePID);
264
265 if ($TSconfigProp['overrideWithExtension']) {
266 if (t3lib_extMgm::isLoaded($TSconfigProp['overrideWithExtension'])) {
267 $onclick = "window.location.href='" . t3lib_extMgm::extRelPath($TSconfigProp['overrideWithExtension']) . 'mod1/index.php?cmd=crPage&positionPid=' . $pid . "';";
268 return $onclick;
269 }
270 }
271
272 $params = '&edit[pages][' . $pid . ']=new&returnNewPageId=1';
273 return t3lib_BEfunc::editOnClick($params, '', $this->R_URI);
274 }
275
276 /**
277 * Get label, htmlspecialchars()'ed
278 *
279 * @return string The localized label for "insert new page here"
280 */
281 function insertlabel() {
282 return $GLOBALS['LANG']->getLL($this->l_insertNewPageHere, 1);
283 }
284
285 /**
286 * Wrapping page title.
287 *
288 * @param string $str Page title.
289 * @param array $rec Page record (?)
290 * @return string Wrapped title.
291 */
292 function linkPageTitle($str, $rec) {
293 return $str;
294 }
295
296 /**
297 * Checks if the user has permission to created pages inside of the $pid page.
298 * Uses caching so only one regular lookup is made - hence you can call the function multiple times without worrying about performance.
299 *
300 * @param integer $pid Page id for which to test.
301 * @return boolean
302 */
303 function checkNewPageInPid($pid) {
304 if (!isset($this->checkNewPageCache[$pid])) {
305 $pidInfo = t3lib_BEfunc::getRecord('pages', $pid);
306 $this->checkNewPageCache[$pid] = ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->doesUserHaveAccess($pidInfo, 8));
307 }
308 return $this->checkNewPageCache[$pid];
309 }
310
311 /**
312 * Returns module configuration for a pid.
313 *
314 * @param integer $pid Page id for which to get the module configuration.
315 * @return array The properties of teh module configuration for the page id.
316 * @see onClickEvent()
317 */
318 function getModConfig($pid) {
319 if (!isset($this->getModConfigCache[$pid])) {
320 // Acquiring TSconfig for this PID:
321 $this->getModConfigCache[$pid] = t3lib_BEfunc::getModTSconfig($pid, $this->modConfigStr);
322 }
323 return $this->getModConfigCache[$pid]['properties'];
324 }
325
326 /**
327 * Insert half/quad lines.
328 *
329 * @param string $codes Keywords for which lines to insert.
330 * @param boolean $allBlank If TRUE all lines are just blank clear.gifs
331 * @return string HTML content.
332 */
333 function insertQuadLines($codes, $allBlank = FALSE) {
334 $codeA = t3lib_div::trimExplode(',', $codes . ',line', 1);
335
336 $lines = array();
337 foreach ($codeA as $code) {
338 if ($code == 'blank' || $allBlank) {
339 $lines[] = '<img src="clear.gif" width="18" height="8" align="top" alt="" />';
340 } else {
341 $lines[] = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/ol/halfline.gif', 'width="18" height="8"') . ' align="top" alt="" />';
342 }
343 }
344 return implode('', $lines);
345 }
346
347 /*************************************
348 *
349 * Content element positioning:
350 *
351 **************************************/
352
353 /**
354 * Creates HTML for inserting/moving content elements.
355 *
356 * @param integer $pid page id onto which to insert content element.
357 * @param integer $moveUid Move-uid (tt_content element uid?)
358 * @param string $colPosList List of columns to show
359 * @param boolean $showHidden If not set, then hidden/starttime/endtime records are filtered out.
360 * @param string $R_URI Request URI
361 * @return string HTML
362 */
363 function printContentElementColumns($pid, $moveUid, $colPosList, $showHidden, $R_URI) {
364 $this->R_URI = $R_URI;
365 $this->moveUid = $moveUid;
366 $colPosArray = t3lib_div::trimExplode(',', $colPosList, 1);
367
368 $lines = array();
369 foreach ($colPosArray as $kk => $vv) {
370 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
371 '*',
372 'tt_content',
373 'pid=' . intval($pid) .
374 ($showHidden ? '' : t3lib_BEfunc::BEenableFields('tt_content')) .
375 ' AND colPos=' . intval($vv) .
376 (strcmp($this->cur_sys_language, '') ? ' AND sys_language_uid=' . intval($this->cur_sys_language) : '') .
377 t3lib_BEfunc::deleteClause('tt_content') .
378 t3lib_BEfunc::versioningPlaceholderClause('tt_content'),
379 '',
380 'sorting'
381 );
382 $lines[$vv] = array();
383 $lines[$vv][] = $this->insertPositionIcon('', $vv, $kk, $moveUid, $pid);
384 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
385 t3lib_BEfunc::workspaceOL('tt_content', $row);
386 if (is_array($row)) {
387 $lines[$vv][] = $this->wrapRecordHeader($this->getRecordHeader($row), $row);
388 $lines[$vv][] = $this->insertPositionIcon($row, $vv, $kk, $moveUid, $pid);
389 }
390 }
391 $GLOBALS['TYPO3_DB']->sql_free_result($res);
392 }
393 return $this->printRecordMap($lines, $colPosArray, $pid);
394 }
395
396 /**
397 * Creates the table with the content columns
398 *
399 * @param array $lines Array with arrays of lines for each column
400 * @param array $colPosArray Column position array
401 * @param integer $pid The id of the page
402 * @return string HTML
403 */
404 function printRecordMap($lines, $colPosArray, $pid = 0) {
405
406 $row1 = '';
407 $row2 = '';
408 $count = t3lib_utility_Math::forceIntegerInRange(count($colPosArray), 1);
409
410 $backendLayout = t3lib_div::callUserFunction('EXT:cms/classes/class.tx_cms_backendlayout.php:tx_cms_BackendLayout->getSelectedBackendLayout', $pid, $this);
411
412 if (isset($backendLayout['__config']['backend_layout.'])) {
413
414 $table = '<div class="t3-gridContainer"><table border="0" cellspacing="0" cellpadding="0" id="typo3-ttContentList">';
415
416 $colCount = intval($backendLayout['__config']['backend_layout.']['colCount']);
417 $rowCount = intval($backendLayout['__config']['backend_layout.']['rowCount']);
418
419 $table .= '<colgroup>';
420 for ($i = 0; $i < $colCount; $i++) {
421 $table .= '<col style="width:' . (100 / $colCount) . '%"></col>';
422 }
423 $table .= '</colgroup>';
424
425 $tcaItems = t3lib_div::callUserFunction('EXT:cms/classes/class.tx_cms_backendlayout.php:tx_cms_BackendLayout->getColPosListItemsParsed', $pid, $this);
426
427 // Cycle through rows
428 for ($row = 1; $row <= $rowCount; $row++) {
429 $rowConfig = $backendLayout['__config']['backend_layout.']['rows.'][$row . '.'];
430 if (!isset($rowConfig)) {
431 continue;
432 }
433
434 $table .= '<tr>';
435
436 for ($col = 1; $col <= $colCount; $col++) {
437 $columnConfig = $rowConfig['columns.'][$col . '.'];
438 if (!isset($columnConfig)) {
439 continue;
440 }
441
442 // Which tt_content colPos should be displayed inside this cell
443 $columnKey = intval($columnConfig['colPos']);
444 $head = '';
445
446 $params = array();
447 $params['pid'] = $pid;
448
449 foreach ($tcaItems as $item) {
450 if ($item[1] == $columnKey) {
451 $head = $GLOBALS['LANG']->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content', 'colPos', $columnKey, $params), 1);
452 }
453 }
454
455 // Render the grid cell
456 $table .= '<td valign="top"' .
457 (isset($columnConfig['colspan']) ? ' colspan="' . $columnConfig['colspan'] . '"' : '') .
458 (isset($columnConfig['rowspan']) ? ' rowspan="' . $columnConfig['rowspan'] . '"' : '') .
459 ' class="t3-gridCell t3-page-column t3-page-column-' . $columnKey .
460 (!isset($columnConfig['colPos']) ? ' t3-gridCell-unassigned' : '') .
461 ((isset($columnConfig['colPos']) && ! $head) ? ' t3-gridCell-restricted' : '') .
462 (isset($columnConfig['colspan']) ? ' t3-gridCell-width' . $columnConfig['colspan'] : '') .
463 (isset($columnConfig['rowspan']) ? ' t3-gridCell-height' . $columnConfig['rowspan'] : '') . '">';
464
465 $table .= '<div class="t3-page-colHeader t3-row-header">';
466
467 if (isset($columnConfig['colPos']) && $head) {
468 $table .= $this->wrapColumnHeader($head, '', '') . '</div>' . implode('<br />', $lines[$columnKey]);
469 } elseif ($columnConfig['colPos']) {
470 $table .= $this->wrapColumnHeader($GLOBALS['LANG']->getLL('noAccess'), '', '') . '</div>';
471 } elseif ($columnConfig['name']) {
472 $table .= $this->wrapColumnHeader($columnConfig['name'], '', '') . '</div>';
473 } else {
474 $table .= $this->wrapColumnHeader($GLOBALS['LANG']->getLL('notAssigned'), '', '') . '</div>';
475 }
476 $table .= '</td>';
477 }
478 $table .= '</tr>';
479 }
480 $table .= '</table></div>';
481 } else {
482 // Traverse the columns here:
483 foreach ($colPosArray as $kk => $vv) {
484 $row1 .= '<td align="center" width="' . round(100 / $count) . '%"><div class="t3-page-colHeader t3-row-header">' .
485 $this->wrapColumnHeader($GLOBALS['LANG']->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content', 'colPos', $vv, $pid), 1), $vv) .
486 '</div></td>';
487 $row2 .= '<td valign="top" nowrap="nowrap">' .
488 implode('<br />', $lines[$vv]) .
489 '</td>';
490 }
491
492 $table = '
493
494 <!--
495 Map of records in columns:
496 -->
497 <table border="0" cellpadding="0" cellspacing="0" id="typo3-ttContentList">
498 <tr>' . $row1 . '</tr>
499 <tr>' . $row2 . '</tr>
500 </table>
501
502 ';
503 }
504 return $this->JSimgFunc('2') . $table;
505 }
506
507 /**
508 * Wrapping the column header
509 *
510 * @param string $str Header value
511 * @param string $vv Column info.
512 * @return string
513 * @see printRecordMap()
514 */
515 function wrapColumnHeader($str, $vv) {
516 return $str;
517 }
518
519 /**
520 * Creates a linked position icon.
521 *
522 * @param array $row Element row.
523 * @param string $vv Column position value.
524 * @param integer $kk Column key.
525 * @param integer $moveUid Move uid
526 * @param integer $pid PID value.
527 * @return string
528 */
529 function insertPositionIcon($row, $vv, $kk, $moveUid, $pid) {
530 $cc = hexdec(substr(md5($row['uid'] . '-' . $vv . '-' . $kk), 0, 4));
531 return '<a href="#" onclick="' . htmlspecialchars($this->onClickInsertRecord($row, $vv, $moveUid, $pid, $this->cur_sys_language)) . '" onmouseover="' . htmlspecialchars('changeImg(\'mImg' . $cc . '\',0);') . '" onmouseout="' . htmlspecialchars('changeImg(\'mImg' . $cc . '\',1);') . '">' .
532 '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/newrecord2_marker_d.gif', 'width="100" height="8"') . ' name="mImg' . $cc . '" border="0" align="top" title="' . $GLOBALS['LANG']->getLL($this->l_insertNewRecordHere, 1) . '" alt="" />' .
533 '</a>';
534 }
535
536 /**
537 * Create on-click event value.
538 *
539 * @param array $row The record.
540 * @param string $vv Column position value.
541 * @param integer $moveUid Move uid
542 * @param integer $pid PID value.
543 * @param integer $sys_lang System language (not used currently)
544 * @return string
545 */
546 function onClickInsertRecord($row, $vv, $moveUid, $pid, $sys_lang = 0) {
547 $table = 'tt_content';
548 if (is_array($row)) {
549 $location = 'tce_db.php?cmd[' . $table . '][' . $moveUid . '][' . $this->moveOrCopy . ']=-' . $row['uid'] . '&prErr=1&uPT=1&vC=' . $GLOBALS['BE_USER']->veriCode() . t3lib_BEfunc::getUrlToken('tceAction');
550 } else {
551 $location = 'tce_db.php?cmd[' . $table . '][' . $moveUid . '][' . $this->moveOrCopy . ']=' . $pid . '&data[' . $table . '][' . $moveUid . '][colPos]=' . $vv . '&prErr=1&vC=' . $GLOBALS['BE_USER']->veriCode() . t3lib_BEfunc::getUrlToken('tceAction');
552 }
553
554 $location .= '&redirect=' . rawurlencode($this->R_URI); // returns to prev. page
555
556 return 'window.location.href=\'' . $location . '\';return false;';
557 }
558
559 /**
560 * Wrapping the record header (from getRecordHeader())
561 *
562 * @param string $str HTML content
563 * @param array $row Record array.
564 * @return string HTML content
565 */
566 function wrapRecordHeader($str, $row) {
567 return $str;
568 }
569
570 /**
571 * Create record header (includes teh record icon, record title etc.)
572 *
573 * @param array $row Record row.
574 * @return string HTML
575 */
576 function getRecordHeader($row) {
577 $line = t3lib_iconWorks::getSpriteIconForRecord('tt_content', $row, array('title' => htmlspecialchars(t3lib_BEfunc::getRecordIconAltText($row, 'tt_content'))));
578 $line .= t3lib_BEfunc::getRecordTitle('tt_content', $row, TRUE);
579 return $this->wrapRecordTitle($line, $row);
580 }
581
582 /**
583 * Wrapping the title of the record.
584 *
585 * @param string $str The title value.
586 * @param array $row The record row.
587 * @return string Wrapped title string.
588 */
589 function wrapRecordTitle($str, $row) {
590 return '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('uid' => intval($row['uid']), 'moveUid' => ''))) . '">' . $str . '</a>';
591 }
592 }
593
594 ?>