24 if ( !isset($this->attributes) ){
32 if ( !isset($atts[$name]) ){
45 if ( !isset($ontologies[$type]) ){
48 import($ontologies[$type][
'path']);
49 $class = $ontologies[$type][
'class'];
56 $ontologies[$type] = array(
'type'=>$type,
'path'=>
$path,
'class'=>$class);
61 static $ontologies = 0;
62 if ( $ontologies === 0 ) $ontologies = array();
67 trigger_error(
"Please implement the ".__FUNCTION__.
" method", E_USER_ERROR);
71 if ( !isset($this->fieldnames) ){
80 if ( !isset($this->fieldnames) ){
81 throw new Exception(
"The fieldnames array has not been set so there is a problem with this Ontology. An ontology should populate the fieldNames array inside its buildAttributes() method. If it does not, then there is a problem.",
DATAFACE_E_ERROR);
83 return @$this->fieldnames[$attname];
95 function _is($method, $attname){
96 return $this->table->$method(
112 function validate($attname, $value, $allowBlanks=
true){
113 if ( method_exists($this,
'validate_'.$attname) ){
114 $method =
'validate_'.$attname;
115 return $this->$method($value, $allowBlanks);
117 if ( !$allowBlanks and !trim($value) )
return false;
122 function getType($attname){
return $this->
_is(
'getType', $attname);}
123 function isDate($attname){
return $this->
_is(
'isDate', $attname);}
124 function isBlob($attname){
return $this->
_is(__FUNCTION__, $attname);}
127 function isText($attname){
return $this->
_is(__FUNCTION__, $attname);}
128 function isXML($attname){
return $this->
_is(__FUNCTION__, $attname);}
129 function isChar($attname){
return $this->
_is(__FUNCTION__, $attname);}
130 function isInt($attname){
return $this->
_is(__FUNCTION__, $attname);}
131 function isFloat($attname){
return $this->
_is(__FUNCTION__, $attname);}
145 function _get($method, $attname){
146 return $this->record->$method(
147 $this->ontology->getFieldname($attname)
153 function display($attname){
return $this->
_get(
'display',$attname);}
154 function q($attname){
return $this->
_get(
'q', $attname);}
155 function qq($attname){
return $this->
_get(
'qq', $attname);}
156 function strval($attname){
return $this->
_get(
'strval', $attname);}