00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00114 class tx_cms_layout extends recordList {
00115
00116
00117 var $stat_select_field='page_id';
00118 var $stat_codes=array();
00119
00120
00121 var $pI_showUser=0;
00122 var $pI_showStat=1;
00123 var $nextThree = 3;
00124 var $pages_noEditColumns=0;
00125 var $option_showBigButtons=1;
00126 var $option_newWizard=1;
00127 var $ext_function=0;
00128 var $doEdit=1;
00129 var $agePrefixes = ' min| hrs| days| yrs';
00130 var $externalTables = array();
00131 var $descrTable;
00132 var $defLangBinding=FALSE;
00133
00134
00135 var $tt_contentConfig = Array (
00136 'showInfo' => 1,
00137 'showCommands' => 1,
00138 'showCommands_info' => 1,
00139 'single' => 1,
00140 'showSingleCol' => 0,
00141 'languageCols' => 0,
00142 'languageMode' => 0,
00143 'languageColsPointer' => 0,
00144 'showHidden' => 1,
00145 'sys_language_uid' => 0,
00146 'cols' => '1,0,2,3'
00147 );
00148
00149
00150 var $allowedTableNames=array();
00151 var $activeTables = array();
00152 var $tt_contentData = Array(
00153 'nextThree' => Array(),
00154 'prev' => Array(),
00155 'next' => Array()
00156 );
00157 var $CType_labels=array();
00158 var $itemLabels=array();
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00179 function getTable($table,$id) {
00180
00181
00182 t3lib_div::loadTCA($table);
00183
00184 if (isset($this->externalTables[$table])) {
00185 $fList = $this->externalTables[$table][0]['fList'];
00186 $icon = $this->externalTables[$table][0]['icon'];
00187
00188
00189 $out = $this->makeOrdinaryList($table, $id, $fList, $icon);
00190 return $out;
00191 } else {
00192
00193
00194 switch($table) {
00195 case 'pages':
00196 return $this->getTable_pages($id);
00197 break;
00198 case 'tt_content':
00199 return $this->getTable_tt_content($id);
00200 break;
00201 case 'fe_users':
00202 return $this->getTable_fe_users($id);
00203 break;
00204 case 'sys_note':
00205 return $this->getTable_sys_note($id);
00206 break;
00207 case 'tt_board':
00208 return $this->getTable_tt_board($id);
00209 break;
00210 case 'tt_address':
00211 return $this->getTable_tt_address($id);
00212 break;
00213 case 'tt_links':
00214 return $this->getTable_tt_links($id);
00215 break;
00216 case 'tt_guest':
00217 return $this->getTable_tt_guest($id);
00218 break;
00219 case 'tt_news':
00220 return $this->getTable_tt_news($id);
00221 break;
00222 case 'tt_calender':
00223 return $this->getTable_tt_calender($id);
00224 break;
00225 case 'tt_products':
00226 return $this->getTable_tt_products($id);
00227 break;
00228 }
00229 }
00230 }
00231
00239 function getTable_pages($id) {
00240 global $TCA;
00241
00242
00243 $out='';
00244 $delClause = t3lib_BEfunc::deleteClause('pages').' AND '.$GLOBALS['BE_USER']->getPagePermsClause(1);
00245
00246
00247 if (!$id) {
00248 $row = $GLOBALS['SOBE']->pageinfo;
00249 } else {
00250 $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages', 'uid='.intval($id).$delClause);
00251 $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
00252 }
00253
00254
00255 if (is_array($row)) {
00256
00257
00258 $pKey = $GLOBALS['SOBE']->MOD_SETTINGS['function']=='tx_cms_webinfo_hits' ? 'hits' : $GLOBALS['SOBE']->MOD_SETTINGS['pages'];
00259 switch($pKey) {
00260 case 'hits':
00261 $this->fieldArray = explode(',','title,'.implode(',',$this->stat_codes));
00262 break;
00263 case 1:
00264 $this->cleanTableNames();
00265 $tableNames=$this->allowedTableNames;
00266 $this->fieldArray = explode(',','title,uid,'.implode(',',array_keys($tableNames)));
00267 break;
00268 case 2:
00269 $this->fieldArray = explode(',','title,uid,lastUpdated,newUntil,no_cache,cache_timeout,php_tree_stop,TSconfig,storage_pid,is_siteroot');
00270 break;
00271 default:
00272 $this->fieldArray = explode(',','title,uid,alias,starttime,endtime,fe_group,target,url,shortcut');
00273 break;
00274 }
00275
00276
00277 $depth=intval($GLOBALS['SOBE']->MOD_SETTINGS['pages_levels']);
00278
00279
00280 $theData = Array();
00281 $theData['subject'] = $this->widthGif;
00282 $out.=$this->addelement(0,'',$theData);
00283
00284
00285 $this->no_noWrap=0;
00286 $this->oddColumnsTDParams=' class="bgColor3-20"';
00287
00288
00289 $this->eCounter=$this->firstElementNumber;
00290
00291
00292 list($flag,$code) = $this->fwd_rwd_nav();
00293 $out.=$code;
00294 $editUids=array();
00295 if ($flag) {
00296
00297
00298 $theRows = Array();
00299 $theRows = $this->pages_getTree($theRows,$row['uid'],$delClause,'',$depth);
00300 if ($GLOBALS['BE_USER']->doesUserHaveAccess($row,2)) $editUids[]=$row['uid'];
00301 $out.=$this->pages_drawItem($row,$this->fieldArray);
00302
00303
00304 foreach($theRows as $n => $sRow) {
00305 if ($GLOBALS['BE_USER']->doesUserHaveAccess($sRow,2)) $editUids[]=$sRow['uid'];
00306 $out.=$this->pages_drawItem($sRow,$this->fieldArray);
00307 }
00308 $this->eCounter++;
00309 }
00310
00311
00312 $theData = Array();
00313 $editIdList = implode(',', $editUids);
00314
00315
00316 foreach($this->fieldArray as $field) {
00317 if ($editIdList && isset($TCA['pages']['columns'][$field]) && $field!='uid' && !$this->pages_noEditColumns) {
00318 $params='&edit[pages]['.$editIdList.']=edit&columnsOnly='.$field.'&disHelp=1';
00319 $iTitle = sprintf($GLOBALS['LANG']->getLL('editThisColumn'),ereg_replace(':$','',trim($GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('pages',$field)))));
00320 $eI= '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath,'')).'">'.
00321 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.htmlspecialchars($iTitle).'" alt="" />'.
00322 '</a>';
00323 } else $eI='';
00324 switch($field) {
00325 case 'title':
00326 $theData[$field] = ' <b>'.$GLOBALS['LANG']->sL($TCA['pages']['columns'][$field]['label']).'</b>'.$eI;
00327 break;
00328 case 'uid':
00329 $theData[$field] = ' <b>ID:</b>';
00330 break;
00331 default:
00332 if (substr($field,0,6)=='table_') {
00333 $f2 = substr($field,6);
00334 if ($TCA[$f2]) {
00335 $theData[$field] = ' '.t3lib_iconWorks::getIconImage($f2,array(),$this->backPath,'title="'.$GLOBALS['LANG']->sL($TCA[$f2]['ctrl']['title'],1).'"');
00336 }
00337 } elseif (substr($field,0,5)=='HITS_') {
00338 $fParts = explode(':',substr($field,5));
00339 switch($fParts[0]) {
00340 case 'days':
00341 $timespan = mktime (0,0,0)+intval($fParts[1])*3600*24;
00342 $theData[$field]=' '.date('d',$timespan);
00343 break;
00344 default:
00345 $theData[$field] = '';
00346 break;
00347 }
00348 } else {
00349 $theData[$field] = ' <b>'.$GLOBALS['LANG']->sL($TCA['pages']['columns'][$field]['label'],1).'</b>'.$eI;
00350 }
00351 break;
00352 }
00353 }
00354
00355
00356 $this->oddColumnsTDParams = '';
00357
00358
00359 $out = t3lib_BEfunc::cshItem($this->descrTable,'func_'.$pKey,$GLOBALS['BACK_PATH']).
00360 '
00361 <table border="0" cellpadding="0" cellspacing="0" class="typo3-page-pages">
00362 '.$this->addelement(1,'',$theData,' class="c-headLine"',20).
00363 $out.'
00364 </table>';
00365 }
00366 $this->oddColumnsTDParams = '';
00367 return $out;
00368 }
00369
00376 function getTable_tt_content($id) {
00377 global $TCA;
00378
00379 $this->initializeLanguages();
00380
00381
00382 $RTE = $GLOBALS['BE_USER']->isRTE();
00383 $lMarg=1;
00384 $showHidden = $this->tt_contentConfig['showHidden']?'':t3lib_BEfunc::BEenableFields('tt_content');
00385 $pageTitleParamForAltDoc='&recTitle='.rawurlencode(t3lib_BEfunc::getRecordTitle('pages',t3lib_BEfunc::getRecord('pages',$id),1));
00386
00387
00388 $this->CType_labels =array();
00389 foreach($TCA['tt_content']['columns']['CType']['config']['items'] as $val) {
00390 $this->CType_labels[$val[1]]=$GLOBALS['LANG']->sL($val[0]);
00391 }
00392 $this->itemLabels =array();
00393 foreach($TCA['tt_content']['columns'] as $name => $val) {
00394 $this->itemLabels[$name]=$GLOBALS['LANG']->sL($val['label']);
00395 }
00396
00397
00398
00399 if (!$this->tt_contentConfig['single']) {
00400
00401
00402 $langList = $this->tt_contentConfig['sys_language_uid'];
00403 if ($this->tt_contentConfig['languageMode']) {
00404 if ($this->tt_contentConfig['languageColsPointer']) {
00405 $langList='0,'.$this->tt_contentConfig['languageColsPointer'];
00406 } else {
00407 $langList=implode(',',array_keys($this->tt_contentConfig['languageCols']));
00408 }
00409 $languageColumn = array();
00410 }
00411 $langListArr = explode(',',$langList);
00412 $defLanguageCount = array();
00413 $defLangBinding = array();
00414
00415
00416 foreach($langListArr as $lP) {
00417 $showLanguage = $this->defLangBinding && $lP==0 ? ' AND sys_language_uid IN (0,-1)' : ' AND sys_language_uid='.$lP;
00418 $cList = explode(',',$this->tt_contentConfig['cols']);
00419 $content = array();
00420 $head = array();
00421
00422
00423 foreach($cList as $key) {
00424 if (!$lP) $defLanguageCount[$key] = array();
00425
00426
00427 $queryParts = $this->makeQueryArray('tt_content', $id, 'AND colPos='.intval($key).$showHidden.$showLanguage);
00428 $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
00429
00430
00431 if ($this->doEdit && $this->option_showBigButtons && !intval($key) && !$GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
00432 $onClick = "document.location='db_new_content_el.php?id=".$id.'&colPos='.intval($key).'&sys_language_uid='.$lP.'&uid_pid='.$id.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))."';";
00433 $theNewButton = $GLOBALS['SOBE']->doc->t3Button($onClick,$GLOBALS['LANG']->getLL('newPageContent'));
00434 $content[$key].= '<img src="clear.gif" width="1" height="5" alt="" /><br />'.$theNewButton;
00435 }
00436
00437
00438 $rowArr = $this->getResult($result);
00439
00440 foreach($rowArr as $row) {
00441 $singleElementHTML = '';
00442 if (!$lP) $defLanguageCount[$key][] = $row['uid'];
00443
00444 $editUidList.= $row['uid'].',';
00445 $singleElementHTML.= $this->tt_content_drawHeader($row,$this->tt_contentConfig['showInfo']?15:5, $this->defLangBinding && $lP>0, TRUE);
00446
00447 $isRTE = $RTE && $this->isRTEforField('tt_content',$row,'bodytext');
00448 $singleElementHTML.= $this->tt_content_drawItem($row,$isRTE);
00449
00450 if ($this->defLangBinding && $this->tt_contentConfig['languageMode']) {
00451 $defLangBinding[$key][$lP][$row[($lP ? 'l18n_parent' : 'uid')]] = $singleElementHTML;
00452 } else {
00453 $content[$key].= $singleElementHTML;
00454 }
00455 }
00456
00457
00458 $newP = $this->newContentElementOnClick($id,$key,$lP);
00459 $head[$key].= $this->tt_content_drawColHeader(t3lib_BEfunc::getProcessedValue('tt_content','colPos',$key), ($this->doEdit&&count($rowArr)?'&edit[tt_content]['.$editUidList.']=edit'.$pageTitleParamForAltDoc:''), $newP);
00460 $editUidList = '';
00461 }
00462
00463
00464 $out='';
00465 foreach($cList as $k => $key) {
00466 if (!$k) {
00467 $out.= '
00468 <td><img src="clear.gif" width="'.$lMarg.'" height="1" alt="" /></td>';
00469 } else {
00470 $out.= '
00471 <td><img src="clear.gif" width="4" height="1" alt="" /></td>
00472 <td bgcolor="black"><img src="clear.gif" width="1" height="1" alt="" /></td>
00473 <td><img src="clear.gif" width="4" height="1" alt="" /></td>';
00474 }
00475 $out.= '
00476 <td valign="top">'.$head[$key].$content[$key].'</td>';
00477
00478
00479 if ($this->tt_contentConfig['languageMode']) {
00480 $languageColumn[$key][$lP] = $head[$key].$content[$key];
00481 if (!$this->defLangBinding) {
00482 $languageColumn[$key][$lP].='<br /><br />'.$this->newLanguageButton($this->getNonTranslatedTTcontentUids($defLanguageCount[$key],$id,$lP),$lP);
00483 }
00484 }
00485 }
00486
00487
00488 $out = '
00489 <table border="0" cellpadding="0" cellspacing="0" width="480" class="typo3-page-cols">
00490 <tr>'.$out.'
00491 </tr>
00492 </table>';
00493
00494
00495 $out.= t3lib_BEfunc::cshItem($this->descrTable,'columns_multi',$GLOBALS['BACK_PATH']);
00496 }
00497
00498
00499
00500 if ($this->tt_contentConfig['languageMode']) {
00501
00502
00503 $languageSelector = $this->languageSelector($id);
00504
00505
00506 $out='';
00507
00508 $midSep = '
00509 <td><img src="clear.gif" width="4" height="1" alt="" /></td>
00510 <td bgcolor="black"><img src="clear.gif" width="1" height="1" alt="" /></td>
00511 <td><img src="clear.gif" width="4" height="1" alt="" /></td>';
00512
00513
00514 $cCont=array();
00515 $sCont=array();
00516 foreach($langListArr as $lP) {
00517
00518
00519 $cCont[$lP]='
00520 <td valign="top" align="center" class="bgColor6"><strong>'.htmlspecialchars($this->tt_contentConfig['languageCols'][$lP]).'</strong></td>';
00521
00522
00523 $viewLink = '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::viewOnClick($this->id,$this->backPath,t3lib_BEfunc::BEgetRootLine($this->id),'','','&L='.$lP)).'">'.
00524 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/zoom.gif','width="12" height="12"').' class="absmiddle" title="" alt="" />'.
00525 '</a>';
00526
00527
00528 if ($lP) {
00529
00530 list($lpRecord) = t3lib_BEfunc::getRecordsByField('pages_language_overlay','pid',$id,'AND sys_language_uid='.intval($lP));
00531 $params='&edit[pages_language_overlay]['.$lpRecord['uid'].']=edit&overrideVals[pages_language_overlay][sys_language_uid]='.$lP;
00532 $lPLabel = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon(t3lib_iconWorks::getIconImage('pages_language_overlay',$lpRecord,$this->backPath,' class="absmiddle"'),'pages_language_overlay',$lpRecord['uid']).
00533 $viewLink.
00534 ($GLOBALS['BE_USER']->check('tables_modify','pages_language_overlay') ? '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath)).'">'.
00535 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.$GLOBALS['LANG']->getLL('edit',1).'" class="absmiddle" alt="" />'.
00536 '</a>' : '').
00537 htmlspecialchars(t3lib_div::fixed_lgd_cs($lpRecord['title'],20));
00538 } else {
00539 $lPLabel = $viewLink;
00540 }
00541 $sCont[$lP]='
00542 <td nowrap="nowrap">'.$lPLabel.'</td>';
00543 }
00544
00545 $out.='
00546 <tr>'.implode($midSep,$cCont).'
00547 </tr>';
00548 $out.='
00549 <tr>'.implode($midSep,$sCont).'
00550 </tr>';
00551
00552
00553 foreach($languageColumn as $cKey => $cCont) {
00554 $out.='
00555 <tr>
00556 <td valign="top">'.implode('</td>'.$midSep.'
00557 <td valign="top">',$cCont).'</td>
00558 </tr>';
00559
00560 if ($this->defLangBinding) {
00561
00562 foreach($defLanguageCount[$cKey] as $defUid) {
00563 $cCont=array();
00564 foreach($langListArr as $lP) {
00565 $cCont[] = $defLangBinding[$cKey][$lP][$defUid].
00566 '<br/>'.$this->newLanguageButton($this->getNonTranslatedTTcontentUids(array($defUid),$id,$lP),$lP);
00567 }
00568 $out.='
00569 <tr>
00570 <td valign="top">'.implode('</td>'.$midSep.'
00571 <td valign="top">',$cCont).'</td>
00572 </tr>';
00573 }
00574
00575
00576 $cCont=array();
00577 foreach($langListArr as $lP) {
00578 $cCont[] = ' ';
00579 }
00580 $out.='
00581 <tr>
00582 <td valign="top">'.implode('</td>'.$midSep.'
00583 <td valign="top">',$cCont).'</td>
00584 </tr>';
00585 }
00586 }
00587
00588
00589 $out = $languageSelector.'
00590 <table border="0" cellpadding="0" cellspacing="0" width="480" class="typo3-page-langMode">
00591 '.$out.'
00592 </table>';
00593
00594
00595 $out.= t3lib_BEfunc::cshItem($this->descrTable,'language_list',$GLOBALS['BACK_PATH']);
00596 }
00597 } else {
00598 #debug('single column');
00599 if ($this->tt_contentConfig['sys_language_uid']==0 || !$this->defLangBinding) {
00600
00601
00602 $showLanguage = $this->defLangBinding && $this->tt_contentConfig['sys_language_uid']==0 ? ' AND sys_language_uid IN (0,-1)' : ' AND sys_language_uid='.$this->tt_contentConfig['sys_language_uid'];
00603
00604 $cList = explode(',',$this->tt_contentConfig['showSingleCol']);
00605 $content=array();
00606 $out='';
00607
00608
00609 $out.='
00610 <tr>
00611 <td><img src="clear.gif" width="'.$lMarg.'" height="1" alt="" /></td>
00612 <td valign="top"><img src="clear.gif" width="150" height="1" alt="" /></td>
00613 <td><img src="clear.gif" width="10" height="1" alt="" /></td>
00614 <td valign="top"><img src="clear.gif" width="300" height="1" alt="" /></td>
00615 </tr>';
00616
00617
00618 while(list($counter,$key)=each($cList)) {
00619
00620
00621 $queryParts = $this->makeQueryArray('tt_content', $id, 'AND colPos='.intval($key).$showHidden.$showLanguage);
00622 $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
00623 $c = 0;
00624 $rowArr = $this->getResult($result);
00625 $rowOut = '';
00626
00627
00628 if ($this->doEdit && $this->option_showBigButtons && !intval($key) && !$GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
00629 $onClick="document.location='db_new_content_el.php?id=".$id.'&colPos='.intval($key).'&sys_language_uid='.$lP.'&uid_pid='.$id.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))."';";
00630 $theNewButton=$GLOBALS['SOBE']->doc->t3Button($onClick,$GLOBALS['LANG']->getLL('newPageContent'));
00631 $theNewButton='<img src="clear.gif" width="1" height="5" alt="" /><br />'.$theNewButton;
00632 } else $theNewButton='';
00633
00634
00635 foreach($rowArr as $row) {
00636 $c++;
00637 $editUidList.=$row['uid'].',';
00638 $isRTE=$RTE && $this->isRTEforField('tt_content',$row,'bodytext');
00639
00640
00641 $rowOut.='
00642 <tr>
00643 <td></td>
00644 <td valign="top">'.$this->tt_content_drawHeader($row).'</td>
00645 <td></td>
00646 <td valign="top">'.$this->tt_content_drawItem($row,$isRTE).'</td>
00647 </tr>';
00648
00649
00650 if ($c != $GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
00651 $rowOut.='
00652 <tr>
00653 <td></td>
00654 <td colspan="3"><img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/stiblet_medium2.gif','width="468" height="1"').' class="c-divider" alt="" /></td>
00655 </tr>';
00656 }
00657 }
00658
00659
00660 if ($counter) {
00661 $out.='
00662 <tr>
00663 <td></td>
00664 <td colspan="3"><br /><br /><br /><br /></td>
00665 </tr>';
00666 }
00667
00668
00669 $newP = $this->newContentElementOnClick($id,$key,$this->tt_contentConfig['sys_language_uid']);
00670 $out.='
00671
00672 <!-- Column header: -->
00673 <tr>
00674 <td></td>
00675 <td valign="top" colspan="3">'.
00676 $this->tt_content_drawColHeader(t3lib_BEfunc::getProcessedValue('tt_content','colPos',$key), ($this->doEdit&&count($rowArr)?'&edit[tt_content]['.$editUidList.']=edit'.$pageTitleParamForAltDoc:''), $newP).
00677 $theNewButton.
00678 '<br /></td>
00679 </tr>';
00680
00681
00682 $out.=$rowOut;
00683 }
00684
00685
00686 $out = '
00687 <table border="0" cellpadding="0" cellspacing="0" width="400" class="typo3-page-columnsMode">
00688 '.$out.'
00689 </table>';
00690
00691
00692 $out.= t3lib_BEfunc::cshItem($this->descrTable,'columns_single',$GLOBALS['BACK_PATH']);
00693 } else {
00694 $out = '<br/><br/>'.$GLOBALS['SOBE']->doc->icons(1).'Sorry, you cannot view a single language in this localization mode (Default Language Binding is enabled)<br/><br/>';
00695 }
00696 }
00697
00698
00699
00700 if ($this->option_showBigButtons) {
00701 $bArray=array();
00702
00703 if (!$GLOBALS['SOBE']->current_sys_language) {
00704 if ($this->ext_CALC_PERMS&2) $bArray[0]=$GLOBALS['SOBE']->doc->t3Button(t3lib_BEfunc::editOnClick('&edit[pages]['.$id."]=edit",$this->backPath,''),$GLOBALS['LANG']->getLL('editPageTitle'));
00705 } else {
00706 if ($this->doEdit && $GLOBALS['BE_USER']->check('tables_modify','pages_language_overlay')) {
00707 list($languageOverlayRecord) = t3lib_BEfunc::getRecordsByField('pages_language_overlay','pid',$id,'AND sys_language_uid='.intval($GLOBALS['SOBE']->current_sys_language));
00708 $bArray[0]=$GLOBALS['SOBE']->doc->t3Button(t3lib_BEfunc::editOnClick('&edit[pages_language_overlay]['.$languageOverlayRecord['uid']."]=edit",$this->backPath,''),$GLOBALS['LANG']->getLL('editPageTitle_curLang'));
00709 }
00710 }
00711 if ($this->ext_CALC_PERMS&4 || $this->ext_CALC_PERMS&2) $bArray[1]=$GLOBALS['SOBE']->doc->t3Button("document.location='".$this->backPath."move_el.php?table=pages&uid=".$id.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))."';",$GLOBALS['LANG']->getLL('move_page'));
00712 if ($this->ext_CALC_PERMS&8) $bArray[2]=$GLOBALS['SOBE']->doc->t3Button("document.location='".$this->backPath."db_new.php?id=".$id.'&pagesOnly=1&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))."';",$GLOBALS['LANG']->getLL('newPage2'));
00713 if ($this->doEdit && $this->ext_function==1) $bArray[3]=$GLOBALS['SOBE']->doc->t3Button("document.location='db_new_content_el.php?id=".$id.'&sys_language_uid='.$GLOBALS['SOBE']->current_sys_language.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))."';",$GLOBALS['LANG']->getLL('newPageContent2'));
00714 $out = '
00715 <table border="0" cellpadding="4" cellspacing="0" class="typo3-page-buttons">
00716 <tr>
00717 <td>'.implode('</td>
00718 <td>',$bArray).'</td>
00719 </tr>
00720 </table>
00721 <img src="clear.gif" width="1" height="5" alt="" /><br />
00722 '.t3lib_BEfunc::cshItem($this->descrTable,'button_panel',$GLOBALS['BACK_PATH']).
00723 $out;
00724 }
00725
00726
00727 return $out;
00728 }
00729
00736 function getTable_fe_users($id) {
00737
00738 $this->addElement_tdParams=array(
00739 'username'=>' nowrap="nowrap"',
00740 'password'=>' nowrap="nowrap"',
00741 'usergroup'=>' nowrap="nowrap"',
00742 'name'=>' nowrap="nowrap"',
00743 'address'=>' nowrap="nowrap"',
00744 'zip'=>' nowrap="nowrap"',
00745 'city'=>' nowrap="nowrap"',
00746 'email'=>' nowrap="nowrap"',
00747 'telephone'=>' nowrap="nowrap"'
00748 );
00749 $fList = 'username,password,usergroup,name,email,telephone,address,zip,city';
00750 $out = $this->makeOrdinaryList('fe_users',$id, $fList, 1);
00751 $this->addElement_tdParams=array();
00752 return $out;
00753 }
00754
00762 function getTable_sys_note($id) {
00763 global $TCA;
00764
00765 if (!t3lib_extMgm::isLoaded('sys_note')) return '';
00766
00767
00768 $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
00769 $tree = $this->getTreeObject($id,intval($GLOBALS['SOBE']->MOD_SETTINGS['pages_levels']),$perms_clause);
00770
00771 $this->itemLabels =array();
00772 foreach($TCA['sys_note']['columns'] as $name => $val) {
00773 $this->itemLabels[$name]=$GLOBALS['LANG']->sL($val['label']);
00774 }
00775
00776
00777 $out='';
00778 if (count($tree->ids)) {
00779 $delClause = t3lib_BEfunc::deleteClause('sys_note');
00780 $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_note', 'pid IN ('.implode(',',$tree->ids).') AND (!personal OR cruser='.intval($GLOBALS['BE_USER']->user['uid']).')'.$delClause);
00781 $dbCount = $GLOBALS['TYPO3_DB']->sql_num_rows($result);
00782
00783
00784 if ($dbCount) {
00785 $this->fieldArray = explode(',','__cmds__,info,note');
00786
00787
00788 $theData = Array();
00789 $theData['__cmds__'] ='';
00790 $theData['info'] = '<b>Info</b><br /><img src="clear.gif" height="1" width="220" alt="" />';
00791 $theData['note'] = '<b>Note</b>';
00792 $out.=$this->addelement(1,'',$theData,' class="c-headLine"',20);
00793
00794
00795 $theData = Array();
00796 $theData['info'] = $this->widthGif;
00797 $out.=$this->addelement(0,'',$theData);
00798
00799 $this->no_noWrap=1;
00800
00801
00802 $this->eCounter=$this->firstElementNumber;
00803 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
00804 list($flag,$code) = $this->fwd_rwd_nav();
00805 $out.=$code;
00806 if ($flag) {
00807 $color = Array (
00808 0 => '',
00809 1 => ' class="bgColor4"',
00810 2 => ' class="bgColor2"',
00811 3 => '',
00812 4 => ' class="bgColor5"'
00813 );
00814 $tdparams = $color[$row['category']];
00815 $info = Array();;
00816 $theData = Array();
00817 $this->getProcessedValue('sys_note','subject,category,author,email,personal',$row,$info);
00818 $cont=implode('<br />',$info);
00819 $head = '<b>Page:</b> '.t3lib_BEfunc::getRecordPath($row['pid'],$perms_clause,10).'<br />';
00820
00821 $theData['__cmds__']= $this->getIcon('sys_note',$row);
00822 $theData['info'] = $head.$cont;
00823 $theData['note'] = nl2br($row['message']);
00824
00825 $out.=$this->addelement(1,'',$theData,$tdparams,20);
00826
00827
00828
00829 $theData = Array();
00830 $theData['info'] = $this->widthGif;
00831 $out.=$this->addelement(0,'',$theData);
00832 }
00833 $this->eCounter++;
00834 }
00835
00836
00837 $out='
00838 <table border="0" cellpadding="1" cellspacing="2" width="480" class="typo3-page-sysnote">
00839 '.$out.'
00840 </table>';
00841 }
00842 }
00843 return $out;
00844 }
00845
00853 function getTable_tt_board($id) {
00854
00855
00856 $delClause = t3lib_BEfunc::deleteClause('tt_board');
00857 $queryParts = $this->makeQueryArray('tt_board', $id, 'AND parent=0');
00858 $this->setTotalItems($queryParts);
00859 $dbCount = 0;
00860
00861
00862 if ($this->totalItems) {
00863 $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
00864 $dbCount = $GLOBALS['TYPO3_DB']->sql_num_rows($result);
00865 }
00866
00867
00868 $out='';
00869 if ($dbCount) {
00870
00871
00872 if ($GLOBALS['SOBE']->MOD_SETTINGS['tt_board']=='expand') {
00873 $this->fieldArray = explode(',','subject,author,date,age');
00874 } else {
00875 $this->fieldArray = explode(',','subject,author,date,age,replys');
00876 }
00877
00878
00879 $theData = Array();
00880 $theData['subject'] = '<b>'.$GLOBALS['LANG']->getLL('tt_board_subject',1).'</b>';
00881 $theData['author'] = '<b>'.$GLOBALS['LANG']->getLL('tt_board_author',1).'</b>';
00882 $theData['date'] = '<b>'.$GLOBALS['LANG']->getLL('tt_board_date',1).'</b>';
00883 $theData['age'] = '<b>'.$GLOBALS['LANG']->getLL('tt_board_age',1).'</b>';
00884 if ($GLOBALS['SOBE']->MOD_SETTINGS['tt_board']!='expand') {
00885 $theData['replys'] = '<b>'.$GLOBALS['LANG']->getLL('tt_board_RE',1).'</b>';
00886 }
00887 $out.=$this->addelement(1,'',$theData,' class="c-headLine"',20);
00888
00889
00890 $theData = Array();
00891 $theData['subject'] = $this->widthGif;
00892 $out.=$this->addelement(0,'',$theData);
00893
00894
00895 $this->eCounter=$this->firstElementNumber;
00896 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
00897 list($flag,$code) = $this->fwd_rwd_nav();
00898 $out.=$code;
00899
00900 if ($flag) {
00901
00902 $theRows = Array();
00903 $theRows = $this->tt_board_getTree ($theRows,$row['uid'],$id,$delClause,'');
00904 $out.=$this->tt_board_drawItem('tt_board',$row,count($theRows));
00905
00906 if ($GLOBALS['SOBE']->MOD_SETTINGS['tt_board']=='expand') {
00907 reset($theRows);
00908 while(list($n,$sRow)=each($theRows)) {
00909 $out.=$this->tt_board_drawItem('tt_board',$sRow,0);
00910 }
00911 }
00912 }
00913 $this->eCounter++;
00914 }
00915
00916
00917 $out='
00918 <table border="0" cellpadding="0" cellspacing="0" class="typo3-page-listTTboard">
00919 '.$out.'
00920 </table>';
00921 }
00922
00923 return $out;
00924 }
00925
00933 function getTable_tt_address($id) {
00934
00935
00936 switch($GLOBALS['SOBE']->MOD_SETTINGS['tt_address']) {
00937 case 1:
00938 $icon = 0;
00939 $fList = 'name,address,zip,city,country';
00940 break;
00941 case 2:
00942 $icon = 1;
00943 $fList = 'name;title;email;company,image';
00944 break;
00945 default:
00946 $icon = 0;
00947 $fList = 'name,email,www,phone,fax,mobile';
00948 break;
00949 }
00950
00951
00952 $out = $this->makeOrdinaryList('tt_address',$id, $fList, $icon);
00953 return $out;
00954 }
00955
00963 function getTable_tt_links($id) {
00964
00965
00966 switch($GLOBALS['SOBE']->MOD_SETTINGS['tt_links']) {
00967 case 1:
00968 $fList = 'title,hidden,url';
00969 break;
00970 case 2:
00971 $fList = 'title;url,note2';
00972 break;
00973 default:
00974 $fList = 'title;url,note';
00975 break;
00976 }
00977
00978 $out = $this->makeOrdinaryList('tt_links',$id, $fList,1);
00979 return $out;
00980 }
00981
00989 function getTable_tt_guest($id) {
00990
00991
00992 $fList = 'title;cr_name;cr_email,note';
00993 $out = $this->makeOrdinaryList('tt_guest',$id, $fList, 1);
00994 return $out;
00995 }
00996
01004 function getTable_tt_news($id) {
01005
01006 $this->addElement_tdParams=array(
01007 'title'=>' nowrap="nowrap"',
01008 'datetime'=>' nowrap="nowrap"',
01009 'starttime'=>' nowrap="nowrap"',
01010 'author'=>' nowrap="nowrap"'
01011 );
01012 $fList = 'title,author,author_email,datetime,starttime,category,image';
01013 $out = $this->makeOrdinaryList('tt_news',$id, $fList, 1);
01014 $this->addElement_tdParams=array();
01015 return $out;
01016 }
01017
01025 function getTable_tt_calender($id) {
01026
01027 $type=$GLOBALS['SOBE']->MOD_SETTINGS['tt_calender'];
01028 switch($type) {
01029 case 'date':
01030
01031 $fList = 'date,title';
01032 $icon=0;
01033 $out = $this->makeOrdinaryList('tt_calender',$id, $fList, $icon, ' AND type=0');
01034 return $out;
01035 break;
01036 case 'date_ext':
01037
01038 $fList = 'title;date;time;datetext;link,note';
01039 $icon=1;
01040 $out = $this->makeOrdinaryList('tt_calender',$id, $fList, $icon, ' AND type=0');
01041 return $out;
01042 break;
01043 case 'todo':
01044
01045 $fList = 'title,complete,priority,date';
01046 $icon=0;
01047 $out = $this->makeOrdinaryList('tt_calender',$id, $fList, $icon, ' AND type=1');
01048 return $out;
01049 break;
01050 case 'todo_ext':
01051
01052 $fList = 'title;complete;priority;date;workgroup;responsible;category,note';
01053 $icon=1;
01054 $out = $this->makeOrdinaryList('tt_calender',$id, $fList, $icon, ' AND type=1');
01055 return $out;
01056 break;
01057 default:
01058
01059 $fList = 'title,date,time,week';
01060 $icon=1;
01061 $out = $this->makeOrdinaryList('tt_calender',$id, $fList, $icon, ' AND type=0');
01062 $out.= $this->makeOrdinaryList('tt_calender',$id, $fList, $icon, ' AND type=1');
01063 return $out;
01064 break;
01065 }
01066 }
01067
01075 function getTable_tt_products($id) {
01076
01077 $type = $GLOBALS['SOBE']->MOD_SETTINGS['tt_products'];
01078 switch($type) {
01079 case 'ext':
01080 $fList = 'title;itemnumber;price;price2;inStock;category,image,note';
01081 $icon=1;
01082 $out = $this->makeOrdinaryList('tt_products',$id, $fList, $icon);
01083 break;
01084 default:
01085 $fList = 'title,itemnumber,price,category,image';
01086 $icon=1;
01087 $out = $this->makeOrdinaryList('tt_products',$id, $fList, $icon);
01088 break;
01089 }
01090
01091 return $out;
01092 }
01093
01094
01095
01096
01097
01098
01099
01100
01101
01102
01103
01104
01105
01106
01107
01108
01109
01110
01121 function makeOrdinaryList($table, $id, $fList, $icon=0, $addWhere='') {
01122 global $TCA;
01123
01124
01125 $out = '';
01126 $queryParts = $this->makeQueryArray($table, $id, $addWhere);
01127 $this->setTotalItems($queryParts);
01128 $dbCount = 0;
01129
01130
01131 if ($this->totalItems) {
01132 $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
01133 $dbCount = $GLOBALS['TYPO3_DB']->sql_num_rows($result);
01134 }
01135
01136
01137 $out = '';
01138 if ($dbCount) {
01139
01140
01141 $this->fieldArray = explode(',','__cmds__,'.$fList);
01142
01143
01144 $theData = array();
01145 $theData = $this->headerFields($this->fieldArray,$table,$theData);
01146 $out.= $this->addelement(1,'',$theData,' class="c-headLine"',15);
01147
01148
01149 $this->eCounter = $this->firstElementNumber;
01150 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
01151 list($flag,$code) = $this->fwd_rwd_nav();
01152 $out.= $code;
01153 if ($flag) {
01154 $params = '&edit['.$table.']['.$row['uid'].']=edit';
01155 $Nrow = array();
01156
01157
01158 if ($icon) {
01159 $Nrow['__cmds__']= $this->getIcon($table,$row);
01160 }
01161 if ($this->doEdit) {
01162 $Nrow['__cmds__'].= '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath)).'">'.
01163 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.$GLOBALS['LANG']->getLL('edit',1).'" alt="" />'.
01164 '</a>';
01165 } else {
01166 $Nrow['__cmds__'].= $this->noEditIcon();
01167 }
01168
01169
01170 $Nrow = $this->dataFields($this->fieldArray,$table,$row,$Nrow);
01171 $tdparams = $this->eCounter%2 ? ' class="bgColor4"' : ' class="bgColor4-20"';
01172 $out.= $this->addelement(1,'',$Nrow,$tdparams);
01173 }
01174 $this->eCounter++;
01175 }
01176
01177
01178 $out='
01179
01180 <!--
01181 STANDARD LIST OF "'.$table.'"
01182 -->
01183 <table border="0" cellpadding="1" cellspacing="2" width="480" id="typo3-page-stdlist">
01184 '.$out.'
01185 </table>';
01186 }
01187 return $out;
01188 }
01189
01200 function dataFields($fieldArr,$table,$row,$out=array()) {
01201 global $TCA;
01202
01203
01204 if ($TCA[$table]) {
01205 t3lib_div::loadTCA($table);
01206 $thumbsCol = $TCA[$table]['ctrl']['thumbnail'];
01207
01208
01209 foreach($fieldArr as $fieldName) {
01210
01211 if ($TCA[$table]['columns'][$fieldName]) {
01212 if ($fieldName==$thumbsCol) {
01213 $out[$fieldName] = $this->thumbCode($row,$table,$fieldName);
01214 } else {
01215 $out[$fieldName] = nl2br(htmlspecialchars(trim(t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getProcessedValue($table,$fieldName,$row[$fieldName]),250))));
01216 }
01217 } else {
01218 $theFields = explode(';',$fieldName);
01219
01220
01221 foreach($theFields as $fName2) {
01222 if ($TCA[$table]['columns'][$fName2]) {
01223 $out[$fieldName].= '<b>'.$GLOBALS['LANG']->sL($TCA[$table]['columns'][$fName2]['label'],1).'</b>'.
01224 ' '.
01225 htmlspecialchars(t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getProcessedValue($table,$fName2,$row[$fName2]),25)).
01226 '<br />';
01227 }
01228 }
01229 }
01230
01231 if (!$out[$fieldName]) $out[$fieldName]=' ';
01232
01233
01234 if ($this->isDisabled($table,$row)) {
01235 $out[$fieldName] = $GLOBALS['TBE_TEMPLATE']->dfw($out[$fieldName]);
01236 }
01237 }
01238 }
01239 return $out;
01240 }
01241
01251 function headerFields($fieldArr,$table,$out=array()) {
01252 global $TCA;
01253
01254 t3lib_div::loadTCA($table);
01255
01256 foreach($fieldArr as $fieldName) {
01257 $ll = $GLOBALS['LANG']->sL($TCA[$table]['columns'][$fieldName]['label'],1);
01258 $out[$fieldName] = '<b>'.($ll?$ll:' ').'</b>';
01259 }
01260 return $out;
01261 }
01262
01263
01264
01265
01266
01267
01268
01269
01270
01271
01272
01273
01274
01275
01276
01277
01278
01279
01280
01281
01282
01293 function pages_getTree($theRows,$pid,$qWhere,$treeIcons,$depth) {
01294 $depth--;
01295 if ($depth>=0) {
01296 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages', 'pid='.intval($pid).$qWhere, '', 'sorting');
01297 $c=0;
01298 $rc = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
01299 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
01300 $c++;
01301 $row['treeIcons'] = $treeIcons.'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/join'.($rc==$c?'bottom':'').'.gif','width="18" height="16"').' alt="" />';
01302 $theRows[]=$row;
01303
01304
01305 $spaceOutIcons = '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/'.($rc==$c?'blank.gif':'line.gif'),'width="18" height="16"').' alt="" />';
01306 $theRows = $this->pages_getTree($theRows,$row['uid'],$qWhere,$treeIcons.$spaceOutIcons,$row['php_tree_stop']?0:$depth);
01307 }
01308 } else {
01309 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', 'pages', 'pid='.intval($pid).$qWhere);
01310 $row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
01311 if ($row[0]) {
01312 $this->plusPages[$pid]=$row[0];
01313 }
01314 }
01315 return $theRows;
01316 }
01317
01325 function pages_drawItem($row,$fieldArr) {
01326 global $TCA;
01327
01328
01329 $theIcon=$this->getIcon('pages',$row);
01330
01331
01332 $theData = Array();
01333 foreach($fieldArr as $field) {
01334 switch($field) {
01335 case 'title':
01336 $red = $this->plusPages[$row['uid']] ? '<font color="red"><b>+ </b></font>' : '';
01337 $pTitle = htmlspecialchars(t3lib_BEfunc::getProcessedValue('pages',$field,$row[$field],20));
01338 if ($red) {
01339 $pTitle = '<a href="'.htmlspecialchars($this->script.'?id='.$row['uid']).'">'.$pTitle.'</a>';
01340 }
01341 $theData[$field]=$row['treeIcons'].$theIcon.$red.$pTitle.' ';
01342 break;
01343 case 'php_tree_stop':
01344 case 'TSconfig':
01345 $theData[$field] = $row[$field]?' <b>x</b>':' ';
01346 break;
01347 case 'uid':
01348 if ($GLOBALS['BE_USER']->doesUserHaveAccess($row,2)) {
01349 $params='&edit[pages]['.$row['uid'].']=edit';
01350 $eI= '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath,'')).'">'.
01351 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.$GLOBALS['LANG']->getLL('editThisPage',1).'" alt="" />'.
01352 '</a>';
01353 } else $eI='';
01354 $theData[$field] = '<span align="right">'.$row['uid'].$eI.'</span>';
01355 break;
01356 default:
01357 if (substr($field,0,6)=='table_') {
01358 $f2 = substr($field,6);
01359 if ($TCA[$f2]) {
01360 $c = $this->numberOfRecords($f2,$row['uid']);
01361 $theData[$field] = ' '.($c?$c:'');
01362 }
01363 } elseif (substr($field,0,5)=='HITS_') {
01364 if (t3lib_extMgm::isLoaded('sys_stat')) {
01365 $fParts = explode(':',substr($field,5));
01366 switch($fParts[0]) {
01367 case 'days':
01368 $timespan = mktime (0,0,0)+intval($fParts[1])*3600*24;
01369
01370 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
01371 'count(*)',
01372 'sys_stat',
01373 $this->stat_select_field.'='.intval($row['uid']).'
01374 AND tstamp>='.intval($timespan).'
01375 AND tstamp<'.intval($timespan+3600*24)
01376 );
01377 list($number) = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
01378 if ($number) {
01379
01380 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
01381 'count(*)',
01382 'sys_stat',
01383 $this->stat_select_field.'='.intval($row['uid']).'
01384 AND tstamp>='.intval($timespan).'
01385 AND tstamp<'.intval($timespan+3600*24).'
01386 AND surecookie!=""',
01387 'surecookie'
01388 );
01389 $scnumber = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
01390
01391 $number.= '/'.$scnumber;
01392 } else {
01393 $number='';
01394 }
01395 break;
01396 }
01397 $theData[$field]= ' '.$number;
01398 } else {
01399 $theData[$field]= ' ';
01400 }
01401 } else {
01402 $theData[$field]= ' '.htmlspecialchars(t3lib_BEfunc::getProcessedValue('pages',$field,$row[$field]));
01403 }
01404 break;
01405 }
01406 }
01407 return $this->addelement(1,'',$theData);
01408 }
01409
01410
01411
01412
01413
01414
01415
01416
01417
01418
01419
01420
01421
01422
01423
01424
01425
01426
01435 function tt_content_drawColHeader($colName,$editParams,$newParams) {
01436
01437
01438 $out = '
01439 <tr>
01440 <td class="bgColor2" nowrap="nowrap"><img src="clear.gif" width="1" height="2" alt="" /><br /><div align="center"><b>'.htmlspecialchars(strtoupper($colName)).'</b></div><img src="clear.gif" width="1" height="2" alt="" /></td>
01441 </tr>';
01442
01443
01444 if ($this->tt_contentConfig['showCommands']) {
01445
01446 $out.= '
01447 <tr>
01448 <td class="bgColor5">';
01449
01450
01451 if ($editParams) {
01452 $out.='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($editParams,$this->backPath)).'">'.
01453 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.$GLOBALS['LANG']->getLL('editColumn',1).'" alt="" />'.
01454 '</a>';
01455 }
01456
01457 if ($newParams) {
01458 $out.='<a href="#" onclick="'.htmlspecialchars($newParams).'">'.
01459 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/new_record.gif','width="16" height="12"').' title="'.$GLOBALS['LANG']->getLL('newInColumn',1).'" alt="" />'.
01460 '</a>';
01461 }
01462
01463 $out.= '
01464 </td>
01465 </tr>';
01466 }
01467
01468
01469 return '
01470 <table border="0" cellpadding="0" cellspacing="0" width="100%" class="typo3-page-colHeader">'.($space?'
01471 <tr>
01472 <td><img src="clear.gif" height="'.$space.'" alt="" /></td>
01473 </tr>':'').
01474 $out.'
01475 </table>';
01476 }
01477
01487 function tt_content_drawHeader($row,$space=0,$disableMoveAndNewButtons=FALSE,$langMode=FALSE) {
01488 global $TCA;
01489
01490
01491 t3lib_div::loadTCA('tt_content');
01492
01493
01494 if ($lockInfo=t3lib_BEfunc::isRecordLocked('tt_content',$row['uid'])) {
01495 $lockIcon='<a href="#" onclick="'.htmlspecialchars('alert('.$GLOBALS['LANG']->JScharCode($lockInfo['msg']).');return false;').'">'.
01496 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/recordlock_warning3.gif','width="17" height="12"').' title="'.htmlspecialchars($lockInfo['msg']).'" alt="" />'.
01497 '</a>';
01498 } else $lockIcon='';
01499
01500
01501 $header = $this->getIcon('tt_content',$row).
01502 $lockIcon.
01503 ($langMode ? $this->languageFlag($row['sys_language_uid']) : '').
01504 ' <b>'.htmlspecialchars($this->CType_labels[$row['CType']]).'</b>';
01505 $out = '
01506 <tr>
01507 <td class="bgColor4">'.$header.'</td>
01508 </tr>';
01509
01510
01511 if ($this->tt_contentConfig['showInfo']) {
01512
01513
01514 $info = Array();
01515 $this->getProcessedValue('tt_content','hidden,starttime,endtime,fe_group,spaceBefore,spaceAfter,section_frame,sectionIndex,linkToTop',$row,$info);
01516
01517
01518 if ($this->tt_contentConfig['showCommands'] && $this->doEdit) {
01519
01520
01521 $out.= '
01522 <!-- Control Panel -->
01523 <tr>
01524 <td class="bgColor5">';
01525
01526
01527 $params='&edit[tt_content]['.$this->tt_contentData['nextThree'][$row['uid']].']=edit';
01528 $out.='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath)).'">'.
01529 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.htmlspecialchars($this->nextThree>1?sprintf($GLOBALS['LANG']->getLL('nextThree'),$this->nextThree):$GLOBALS['LANG']->getLL('edit')).'" alt="" />'.
01530 '</a>';
01531
01532 if (!$disableMoveAndNewButtons) {
01533
01534 if ($this->option_newWizard) {
01535 $onClick="document.location='db_new_content_el.php?id=".$row['pid'].'&sys_language_uid='.$row['sys_language_uid'].'&colPos='.$row['colPos'].'&uid_pid='.(-$row['uid']).'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))."';";
01536 } else {
01537 $params='&edit[tt_content]['.(-$row['uid']).']=new';
01538 $onClick = t3lib_BEfunc::editOnClick($params,$this->backPath);
01539 }
01540 $out.='<a href="#" onclick="'.htmlspecialchars($onClick).'">'.
01541 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/new_record.gif','width="16" height="12"').' title="'.$GLOBALS['LANG']->getLL('newAfter',1).'" alt="" />'.
01542 '</a>';
01543
01544
01545 if ($this->tt_contentData['prev'][$row['uid']]) {
01546 $params='&cmd[tt_content]['.$row['uid'].'][move]='.$this->tt_contentData['prev'][$row['uid']];
01547 $out.='<a href="'.htmlspecialchars($GLOBALS['SOBE']->doc->issueCommand($params)).'">'.
01548 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_up.gif','width="11" height="10"').' title="'.$GLOBALS['LANG']->getLL('moveUp',1).'" alt="" />'.
01549 '</a>';
01550 } else {
01551 $out.='<img src="clear.gif" '.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_up.gif','width="11" height="10"',2).' alt="" />';
01552 }
01553
01554 if ($this->tt_contentData['next'][$row['uid']]) {
01555 $params='&cmd[tt_content]['.$row['uid'].'][move]='.$this->tt_contentData['next'][$row['uid']];
01556 $out.='<a href="'.htmlspecialchars($GLOBALS['SOBE']->doc->issueCommand($params)).'">'.
01557 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_down.gif','width="11" height="10"').' title="'.$GLOBALS['LANG']->getLL('moveDown',1).'" alt="" />'.
01558 '</a>';
01559 } else {
01560 $out.='<img src="clear.gif" '.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_down.gif','width="11" height="10"',2).' alt="" />';
01561 }
01562 }
01563
01564
01565 $hiddenField = $TCA['tt_content']['ctrl']['enablecolumns']['disabled'];
01566 if ($hiddenField && $TCA['tt_content']['columns'][$hiddenField] && (!$TCA['tt_content']['columns'][$hiddenField]['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields','tt_content:'.$hiddenField))) {
01567 if ($row[$hiddenField]) {
01568 $params='&data[tt_content]['.$row['uid'].']['.$hiddenField.']=0';
01569 $out.='<a href="'.htmlspecialchars($GLOBALS['SOBE']->doc->issueCommand($params)).'">'.
01570 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_unhide.gif','width="11" height="10"').' title="'.$GLOBALS['LANG']->getLL('unHide',1).'" alt="" />'.
01571 '</a>';
01572 } else {
01573 $params='&data[tt_content]['.$row['uid'].']['.$hiddenField.']=1';
01574 $out.='<a href="'.htmlspecialchars($GLOBALS['SOBE']->doc->issueCommand($params)).'">'.
01575 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_hide.gif','width="11" height="10"').' title="'.$GLOBALS['LANG']->getLL('hide',1).'" alt="" />'.
01576 '</a>';
01577 }
01578 }
01579
01580
01581 $params='&cmd[tt_content]['.$row['uid'].'][delete]=1';
01582 $out.='<a href="'.htmlspecialchars($GLOBALS['SOBE']->doc->issueCommand($params)).'" onclick="'.htmlspecialchars('return confirm('.$GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL('deleteWarning')).');').'">'.
01583 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/garbage.gif','width="11" height="12"').' title="'.$GLOBALS['LANG']->getLL('deleteItem',1).'" alt="" />'.
01584 '</a>';
01585
01586
01587 $out.= '
01588 </td>
01589 </tr>';
01590 }
01591
01592
01593 if (count($info)) {
01594 $out.= '
01595 <tr>
01596 <td class="bgColor4-20">'.implode('<br />',$info).'</td>
01597 </tr>';
01598 }
01599 }
01600
01601 return '
01602 <table border="0" cellpadding="0" cellspacing="0" class="typo3-page-ceHeader">'.($space?'
01603 <tr>
01604 <td><img src="clear.gif" height="'.$space.'" alt="" /></td>
01605 </tr>':'').
01606 $out.'
01607 </table>';
01608 }
01609
01617 function tt_content_drawItem($row, $isRTE=FALSE) {
01618 global $TCA;
01619
01620 $out='';
01621 $outHeader='';
01622
01623
01624 if ($row['header'] && $row['header_layout']!=100) {
01625 $infoArr = Array();
01626 $this->getProcessedValue('tt_content','header_position,header_layout,header_link',$row,$infoArr);
01627
01628 $outHeader= ($row['date'] ? htmlspecialchars($this->itemLabels['date'].' '.t3lib_BEfunc::date($row['date'])).'<br />':'').
01629 $this->infoGif($infoArr).
01630 '<b>'.$this->linkEditContent($this->renderText($row['header']),$row).'</b><br />';
01631 }
01632
01633
01634 $infoArr=Array();
01635 switch($row['CType']) {
01636 case 'header':
01637 if ($row['subheader']) {
01638 $this->getProcessedValue('tt_content','layout',$row,$infoArr);
01639 $out.= $this->infoGif($infoArr).
01640 $this->linkEditContent($this->renderText($row['subheader']),$row).'<br />';
01641 }
01642 break;
01643 case 'text':
01644 case 'textpic':
01645 case 'image':
01646 if ($row['CType']=='text' || $row['CType']=='textpic') {
01647 if ($row['bodytext']) {
01648 $this->getProcessedValue('tt_content','text_align,text_face,text_size,text_color,text_properties',$row,$infoArr);
01649 $out.= $this->infoGif($infoArr).
01650 $this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
01651 }
01652 }
01653 if ($row['CType']=='textpic' || $row['CType']=='image') {
01654 if ($row['image']) {
01655 $infoArr=Array();
01656 $this->getProcessedValue('tt_content','imageorient,imagecols,image_noRows,imageborder,imageheight,image_link,image_zoom,image_compression,image_effects,image_frames',$row,$infoArr);
01657 $out.= $this->infoGif($infoArr).
01658 $this->thumbCode($row,'tt_content','image').'<br />';
01659
01660 if ($row['imagecaption']) {
01661 $infoArr=Array();
01662 $this->getProcessedValue('tt_content','imagecaption_position',$row,$infoArr);
01663 $out.= $this->infoGif($infoArr).
01664 $this->linkEditContent($this->renderText($row['imagecaption']),$row).'<br />';
01665 }
01666 }
01667 }
01668 break;
01669 case 'bullets':
01670 if ($row['bodytext']) {
01671 $this->getProcessedValue('tt_content','layout,text_align,text_face,text_size,text_color,text_properties',$row,$infoArr);
01672 $out.= $this->infoGif($infoArr).
01673 $this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
01674 }
01675 break;
01676 case 'table':
01677 if ($row['bodytext']) {
01678 $this->getProcessedValue('tt_content','table_bgColor,table_border,table_cellspacing,cols,layout,text_align,text_face,text_size,text_color,text_properties',$row,$infoArr);
01679 $out.= $this->infoGif($infoArr).
01680 $this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
01681 }
01682 break;
01683 case 'uploads':
01684 if ($row['media']) {
01685 $this->getProcessedValue('tt_content','media,select_key,layout,filelink_size,table_bgColor,table_border,table_cellspacing',$row,$infoArr);
01686 $out.= $this->infoGif($infoArr).
01687 $this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
01688 }
01689 break;
01690 case 'multimedia':
01691 if ($row['multimedia']) {
01692 $out.= $this->renderText($row['multimedia']).'<br />';
01693 $out.= $this->renderText($row['parameters']).'<br />';
01694 }
01695 break;
01696 case 'mailform':
01697 if ($row['bodytext']) {
01698 $this->getProcessedValue('tt_content','pages,subheader',$row,$infoArr);
01699 $out.= $this->infoGif($infoArr).
01700 $this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
01701 }
01702 break;
01703 case 'splash':
01704 if ($row['bodytext']) {
01705 $out.= $this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
01706 }
01707 if ($row['image']) {
01708 $infoArr=Array();
01709 $this->getProcessedValue('tt_content','imagewidth',$row,$infoArr);
01710 $out.= $this->infoGif($infoArr).
01711 $this->thumbCode($row,'tt_content','image').'<br />';
01712 }
01713 break;
01714 case 'menu':
01715 if ($row['pages']) {
01716 $this->getProcessedValue('tt_content','menu_type',$row,$infoArr);
01717 $out.= $this->infoGif($infoArr).
01718 $this->linkEditContent($row['pages'],$row).'<br />';
01719 }
01720 break;
01721 case 'shortcut':
01722 if ($row['records']) {
01723 $this->getProcessedValue('tt_content','layout',$row,$infoArr);
01724 $out.= $this->infoGif($infoArr).
01725 $this->linkEditContent($row['shortcut'],$row).'<br />';
01726 }
01727 break;
01728 case 'list':
01729 $this->getProcessedValue('tt_content','layout',$row,$infoArr);
01730 $out.= $this->infoGif($infoArr).
01731 $GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('tt_content','list_type'),1).' '.
01732 $GLOBALS['LANG']->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content','list_type',$row['list_type']),1).'<br />';
01733
01734 $out.= $GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('tt_content','select_key'),1).' '.$row['select_key'].'<br />';
01735
01736 $infoArr=Array();
01737 $this->getProcessedValue('tt_content','recursive',$row,$infoArr);
01738 $out.= $this->infoGif($infoArr).
01739 $GLOBALS['LANG']->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content','pages',$row['pages']),1).'<br />';
01740 break;
01741 case 'script':
01742 $out.= $GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('tt_content','select_key'),1).' '.$row['select_key'].'<br />';
01743 $out.= '<br />'.$this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
01744 $out.= '<br />'.$this->linkEditContent($this->renderText($row['imagecaption']),$row).'<br />';
01745 break;
01746 default:
01747 if ($row['bodytext']) {
01748 $out.=$this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
01749 }
01750 break;
01751 }
01752
01753
01754 $out = '
01755 <span class="exampleContent">'.$out.'</span>';
01756
01757 $out = $outHeader.$out;
01758
01759 if ($isRTE) {
01760 $out.= $this->linkRTEbutton($row);
01761 }
01762
01763
01764 if ($this->isDisabled('tt_content',$row)) {
01765 return $GLOBALS['TBE_TEMPLATE']->dfw($out);
01766 } else {
01767 return $out;
01768 }
01769 }
01770
01780 function getNonTranslatedTTcontentUids($defLanguageCount,$id,$lP) {
01781 if ($lP && count($defLanguageCount)) {
01782
01783
01784 $queryParts = $this->makeQueryArray('tt_content', $id, 'AND sys_language_uid='.intval($lP).' AND l18n_parent IN ('.implode(',',$defLanguageCount).')');
01785 $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
01786
01787
01788 $defLanguageCount = array_flip($defLanguageCount);
01789
01790
01791 $rowArr = $this->getResult($result);
01792 foreach($rowArr as $row) {
01793 unset($defLanguageCount[$row['l18n_parent']]);
01794 }
01795
01796
01797 $defLanguageCount = array_keys($defLanguageCount);
01798 }
01799
01800 return $defLanguageCount;
01801 }
01802
01810 function newLanguageButton($defLanguageCount,$lP) {
01811 if ($this->doEdit && count($defLanguageCount) && $lP) {
01812
01813 $params = '';
01814 foreach($defLanguageCount as $uidVal) {
01815 $params.='&cmd[tt_content]['.$uidVal.'][localize]='.$lP;
01816 }
01817
01818
01819 $onClick = "document.location='".$GLOBALS['SOBE']->doc->issueCommand($params)."'; return false;";
01820 $theNewButton = $GLOBALS['SOBE']->doc->t3Button($onClick,$GLOBALS['LANG']->getLL('newPageContent_copyForLang').' ['.count($defLanguageCount).']');
01821 return $theNewButton;
01822 }
01823 }
01824
01831 function infoGif($infoArr) {
01832 if (count($infoArr) && $this->tt_contentConfig['showInfo']) {
01833 $out='<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/zoom2.gif','width="12" height="12"').' title="'.htmlspecialchars(implode(chr(10),$infoArr)).'" alt="" /> ';
01834 return $out;
01835 }
01836 }
01837
01847 function newContentElementOnClick($id,$colPos,$sys_language) {
01848 if ($this->option_newWizard) {
01849 $onClick="document.location='db_new_content_el.php?id=".$id.'&colPos='.$colPos.'&sys_language_uid='.$sys_language.'&uid_pid='.$id.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))."';";
01850 } else {
01851 $onClick=t3lib_BEfunc::editOnClick('&edit[tt_content]['.$id.']=new&defVals[tt_content][colPos]='.$colPos.'&defVals[tt_content][sys_language_uid]='.$sys_language,$this->backPath);
01852 }
01853 return $onClick;
01854 }
01855
01865 function linkEditContent($str,$row) {
01866 $addButton='';
01867 $onClick = '';
01868
01869 if ($this->doEdit) {
01870
01871 $onClick=t3lib_BEfunc::editOnClick('&edit[tt_content]['.$row['uid'].']=edit',$this->backPath);
01872 }
01873
01874 return $onClick ? '<a href="#" onclick="'.htmlspecialchars($onClick).'" title="'.$GLOBALS['LANG']->getLL('edit',1).'">'.$str.'</a>'.$addButton : $str;
01875 }
01876
01883 function linkRTEbutton($row) {
01884 $params = array();
01885 $params['table'] = 'tt_content';
01886 $params['uid'] = $row['uid'];
01887 $params['pid'] = $row['pid'];
01888 $params['field'] = 'bodytext';
01889 $params['returnUrl'] = t3lib_div::linkThisScript();
01890 $RTEonClick = "document.location='".$this->backPath."wizard_rte.php?".t3lib_div::implodeArrayForUrl('',array('P'=>$params))."';return false;";
01891 $addButton = $this->option_showBigButtons && $this->doEdit ? $GLOBALS['SOBE']->doc->t3Button($RTEonClick,$GLOBALS['LANG']->getLL('editInRTE')) : '';
01892
01893 return $addButton;
01894 }
01895
01904 function languageSelector($id) {
01905 if ($GLOBALS['BE_USER']->check('tables_modify','pages_language_overlay')) {
01906
01907
01908 $res = $GLOBALS['SOBE']->exec_languageQuery(0);
01909 $langSelItems=array();
01910 $langSelItems[0]='
01911 <option value="0"></option>';
01912 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
01913 $langSelItems[$row['uid']]='
01914 <option value="'.$row['uid'].'">'.htmlspecialchars($row['title']).'</option>';
01915 }
01916
01917
01918 $res = $GLOBALS['SOBE']->exec_languageQuery($id);
01919 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
01920 unset($langSelItems[$row['uid']]);
01921 }
01922
01923
01924 if (count($langSelItems)>1) {
01925 $onChangeContent = 'document.location=\''.$this->backPath.'alt_doc.php?&edit[pages_language_overlay]['.$id.']=new&overrideVals[pages_language_overlay][sys_language_uid]=\'+this.options[this.selectedIndex].value+\'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')).'\'';
01926 return $GLOBALS['LANG']->getLL('new_language',1).': <select name="createNewLanguage" onchange="'.htmlspecialchars($onChangeContent).'">
01927 '.implode('',$langSelItems).'
01928 </select><br /><br />';
01929 }
01930 }
01931 }
01932
01939 function getResult($result) {
01940
01941
01942 $editUidList='';
01943 $recs=Array();
01944 $nextTree = $this->nextThree;
01945 $c=0;
01946 $output=Array();
01947
01948
01949 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
01950
01951
01952 $output[]=$row;
01953
01954
01955 $recs[$c]=$row['uid'];
01956
01957
01958 for($a=0;$a<$nextTree;$a++) {
01959 if(isset($recs[$c-$a])) {
01960 $this->tt_contentData['nextThree'][$recs[$c-$a]].=$row['uid'].',';
01961 }
01962 }
01963
01964
01965 if (isset($recs[$c-1])) {
01966 if (isset($recs[$c-2])) {
01967 $this->tt_contentData['prev'][$row['uid']]=-$recs[$c-2];
01968 } else {
01969 $this->tt_contentData['prev'][$row['uid']]=$row['pid'];
01970 }
01971 $this->tt_contentData['next'][$recs[$c-1]]=-$row['uid'];
01972 }
01973 $c++;
01974 }
01975
01976
01977 return $output;
01978 }
01979
01980
01981
01982
01983
01984
01985
01986
01987
01988
01989
01990
01991
01992
01993
01994
01995
01996
01997
02008 function tt_board_getTree($theRows,$parent,$pid,$qWhere,$treeIcons) {
02009
02010
02011 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_board', 'pid='.intval($pid).' AND parent='.intval($parent).$qWhere, '', 'crdate');
02012
02013
02014 $c=0;
02015 $rc = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
02016 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
02017 $c++;
02018 $row['treeIcons'] = $treeIcons.'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/'.($rc==$c ? 'joinbottom.gif' : 'join.gif'),'width="18" height="16"').' alt="" />';
02019 $theRows[]=$row;
02020
02021
02022 $theRows = $this->tt_board_getTree(
02023 $theRows,
02024 $row['uid'],
02025 $row['pid'],
02026 $qWhere,
02027 $treeIcons.'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/'.($rc==$c ? 'blank.gif' : 'line.gif'),'width="18" height="16"').' alt="" />'
02028 );
02029 }
02030
02031
02032 return $theRows;
02033 }
02034
02043 function tt_board_drawItem($table,$row,$re) {
02044
02045
02046 $theData = Array();
02047 $theData['subject'] = t3lib_div::fixed_lgd_cs(htmlspecialchars($row['subject']),25).' ';
02048 $theData['author'] = t3lib_div::fixed_lgd_cs(htmlspecialchars($row['author']),15).' ';
02049 $theData['date'] = t3lib_div::fixed_lgd_cs(t3lib_BEfunc::datetime($row['crdate']),20).' ';
02050 $theData['age'] = t3lib_BEfunc::calcAge(time()-$row['crdate'], $this->agePrefixes).' ';
02051 if ($re) {
02052 $theData['replys'] = $re;
02053 }
02054
02055
02056 $theData['subject'] =
02057 $row['treeIcons'].
02058 $this->getIcon($table,$row).
02059 $theData['subject'];
02060
02061
02062 return $this->addelement(1,'',$theData);
02063 }
02064
02065
02066
02067
02068
02069
02070
02071
02072
02073
02074
02075
02076
02077
02078
02079
02080
02081
02082
02090 function numberOfRecords($table,$pid) {
02091 global $TCA;
02092
02093 $c=0;
02094 if ($TCA[$table]) {
02095 $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', $table, 'pid='.intval($pid).t3lib_BEfunc::deleteClause($table));
02096 if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) {
02097 $c=$row[0];
02098 }
02099 }
02100 return $c;
02101 }
02102
02109 function renderText($input) {
02110 $input = strip_tags($input);
02111 $input = t3lib_div::fixed_lgd_cs($input,1500);
02112 return nl2br(htmlspecialchars(trim($this->wordWrapper($input))));
02113 }
02114
02123 function getIcon($table,$row) {
02124
02125
02126 $alttext = t3lib_BEfunc::getRecordIconAltText($row,$table);
02127 $iconImg = t3lib_iconWorks::getIconImage($table,$row,$this->backPath,'title="'.$alttext.'"');
02128 $this->counter++;
02129
02130
02131 $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg,$table,$row['uid']);
02132
02133 return $theIcon;
02134 }
02135
02146 function getProcessedValue($table,$fieldList,$row,&$info) {
02147
02148
02149 $fieldArr = explode(',',$fieldList);
02150
02151
02152 foreach($fieldArr as $field) {
02153 if ($row[$field]) {
02154 $info[]= htmlspecialchars($this->itemLabels[$field]).' '.htmlspecialchars(t3lib_BEfunc::getProcessedValue($table,$field,$row[$field]));
02155 }
02156 }
02157 }
02158
02166 function isDisabled($table,$row) {
02167 global $TCA;
02168 if (
02169 ($TCA[$table]['ctrl']['enablecolumns']['disabled'] && $row[$TCA[$table]['ctrl']['enablecolumns']['disabled']]) ||
02170 ($TCA[$table]['ctrl']['enablecolumns']['starttime'] && $row[$TCA[$table]['ctrl']['enablecolumns']['starttime']]>time() ) ||
02171 ($TCA[$table]['ctrl']['enablecolumns']['endtime'] && $row[$TCA[$table]['ctrl']['enablecolumns']['endtime']] && $row[$TCA[$table]['ctrl']['enablecolumns']['endtime']]<time())
02172 ) return true;
02173 }
02174
02184 function wordWrapper($content,$max=50,$char=' -') {
02185 $array = split(' |'.chr(10),$content);
02186 foreach($array as $val) {
02187 if (strlen($val)>$max) {
02188 $content=str_replace($val,substr(chunk_split($val,$max,$char),0,-1),$content);
02189 }
02190 }
02191 return $content;
02192 }
02193
02201 function noEditIcon($label='noEditItems') {
02202 return '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2_d.gif','width="11" height="12"').' title="'.$GLOBALS['LANG']->getLL($label,1).'" alt="" />';
02203 }
02204
02210 function cleanTableNames() {
02211 global $TCA;
02212
02213
02214 $tableNames=array_flip(array_keys($TCA));
02215
02216
02217 unset($tableNames['pages']);
02218 unset($tableNames['static_template']);
02219 unset($tableNames['sys_filemounts']);
02220 unset($tableNames['sys_action']);
02221 unset($tableNames['sys_workflows']);
02222 unset($tableNames['be_users']);
02223 unset($tableNames['be_groups']);
02224
02225 $this->allowedTableNames=array();
02226
02227
02228 if (is_array($tableNames)) {
02229 foreach($tableNames as $k => $v) {
02230 if ($GLOBALS['BE_USER']->check('tables_select',$k)) {
02231 $this->allowedTableNames['table_'.$k]=$k;
02232 }
02233 }
02234 }
02235 }
02236
02246 function isRTEforField($table,$row,$field){
02247 $specConf = $this->getSpecConfForField($table,$row,$field);
02248 $p = t3lib_BEfunc::getSpecConfParametersFromArray($specConf['rte_transform']['parameters']);
02249 if (isset($specConf['richtext']) && (!$p['flag'] || !$row[$p['flag']])) {
02250 list($tscPID,$thePidValue) = t3lib_BEfunc::getTSCpid($table,$row['uid'],$row['pid']);
02251 if ($thePidValue>=0) {
02252 $RTEsetup = $GLOBALS['BE_USER']->getTSConfig('RTE',t3lib_BEfunc::getPagesTSconfig($tscPID));
02253 $RTEtypeVal = t3lib_BEfunc::getTCAtypeValue($table,$row);
02254 $thisConfig = t3lib_BEfunc::RTEsetup($RTEsetup['properties'],$table,$field,$RTEtypeVal);
02255 if (!$thisConfig['disabled']) {
02256 return TRUE;
02257 }
02258 }
02259 }
02260
02261 return FALSE;
02262 }
02263
02275 function getSpecConfForField($table,$row,$field) {
02276
02277
02278 $types_fieldConfig = t3lib_BEfunc::getTCAtypes($table,$row);
02279
02280
02281 if (is_array($types_fieldConfig)) {
02282 foreach($types_fieldConfig as $vconf) {
02283 if ($vconf['field']==$field) return $vconf['spec'];
02284 }
02285 }
02286 }
02287
02288
02289
02290
02291
02292
02293
02294
02295
02296
02297
02298
02299
02300
02301
02302
02303
02304
02312 function getPageInfoBox($rec,$edit=0) {
02313 global $LANG;
02314
02315
02316 if ($edit) {
02317 $params='&edit[pages]['.$rec['uid'].']=edit';
02318 $editIcon='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath)).'">'.
02319 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.$GLOBALS['LANG']->getLL('edit',1).'" alt="" />'.
02320 '</a>';
02321 } else {
02322 $editIcon=$this->noEditIcon('noEditPage');
02323 }
02324
02325
02326 $outPutContent = t3lib_iconWorks::getIconImage('pages',$rec,$this->backPath,'title="'.htmlspecialchars(t3lib_BEfunc::titleAttribForPages($rec)).'"').
02327 $editIcon.
02328 ' '.
02329 htmlspecialchars($rec['title']);
02330
02331
02332
02333 $lines=array();
02334
02335
02336 if ($this->pI_showUser) {
02337
02338 $users= t3lib_BEfunc::getUserNames('username,usergroup,usergroup_cached_list,uid,realName');
02339 $groupArray = explode(',',$GLOBALS['BE_USER']->user['usergroup_cached_list']);
02340 $users=t3lib_BEfunc::blindUserNames($users,$groupArray);
02341 $lines[]=array($LANG->getLL('pI_crUser').':',htmlspecialchars($users[$rec['cruser_id']]['username']).' ('.$users[$rec['cruser_id']]['realName'].')');
02342 }
02343
02344
02345 $lines[]=array($LANG->getLL('pI_crDate').':', t3lib_BEfunc::datetime($rec['crdate']).' ('.t3lib_BEfunc::calcAge(time()-$rec['crdate'],$this->agePrefixes).')');
02346
02347
02348 $lines[]=array($LANG->getLL('pI_lastChange').':', t3lib_BEfunc::datetime($rec['tstamp']).' ('.t3lib_BEfunc::calcAge(time()-$rec['tstamp'],$this->agePrefixes).')');
02349
02350
02351 if ($rec['SYS_LASTCHANGED']) {
02352 $lines[]=array($LANG->getLL('pI_lastChangeContent').':', t3lib_BEfunc::datetime($rec['SYS_LASTCHANGED']).' ('.t3lib_BEfunc::calcAge(time()-$rec['SYS_LASTCHANGED'],$this->agePrefixes).')');
02353 }
02354
02355
02356 $lines[]='';
02357
02358
02359 $dfields = explode(',','alias,target,hidden,starttime,endtime,fe_group,no_cache,cache_timeout,newUntil,lastUpdated,subtitle,keywords,description,abstract,author,author_email');
02360 foreach($dfields as $fV) {
02361 if ($rec[$fV]) {
02362 $lines[]=array($GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('pages',$fV)), t3lib_BEfunc::getProcessedValue('pages',$fV,$rec[$fV]));
02363 }
02364 }
02365
02366
02367 if ($this->pI_showStat && t3lib_extMgm::isLoaded('sys_stat')) {
02368
02369
02370 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', 'sys_stat', 'page_id='.intval($rec['uid']));
02371 $rrow = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
02372 if ($rrow[0]) {
02373
02374
02375 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('min(tstamp) AS min,max(tstamp) AS max', 'sys_stat', 'page_id='.intval($rec['uid']));
02376 $rrow2 = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
02377
02378 $lines[]='';
02379 $lines[]=array($LANG->getLL('pI_hitsPeriod').':',t3lib_BEfunc::date($rrow2[0]).' - '.t3lib_BEfunc::date($rrow2[1]).' ('.t3lib_BEfunc::calcAge($rrow2[1]-$rrow2[0],$this->agePrefixes).')');
02380 $lines[]=array($LANG->getLL('pI_hitsTotal').':',$rrow[0]);
02381
02382
02383
02384 $nextMidNight = mktime (0,0,0)+1*3600*24;
02385
02386 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*), FLOOR(('.$nextMidNight.'-tstamp)/(24*3600)) AS day', 'sys_stat', 'page_id='.intval($rec['uid']).' AND tstamp>'.($nextMidNight-10*24*3600), 'day');
02387 $days=array();
02388 while($rrow = $GLOBALS['TYPO3_DB']->sql_fetch_row($res)) {
02389 $days[$rrow[1]] = $rrow[0];
02390 }
02391
02392 $headerH=array();
02393 $contentH=array();
02394 for($a=9;$a>=0;$a--) {
02395 $headerH[]='
02396 <td class="bgColor5" nowrap="nowrap"> '.date('d',$nextMidNight-($a+1)*24*3600).' </td>';
02397 $contentH[]='
02398 <td align="center">'.($days[$a] ? intval($days[$a]) : '-').'</td>';
02399 }
02400
02401
02402 $hitTable='
02403 <table border="0" cellpadding="0" cellspacing="1" class="typo3-page-hits">
02404 <tr>'.implode('',$headerH).'</tr>
02405 <tr>'.implode('',$contentH).'</tr>
02406 </table>';
02407 $lines[]=array($LANG->getLL('pI_hits10days').':',$hitTable,1);
02408
02409
02410
02411 $nextHour = mktime (date('H'),0,0)+3600;
02412 $hours=16;
02413
02414 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*), FLOOR(('.$nextHour.'-tstamp)/3600) AS hours', 'sys_stat', 'page_id='.intval($rec['uid']).' AND tstamp>'.($nextHour-$hours*3600), 'hours');
02415 $days=array();
02416 while($rrow = $GLOBALS['TYPO3_DB']->sql_fetch_row($res)) {
02417 $days[$rrow[1]]=$rrow[0];
02418 }
02419
02420 $headerH=array();
02421 $contentH=array();
02422 for($a=($hours-1);$a>=0;$a--) {
02423 $headerH[]='
02424 <td class="bgColor5" nowrap="nowrap"> '.intval(date('H',$nextHour-($a+1)*3600)).' </td>';
02425 $contentH[]='
02426 <td align="center">'.($days[$a] ? intval($days[$a]) : '-').'</td>';
02427 }
02428
02429
02430 $hitTable='
02431 <table border="0" cellpadding="0" cellspacing="1" class="typo3-page-stat">
02432 <tr>'.implode('',$headerH).'</tr>
02433 <tr>'.implode('',$contentH).'</tr>
02434 </table>';
02435 $lines[]=array($LANG->getLL('pI_hits24hours').':',$hitTable,1);
02436 }
02437 }
02438
02439
02440
02441 foreach($lines as $fV) {
02442 if (is_array($fV)) {
02443 if (!$fV[2]) $fV[1]=htmlspecialchars($fV[1]);
02444 $out.='
02445 <tr>
02446 <td class="bgColor4" nowrap="nowrap"><strong>'.htmlspecialchars($fV[0]).' </strong></td>
02447 <td class="bgColor4">'.$fV[1].'</td>
02448 </tr>';
02449 } else {
02450 $out.='
02451 <tr>
02452 <td colspan="2"><img src="clear.gif" width="1" height="3" alt="" /></td>
02453 </tr>';
02454 }
02455 }
02456
02457
02458 $outPutContent.='
02459
02460
02461
02462 <!--
02463 Page info box:
02464 -->
02465 <table border="0" cellpadding="0" cellspacing="1" id="typo3-page-info">
02466 '.$out.'
02467 </table>';
02468
02469
02470 return $outPutContent;
02471 }
02472
02481 function getTableMenu($id) {
02482 global $TCA;
02483
02484
02485 $this->activeTables=array();
02486 $theTables = explode(',','tt_content,fe_users,tt_address,tt_links,tt_board,tt_guest,tt_calender,tt_products,tt_news');
02487
02488
02489 if (is_array($this->externalTables)) {
02490 $theTables = array_unique(array_merge($theTables, array_keys($this->externalTables)));
02491 }
02492
02493
02494 foreach($theTables as $tName) {
02495
02496
02497 if ($GLOBALS['BE_USER']->check('tables_select',$tName) && (t3lib_extMgm::isLoaded($tName)||t3lib_div::inList('fe_users,tt_content',$tName) || isset($this->externalTables[$tName]))) {
02498
02499
02500 $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', $tName, 'pid='.intval($id).t3lib_BEfunc::deleteClause($tName));
02501 list($c) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
02502
02503
02504 if ($c || t3lib_div::inList('tt_content',$tName)) {
02505
02506
02507 $out.='
02508 <td><a href="#'.$tName.'"></a>'.
02509 t3lib_iconWorks::getIconImage($tName,Array(),$this->backPath,'title="'.$GLOBALS['LANG']->sL($TCA[$tName]['ctrl']['title'],1).'"').
02510 '</td>';
02511
02512
02513 $this->activeTables[$tName]=
02514 t3lib_iconWorks::getIconImage($tName,Array(),$this->backPath,'title="'.$GLOBALS['LANG']->sL($TCA[$tName]['ctrl']['title'],1).': '.$c.' '.$GLOBALS['LANG']->getLL('records',1).'" class="absmiddle"').
02515 ' '.
02516 $GLOBALS['LANG']->sL($TCA[$tName]['ctrl']['title'],1);
02517 }
02518 }
02519 }
02520
02521
02522 $out = '
02523
02524
02525
02526 <!--
02527 Menu of tables on the page (table menu)
02528 -->
02529 <table border="0" cellpadding="0" cellspacing="0" id="typo3-page-tblMenu">
02530 <tr>'.$out.'
02531 </tr>
02532 </table>';
02533
02534
02535 return $out;
02536 }
02537 }
02538
02539
02540
02541
02542 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/cms/layout/class.tx_cms_layout.php']) {
02543 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/cms/layout/class.tx_cms_layout.php']);
02544 }
02545 ?>