Esempio n. 1
0
 private static function getElementType($pa_element_info)
 {
     $va_table_fields = $va_element_opts = array();
     $vn_element_id = $pa_element_info['element_id'];
     switch ($pa_element_info['datatype']) {
         case 0:
             //container
             /* Retrieve child elements of the container. */
             $t_element = new ca_metadata_elements((int) $pa_element_info['element_id']);
             if ($t_element->getPrimaryKey()) {
                 $va_children = $t_element->getElementsInSet();
                 foreach ($va_children as $va_child) {
                     if ($va_child['element_id'] == $vn_element_id) {
                         continue;
                     }
                     $va_table_fields += SolrConfiguration::getElementType($va_child);
                 }
             }
             break;
         case 1:
             // text
         // text
         case 3:
             // list
         // list
         case 5:
             // url
         // url
         case 6:
             // currency
         // currency
         case 8:
             // length
         // length
         case 9:
             // weight
         // weight
         case 13:
             // LCSH
         // LCSH
         case 14:
             // geonames
         // geonames
         case 15:
             // file
         // file
         case 16:
             // media
         // media
         case 19:
             // taxonomy
         // taxonomy
         case 20:
             // information service
             $va_element_opts['type'] = 'text';
             break;
         case 2:
             // daterange
             $va_element_opts['type'] = 'daterange';
             $va_table_fields['_ca_attribute_' . $vn_element_id . '_text'] = array('type' => 'text');
             break;
         case 4:
             // geocode
             $va_element_opts['type'] = 'geocode';
             $va_table_fields['_ca_attribute_' . $vn_element_id . '_text'] = array('type' => 'text');
             break;
         case 10:
             // timecode
         // timecode
         case 12:
             // numeric/float
             $va_element_opts['type'] = 'float';
             break;
         case 11:
             // integer
             $va_element_opts['type'] = 'int';
             break;
         default:
             $va_element_opts['type'] = 'text';
             break;
     }
     $va_table_fields['_ca_attribute_' . $vn_element_id] = $va_element_opts;
     return $va_table_fields;
 }