00001 <?php 00016 class SMWErrorValue extends SMWDataValue { 00017 00018 public function __construct( $typeid, $errormsg = '', $uservalue = '', $caption = false ) { 00019 parent::__construct( $typeid ); 00020 $this->m_caption = ( $caption !== false ) ? $caption : $uservalue; 00021 if ( $errormsg !== '' ) { 00022 $this->addError( $errormsg ); 00023 } 00024 } 00025 00026 protected function parseUserValue( $value ) { 00027 if ( $this->m_caption === false ) { 00028 $this->m_caption = $value; 00029 } 00030 $this->addError( wfMsgForContent( 'smw_parseerror' ) ); 00031 } 00032 00038 protected function loadDataItem( SMWDataItem $dataItem ) { 00039 if ( $dataItem->getDIType() == SMWDataItem::TYPE_ERROR ) { 00040 $this->addError( $dataItem->getErrors() ); 00041 $this->m_caption = $this->getErrorText(); 00042 return true; 00043 } else { 00044 return false; 00045 } 00046 } 00047 00048 public function getShortWikiText( $linked = null ) { 00049 return $this->m_caption; 00050 } 00051 00052 public function getShortHTMLText( $linker = null ) { 00053 return htmlspecialchars( $this->getShortWikiText( $linker ) ); 00054 } 00055 00056 public function getLongWikiText( $linked = null ) { 00057 return $this->getErrorText(); 00058 } 00059 00060 public function getLongHTMLText( $linker = null ) { 00061 return $this->getErrorText(); 00062 } 00063 00064 public function getWikiValue() { 00065 return $this->m_dataitem->getString(); 00066 } 00067 00068 public function isValid() { 00069 return false; 00070 } 00071 00072 }
1.5.6