/** * Retrieve template objects which are related to a specific datastructure * * @param tx_templavoila_datastructure * @param integer $pid * @return array */ public function getTemplatesByDatastructure(tx_templavoila_datastructure $ds, $storagePid = 0) { $toList = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('tx_templavoila_tmplobj.uid', 'tx_templavoila_tmplobj', 'tx_templavoila_tmplobj.datastructure=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($ds->getKey(), 'tx_templavoila_tmplobj') . (intval($storagePid) > 0 ? ' AND tx_templavoila_tmplobj.pid = ' . intval($storagePid) : '') . t3lib_BEfunc::deleteClause('tx_templavoila_tmplobj') . ' AND pid!=-1 ' . t3lib_BEfunc::versioningPlaceholderClause('tx_templavoila_tmplobj')); $toCollection = array(); foreach ($toList as $toRec) { $toCollection[] = $this->getTemplateByUid($toRec['uid']); } usort($toCollection, array($this, 'sortTemplates')); return $toCollection; }
/** * Sorts datastructure alphabetically * * @param tx_templavoila_datastructure $obj1 * @param tx_templavoila_datastructure $obj2 * @return int Result of the comparison (see strcmp()) * @see usort() * @see strcmp() */ public function sortDatastructures($obj1, $obj2) { return strcmp(strtolower($obj1->getSortingFieldValue()), strtolower($obj2->getSortingFieldValue())); }
/** * Rendering a single data structures information * * @param array Data Structure information * @param array Array with TO found for this ds * @param integer Scope. * @return string HTML content */ function renderDataStructureDisplay(tx_templavoila_datastructure $dsObj, $scope, $toIdArray) { $tableAttribs = ' border="0" cellpadding="1" cellspacing="1" width="98%" style="margin-top: 10px;" class="lrPadding"'; $XMLinfo = array(); if ($this->MOD_SETTINGS['set_details']) { $XMLinfo = $this->DSdetails($dsObj->getDataprotXML()); } if ($dsObj->isFilebased()) { $onClick = 'document.location=\'' . $this->doc->backPath . 'file_edit.php?target=' . rawurlencode(t3lib_div::getFileAbsFileName($dsObj->getKey())) . '&returnUrl=' . rawurlencode(t3lib_div::sanitizeLocalUrl(t3lib_div::getIndpEnv('REQUEST_URI'))) . '\';'; $dsIcon = '<a href="#" onclick="' . htmlspecialchars($onClick) . '"><img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/fileicons/xml.gif','width="18" height="16"').' alt="" title="' . $dsObj->getKey() . '" class="absmiddle" /></a>'; } else { $dsIcon = t3lib_iconWorks::getSpriteIconForRecord('tx_templavoila_datastructure' ,array(), array('title' => $dsObj->getKey())); $dsIcon = $this->doc->wrapClickMenuOnIcon($dsIcon, 'tx_templavoila_datastructure', $dsObj->getKey(), 1, '&callingScriptId='.rawurlencode($this->doc->scriptID)); } // Preview icon: if ($dsObj->getIcon()) { if (isset($this->modTSconfig['properties']['dsPreviewIconThumb']) && $this->modTSconfig['properties']['dsPreviewIconThumb'] != '0') { $path = realpath(dirname(__FILE__) . '/' . preg_replace('/\w+\/\.\.\//', '', $GLOBALS['BACK_PATH'] . $dsObj->getIcon())); $path = str_replace(realpath(PATH_site) . '/', PATH_site, $path); if($path == FALSE) { $previewIcon = $GLOBALS['LANG']->getLL('noicon', 1); } else { $previewIcon = t3lib_BEfunc::getThumbNail($this->doc->backPath . 'thumbs.php', $path, 'hspace="5" vspace="5" border="1"', strpos($this->modTSconfig['properties']['dsPreviewIconThumb'], 'x') ? $this->modTSconfig['properties']['dsPreviewIconThumb'] : ''); } } else { $previewIcon = '<img src="' . $this->doc->backPath . $dsObj->getIcon() . '" alt="" />'; } } else { $previewIcon = $GLOBALS['LANG']->getLL('noicon', 1); } // Links: if ($dsObj->isFilebased()) { $editLink = $editDataprotLink = ''; $dsTitle = $dsObj->getLabel(); } else { $editLink = $lpXML.= '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick('&edit[tx_templavoila_datastructure]['.$dsObj->getKey().']=edit',$this->doc->backPath)).'">' . t3lib_iconWorks::getSpriteIcon('actions-document-open') .'</a>'; $editDataprotLink = '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick('&edit[tx_templavoila_datastructure]['.$dsObj->getKey().']=edit&columnsOnly=dataprot',$this->doc->backPath)).'">' . t3lib_iconWorks::getSpriteIcon('actions-document-open') . '</a>'; $dsTitle = '<a href="'.htmlspecialchars('../cm1/index.php?table=tx_templavoila_datastructure&uid=' . $dsObj->getKey() . '&id=' . $this->id . '&returnUrl=' . rawurlencode( t3lib_div::sanitizeLocalUrl(t3lib_div::getIndpEnv('REQUEST_URI')))) . '">' . htmlspecialchars($dsObj->getLabel()) . '</a>'; } // Compile info table: $content.=' <table'.$tableAttribs.'> <tr class="bgColor5"> <td colspan="3" style="border-top: 1px solid black;">'. $dsIcon. $dsTitle. $editLink. '</td> </tr> <tr class="bgColor4"> <td rowspan="'.($this->MOD_SETTINGS['set_details'] ? 4 : 2).'" style="width: 100px; text-align: center;">'.$previewIcon.'</td> ' . ($this->MOD_SETTINGS['set_details'] ? '<td style="width:200px">' . $GLOBALS['LANG']->getLL('templatestatus', 1) . '</td> <td>' . $this->findDSUsageWithImproperTOs($dsObj, $scope, $toIdArray) . '</td>' : '' ) . '</tr> <tr class="bgColor4"> <td>' . $GLOBALS['LANG']->getLL('globalprocessing_xml') . '</td> <td> '.$lpXML.($dsObj->getDataprotXML() ? t3lib_div::formatSize(strlen($dsObj->getDataprotXML())).' bytes'. ($this->MOD_SETTINGS['set_details'] ? '<hr/>'.$XMLinfo['HTML'] : '') : '').' </td> </tr>'.($this->MOD_SETTINGS['set_details'] ? ' <tr class="bgColor4"> <td>' . $GLOBALS['LANG']->getLL('created', 1) . '</td> <td>' . t3lib_BEfunc::datetime($dsObj->getCrdate()) . ' ' . $GLOBALS['LANG']->getLL('byuser', 1) . ' [' . $dsObj->getCruser() . ']</td> </tr> <tr class="bgColor4"> <td>' . $GLOBALS['LANG']->getLL('updated', 1) . '</td> <td>'.t3lib_BEfunc::datetime($dsObj->getTstamp()).'</td> </tr>' : '').' </table> '; // Format XML if requested (renders VERY VERY slow) if ($this->MOD_SETTINGS['set_showDSxml']) { if ($dsObj->getDataprotXML()) { require_once(PATH_t3lib.'class.t3lib_syntaxhl.php'); $hlObj = t3lib_div::makeInstance('t3lib_syntaxhl'); $content.='<pre>'.str_replace(chr(9),' ',$hlObj->highLight_DS($dsObj->getDataprotXML())).'</pre>'; } $lpXML.= $editDataprotLink; } if ($this->MOD_SETTINGS['set_details']) { if ($XMLinfo['referenceFields']) { $containerMode = $GLOBALS['LANG']->getLL('yes', 1); if ($XMLinfo['languageMode']==='Separate') { $containerMode .= ' ' . $this->doc->icons(3) . $GLOBALS['LANG']->getLL('containerwithseparatelocalization', 1); } elseif ($XMLinfo['languageMode']==='Inheritance') { $containerMode .= ' '.$this->doc->icons(2); if ($XMLinfo['inputFields']) { $containerMode .= $GLOBALS['LANG']->getLL('mixofcontentandref', 1); } else { $containerMode .= $GLOBALS['LANG']->getLL('nocontentfields', 1); } } } else { $containerMode = 'No'; } $containerMode.=' (ARI='.$XMLinfo['rootelements'].'/'.$XMLinfo['referenceFields'].'/'.$XMLinfo['inputFields'].')'; } // Return content return array( 'HTML' => $content, 'languageMode' => $XMLinfo['languageMode'], 'container' => $containerMode ); }