$size = 'width="' . $width . '" '; } else { $width = '100%'; } if (array_key_exists('height', $_REQUEST)) { $height = $_REQUEST['height']; $size = $size . ' height="' . $height . '"'; } else { $height = '100%'; } if ($type_source == 'youtube') { print linkifyYouTubeURLs($filedata['URL'], $size); //returns iframe } else { if ($type_source == 'gdrive') { print linkifyGoogleDriveURLs($filedata['URL'], $size); //returns iframe } else { if ($type_media == 'image') { $size = 'width="' . $width . '" height="' . $height . '"'; $annot_edit = $isannotation_editor ? '&annedit=yes' : ''; $text = '<iframe ' . $size . ' src="' . HEURIST_BASE_URL . 'records/files/mediaViewer.php?ulf_ID=' . $_REQUEST['ulf_ID'] . $annot_edit . '&db=' . $_REQUEST['db'] . '" frameborder="0"></iframe>'; print $text; } else { if ($type_media == 'document' && $filedata['mimeType']) { print '<embed width="100%" height="80%" name="plugin" src="' . $filedata['URL'] . '" type="' . $filedata['mimeType'] . '" />'; } else { if ($type_media == 'video') { $size = ' height="280" width="420" '; print createVideoTag2($filedata['URL'], $filedata['mimeType'], $size); } else {
function smarty_function_wrap($params, &$smarty) { if ($params['var']) { if (array_key_exists('dt', $params)) { $dt = $params['dt']; } if (array_key_exists('mode', $params)) { $mode = $params['mode']; } else { $mode = null; } $label = ""; if (array_key_exists('lbl', $params) && $params['lbl'] != "") { $label = $params['lbl']; } $width = ""; $mapsize = "width=200"; if (array_key_exists('width', $params) && $params['width'] != "") { $width = $params['width']; if (is_numeric($width) < 0) { $width = $width . "px"; $mapsize = "width=" . $width; } } $height = ""; if (array_key_exists('height', $params) && $params['height'] != "") { $height = $params['height']; if (is_numeric($height) < 0) { $height = $height . "px"; $mapsize = $mapsize . "&height=" . $height; } } if (!(strpos($mapsize, "&") > 0)) { $mapsize = $mapsize . "&height=200"; } $size = ""; if ($width == "" && $height == "") { $size = "width=" . ($dt == 'geo' ? "200px" : "'300px'"); } else { if ($width != "") { $size = "width='" . $width . "'"; } if ($height != "") { $size = $size . " height='" . $height . "'"; } } if ($dt == "url") { return "<a href='" . $params['var'] . "' target='_blank'>" . $params['var'] . "</a>"; } else { if ($dt == "file") { //insert image or link $values = $params['var']; $limit = intval(@$params['limit']); $sres = ""; if (!is_array($values) || !array_key_exists(0, $values)) { $values = array($values); } foreach ($values as $idx => $value) { if ($limit > 0 && $idx >= $limit) { break; } $type_media = $value['mediaType']; if ($mode == "thumbnail") { $sres = $sres . "<a href='" . ($value['playerURL'] ? $value['playerURL'] : $value['URL']) . "' target='_blank'>" . "<img src='" . $value['thumbURL'] . "' title='" . $value['description'] . "'/></a>"; } else { if ($mode == "player") { if ($type_media == 'image') { $sres = $sres . "<img src='" . $value['URL'] . "' " . $size . " title='" . $value['description'] . "'/>"; //.$value['origName']; } else { if ($value['remoteSource'] == 'youtube') { $sres = $sres . linkifyYouTubeURLs($value['URL'], $size); } else { if ($value['remoteSource'] == 'gdrive') { $sres = $sres . linkifyGoogleDriveURLs($value['URL'], $size); } else { if ($type_media == 'document' && $value['mimeType']) { $sres = $sres . '<embed $size name="plugin" src="' . $value['URL'] . '" type="' . $value['mimeType'] . '" />'; } else { if ($type_media == 'video') { // UNFORTUNATELY HTML5 rendering does not work properly // $sres = $sres.createVideoTag($value['URL'], $value['mimeType'], $size); $sres = $sres . createVideoTag2($value['URL'], $value['mimeType'], $size); } else { if ($type_media == 'audio') { $sres = $sres . createAudioTag($value['URL'], $value['mimeType']); } else { $sres = $sres . "Unsupported media type " . $type_media; } } } } } } } else { $lurl = strtolower($value['URL']); if ($value['remoteSource'] == 'youtube') { $sres = $sres . linkifyYouTubeURLs($value['URL'], $size); } else { if ($value['remoteSource'] == 'gdrive') { $sres = $sres . linkifyGoogleDriveURLs($value['URL'], $size); } else { if ($type_media == 'image' || strpos($lurl, ".jpg") > 0 || strpos($lurl, ".png") > 0 || strpos($lurl, ".gif") > 0) { $sres = $sres . "<img src='" . $value['URL'] . "' " . $size . " title='" . $value['description'] . "'/>"; //.$value['origName']; } else { $sres = $sres . "<a href='" . $value['URL'] . "' target='_blank' title='" . $value['description'] . "'>" . $value['origName'] . "</a>"; } } } } } } return $sres; } else { if ($dt == 'geo') { $value = $params['var']; $res = ""; if ($value && $value['wkt']) { $geom = geoPHP::load($value['wkt'], 'wkt'); if (!$geom->isEmpty()) { if (array_key_exists('mode', $params) && $params['mode'] == "link") { $point = $geom->centroid(); if ($label == "") { $label = "on map"; } $res = '<a href="http://maps.google.com/maps?z=18&q=' . $point->y() . "," . $point->x() . '" target="_blank">' . $label . "</a>"; } else { $recid = $value['recid']; $url = HEURIST_BASE_URL . "viewers/map/showMapUrl.php?" . $mapsize . "&q=ids:" . $recid . "&db=" . HEURIST_DBNAME; //"&t="+d; return "<img src=\"" . $url . "\" " . $size . "/>"; } } } return $res; } else { if ($label != "") { $label = $label . ": "; } return $label . $params['var'] . '<br/>'; } } } } else { return ''; } }