00001 <?php
00011 class STransObject extends STrans
00012 {
00016 const MINIMAL = 1;
00017 const COMPACT = 2;
00018 const FULL = 3;
00019
00023 protected $XMLObj = "";
00024
00029 public function doc() {
00030 return "STransObject is the parent translator class for all PR2 translators"
00031 . " that take data objects as input and generate HTML output";
00032 }
00033
00034
00035
00036
00037
00042 public function getInFormat() {
00043 return 'object';
00044 }
00045
00050 public function getOutFormat() {
00051 return 'html';
00052 }
00053
00058 public function translate ($si)
00059 {
00060
00061 $object = $si->getSource();
00062
00063 if ($object == null){
00064 $this->setPrettyError("No object instance was provided for translation with input " . $input->getName());
00065 return false;
00066 }
00067
00068
00069 if (!is_callable(array($object, 'hasError'))){
00070
00071
00072
00073 $this->setWarning("Object of type " . get_class($object) . " passed to translator "
00074 . get_class($this) . " does not support standard Shodor error checking.");
00075 } else {
00076
00077
00078
00079 if ($object->hasError()) {
00080 $this->setPrettyError('translate', "Canceling translation of object type " . get_class($object)
00081 . " which has the following errors:");
00082 $this->setError($object->getError());
00083 return false;
00084 }
00085 }
00086
00087
00088
00089
00090 return true;
00091 }
00092 }