00001 <?php
00007 class STransMediaDocument extends STrans
00008 {
00013 public function doc() {
00014 return "STransMediaImage translates SNAP2 image resources into "
00015 . "embeddable HTML.";
00016 }
00017
00022 public function getInFormat() {
00023 return 'media_document';
00024 }
00025
00030 public function getOutFormat() {
00031 return 'html';
00032 }
00033
00039 public function translate($si) {
00040 $version = $si->getOption('_version');
00041 $resource = $si->getOption('_resource');
00042
00043 $params = array();
00044 $opt = $si->getOption('embed');
00045 if($opt != "") $params['embed'] = $opt;
00046 $opt = $si->getOption('class');
00047 if($opt != "") $params['class'] = $opt;
00048 $opt = $si->getOption('style');
00049 if($opt != "") $params['style'] = $opt;
00050 $opt = $si->getOption('width');
00051 if($opt != "") $params['width'] = $opt;
00052 $opt = $si->getOption('height');
00053 if($opt != "") $params['height'] = $opt;
00054 $opt = $si->getOption('title');
00055 if($opt != "") $params['title'] = $opt;
00056
00057 $html = $version->getContentModule()->getHTML($params);
00058
00059 if($html === false)
00060 $html = "<div style=\"padding: 4px; border: 1px solid black; "
00061 . "background-color: #E0E0E0; width: 8em; text-align: center;\">No Content</div>";
00062
00063 $this->sendToTarget($si, $html);
00064
00065 return true;
00066 }
00067 }
00068
00069 ?>