public function postProcessDiffView($table, $fieldName, $recordOld, $recordNew, $currentDiff, $parentObject) { $diffView = $currentDiff; if ($table == 'tt_content' && $fieldName == 'tx_damttcontent_files' && $this->needsPostProcessing($recordOld, $recordNew)) { $filesOld = tx_dam_db::getReferencedFiles('tt_content', $recordOld['uid'], $this->fileFieldConfiguration['MM_match_fields'], $this->fileFieldConfiguration['MM'], 'tx_dam.*'); $filesNew = tx_dam_db::getReferencedFiles('tt_content', $recordNew['uid'], $this->fileFieldConfiguration['MM_match_fields'], $this->fileFieldConfiguration['MM'], 'tx_dam.*'); // building a string represemtation of the fields that can then // be sent to t3lib_diff, also collect the files to replace later $fieldContentOld = array(); $placeholders = array(); foreach ($filesOld['rows'] as $damFile) { $fieldContentOld[] = 'tx_dam:' . $damFile['uid']; $placeholders['tx_dam:' . $damFile['uid']] = $damFile; } $fieldContentOld = implode(' ', $fieldContentOld); $fieldContentNew = array(); foreach ($filesNew['rows'] as $damFile) { $fieldContentNew[] = 'tx_dam:' . $damFile['uid']; $placeholders['tx_dam:' . $damFile['uid']] = $damFile; } $fieldContentNew = implode(' ', $fieldContentNew); // create the diff $diff = t3lib_div::makeInstance('t3lib_diff'); $fieldDiff = $diff->makeDiffDisplay($fieldContentOld, $fieldContentNew, 'div'); // replace placeholders with thumbnail and title foreach ($placeholders as $placeholder => $damFile) { $thumbnail = tx_dam_guiFunc::thumbnail($damFile); $replacement = $thumbnail . ' ' . $damFile['title']; $fieldDiff = str_replace($placeholder, $replacement, $fieldDiff); } $diffView = $fieldDiff; } return $diffView; }
/** * Preprocesses the preview rendering of a content element. * * @param tx_cms_layout $parentObject: Calling parent object * @param boolean $drawItem: Whether to draw the item using the default functionalities * @param string $headerContent: Header content * @param string $itemContent: Item content * @param array $row: Record row of tt_content * @return void */ public function preProcess(tx_cms_layout &$parentObject, &$drawItem, &$headerContent, &$itemContent, array &$row) { if ($row['tx_damttcontent_files']) { $config =& $GLOBALS['TCA']['tt_content']['columns']['tx_damttcontent_files']['config']; $record = $this->determineRecord($row); $damItems = tx_dam_db::getReferencedFiles('tt_content', $record['uid'], $config['MM_match_fields'], $config['MM'], 'tx_dam.*'); if ($damItems['rows']) { $itemContent = $this->renderDamItems($damItems['rows']); } } }
/** * Will return an array of Tx_ExtbaseDam_Domain_Model_Dam objects for the given table/uid/ident combination. * * @var string $table The table that dam-records have to be fetched for. * @var int $uid The UID of the record for which the dam-records have to be fetched for. * @var string $ident The field ident that dam-records have to be fetched for. * @var string $orderBy Any ordering that should be applied. * @var int $limit The maximum amount of objects to return. * @return array An array of Dam objects. */ public static function get($table, $uid, $ident, $orderBy = '', $limit = 1000) { // check if this exact function call has been made before and give the cached result if (isset(self::$objectStorage['ref'][$table][$uid][$ident][$orderBy][$limit])) { return self::$objectStorage['ref'][$table][$uid][$ident][$orderBy][$limit]; } // gets the data from DAM $damArray = tx_dam_db::getReferencedFiles($table, $uid, $ident, 'tx_dam_mm_ref', 'tx_dam.*', array(), '', $orderBy, $limit); $rows = $damArray['rows']; if (count($rows) > 0) { // dataMapper is a singleton $dataMapper = t3lib_div::makeInstance('Tx_Extbase_Persistence_Mapper_DataMapper'); $objects = $dataMapper->map('Tx_ExtbaseDam_Domain_Model_Dam', $rows); // cache the function call self::$objectStorage['ref'][$table][$uid][$ident][$orderBy][$limit] = $objects; return $objects; } self::$objectStorage['ref'][$table][$uid][$ident][$orderBy][$limit] = array(); // no records found return array(); }
/** * Will return an array of Tx_ExtbaseDam_Domain_Model_Dam objects for the given table/uid/ident combination. * * @var string $table The table that dam-records have to be fetched for. * @var int $uid The UID of the record for which the dam-records have to be fetched for. * @var string $ident The field ident that dam-records have to be fetched for. * @var string $orderBy Any ordering that should be applied. * @var int $limit The maximum amount of objects to return. * @return array An array of Dam objects. */ public static function get($table, $uid, $ident, $orderBy = '', $limit = 1000) { // check if this exact function call has been made before and give the cached result if (isset(self::$objectStorage['ref'][$table][$uid][$ident][$orderBy][$limit])) { return self::$objectStorage['ref'][$table][$uid][$ident][$orderBy][$limit]; } // gets the data from DAM $damArray = \tx_dam_db::getReferencedFiles($table, $uid, $ident, 'tx_dam_mm_ref', 'tx_dam.*', array(), '', $orderBy, $limit); $rows = $damArray['rows']; if (count($rows) > 0) { // dataMapper is a singleton $dataMapper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMapper'); $objects = $dataMapper->map('CIC\\Cicbase\\Domain\\Model\\DigitalAsset', $rows); // cache the function call self::$objectStorage['ref'][$table][$uid][$ident][$orderBy][$limit] = $objects; return $objects; } self::$objectStorage['ref'][$table][$uid][$ident][$orderBy][$limit] = array(); // no records found return array(); }
/** * Used to fetch a file list for TypoScript cObjects * * tt_content.textpic.20.imgList > * tt_content.textpic.20.imgList.cObject = USER * tt_content.textpic.20.imgList.cObject { * userFunc = tx_dam_divFe->fetchFileList * * @param mixed $content: ... * @param array $conf: ... * @return string comma list of files with path * @see dam_ttcontent extension */ function fetchFileList($content, $conf) { $files = array(); $filePath = $this->cObj->stdWrap($conf['additional.']['filePath'], $conf['additional.']['filePath.']); $fileList = trim($this->cObj->stdWrap($conf['additional.']['fileList'], $conf['additional.']['fileList.'])); $refField = trim($this->cObj->stdWrap($conf['refField'], $conf['refField.'])); $fileList = t3lib_div::trimExplode(',', $fileList); foreach ($fileList as $file) { if ($file) { $files[] = $filePath . $file; } } $uid = $this->cObj->data['_LOCALIZED_UID'] ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid']; $refTable = $conf['refTable'] && is_array($GLOBALS['TCA'][$conf['refTable']]) ? $conf['refTable'] : 'tt_content'; if (isset($GLOBALS['BE_USER']->workspace) && $GLOBALS['BE_USER']->workspace !== 0) { $workspaceRecord = $GLOBALS['TSFE']->sys_page->getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, $refTable, $uid, 'uid'); if (is_array($workspaceRecord)) { $uid = $workspaceRecord['uid']; } } $damFiles = tx_dam_db::getReferencedFiles($refTable, $uid, $refField); $files = array_merge($files, $damFiles['files']); return implode(',', $files); }
/** * Gibt alle Referenzen zurück * * @param string $sTableName * @param int $iItemId * @param string $sFieldName * @param array $options * @return array */ public static function getReferences($sTableName, $iItemId, $sFieldName, $options = array()) { if (!self::isLoaded()) { return array('files' => array(), 'rows' => array()); } require_once t3lib_extMgm::extPath('dam') . 'lib/class.tx_dam_db.php'; $files = tx_dam_db::getReferencedFiles($sTableName, $iItemId, $sFieldName); return self::wrapReferencesResult($files, $options); }
/** * get the images out of DAM * * @param int $limitImages: How many images to return; default=0 list all * @return image(s) */ public function getImagesDam($limitImages = 0) { // update of ian (ian@webian.it) thx! // check if there's a localized version of the current content object $uid = $this->cObj->data['uid']; if ($this->cObj->data['_LOCALIZED_UID']) { $uid = $this->cObj->data['_LOCALIZED_UID']; } $sys_language_uid = $GLOBALS['TSFE']->sys_language_content; // get all the files $images = tx_dam_db::getReferencedFiles('tt_content', $uid, 'rgsmoothgallery', 'tx_dam_mm_ref'); // randomise and limit image items returned from images array if ($limitImages > 0) { $test = $images['files']; $test = $this->getSlicedRandomArray($test, 0, $limitImages); $images['files'] = $test; } // begin gallery $content .= $this->beginGallery($this->config['id'], $limitImages); // add image foreach ($images['files'] as $key => $path) { // get data from the single image $fields = 'title,description'; $tables = 'tx_dam'; // now i check the tx_dam table to see if there's a localization for the current DAM record (image) $temp_where = 'l18n_parent = ' . $key . ' AND sys_language_uid = ' . $sys_language_uid; $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', $tables, $temp_where); // if i find a localized record i overwrite the default language $key with the localized language $key if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $key = $row['uid']; } $GLOBALS['TYPO3_DB']->sql_free_result($res); $temp_where = 'uid = ' . $key; $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, $tables, $temp_where); $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); // add element to slideshow $content .= $this->addImage($path, $row['title'], $row['description'], $this->config['showThumbs'], $path, $limitImages); } $content .= $this->endGallery(); return $content; }
/** * Set the Information of the images if mode = dam * * @param boolean $fromCategory * @return boolean */ protected function setDataDam($fromCategory = false, $table = 'tt_content', $uid = 0) { // clear the imageDir $this->imageDir = ''; // get all fields for captions $damCaptionFields = t3lib_div::trimExplode(',', $this->conf['damCaptionFields'], true); $damDescFields = t3lib_div::trimExplode(',', $this->conf['damDescFields'], true); $damHrefFields = t3lib_div::trimExplode(',', $this->conf['damHrefFields'], true); $fieldsArray = array_merge($damCaptionFields, $damDescFields, $damHrefFields); $fields = NULL; if (count($fieldsArray) > 0) { foreach ($fieldsArray as $field) { $fields .= ',tx_dam.' . $field; } } if ($fromCategory === true) { // Get the images from dam category $damcategories = $this->getDamcats($this->lConf['damcategories']); $res = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(tx_dam_db::getMetaInfoFieldList() . $fields, 'tx_dam', 'tx_dam_mm_cat', 'tx_dam_cat', " AND tx_dam_cat.uid IN (" . implode(",", $damcategories) . ")", '', 'tx_dam.sorting', ''); while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $images['rows'][] = $row; } } else { // Get the images from dam $images = tx_dam_db::getReferencedFiles($table, $uid, 'imagecarousel', 'tx_dam_mm_ref', tx_dam_db::getMetaInfoFieldList() . $fields, '', '', 'tx_dam_mm_ref.sorting_foreign'); } if (count($images['rows']) > 0) { // overlay the translation $conf = array('sys_language_uid' => $this->sys_language_uid, 'lovl_mode' => ''); // add image foreach ($images['rows'] as $key => $row) { $row = tx_dam_db::getRecordOverlay('tx_dam', $row, $conf); $absFileName = t3lib_div::getFileAbsFileName($row['file_path'] . $row['file_name']); $size = @getimagesize($absFileName); if (preg_match("/^image\\//i", $size['mime'])) { // set the data $this->images[] = $row['file_path'] . $row['file_name']; ${$href} = ''; unset($href); if (count($damHrefFields) > 0) { foreach ($damHrefFields as $damHrefField) { if (!isset($href) && trim($row[$damHrefField])) { $href = $row[$damHrefField]; break; } } } $this->hrefs[] = $href; // set the caption $caption = ''; unset($caption); if (count($damCaptionFields) > 0) { if (isset($this->conf['damCaptionObject'])) { foreach ($damCaptionFields as $damCaptionField) { if (isset($row[$damCaptionField])) { $GLOBALS['TSFE']->register['dam_' . $damCaptionField] = $row[$damCaptionField]; } } $caption = trim($this->cObj->cObjGetSingle($this->conf['damCaptionObject'], $this->conf['damCaptionObject.'])); // Unset the registered values foreach ($damCaptionFields as $damCaptionField) { unset($GLOBALS['TSFE']->register['dam_' . $damCaptionField]); } } else { // the old way foreach ($damCaptionFields as $damCaptionField) { if (!isset($caption) && trim($row[$damCaptionField])) { $caption = $row[$damCaptionField]; break; } } } } $this->captions[] = $caption; // set the description $description = ''; unset($description); if (count($damDescFields) > 0) { if (isset($this->conf['damDescObject'])) { foreach ($damDescFields as $damDescField) { if (isset($row[$damDescField])) { $GLOBALS['TSFE']->register['dam_' . $damDescField] = $row[$damDescField]; } } $description = trim($this->cObj->cObjGetSingle($this->conf['damDescObject'], $this->conf['damDescObject.'])); // Unset the registered values foreach ($damDescFields as $damDescField) { unset($GLOBALS['TSFE']->register['dam_' . $damDescField]); } } else { // the old way foreach ($damDescFields as $damDescField) { if (!isset($description) && trim($row[$damDescField])) { $description = $row[$damDescField]; break; } } } } $this->description[] = $description; } } } return true; }
/** * Return files from dam reference field (this is used for generating filelist field which TCA was overriden by CSS MULTIMEDIA) * * @param mixed $content: ... * @param array $conf: ... * @return string comma list of files with path */ function fetchFileList($content, $conf) { $refField = trim($this->cObj->stdWrap($conf['refField'], $conf['refField.'])); $damFiles = tx_dam_db::getReferencedFiles('tt_content', $this->cObj->data['uid'], $refField); return implode(',', $damFiles['files']); }
/** * Finding relations in table tx_dam_mm_ref. * * @param string The name of the related table * @param string The name of the field refering to tx_dam * @param string The uid of the record from $table * @param string The (expected) number of relations * @param array Parameters set for the softref parser key in TCA/columns (currently unused) * @return array Result array on positive matches, see description above. Otherwise false */ function findRef_dam_mm_ref($table, $field, $uid, $count, $spParams) { $elements = array(); $tokenList = array(); $whereClauses = array('deleted' => ''); $fileList = tx_dam_db::getReferencedFiles($table, $uid, $field, '', '', $whereClauses); $uids = array_keys($fileList['rows']); foreach ($uids as $key => $uid) { // Initialize the element entry with info text here: $tokenID = $this->makeTokenID($key); $elements[$key] = array(); $elements[$key]['matchString'] = $uid; // Token and substitute value: $tokenList[$key] = "{softref:{$tokenID}}"; $elements[$key]['subst'] = array('type' => 'db', 'recordRef' => 'tx_dam:' . $uid, 'tokenID' => $tokenID, 'tokenValue' => $uid); } if (count($elements) > 0) { $resultArray = array('content' => implode(',', $tokenList), 'elements' => $elements); return $resultArray; } else { return FALSE; } }
/** * Make a comma list of uid's by a mm-relation to the tx_dam table which is used to get eg. the references tt_content<>tx_dam * * @param string $foreign_table Table name to get references for. Eg tt_content * @param integer $foreign_uid The uid of the referenced record * @param mixed $MM_ident Array of field/value pairs that should match in MM table. If it is a string, it will be used as value for the field 'ident'. * @return string uid comma list */ function getReferencesUidList($foreign_table, $foreign_uid, $MM_ident) { $result = tx_dam_db::getReferencedFiles($foreign_table, $foreign_uid, $MM_ident, '', 'tx_dam.uid'); $uidList = implode(',', array_keys($result['rows'])); return $uidList; }
function getDamImages() { // check if there's a localized version of the current content object $uid = $this->cObj->data['uid']; if ($this->cObj->data['_LOCALIZED_UID']) { $uid = $this->cObj->data['_LOCALIZED_UID']; } $sys_language_uid = $GLOBALS['TSFE']->sys_language_content; // get all DAM files $images = tx_dam_db::getReferencedFiles('tt_content', $uid, 'cfa_mooflow', 'tx_dam_mm_ref'); // add image foreach ($images['files'] as $key => $path) { // get data from the single image $fields = 'title,description,file_name,instructions'; $tables = 'tx_dam'; // now i check the tx_dam table to see if there's a localization for the current DAM record (image) $temp_where = 'l18n_parent = ' . $key . ' AND sys_language_uid = ' . $sys_language_uid; $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', $tables, $temp_where); // if i find a localized record i overwrite the default language $key with the localized language $key if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $key = $row['uid']; } $GLOBALS['TYPO3_DB']->sql_free_result($res); $temp_where = 'uid = ' . $key; $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, $tables, $temp_where); $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); /** * Get link from instructions field if is available and linkMethod is "link" * Elsewhere use picture path as link */ if ($this->linkMethod == "link" && $row['instructions']) { /* url fix */ if (substr($row['instructions'], 0, 1) != "/") { $row['instructions'] = 'http://' . $row['instructions']; } $imgs .= '<a href="' . $row['instructions'] . '" rel="image" target="_blank">'; } else { $imgs .= '<a href="' . $path . '" rel="image" target="_blank">'; } $imgs .= '<img src="' . $path . '" alt="' . strtr(htmlspecialchars($row['description']), array("\r\n" => '<br />', "\r" => '<br />', "\n" => '<br />')) . '" title="' . strtr(htmlspecialchars($row['title']), array("\r\n" => '<br />', "\r" => '<br />', "\n" => '<br />')) . '" />'; $imgs .= '</a>'; } return $imgs; }
/** * Render different label for media elements * * @param array $params configuration * @return void */ public function getUserLabelMedia(array &$params) { $ll = 'LLL:EXT:news/Resources/Private/Language/locallang_db.xml:'; $title = $typeInfo = $additionalHtmlContent = ''; $type = $GLOBALS['LANG']->sL($ll . 'tx_news_domain_model_media.type.I.' . $params['row']['type']); // Add additional info based on type switch ((int) $params['row']['type']) { // Image case Tx_News_Domain_Model_Media::MEDIA_TYPE_IMAGE: $typeInfo .= $this->getTitleFromFields('title,alt,caption,image', $params['row']); if (!empty($params['row']['image'])) { $params['row']['image'] = $this->splitFileName($params['row']['image']); $additionalHtmlContent = '<br />' . t3lib_BEfunc::thumbCode($params['row'], 'tx_news_domain_model_media', 'image', $GLOBALS['BACK_PATH'], '', NULL, 0, '', '', FALSE); } break; // Audio & Video // Audio & Video case Tx_News_Domain_Model_Media::MEDIA_TYPE_MULTIMEDIA: $typeInfo .= $this->getTitleFromFields('caption,multimedia', $params['row']); break; // HTML // HTML case Tx_News_Domain_Model_Media::MEDIA_TYPE_HTML: // Don't show html value as this could get a XSS $typeInfo .= $params['row']['caption']; break; // DAM // DAM case Tx_News_Domain_Model_Media::MEDIA_TYPE_DAM: if (intval($params['row']['uid']) > 0) { $config = $GLOBALS['TCA'][$params['table']]['columns']['dam']['config']; $damItems = tx_dam_db::getReferencedFiles($params['table'], $params['row']['uid'], $config['MM_match_fields'], $config['MM'], 'tx_dam.*'); if (is_array($damItems['rows'])) { $item = array_shift($damItems['rows']); $typeInfo = $this->getTitleFromFields('title,file_name', $item); } } break; default: $typeInfo .= $params['row']['caption']; } $title = !empty($typeInfo) ? $type . ': ' . $typeInfo : $type; $title = htmlspecialchars($title) . $additionalHtmlContent; // Hook to modify the label, especially useful when using custom media relations if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['mediaLabel'])) { $params = array('params' => $params, 'title' => $title); foreach ($GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['mediaLabel'] as $reference) { $title = t3lib_div::callUserFunction($reference, $params, $this); } } // Preview if ($params['row']['showinpreview']) { $label = htmlspecialchars($GLOBALS['LANG']->sL($ll . 'tx_news_domain_model_media.show')); $icon = '../' . t3lib_extMgm::siteRelPath('news') . 'Resources/Public/Icons/preview.gif'; $title .= ' <img title="' . $label . '" src="' . $icon . '" />'; } // Show the [No title] if empty if (empty($title)) { $title = t3lib_befunc::getNoRecordTitle(TRUE); } $params['title'] = $title; }
function init($PA, $fobj) { //INIT mapped php values!!!! $extPath = 'typo3conf/ext/go_imageedit_be/'; $resPath = $extPath . 'res/'; $imgCrop = '../' . $resPath . 'image-crop/'; //UID des CElements $uid = $PA['row']['uid']; //CType für locale-typoscript-config // changed by Caspar, we need the complete CType, not just the extension key [substr($PA['row']['CType'], 0, -4)] $this->curCType = $PA['row']['CType'] != 'list' ? $PA['row']['CType'] : $PA['row']['list_type']; $this->config = $this->getTCA($this->curCType); $this->inheritFromDefaultTCA(); //Array mit allen Bildern die vorhanden sind $this->damLoaded = t3lib_extMgm::isLoaded('dam'); $tmpImage = ''; $tmpPath = ''; //nicht von dam verwaltete bilder + pfade $paths = array(); $images = array(); $tmpImage = $PA['row']['image']; $images = $this->getImageArray($tmpImage, $this->config['menu']['maxImages']); foreach ($images as $key => $value) { $paths[$key] = $this->config['rootImgPath']; } //von dam verwaltete bilder + pfade anhängen if ($this->damLoaded) { $result = tx_dam_db::getReferencedFiles('tt_content', $uid, '', 'tx_dam_mm_ref', 'tx_dam.uid,tx_dam.file_path,tx_dam.file_name', '', '', 'tx_dam_mm_ref.ident, tx_dam_mm_ref.sorting_foreign'); foreach ($result['rows'] as $row) { // changed by Caspar, only add if it is an image... (no pdf, swf, etc...) if (t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], strtolower(substr($row['file_name'], strrpos($row['file_name'], '.') + 1)))) { $tmpImage .= $row['file_name'] . ','; $tmpPath .= $row['file_path'] . ','; } } $tmpImage = trim($tmpImage, ','); $tmpPath = trim($tmpPath, ','); $images += $this->getImageArray($tmpImage, $this->config['menu']['maxImages']); $paths += $this->getImageArray($tmpPath, $this->config['menu']['maxImages']); } //Einträge von Bildern, die nicht mehr vorhanden sind, entfernen $saveConfig = $this->getImageValues($uid); $saveConfig = $this->cleanConfig($saveConfig, $images, $paths); $this->saveImageValues($uid, $saveConfig); //erstellt eine html-selectliste der Bilder $htmlForm = $this->config['menu']['displayType'] == 1 ? $this->int_buildImageListForm($images) : $this->int_buildImageListForm2($images, $paths); //sucht das momentan zu bearbeitende Bild heraus und schreib den Wert in die Exemplarvariable $this->curImageID $this->getCurImageID(); //Pfad zum Bild $this->config['imgPath'] = $paths[$this->curImageID] . $images[$this->curImageID]; $imgPath = '../' . $this->config['imgPath']; //ZOOM des Dargestellten Bildes, <= 1 $zoom = 1; if (file_exists(PATH_typo3conf . $imgPath) && !is_dir($imgPath)) { // variable für Original-Pfad... $imgPathOrig = $imgPath; // PER PFAD und IM Breite und Höhe ermitteln $imageSize = getimagesize(PATH_typo3conf . $imgPath); // FÜR DIE GEMAPPTE PHP DATEI, BREITE UND HÖHE DER ARBEITSFLÄCHE list($oriWidth, $oriHeight) = $imageSize; // FIXED ASPECT RATIO übergeben if (!$this->config['selector']['allowCustomRatio'] && is_numeric($this->config['selector']['formatW']) && is_numeric($this->config['selector']['formatH'])) { $fixedRatio = sprintf('%f', $this->config['selector']['formatW'] / $this->config['selector']['formatH']); } else { $fixedRatio = 'false'; } // maximale Anzeige-Grössen im Backend $dw = $this->config['adjustResolution']['maxDisplayedWidth']; $dh = $this->config['adjustResolution']['maxDisplayedHeight']; // Zur besseren Darstellung wird das Bild auf die in $config['adjustRes'] // festgelegten Groeßen heruntergerechnet, wenn es grösser ist... if ($this->config['adjustResolution']['enabled'] && (!empty($dw) && $dw < $oriWidth || !empty($dh) && $dh < $oriHeight)) { $extInfo = pathinfo(PATH_typo3conf . $imgPath); $extInfo = $extInfo['extension']; require_once PATH_typo3conf . '../typo3/sysext/cms/tslib/class.tslib_gifbuilder.php'; $imageBuild = t3lib_div::makeInstance('tslib_gifBuilder'); $imageBuild->init(); $imageBuild->absPrefix = PATH_typo3conf . '../'; $imgNew = $imageBuild->imageMagickConvert(PATH_typo3conf . $imgPath, $extInfo, $dw . 'm', $dh . 'm'); $imgPath = $imgNew[3]; $tmp = getimagesize($imgPath); $imgPath = str_replace(PATH_typo3conf, '', $imgPath); $zoom = $tmp[0] / $oriWidth; unset($tmp); } // AUS DER DB WERTE ERMITTELN $values = $this->getImageValues($uid); $values = isset($values['files'][$this->config['imgPath']]) ? $values['files'][$this->config['imgPath']] : false; if (is_array($values) && !(empty($values[0]) && empty($values[1]))) { $this->doAction('saveImageValues', $uid, $this->config['imgPath'], $values[2], $values[3], $values[0], $values[1]); $values = $this->getImageValues($uid); $values = isset($values['files'][$this->config['imgPath']]) ? $values['files'][$this->config['imgPath']] : false; } //$log .= '<div class="neben"><pre>dbValuesPre:<br />'.print_r($values,true).'</pre><div class="clleft"> </div></div>'; list($selectorWidth, $selectorHeight, $selectorOffX, $selectorOffY, $lWidth, $lHeight, $adjust) = $values; //VALUES ist leer, oder $adjust = 1 if ($values == false || $adjust == 1) { $localWidth = $PA['row']['imagewidth']; $localHeight = $PA['row']['imageheight']; if ($adjust == 1 && !empty($localWidth) && !empty($localHeight)) { $selectorSize = array($localWidth, $localHeight); } else { if (is_numeric($this->config['selector']['formatW']) && is_numeric($this->config['selector']['formatH'])) { $selectorSize = array($this->config['selector']['formatW'], $this->config['selector']['formatH']); } else { $selectorSize = $imageSize; } } // vorgegebenes Format auf das Image projezieren list($selectorWidth, $selectorHeight, $selectorOffX, $selectorOffY) = $this->scaleToFullWH($imageSize, $selectorSize); } $log .= '<div class="neben"><pre>compossed Config:<br />' . print_r($this->config, true) . '</pre><div class="clleft"> </div></div>'; $log .= '<div class="neben">Zoom: ' . $zoom . '<pre>dbValues: ' . print_r($values, true) . '</pre></div>'; $log .= '<div class="neben"><pre>imageSize' . print_r($imageSize, true) . '</pre></div>'; $log .= '<div class="neben"><pre>selectorSize: ' . print_r($selectorSize, true) . '</pre></div>'; $log .= '<div class="neben"><pre>scaleToFullWH: ' . print_r($this->scaleToFullWH($imageSize, $selectorSize), true) . '</pre></div>'; //Gemappte php Datei einlesen include 'res/image-crop/image-crop_jan_mapped.php'; $content .= ' crop_script_alwaysPreserveAspectRatio = ' . ($this->config['selector']['allowCustomRatio'] ? "false" : "true") . '; //crop_script_fixedRatio = true; var imgname = "' . $imgPathOrig . '"; pageuid = ' . $uid . '; minWidth = ' . $this->config['selector']['minWidth'] * $zoom . '; minHeight = ' . $this->config['selector']['minHeight'] * $zoom . '; var zoom = ' . 1 / $zoom . '; init_imageCrop(); </script> <link rel="stylesheet" href="../' . $extPath . 'css/be.css"> '; } else { $content .= 'Keine Bilder vorhanden.'; } return '<div class="imageedit">' . ($this->config['debug'] ? '<div class="debug clearfix">' . $log . '</div>' : '') . '<div class="content">' . (count($images) > 1 ? '<div class="selectorField">' . $htmlForm . '</div>' : '') . $content . '</div>' . '</div>'; }
/** * The method get image-informations, included with extension DAM, from the Database * @author Caspar Stuebs * * Returns: * array ( * 'files' => array( * record-uid => 'fileadmin/example.jpg', * ) * 'rows' => array( * record-uid => array(meta data array), * ) * ); * * @param string $table: The table where the image is included * @param mixed $uid: The uid from the table to look for the image. should be one uid, a comma-seperated list of uids, an array of uids or emtpy for all * @param string $ident: The fieldname from the table where the images are included, empty for all * @param mixed $where: Additional where clause as array or string (key => value) * @param array $fields: Additional fields from $table * * @return array An array with image-informations, ordered by tx_dam_mm_ref.ident, tx_dam_mm_ref.sorting_foreign; false, if DAM is not loaded */ function getDamImages($table = 'tt_content', $uid = '', $ident = '', $where = array(), $fields = array()) { $return = false; $addFields = ''; if (t3lib_extMgm::isLoaded('dam')) { if (is_array($uid)) { $uid = implode(',', $uid); } //if(!is_array($where)) $where = array(); if (!is_array($fields) && !empty($fields) && $fields != 'uid') { $addFields = ',' . $table . '.' . $fields; } elseif (is_array($fields) && count($fields)) { foreach ($fields as $field) { if ($field != 'uid') { $addFields = ',' . $table . '.' . $field; } } } $return = tx_dam_db::getReferencedFiles($table, $uid, $ident, 'tx_dam_mm_ref', 'tx_dam.*,tx_dam_mm_ref.*' . $addFields, $where, '', 'tx_dam_mm_ref.ident, tx_dam_mm_ref.sorting_foreign'); } return $return; }
/** * Draws the preview content for a content element * * @param string Content element * @param boolean Set if the RTE link can be created. * @return string HTML */ function tt_content_drawItem($row, $isRTE = FALSE) { global $TCA; $out = ''; $outHeader = ''; // Make header: if ($row['header'] && $row['header_layout'] != 100) { $infoArr = array(); $this->getProcessedValue('tt_content', 'header_position,header_layout,header_link', $row, $infoArr); $outHeader = ($row['date'] ? htmlspecialchars($this->itemLabels['date'] . ' ' . t3lib_BEfunc::date($row['date'])) . '<br />' : '') . $this->infoGif($infoArr) . '<b>' . $this->linkEditContent($this->renderText($row['header']), $row) . '</b><br />'; } // Make content: $infoArr = array(); switch ($row['CType']) { case 'header': if ($row['subheader']) { $this->getProcessedValue('tt_content', 'layout', $row, $infoArr); $out .= $this->infoGif($infoArr) . $this->linkEditContent($this->renderText($row['subheader']), $row) . '<br />'; } break; case 'text': case 'textpic': case 'image': if ($row['CType'] == 'text' || $row['CType'] == 'textpic') { if ($row['bodytext']) { $this->getProcessedValue('tt_content', 'text_align,text_face,text_size,text_color,text_properties', $row, $infoArr); $out .= $this->infoGif($infoArr) . $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />'; } } if ($row['CType'] == 'textpic' || $row['CType'] == 'image') { if ($row['image']) { $infoArr = array(); $this->getProcessedValue('tt_content', 'imageorient,imagecols,image_noRows,imageborder,imageheight,image_link,image_zoom,image_compression,image_effects,image_frames', $row, $infoArr); $out .= $this->infoGif($infoArr) . $this->thumbCode($row, 'tt_content', 'image') . '<br />'; if ($row['imagecaption']) { $infoArr = array(); $this->getProcessedValue('tt_content', 'imagecaption_position', $row, $infoArr); $out .= $this->infoGif($infoArr) . $this->linkEditContent($this->renderText($row['imagecaption']), $row) . '<br />'; } } ########### if ($row['tx_damttcontent_files']) { require_once PATH_txdam . 'lib/class.tx_dam_image.php'; require_once PATH_txdam . 'lib/class.tx_dam_tcefunc.php'; require_once PATH_txdam . 'lib/class.tx_dam_guifunc.php'; $config = $TCA['tt_content']['columns']['tx_damttcontent_files']['config']; if ($GLOBALS['BE_USER']->workspace !== 0) { $workspaceRecord = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, 'tt_content', $row['uid']); if ($workspaceRecord) { $row = $workspaceRecord; } } $filesArray = tx_dam_db::getReferencedFiles('tt_content', $row['uid'], $config['MM_match_fields'], $config['MM'], 'tx_dam.*'); foreach ($filesArray['rows'] as $rowDAM) { $caption = tx_dam_guiFunc::meta_compileInfoData($rowDAM, '_caption:truncate:100', 'value-string'); #$imgAttributes['title'] = tx_dam_guiFunc::meta_compileHoverText($rowDAM); #$thumb = tx_dam_image::previewImgTag($rowDAM, '', $imgAttributes); $thumb = tx_dam_guiFunc::thumbnail($rowDAM); $thumb = '<div style="float:left;width:56px; overflow:auto; margin: 2px 5px 2px 0; padding: 5px; background-color:#fff; border:solid 1px #ccc;">' . $thumb . '</div>'; $thumb = '<div>' . $thumb . $caption . '</div><div style="clear:both"></div>'; $out .= $thumb; } } ############# } break; case 'bullets': if ($row['bodytext']) { $this->getProcessedValue('tt_content', 'layout,text_align,text_face,text_size,text_color,text_properties', $row, $infoArr); $out .= $this->infoGif($infoArr) . $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />'; } break; case 'table': if ($row['bodytext']) { $this->getProcessedValue('tt_content', 'table_bgColor,table_border,table_cellspacing,cols,layout,text_align,text_face,text_size,text_color,text_properties', $row, $infoArr); $out .= $this->infoGif($infoArr) . $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />'; } break; case 'uploads': if ($row['media']) { $this->getProcessedValue('tt_content', 'media,select_key,layout,filelink_size,table_bgColor,table_border,table_cellspacing', $row, $infoArr); $out .= $this->infoGif($infoArr) . $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />'; } break; case 'multimedia': if ($row['multimedia']) { $out .= $this->renderText($row['multimedia']) . '<br />'; $out .= $this->renderText($row['parameters']) . '<br />'; } break; case 'mailform': if ($row['bodytext']) { $this->getProcessedValue('tt_content', 'pages,subheader', $row, $infoArr); $out .= $this->infoGif($infoArr) . $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />'; } break; case 'splash': if ($row['bodytext']) { $out .= $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />'; } if ($row['image']) { $infoArr = array(); $this->getProcessedValue('tt_content', 'imagewidth', $row, $infoArr); $out .= $this->infoGif($infoArr) . $this->thumbCode($row, 'tt_content', 'image') . '<br />'; } break; case 'menu': if ($row['pages']) { $this->getProcessedValue('tt_content', 'menu_type', $row, $infoArr); $out .= $this->infoGif($infoArr) . $this->linkEditContent($row['pages'], $row) . '<br />'; } break; case 'shortcut': if ($row['records']) { $this->getProcessedValue('tt_content', 'layout', $row, $infoArr); $out .= $this->infoGif($infoArr) . $this->linkEditContent($row['shortcut'], $row) . '<br />'; } break; case 'list': $this->getProcessedValue('tt_content', 'layout', $row, $infoArr); $out .= $this->infoGif($infoArr) . $GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('tt_content', 'list_type'), 1) . ' ' . $GLOBALS['LANG']->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content', 'list_type', $row['list_type']), 1) . '<br />'; $out .= $GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('tt_content', 'select_key'), 1) . ' ' . $row['select_key'] . '<br />'; $infoArr = array(); $this->getProcessedValue('tt_content', 'recursive', $row, $infoArr); $out .= $this->infoGif($infoArr) . $GLOBALS['LANG']->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content', 'pages', $row['pages']), 1) . '<br />'; break; case 'script': $out .= $GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('tt_content', 'select_key'), 1) . ' ' . $row['select_key'] . '<br />'; $out .= '<br />' . $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />'; $out .= '<br />' . $this->linkEditContent($this->renderText($row['imagecaption']), $row) . '<br />'; break; default: if ($row['bodytext']) { $out .= $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />'; } break; } // Wrap span-tags: $out = ' <span class="exampleContent">' . $out . '</span>'; // Add header: $out = $outHeader . $out; // Add RTE button: if ($isRTE) { $out .= $this->linkRTEbutton($row); } // Return values: if ($this->isDisabled('tt_content', $row)) { return $GLOBALS['TBE_TEMPLATE']->dfw($out); } else { return $out; } }
/** * Return all references for the given reference data * * @param string $refTable * @param string $refField * @return array */ public static function getReferences($refTable, $refUid, $refField) { require_once tx_rnbase_util_Extensions::extPath('dam') . 'lib/class.tx_dam_db.php'; return tx_dam_db::getReferencedFiles($refTable, $refUid, $refField); }
/** * connects into the tt_news to fill the 2 markers * * @param array an array of markers coming from the extension * @param array the current record of the extension * @param array the configuration coming from the extension * @param object the parent object calling this method * @return array processed marker array */ function extraItemMarkerProcessor($markerArray, $row, $lConf, &$pObj) { $this->cObj = t3lib_div::makeInstance('tslib_cObj'); // local cObj. $this->pObj =& $pObj; $this2 = $pObj; $conf = $pObj->conf; $confLinks = $conf['lonewsdownloads.']; if (!$confLinks['download_single']) { $markerArray['###LO_DOWNLOADS###'] = 'Please include static TypoScript of LONewsDownloads or remove marker. "###LO_DOWNLOADS###"'; return $markerArray; } $downloads = ''; if (t3lib_extMgm::isLoaded('dam')) { if (t3lib_extMgm::isLoaded('dam_ttnews')) { $row = $pObj->local_cObj->data; //workspaces if (isset($row['_ORIG_uid']) && $row['_ORIG_uid'] > 0) { // draft workspace $uid = $row['_ORIG_uid']; } else { // live workspace $uid = $row['uid']; } // Check for translation if ($row['_LOCALIZED_UID']) { $uid = $row['_LOCALIZED_UID']; } $damFiles = tx_dam_db::getReferencedFiles('tt_news', $uid, 'tx_damnews_dam_media'); // Thanks to Lars Trebing, Marit AG if (count($damFiles['rows']) > 0) { $overlayConf = array('sys_language_uid' => $this->sys_language_uid); foreach ($damFiles['rows'] as $fileKey => $fileRow) { $fileRow = $recordOverlay = tx_dam_db::getRecordOverlay('tx_dam', $fileRow, $overlayConf); $damFiles['rows'][$fileKey] = $fileRow; } } $files = $damFiles['files']; $fileData = $damFiles['rows']; //t3lib_div::debug($damFiles); } else { $markerArray['###LO_DOWNLOADS###'] = 'DAM not supportet, please install dam_ttnews'; return $markerArray; } } else { # Prevents output if no file was selected, thanks to Jeroen Vreuls $files = array(); if (!empty($row['news_files'])) { $files = explode(',', $row['news_files']); $lables = explode("\n", $row['tx_lonewsdownloads_downloadlabel']); $fileData = array(); foreach ($files as $key => $file) { $pathinfo = pathinfo('uploads/media/' . $file); // t3lib_div::debug($pathinfo); $lables[$key] = trim($lables[$key]); $fileData[$key]['title'] = $lables[$key] ? $lables[$key] : $pathinfo['filename']; $fileData[$key]['file_size'] = filesize('uploads/media/' . $file); $fileData[$key]['file_type'] = strtolower($pathinfo['extension']); $files[$key] = 'uploads/media/' . $file; } } } $local_cObj = t3lib_div::makeInstance('tslib_cObj'); $local_data = $this->cObj->data; $local_data = $row; if (!$confLinks['maxItems']) { $confLinks['maxItems'] = null; } if ($confLinks['start'] || $confLinks['maxItems']) { $files = array_slice($files, $confLinks['start'], $confLinks['maxItems'], true); } foreach ($files as $key => $file) { if (is_array($fileData[$key])) { foreach ($fileData[$key] as $keyD => $valueD) { $local_data['single_news_file_' . $keyD] = $valueD; } } /* $local_data['single_news_file_file_size_Byte'] = intval($local_data['single_news_file_file_size']); $local_data['single_news_file_file_size_kB'] = round($local_data['single_news_file_file_size'] / 1024); $local_data['single_news_file_file_size_MB'] = round($local_data['single_news_file_file_size'] / 1024 / 1024); if($local_data['single_news_file_file_size_MB'] > 0) { $local_data['single_news_file_file_size'] = $local_data['single_news_file_file_size_MB'].' MB'; } else if($local_data['single_news_file_file_size_kB'] > 0) { $local_data['single_news_file_file_size'] = $local_data['single_news_file_file_size_kB'].' kB'; } else { $local_data['single_news_file_file_size'] = $local_data['single_news_file_file_size_Byte'].' Byte'; } */ $local_data['single_news_file'] = $file; $local_cObj->data = $local_data; $downloads .= $local_cObj->cObjGetSingle($confLinks['download_single'], $confLinks['download_single.']); } $local_data['lodownload_list'] = $downloads; $local_cObj->data = $local_data; $markerArray['###LO_DOWNLOADS###'] = $local_cObj->cObjGetSingle($confLinks['download_list'], $confLinks['download_list.']); return $markerArray; }
/** * Generation of TCEform element of the type "group" for media elements. * This is used to select media records in eg. tt_content. * * @param array $PA An array with additional configuration options. * @param object $fobj TCEForms object reference * @return string The HTML code for the TCEform field */ function getSingleField_typeMedia($PA, &$fObj) { global $TYPO3_CONF_VARS; $this->tceforms =& $PA['pObj']; if (!(($msg = $this->isMMForeignActive()) === true)) { return $this->tceforms->getSingleField_typeNone_render(array('rows' => 1), $msg); } $table = $PA['table']; $field = $PA['field']; $row = $PA['row']; $config = $PA['fieldConf']['config']; $disabled = ''; if ($this->tceforms->renderReadonly || $config['readOnly']) { $disabled = ' disabled="disabled"'; } $minitems = t3lib_div::intInRange($config['minitems'], 0); $maxitems = t3lib_div::intInRange($config['maxitems'], 0); if (!$maxitems) { $maxitems = 100000; } $this->tceforms->requiredElements[$PA['itemFormElName']] = array($minitems, $maxitems, 'imgName' => $table . '_' . $row['uid'] . '_' . $field); $item = ''; $item .= '<input type="hidden" name="' . $PA['itemFormElName'] . '_mul" value="' . ($config['multiple'] ? 1 : 0) . '"' . $disabled . ' />'; $info = ''; // Acting according to either "file" or "db" type: switch ((string) $config['internal_type']) { case 'db': // If the element is of the internal type "db": // Creating string showing allowed types: $tempFT_db = t3lib_div::trimExplode(',', $config['allowed'], true); while (list(, $theT) = each($tempFT_db)) { if ($theT) { $info .= '<span class="nobr"> ' . t3lib_iconWorks::getIconImage($theT, array(), $this->tceforms->backPath, 'align="top"') . $this->tceforms->sL($GLOBALS['TCA'][$theT]['ctrl']['title'], true) . '</span><br />'; } } // Creating string showing allowed types: $tempFT = t3lib_div::trimExplode(',', $config['allowed_types'], true); if (!count($tempFT)) { $info .= '*'; } foreach ($tempFT as $ext) { if ($ext) { $info .= strtoupper($ext) . ' '; } } // Creating string, showing disallowed types: $tempFT_dis = t3lib_div::trimExplode(',', $config['disallowed_types'], true); if (count($tempFT_dis)) { $info .= '<br />'; } foreach ($tempFT_dis as $ext) { if ($ext) { $info .= '-' . strtoupper($ext) . ' '; } } // Collectiong file items: $itemArray = array(); $filesArray = array(); if (intval($row['uid'])) { $filesArray = tx_dam_db::getReferencedFiles($table, $row['uid'], $config['MM_match_fields'], $config['MM'], 'tx_dam.*'); foreach ($filesArray['rows'] as $row) { $itemArray[] = array('table' => 'tx_dam', 'id' => $row['uid'], 'title' => $row['title'] ? $row['title'] : $row['file_name']); } } $thumbsnails = $this->renderFileList($filesArray, $config['show_thumbs']); /* // making thumbnails $thumbsnails = ''; if ($config['show_thumbs'] AND count($filesArray)) { foreach($filesArray['rows'] as $row) { // Icon $absFilePath = tx_dam::file_absolutePath($row); $fileExists = @file_exists($absFilePath); $addAttrib = 'class="absmiddle"'; $addAttrib .= tx_dam_guiFunc::icon_getTitleAttribute($row); $fileIcon = tx_dam::icon_getFileTypeImgTag($row, $addAttrib); // add clickmenu if ($fileExists AND !$disabled) { # $fileIcon = $this->tceforms->getClickMenu($fileIcon, $absFilePath); $fileIcon = $this->tceforms->getClickMenu($fileIcon, 'tx_dam', $row['uid']); } $title = t3lib_div::fixed_lgd_cs($this->tceforms->noTitle($row['title']), $this->tceforms->titleLen); $thumb = tx_dam_image::previewImgTag($row, '', 'align="middle"'); $thumbDescr = '<div class="nobr">'.$fileIcon.$title.'<br />'.$row['file_name'].'</div>'; $thumbsnails .= '<tr><td>'.$thumb.'</td><td>'.$thumbDescr.'</td></tr>'; } $thumbsnails = '<table border="0">'.$thumbsnails.'</table>'; } */ // Creating the element: $params = array('size' => intval($config['size']), 'dontShowMoveIcons' => $maxitems <= 1, 'autoSizeMax' => t3lib_div::intInRange($config['autoSizeMax'], 0), 'maxitems' => $maxitems, 'style' => isset($config['selectedListStyle']) ? ' style="' . htmlspecialchars($config['selectedListStyle']) . '"' : ' style="' . $this->tceforms->defaultMultipleSelectorStyle . '"', 'info' => $info, 'thumbnails' => $thumbsnails, 'readOnly' => $disabled); // Extra parameter for DAM element browser $user_eb_param = $config['allowed_types']; $item .= $this->dbFileIcons($PA['itemFormElName'], 'db', implode(',', $tempFT_db), $itemArray, '', $params, $PA['onFocus'], $user_eb_param); break; } // Wizards: if (!$disabled) { $specConf = $this->tceforms->getSpecConfFromString($PA['extra'], $PA['fieldConf']['defaultExtras']); $altItem = '<input type="hidden" name="' . $PA['itemFormElName'] . '" value="' . htmlspecialchars($PA['itemFormElValue']) . '" />'; $item = $this->tceforms->renderWizards(array($item, $altItem), $config['wizards'], $table, $row, $field, $PA, $PA['itemFormElName'], $specConf); } return $item; }
/** * Returns the html for the image(s) in the listView * * @param string $imgFieldContent: Content of the image field * @return string the whole img code */ function makeListImageCode($imgFieldContent, $type = null) { // dam_ttnews compatible, no extra configuration needed // sponsored by phase2-networks.com $damOn = t3lib_extMgm::isLoaded($key = 'dam_ttnews'); if ($damOn) { $damFiles = tx_dam_db::getReferencedFiles('tt_news', $this->getFieldContent('uid'), 'tx_damnews_dam_images'); if (is_array($damFiles['files'])) { $image = current($damFiles['files']); } } if (!$imgFieldContent && (!$image && $damOn)) { return ''; } else { $altText = ""; $titleText = ""; $caption = ""; $caption = explode(chr(10), $this->getFieldContent('imagecaption')); $caption = $caption[0]; $altText = explode(chr(10), $this->getFieldContent('imagealttext')); $altText = $altText[0]; $titleText = explode(chr(10), $this->getFieldContent('imagetitletext')); $titleText = $titleText[0]; //rvvn : gregory goidin : allow the user to use some data in TS => images titleText $this->cObj->data['tx_newssdf_caption'] = $caption; if (!$damOn) { $imagesArray = explode(",", $imgFieldContent); $image = $this->uploadFolder . $imagesArray['0']; } if ($type != 'calendar') { //rvvn : gregory goidin : add image alttext and titletext $conf = $this->conf['listView.']['image.']; $conf['altText'] = $altText; $conf['titleText'] = $titleText; $imgCode = $this->cObj->cImage($image, $conf); } else { //rvvn : gregory goidin : add image alttext and titletext $conf = $this->conf['calendar.']['image.']; $conf['altText'] = $altText; $conf['titleText'] = $titleText; $imgCode = $this->cObj->cImage($image, $conf); } return $imgCode; } }