Skip to content

Commit

Permalink
Add dataframe as component in search functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-render committed Oct 12, 2022
1 parent a5be576 commit 3b13ef2
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/dedalo/dataframe/class.dataframe.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
*
*/
class dataframe extends common {
class dataframe extends component_relation_common {

public $tipo;

Expand Down Expand Up @@ -66,7 +66,7 @@ public function get_html() {

/**
* GET_AR_CHILDRENS : private alias of RecordObj_dd::get_ar_recursive_childrens
* Note th use of $ar_exclude_models to exclude not desired section elements, like auxiliar structure terms that are not necesary here
* Note the use of $ar_exclude_models to exclude not desired section elements, like auxiliary structure terms that are not necessary here
*/
public function get_ar_childrens() {
#$RecordObj_dd = new RecordObj_dd($tipo);
Expand Down
30 changes: 30 additions & 0 deletions lib/dedalo/search/class.search_development2.php
Original file line number Diff line number Diff line change
Expand Up @@ -3333,6 +3333,36 @@ public static function get_components_from_section($ar_section_tipo, $path=[], $
// Add element
$ar_result[] = $element;

if( $modelo_name==='component_autocomplete'){
$RecordObj_dd = new RecordObj_dd($component_tipo);
$propiedades = $RecordObj_dd->get_propiedades(true);

if(isset($propiedades->dataframe)){
$dataframe = $propiedades->dataframe[0];

// element object base
$df_element = new stdClass();
$df_element->section_group_tipo = $section_group_tipo;
$df_element->section_group_model = $section_group_model;
$df_element->section_group_label = $section_group_label;
$df_element->section_tipo = $section_tipo;
$df_element->section_label = $section_label;
$df_element->component_tipo = $dataframe->tipo;
$df_element->component_label = $element->component_label. ' ' .RecordObj_dd::get_termino_by_tipo($dataframe->type, DEDALO_DATA_LANG , true, true);
$df_element->path = $path;
$df_element->has_subquery = false; // Default (changes when component_portal/component_autocomplete)
$df_element->target_section = false; // Default (changes when component_portal/component_autocomplete)
$df_element->ar_tipo_exclude_elements = false; // default (changes when component_portal/component_autocomplete and ar_terminos_relacionados_to_exclude)
// Add modelo_name
$df_element->modelo_name = 'dataframe';

// Add element
$ar_result[] = $df_element;

}


}

// store as added to avoid duplicates
$ar_added_components[] = $component_tipo;
Expand Down
6 changes: 6 additions & 0 deletions lib/dedalo/search/trigger.search2.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ function load_components($json_data) {

$component_tipo = $component_info->component_tipo;
$modelo_name = RecordObj_dd::get_modelo_name_by_tipo($component_info->component_tipo,true);
if($modelo_name === 'dataframe'){
$ar_children = section::get_ar_children_tipo_by_modelo_name_in_section($component_info->component_tipo, ['component'], $from_cache=true, $resolve_virtual=true, $recursive=false, $search_exact=false);
$component_info->component_tipo = $ar_children[0];
$modelo_name = RecordObj_dd::get_modelo_name_by_tipo($component_info->component_tipo,true);
$component_info->modo = "dataframe_search";
}
$component = component_common::get_instance(
$modelo_name,
$component_info->component_tipo,
Expand Down

0 comments on commit 3b13ef2

Please sign in to comment.