00001 <?php
00007 class STransMediaFile 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_file';
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('class');
00045 if($opt != "") $params['class'] = $opt;
00046 $opt = $si->getOption('style');
00047 if($opt != "") $params['style'] = $opt;
00048 $opt = $si->getOption('width');
00049 if($opt != "") $params['width'] = $opt;
00050 $opt = $si->getOption('height');
00051 if($opt != "") $params['height'] = $opt;
00052 $opt = $si->getOption('title');
00053 if($opt != "") $params['title'] = $opt;
00054
00055 $html = $version->getContentModule()->getHTML($params);
00056
00057 if($html === false)
00058 $html = "<div style=\"padding: 4px; border: 1px solid black; "
00059 . "background-color: #E0E0E0; width: 8em; text-align: center;\">No Content</div>";
00060
00061 $this->sendToTarget($si, $html);
00062
00063 return true;
00064 }
00065 }
00066
00067 ?>