예제 #1
0
 /**
  *
  */
 public function __construct($ps_source = null, $pa_options = null)
 {
     parent::__construct($ps_source, $pa_options);
     $this->ops_title = _t('Base XML data reader');
     $this->ops_display_name = _t('Base XML data reader');
     $this->ops_description = _t('Provides basic XML functions for all XML-format data readers');
     $this->opa_formats = array();
 }
예제 #2
0
 /**
  *
  */
 public function __construct($ps_source = null, $pa_options = null)
 {
     parent::__construct($ps_source, $pa_options);
     $this->ops_title = _t('EXIF data reader');
     $this->ops_display_name = _t('Embedded EXIF media metadata');
     $this->ops_description = _t('Reads Embedded EXIF Media Metadata');
     $this->opa_formats = array('exif');
     // must be all lowercase to allow for case-insensitive matching
 }
예제 #3
0
 /**
  *
  */
 public function __construct($ps_source = null, $pa_options = null)
 {
     parent::__construct($ps_source, $pa_options);
     $this->ops_title = _t('MySQL data reader');
     $this->ops_display_name = _t('MySQL database');
     $this->ops_description = _t('Reads data from MySQL databases');
     $this->opa_formats = array('mysql');
     // must be all lowercase to allow for case-insensitive matching
 }
예제 #4
0
 /**
  *
  */
 public function __construct($ps_source = null, $pa_options = null)
 {
     parent::__construct($ps_source, $pa_options);
     $this->ops_title = _t('Excel XLSX data reader');
     $this->ops_display_name = _t('Excel XLS/XLSX');
     $this->ops_description = _t('Reads Microsoft Excel XLSX files');
     $this->opa_formats = array('xlsx');
     // must be all lowercase to allow for case-insensitive matching
 }
 /**
  *
  */
 public function __construct($ps_source = null, $pa_options = null)
 {
     parent::__construct($ps_source, $pa_options);
     $this->ops_title = _t('CollectiveAccess data reader');
     $this->ops_display_name = _t('CollectiveAccess database');
     $this->ops_description = _t('Reads data from CollectiveAccess databases via web services');
     $this->opa_formats = array('collectiveaccess');
     // must be all lowercase to allow for case-insensitive matching
     $this->opo_datamodel = Datamodel::load();
 }
 /**
  *
  */
 public function __construct($ps_source = null, $pa_options = null)
 {
     parent::__construct($ps_source, $pa_options);
     $this->ops_title = _t('Base Delimited data reader');
     $this->ops_display_name = _t('Base delimited data reader');
     $this->ops_description = _t('Provides basic functions for all delimited data readers');
     $this->opa_formats = array();
     $this->opa_properties['delimiter'] = $this->ops_delimiter;
     $this->opo_parser = new DelimitedDataParser($this->ops_delimiter);
 }
예제 #7
0
 /**
  * 
  * 
  * @param mixed $ps_spec MARC code/MARC subcode/indicators
  * @param array $pa_options
  *		delimiter = 
  * @return mixed
  */
 public function get($ps_spec, $pa_options = null)
 {
     if ($vm_ret = parent::get($ps_spec, $pa_options)) {
         return $vm_ret;
     }
     list($ps_code, $ps_subcode, $ps_indicators) = explode('/', $ps_spec);
     if (!isset($this->opa_rows[$this->opn_current_row])) {
         return null;
     }
     $vs_delimiter = isset($pa_options['delimiter']) ? $pa_options['delimiter'] : ';';
     $vs_ind1 = substr($ps_indicators, 0, 1);
     $vs_ind2 = substr($ps_indicators, 0, 2);
     $o_record = $this->opa_rows[$this->opn_current_row];
     if ($o_fields = $o_record->getFields($ps_code)) {
         $va_content = array();
         foreach ($o_fields as $o_field) {
             switch ($vs_class = get_class($o_field)) {
                 case 'File_MARC_Control_Field':
                     continue;
                     break;
                 default:
                     if (strlen($vs_ind1) && $vs_ind1 != $o_field->getIndicator(1)) {
                         continue;
                     }
                     if (strlen($vs_ind2) && $vs_ind2 != $o_field->getIndicator(2)) {
                         continue;
                     }
                     $o_subfield = $o_field->getSubfield($ps_subcode);
                     $va_content[] = is_object($o_subfield) ? $o_subfield->getData() : '';
                     break;
             }
         }
         return join($vs_delimiter, $va_content);
     }
     return null;
 }
예제 #8
0
 /**
  * 
  * 
  * @param string $ps_field
  * @param array $pa_options
  * @return mixed
  */
 public function get($ps_field, $pa_options = null)
 {
     if ($vm_ret = parent::get($ps_field, $pa_options)) {
         return $vm_ret;
     }
     if ($this->opn_current_row !== 0) {
         return null;
     }
     if (!is_array($this->opa_row_buf)) {
         return null;
     }
     $va_keys = explode("/", $ps_field);
     $va_ptr =& $this->opa_row_buf;
     foreach ($va_keys as $vs_key) {
         if ($vs_key = trim(strtolower($vs_key))) {
             if (!isset($va_ptr[$vs_key])) {
                 return null;
             }
             $va_ptr =& $va_ptr[$vs_key];
         }
     }
     if (caGetOption('returnAsArray', $pa_options, false)) {
         return is_array($va_ptr) ? $va_ptr : array($va_ptr);
     }
     return $va_ptr;
 }
 /**
  * 
  * 
  * @param string $ps_spec
  * @param array $pa_options
  * @return mixed
  */
 public function get($ps_spec, $pa_options = null)
 {
     if ($vm_ret = parent::get($ps_spec, $pa_options)) {
         return $vm_ret;
     }
     $vb_return_as_array = caGetOption('returnAsArray', $pa_options, false);
     $vs_delimiter = caGetOption('delimiter', $pa_options, ';');
     // Recondition the spec for Xpath
     $ps_spec = $this->_convertXPathExpression($ps_spec, array('useRootTag' => $this->ops_base_root_tag));
     if (!($o_node_list = @$this->opo_handle_xpath->query($ps_spec))) {
         return null;
     }
     $va_values = array();
     foreach ($o_node_list as $o_node) {
         $va_values[] = ($vs_xml = $this->getInnerXML($o_node)) ? $vs_xml : $o_node->nodeValue;
     }
     if ($vb_return_as_array) {
         return $va_values;
     }
     return join($vs_delimiter, $va_values);
 }
예제 #10
0
 /**
  * 
  * 
  * @param string $ps_spec
  * @param array $pa_options
  * @return mixed
  */
 public function get($ps_spec, $pa_options = null)
 {
     if ($vm_ret = BaseDataReader::get($ps_spec, $pa_options)) {
         return $vm_ret;
     }
     $vb_return_as_array = caGetOption('returnAsArray', $pa_options, false);
     $vs_delimiter = caGetOption('delimiter', $pa_options, ';');
     //$ps_spec = str_replace("/", "", $ps_spec);
     if ($this->opb_tag_names_as_case_insensitive) {
         $ps_spec = strtolower($ps_spec);
     }
     if (is_array($this->opa_row_buf) && $ps_spec && isset($this->opa_row_buf[$ps_spec])) {
         if ($vb_return_as_array) {
             return $this->opa_row_buf[$ps_spec];
         } else {
             return join($vs_delimiter, $this->opa_row_buf[$ps_spec]);
         }
     }
     return null;
 }
 /**
  * 
  * 
  * @param mixed $pn_col
  * @param array $pa_options
  * @return mixed
  */
 public function get($ps_col, $pa_options = null)
 {
     if ($vm_ret = parent::get($ps_col, $pa_options)) {
         return $vm_ret;
     }
     $pb_return_as_array = isset($pa_options['returnAsArray']) ? (bool) $pa_options['returnAsArray'] : false;
     $pa_restrict_to_relationship_types = isset($pa_options['restrictToRelationshipTypes']) ? $pa_options['restrictToRelationshipTypes'] : false;
     if (!is_array($pa_restrict_to_relationship_types) && $pa_restrict_to_relationship_types) {
         $pa_restrict_to_relationship_types = array($pa_restrict_to_relationship_types);
     }
     $pb_return_all_locales = isset($pa_options['returnAllLocales']) ? (bool) $pa_options['returnAllLocales'] : false;
     $pb_convert_codes_to_display_text = isset($pa_options['convertCodesToDisplayText']) ? (bool) $pa_options['convertCodesToDisplayText'] : false;
     $vs_delimiter = isset($pa_options['delimiter']) ? (string) $pa_options['delimiter'] : "; ";
     $va_col = explode(".", $ps_col);
     $va_data = $this->opa_row_buf[$this->opn_current_row];
     if ($va_col[0] == $this->ops_table) {
         // field in this table
         if (!$pb_return_all_locales) {
             $va_data['attributes'] = caExtractValuesByUserLocale($va_data['attributes']);
             $va_tmp = caExtractValuesByUserLocale(array($va_data['preferred_labels']));
             $va_data['preferred_labels'] = array_pop($va_tmp);
         }
         switch (sizeof($va_col)) {
             // ------------------------------------------------------------------------------------------------
             case 2:
                 if ($va_col[1] == 'preferred_labels') {
                     // figure out what the display field is
                     if ($t_instance = $this->opo_datamodel->getInstanceByTableName($va_col[0], true)) {
                         $vs_display_field = $t_instance->getLabelDisplayField();
                         return $va_data['preferred_labels'][$vs_display_field];
                     }
                     return null;
                 }
                 // try intrinsic
                 if (isset($va_data['intrinsic'][$va_col[1]])) {
                     if ($pb_convert_codes_to_display_text && isset($va_data['intrinsic'][$va_col[1] . '_display'])) {
                         $vs_val = $va_data['intrinsic'][$va_col[1] . '_display'];
                     } else {
                         $vs_val = $va_data['intrinsic'][$va_col[1]];
                     }
                     if ($pb_return_as_array) {
                         if ($pb_return_all_locales) {
                             return array($va_data['locale'] => array(0 => $vs_val));
                         } else {
                             return array(0 => $vs_val);
                         }
                     } else {
                         return $va_data['intrinsic'][$va_col[1]];
                     }
                 }
                 if (isset($va_data['attributes'][$va_col[1]]) && is_array($va_data['attributes'][$va_col[1]]) && sizeof($va_data['attributes'][$va_col[1]])) {
                     $va_vals = array();
                     foreach ($va_data['attributes'][$va_col[1]] as $vn_i => $va_val) {
                         if ($pb_convert_codes_to_display_text && isset($va_val[$va_col[1] . '_display'])) {
                             $vs_val = $va_val[$va_col[1] . '_display'];
                         } else {
                             $vs_val = $va_val[$va_col[1]];
                         }
                         if ($pb_return_as_array && $pb_return_all_locales) {
                             $va_vals[$va_val['locale']][] = $vs_val;
                         } else {
                             $va_vals[] = $vs_val;
                         }
                     }
                     if ($pb_return_as_array) {
                         return $va_vals;
                     } else {
                         return join($vs_delimiter, $va_vals);
                     }
                 }
                 break;
                 // ------------------------------------------------------------------------------------------------
             // ------------------------------------------------------------------------------------------------
             case 3:
                 if ($va_col[1] == 'preferred_labels') {
                     // figure out what the display field is
                     if (isset($va_data['preferred_labels'][$va_col[2]])) {
                         return $va_data['preferred_labels'][$va_col[2]];
                     }
                     return null;
                 }
                 if (isset($va_data['attributes'][$va_col[1]]) && is_array($va_data['attributes'][$va_col[1]]) && sizeof($va_data['attributes'][$va_col[1]])) {
                     $va_vals = array();
                     foreach ($va_data['attributes'][$va_col[1]] as $vn_i => $va_val) {
                         if ($pb_convert_codes_to_display_text && isset($va_val[$va_col[2] . '_display'])) {
                             $vs_val = $va_val[$va_col[2] . '_display'];
                         } else {
                             $vs_val = $va_val[$va_col[2]];
                         }
                         if ($pb_return_as_array && $pb_return_all_locales) {
                             $va_vals[$va_val['locale']][] = $vs_val;
                         } else {
                             $va_vals[] = $vs_val;
                         }
                     }
                     if ($pb_return_as_array) {
                         return $va_vals;
                     } else {
                         return join($vs_delimiter, $va_vals);
                     }
                 }
                 break;
                 // ------------------------------------------------------------------------------------------------
         }
         return null;
     } else {
         //
         // Object representations
         //
         if ($va_col[0] == 'ca_object_representations' && $va_col[1] == 'media' && $this->ops_table == 'ca_objects') {
             $va_urls = array();
             foreach ($va_data['representations'] as $vn_rep_id => $va_rep_data) {
                 if ($va_rep_data['urls']['original']) {
                     $va_urls[] = $va_rep_data['urls']['original'];
                 }
             }
             if (sizeof($va_urls) > 0) {
                 return join($vs_delimiter, $va_urls);
             }
             // if urls in "representations" block aren't set it might be an old services implementation
             // so we fall through and try to get it with a regular "get"
         }
         //
         // Related
         //
         if (!isset($va_data['related'][$va_col[0]])) {
             return null;
         }
         $va_rel_data = $va_data['related'][$va_col[0]];
         switch (sizeof($va_col)) {
             // ------------------------------------------------------------------------------------------------
             case 2:
                 if ($va_col[1] == 'preferred_labels') {
                     // figure out what the display field is
                     if ($t_instance = $this->opo_datamodel->getInstanceByTableName($va_col[0], true)) {
                         $vs_display_field = $t_instance->getLabelDisplayField();
                         $va_rels = array();
                         foreach ($va_rel_data as $vn_i => $va_rel) {
                             if (is_array($pa_restrict_to_relationship_types) && !in_array($va_rel['relationship_typename'], $pa_restrict_to_relationship_types)) {
                                 continue;
                             }
                             $va_rels[] = $va_rel['preferred_labels'][$vs_display_field];
                         }
                         if ($pb_return_as_array) {
                             return $va_rels;
                         } else {
                             return join($vs_delimiter, $va_rels);
                         }
                     }
                     return null;
                 }
                 // try intrinsic
                 $va_rels = array();
                 foreach ($va_rel_data as $vn_i => $va_rel) {
                     if (is_array($pa_restrict_to_relationship_types) && !in_array($va_rel['relationship_typename'], $pa_restrict_to_relationship_types)) {
                         continue;
                     }
                     if (isset($va_rel['intrinsic'][$va_col[1]])) {
                         if ($pb_convert_codes_to_display_text && isset($va_rel['intrinsic'][$va_col[1] . '_display'])) {
                             $va_rels[] = $va_rel['intrinsic'][$va_col[1] . '_display'];
                         } else {
                             $va_rels[] = $va_rel['intrinsic'][$va_col[1]];
                         }
                     } elseif (isset($va_rel[$va_col[1]])) {
                         if ($pb_convert_codes_to_display_text && isset($va_rel[$va_col[1] . '_display'])) {
                             $va_rels[] = $va_rel[$va_col[1] . '_display'];
                         } else {
                             $va_rels[] = $va_rel[$va_col[1]];
                         }
                     }
                 }
                 if ($pb_return_as_array) {
                     return $va_rels;
                 } else {
                     return join($vs_delimiter, $va_rels);
                 }
                 break;
                 // ------------------------------------------------------------------------------------------------
             // ------------------------------------------------------------------------------------------------
             case 3:
                 if ($va_col[1] == 'preferred_labels') {
                     // figure out what the display field is
                     if ($t_instance = $this->opo_datamodel->getInstanceByTableName($va_col[0], true)) {
                         $va_rels = array();
                         foreach ($va_rel_data as $vn_i => $va_rel) {
                             if (is_array($pa_restrict_to_relationship_types) && !in_array($va_rel['relationship_typename'], $pa_restrict_to_relationship_types)) {
                                 continue;
                             }
                             $va_rels[] = $va_rel['preferred_labels'][$va_col[2]];
                         }
                         if ($pb_return_as_array) {
                             return $va_rels;
                         } else {
                             return join($vs_delimiter, $va_rels);
                         }
                     }
                     return null;
                 }
                 break;
                 // ------------------------------------------------------------------------------------------------
         }
         return null;
     }
     return null;
 }
예제 #12
0
 /**
  * 
  * 
  * @param mixed $pn_col
  * @param array $pa_options
  * @return mixed
  */
 public function get($pn_col, $pa_options = null)
 {
     if ($vm_ret = parent::get($pn_col, $pa_options)) {
         return $vm_ret;
     }
     if (!is_numeric($pn_col)) {
         $pn_col = PHPExcel_Cell::columnIndexFromString($pn_col);
     }
     if (is_array($this->opa_row_buf) && (int) $pn_col > 0 && (int) $pn_col <= sizeof($this->opa_row_buf)) {
         return $this->opa_row_buf[(int) $pn_col];
     }
     return null;
 }
예제 #13
0
 /**
  * 
  * 
  * @param mixed $pn_col
  * @param array $pa_options
  * @return mixed
  */
 public function get($ps_col, $pa_options = null)
 {
     if ($vm_ret = parent::get($ps_col, $pa_options)) {
         return $vm_ret;
     }
     $va_col = explode(".", $ps_col);
     if (sizeof($va_col) == 1) {
         return isset($this->opa_row_buf[$ps_col]) ? $this->opa_row_buf[$ps_col] : null;
     }
     if (sizeof($va_col) > 1 && $va_col[0] == $this->ops_table) {
         return isset($this->opa_row_buf[$va_col[1]]) ? $this->opa_row_buf[$va_col[1]] : null;
     }
     // TODO: pull related rows?
     return null;
 }
 /**
  * 
  * 
  * @param string $ps_spec
  * @param array $pa_options
  * @return mixed
  */
 public function get($ps_spec, $pa_options = null)
 {
     if ($vm_ret = parent::get($ps_spec, $pa_options)) {
         return $vm_ret;
     }
     $vb_return_as_array = caGetOption('returnAsArray', $pa_options, false);
     $vs_delimiter = caGetOption('delimiter', $pa_options, ';');
     $vs_value = $this->opo_parser->getRowValue($ps_spec);
     if ($vb_return_as_array) {
         return array($vs_value);
     }
     return $vs_value;
 }