Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

saved search fix,bio details hotfix;

  • Loading branch information...
commit 7a301f45514362003fbbc3cba3a582178992e0da 1 parent db6a390
@hmayaktigranyan hmayaktigranyan authored
View
4 inc/lib_util.inc
@@ -219,7 +219,7 @@ function get_record_url($record_number, $entity, $url_type = "view") {
case 'supporting_docs_meta':
return "index.php?mod=docu&act=edit_document&doc_id=$record_number";
case 'biographic_details':
- return "index.php?mod=person&act=biography_list&type=rp&biography_id=$record_number";
+ return "index.php?mod=person&act=biography_list&type=bd&biography_id=$record_number";
default:
return;
}
@@ -277,7 +277,7 @@ function get_record_url($record_number, $entity, $url_type = "view") {
case 'supporting_docs_meta':
return "index.php?mod=docu&act=view_document&doc_id=$record_number";
case 'biographic_details':
- return "index.php?mod=person&act=biography_list&type=rp&biography_id=$record_number";
+ return "index.php?mod=person&act=biography_list&type=bd&biography_id=$record_number";
default:
return;
}
View
1  mod/analysis/analysisModule.class.php
@@ -696,7 +696,6 @@ public function generateSqlforEntity($entity_type, $shuffle = false, $dataArrayO
break;
}
-
//var_dump('person address' , $dataArray ) ;
if (get_table_for_entity($entity_type) == 'person' && isset($dataArray['person_addresses'])) {
View
80 mod/person/personModule.class.php
@@ -108,7 +108,7 @@ public function act_new_person() {
form_objects($this->person_form, $person);
$person->deceased = ($person->deceased == 'on') ? 'y' : 'n';
-
+
if (isset($person->number_of_persons_in_group) && !$person->number_of_persons_in_group) {
$person->number_of_persons_in_group = Null;
}
@@ -227,16 +227,16 @@ function act_edit_person() {
if ($status_person) {
$person = new Person();
form_objects($person_form, $person);
-
+
$person->deceased = ($person->deceased == 'on') ? 'y' : 'n';
-
- if(isset($person->number_of_persons_in_group) && !$person->number_of_persons_in_group){
+
+ if (isset($person->number_of_persons_in_group) && !$person->number_of_persons_in_group) {
$person->number_of_persons_in_group = Null;
}
- if(isset($person->dependants) && !$person->dependants){
+ if (isset($person->dependants) && !$person->dependants) {
$person->dependants = Null;
}
-
+
$person->SaveAll();
$person->SavePicture();
$this->person = $person;
@@ -299,7 +299,7 @@ function act_browse() {
}
$this->result_pager = Browse::getExecuteSql($sqlStatement);
$this->columnValues = $this->result_pager->get_page_data();
-
+
$this->columnValues = set_links_in_recordset($this->columnValues, 'person');
set_huriterms_in_record_array($entity_type_form_results, $this->columnValues);
@@ -590,15 +590,69 @@ public function related_person_name($person_id) {
}
public function biography_list($person_id) {
- $this->biographics = Browse::getBiographyList($person_id);
- $this->biographics_reverse = Browse::getBiographyListReverse($person_id);
+ global $conf;
+ if($conf['subbrowse']['biography_list']) {
+ include_once APPROOT . 'inc/lib_form.inc';
+
+ //$notIn = acl_list_acts_permissons();
+ $notIn = 'allowed_records'; // passed to generateSql function to use the temporary table to find the allowed records
+ require_once(APPROOT . 'mod/analysis/analysisModule.class.php');
+ $analysisModule = new analysisModule();
+ $sqlStatement = $analysisModule->generateSqlforEntity('biographic_details', null, array('person'=>$person_id), 'browse');
+
+ $entity_type_form_results = generate_formarray('biographic_details', 'browse');
+ $entity_type_form_results['biographic_details_record_number']['type'] = 'text';
+ $field_list = array();
+ foreach ($entity_type_form_results as $field_name => $field) {
+ // Generates the view's Label list
+ $field_list[$field['map']['field']] = $field['label'];
+ }
+
+ foreach ($entity_type_form_results as $fieldName => &$field) {
+ $field['extra_opts']['help'] = null;
+ $field['label'] = null;
+ $field['extra_opts']['clari'] = null;
+ $field['extra_opts']['value'] = $_GET[$fieldName];
+ $field['extra_opts']['required'] = null;
+ $field['extra_opts']['class'] = "input-block-level";
+ }
+
+ $entity_fields_html = shn_form_get_html_fields($entity_type_form_results);
+ $htmlFields = array();
+ //iterate through the search fields, checking input values
+ foreach ($entity_type_form_results as $field_name => $x) {
+ // Generates the view's Label list
+ $htmlFields[$field_name] = $entity_fields_html[$field_name];
+ }
+
+ //var_dump($sqlStatement);
+ $this->result_pager = Browse::getExecuteSql($sqlStatement);
+ $this->columnValues = $this->result_pager->get_page_data();
+ $additionalurlfields = array();
+ $additionalurlfields["person"] = array("entity" => "person", "val" => "person");
+ $additionalurlfields["related_person"] = array("entity" => "person", "val" => "person");
+ $additionalurlfields["biographic_details_record_number"] = array("entity" => "biographic_details", "val" => "biographic_details_record_number");
+
+ $this->columnValues = set_links_in_recordset($this->columnValues, 'biographic_details', $additionalurlfields);
+ // var_dump($this->columnValues);exit;
+ set_huriterms_in_record_array($entity_type_form_results, $this->columnValues);
+
+
+ //rendering the view
+ $this->columnNames = $field_list;
+ $this->htmlFields = $htmlFields;
+ $this->biographics = $this->columnValues;
+
+ } else {
+ $this->biographics = Browse::getBiographyList($person_id);
+ $this->biographics_reverse = Browse::getBiographyListReverse($person_id);
+ }
}
public function act_print() {
$this->person->LoadRelationships();
$this->biographics = Browse::getBiographyList($this->person->person_record_number);
$this->biographics_reverse = Browse::getBiographyListReverse($this->person->person_record_number);
-
}
public function act_permissions() {
@@ -662,7 +716,7 @@ public function act_update_person_perms() {
}
}
- public function act_browse_biography(){
+ public function act_browse_biography() {
include_once APPROOT . 'inc/lib_form.inc';
//$notIn = acl_list_acts_permissons();
@@ -705,7 +759,8 @@ public function act_browse_biography(){
$additionalurlfields = array();
$additionalurlfields["person"] = array("entity" => "person", "val" => "person");
$additionalurlfields["related_person"] = array("entity" => "person", "val" => "person");
-
+ $additionalurlfields["biographic_details_record_number"] = array("entity" => "biographic_details", "val" => "biographic_details_record_number");
+
$this->columnValues = set_links_in_recordset($this->columnValues, 'biographic_details', $additionalurlfields);
// var_dump($this->columnValues);exit;
set_huriterms_in_record_array($entity_type_form_results, $this->columnValues);
@@ -715,4 +770,5 @@ public function act_browse_biography(){
$this->columnNames = $field_list;
$this->htmlFields = $htmlFields;
}
+
}
View
236 mod/person/tpls/act_biography_list.php
@@ -1,42 +1,88 @@
-<?php include_once('tabs.php')?>
-<?php include_once('person_name.php')?>
+<?php include_once('tabs.php') ?>
+<?php include_once('person_name.php') ?>
<?php
- include_once('view_card_list.php');
- draw_card_list('bd',$pid);
+include_once('view_card_list.php');
+draw_card_list('bd', $pid);
+global $conf;
?>
<div class="panel">
-<a class="btn btn-primary" href="<?php echo get_url('person','new_biography',null,array('pid'=>$pid, 'search_type'=>'person')) ?>"><i class="icon-plus icon-white"></i> <?php echo _t('ADD_BIOGRAPHIC_DETAILS')?></a>
-<br />
-<br />
-<?php
+ <a class="btn btn-primary" href="<?php echo get_url('person', 'new_biography', null, array('pid' => $pid, 'search_type' => 'person')) ?>"><i class="icon-plus icon-white"></i> <?php echo _t('ADD_BIOGRAPHIC_DETAILS') ?></a>
+ <br />
+ <br />
+ <?php
if ((is_array($biographics) && count($biographics) != 0) || is_array($biographics_reverse) && count($biographics_reverse) != 0) {
-?>
-<form class="form-horizontal" action="<?php get_url('person','delete_biographic')?>" method="post">
-<table class='table table-bordered table-striped table-hover'>
- <thead>
- <tr>
- <th width='16px'><input type='checkbox' onchange='$("input.delete").attr("checked",this.checked)' /></th>
- <th class="title"><?php echo _t('VIEW_BIOGRAPHIC_DETAILS')?></th>
- <th class="title"><?php echo _t('TYPE_OF_RELATIONSHIP')?></th>
- <th class="title"><?php echo _t('RELATED_PERSON')?></th>
- <th class="title"><?php echo _t('INITIAL_DATE')?></th>
- <th class="title"><?php echo _t('FINAL_DATE')?></th>
- </tr>
- </thead>
- <tbody>
-<?php
- foreach($biographics as $bio){
-?>
- <tr class='<?php if($i++%2==1)echo "odd ";if($_GET['biography_id']==$bio['biographic_details_record_number'])echo 'active'; ?>' >
- <td><input name="biographics[]" type='checkbox' value='<?php echo $bio['biographic_details_record_number'] ?>' class='delete'/></td>
- <td><a href="<?php echo get_url('person','biography_list',null,array('biography_id'=>$bio['biographic_details_record_number'], 'type'=>'bd')); ?>"><?php echo $bio['biographic_details_record_number']; ?></a></td>
- <td><a href="<?php echo get_url('person','biography_list',null,array('biography_id'=>$bio['biographic_details_record_number'], 'type'=>'bd')); ?>"><?php echo $bio['relationship_type']; ?></a></td>
- <td><a href="<?php echo get_url('person','biography_list',null,array('biography_id'=>$bio['biographic_details_record_number'], 'type'=>'rp')); ?>"><?php echo $bio['person_name']; ?></a></td>
- <td><?php echo $bio['initial_date']; ?></td>
- <td><?php echo $bio['final_date']; ?></td>
- </tr>
-<?php
- }
+ ?>
+ <form class="form-horizontal" action="<?php get_url('person', 'delete_biographic') ?>" method="post">
+ <table class='table table-bordered table-striped table-hover'>
+ <thead>
+ <tr>
+ <th width='16px'><input type='checkbox' onchange='$("input.delete").attr("checked", this.checked)' /></th>
+
+ <?php
+ if ($conf['subbrowse']['biography_list']) {
+
+ foreach ($columnNames as $field => $value) {
+ ?>
+ <th class="title"><?php echo $value ?></th>
+ <?php
+ }
+ } else {
+ ?>
+ <th class="title"><?php echo _t('VIEW_BIOGRAPHIC_DETAILS') ?></th>
+ <th class="title"><?php echo _t('TYPE_OF_RELATIONSHIP') ?></th>
+ <th class="title"><?php echo _t('RELATED_PERSON') ?></th>
+ <th class="title"><?php echo _t('INITIAL_DATE') ?></th>
+ <th class="title"><?php echo _t('FINAL_DATE') ?></th>
+ <?php
+ }
+ ?>
+ </tr>
+ </thead>
+ <tbody>
+ <?php
+ foreach ($biographics as $bio) {
+ ?>
+ <tr class='<?php if ($i++ % 2 == 1) echo "odd ";if ($_GET['biography_id'] == $bio['biographic_details_record_number']) echo 'active'; ?>' >
+ <td><input name="biographics[]" type='checkbox' value='<?php echo $bio['biographic_details_record_number'] ?>' class='delete'/></td>
+ <?php
+ if ($conf['subbrowse']['biography_list']) {
+ $tdIndex = 1;
+$columnvalue = $bio;
+
+ foreach ($columnNames as $field => $value) {
+
+ if ($tdIndex == 1) {
+ if ($columnvalue[$field] == null || trim($columnvalue[$field]) == '') {
+ $columnvalue[$field] = " . . . ";
+ }
+ $displayValue = '<a href="' . $columnvalue['record_url'] . '">' . $columnvalue[$field] . '</a>';
+ } else if ($tdIndex == 2 && $columnvalue['entity_record_url'] != null) {
+ if ($columnvalue[$field] == null || trim($columnvalue[$field]) == '') {
+ $columnvalue[$field] = " . . . ";
+ }
+ $displayValue = '<a href="' . $columnvalue['entity_record_url'] . '" >' . $columnvalue[$field] . '</a>';
+ } else if (isset($columnvalue[$field . '_record_url'])) {
+ $displayValue = '<a href="' . $columnvalue[$field . '_record_url'] . '" title="' . $columnvalue['record_number'] . '">' . $columnvalue[$field] . '</a>';
+ } else {
+ $displayValue = $columnvalue[$field];
+ }
+
+ echo "<td>" . $displayValue . "</td>";
+ $tdIndex++;
+ }
+ } else {
+ ?>
+ <td><a href="<?php echo get_url('person', 'biography_list', null, array('biography_id' => $bio['biographic_details_record_number'], 'type' => 'bd')); ?>"><?php echo $bio['biographic_details_record_number']; ?></a></td>
+ <td><a href="<?php echo get_url('person', 'biography_list', null, array('biography_id' => $bio['biographic_details_record_number'], 'type' => 'bd')); ?>"><?php echo $bio['relationship_type']; ?></a></td>
+ <td><a href="<?php echo get_url('person', 'biography_list', null, array('biography_id' => $bio['biographic_details_record_number'], 'type' => 'rp')); ?>"><?php echo $bio['person_name']; ?></a></td>
+ <td><?php echo $bio['initial_date']; ?></td>
+ <td><?php echo $bio['final_date']; ?></td>
+ <?php
+ }
+ ?>
+ </tr>
+ <?php
+ }
foreach ($biographics_reverse as $bio) {
?>
<tr class='<?php if ($i++ % 2 == 1) echo "odd ";if ($_GET['biography_id'] == $bio['biographic_details_record_number']) echo 'active'; ?>' >
@@ -49,78 +95,74 @@
</tr>
<?php
}
-?>
- <tr class='actions'>
- <td colspan='8'><button type='submit' class='btn btn-grey' name='delete' >
-<i class="icon-trash"></i> <?php echo _t('DELETE') ?></button>
- </td>
- </tr>
- </tbody>
-</table>
-</form>
-<?php
- }
- else{
- echo '<div class="alert alert-info"><button type="button" class="close" data-dismiss="alert">×</button>';
- echo _t('THERE_IS_NO_BIOGRAPHIC_DETAILS_ABOUT_THIS_PERSON_YET__YOU_SHOULD_ADD_SOME_');
- echo "</div>";
- }
-?>
-<div class="form-container">
-<form class="form-horizontal" action='<?php echo get_url('person','biography_list')?>' method='post' enctype='multipart/form-data'>
-<?php
- if($_GET['type']=='bd'){
-?>
-<br />
-<br />
-<?php
- echo "<h3>" ._t('VIEW_BIOGRAPHIC_DETAILS') . "</h3>";
- echo "<br />";
-?>
- <a class="btn" href="<?php echo get_url('person','edit_biography',null,array('biography_id'=>$_GET['biography_id'])) ?>"><i class="icon-edit"></i> <?php echo _t('EDIT_THIS_BIOGRAPHIC_DETAILS')?></a>
- <br />
- <br />
-<?php
-
- shn_form_get_html_labels($biography_form , false );
- $fields['save'] = null;
-
- }
- if($_GET['type']=='rp'){
-?>
-<br />
-<br />
-<?php
- echo "<h3>" ._t('VIEW_RELATED_PERSON') . "</h3>";
-?>
+ ?>
+ <tr class='actions'>
+ <td colspan='8'><button type='submit' class='btn btn-grey' name='delete' >
+ <i class="icon-trash"></i> <?php echo _t('DELETE') ?></button>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </form>
+ <?php
+ }
+ else {
+ echo '<div class="alert alert-info"><button type="button" class="close" data-dismiss="alert">×</button>';
+ echo _t('THERE_IS_NO_BIOGRAPHIC_DETAILS_ABOUT_THIS_PERSON_YET__YOU_SHOULD_ADD_SOME_');
+ echo "</div>";
+ }
+ ?>
+ <div class="form-container">
+ <form class="form-horizontal" action='<?php echo get_url('person', 'biography_list') ?>' method='post' enctype='multipart/form-data'>
+ <?php
+ if ($_GET['type'] == 'bd') {
+ ?>
+ <br />
<br />
<?php
- if (isset($_GET['reverse'])) {
- ?>
- <a class="btn" href="<?php echo get_url('person','person',null,array('pid'=>$biographic_details->person)) ?>"><i class="icon-zoom-in"></i><?php echo _t('MORE_ABOUT_THIS_PERSON')?></a>
-
+ echo "<h3>" . _t('VIEW_BIOGRAPHIC_DETAILS') . "</h3>";
+ echo "<br />";
+ ?>
+ <a class="btn" href="<?php echo get_url('person', 'edit_biography', null, array('biography_id' => $_GET['biography_id'])) ?>"><i class="icon-edit"></i> <?php echo _t('EDIT_THIS_BIOGRAPHIC_DETAILS') ?></a>
+ <br />
+ <br />
<?php
-
- } else {
+ shn_form_get_html_labels($biography_form, false);
+ $fields['save'] = null;
+ }
+ if ($_GET['type'] == 'rp') {
?>
- <a class="btn" href="<?php echo get_url('person','person',null,array('pid'=>$biographic_details->related_person)) ?>"><i class="icon-zoom-in"></i><?php echo _t('MORE_ABOUT_THIS_PERSON')?></a>
-
+ <br />
+ <br />
<?php
-
+ echo "<h3>" . _t('VIEW_RELATED_PERSON') . "</h3>";
+ ?>
+ <br />
+ <?php
+ if (isset($_GET['reverse'])) {
+ ?>
+ <a class="btn" href="<?php echo get_url('person', 'person', null, array('pid' => $biographic_details->person)) ?>"><i class="icon-zoom-in"></i><?php echo _t('MORE_ABOUT_THIS_PERSON') ?></a>
+
+ <?php
+ } else {
+ ?>
+ <a class="btn" href="<?php echo get_url('person', 'person', null, array('pid' => $biographic_details->related_person)) ?>"><i class="icon-zoom-in"></i><?php echo _t('MORE_ABOUT_THIS_PERSON') ?></a>
+
+ <?php
}
?>
- <br />
-<?php
- echo "<br />";
- $fields['save'] = null;
- shn_form_get_html_labels($related_person_form , false );
+ <br />
+ <?php
+ echo "<br />";
+ $fields['save'] = null;
+ shn_form_get_html_labels($related_person_form, false);
// $person_form = person_form('view');
// popuate_formArray($person_form , $person );
// shn_form_get_html_labels($person_form , false );
- }
-?>
-</form>
-</div>
+ }
+ ?>
+ </form>
+ </div>
</div>
View
1  module/oe2wp-data.json
1 addition, 0 deletions not shown
View
181 module/oe2wp.php
@@ -0,0 +1,181 @@
+<?php
+
+error_reporting(E_ALL ^ E_NOTICE);
+set_time_limit(10000000);
+define('APPROOT', realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR);
+//define('APPROOT', "C:/server/huridocs/openevsys/project/");
+if (!file_exists(APPROOT . 'conf/sysconf.php')) {
+ exit(0);
+}
+
+/* * ****** If the system is installed start the bootstrap process ******* */
+
+//Include the configuration file at the begining since
+//rest of the handlers will require configuration values
+require_once(APPROOT . 'conf/sysconf.php');
+
+//load error and exception handlers
+require_once(APPROOT . 'inc/handler_error.inc');
+require_once(APPROOT . 'inc/handler_exception.inc');
+
+//load db handler
+require_once(APPROOT . 'inc/handler_db.inc');
+
+//overide conf values from db
+require_once(APPROOT . 'inc/handler_config.inc');
+
+$conf['locale'] = "es";
+//input ( $_GET , $_POST ) validation utf-8
+require_once(APPROOT . 'inc/handler_filter.inc');
+
+//utility function used by the system
+//this contain autoload to string manipulation
+require_once(APPROOT . 'inc/lib_util.inc');
+
+//load session handler
+require_once(APPROOT . 'inc/session/handler_session.inc');
+
+
+//load l10n library
+require_once(APPROOT . 'inc/i18n/handler_l10n.inc');
+
+$_SESSION['username'] = 'admin';
+//load authentication handler
+require_once(APPROOT . 'inc/security/handler_auth.inc');
+//load acl
+require_once(APPROOT . 'inc/security/handler_acl.inc');
+
+
+require_once(APPROOT . 'mod/analysis/analysisModule.class.php');
+require_once(APPROOT . 'mod/analysis/searchSql.php');
+include_once APPROOT . 'inc/lib_entity_forms.inc';
+include_once APPROOT . 'inc/lib_uuid.inc';
+include_once APPROOT . 'inc/lib_form_util.inc';
+
+$dataFile = APPROOT . "module" . DIRECTORY_SEPARATOR . "oe2wp-data.json";
+
+$sync = array();
+$syncData = array();
+$syncData['taxonomies'] = array();
+$syncData['entities'] = array();
+
+$sync['taxonomies'] = array(array('list_code' => 70, 'wp_taxonomy' => 'tipoconflicto'),
+ array('list_code' => 71, 'wp_taxonomy' => 'ubicacion'),
+ array('list_code' => 4, 'wp_taxonomy' => 'type_of_act'),
+ array('list_code' => 76, 'wp_taxonomy' => 'mediolesion'),
+ array('list_code' => 82, 'wp_taxonomy' => 'area_corporal'),
+ /* array('list_code'=>71,'wptaxonomy'=>'ubicacto'), */
+);
+$sync['entities'] = array(
+ array('entity' => 'event', 'wp_post_type' => 'event',
+ 'fields' => array(
+ array('field_name' => 'event_record_number', 'wp_field' => 'oe_id','wptype'=>'meta'),
+ array('field_name' => 'event_title', 'wp_field' => 'post_title','wptype'=>'core'),
+ array('field_name' => 'event_description', 'wp_field' => 'post_content','wptype'=>'core'),
+ array('field_name' => 'tipoconflicto', 'wp_field' => 'tipoconflicto', 'type' => 'taxonomy', 'multiple' => true,'wptype'=>'taxonomy'),
+ array('field_name' => 'ubicacion', 'wp_field' => 'ubicacion', 'type' => 'taxonomy','wptype'=>'taxonomy'),
+ array('field_name' => 'initial_date', 'wp_field' => 'initial_date','wptype'=>'meta'),
+ array('field_name' => 'final_date', 'wp_field' => 'final_date','wptype'=>'meta'),
+ array('field_name' => 'event_location_latitude', 'wp_field' => 'location_latitude','wptype'=>'meta'),
+ array('field_name' => 'event_location_longitude', 'wp_field' => 'location_longitude','wptype'=>'meta'),
+ array('type' => 'count_muerte', 'wp_field' => 'count_muerte','wptype'=>'meta'),
+ array('type' => 'count_herida', 'wp_field' => 'count_herida','wptype'=>'meta'),
+ )
+ ),
+ array('entity' => 'act', 'wp_post_type' => 'act',
+ 'fields' => array(
+ array('field_name' => 'act_record_number', 'wp_field' => 'oe_id','wptype'=>'meta'),
+ array('type' => 'victimname', 'wp_field' => 'post_title','wptype'=>'core'),
+ array('field_name' => 'descripacto', 'wp_field' => 'post_content','wptype'=>'core'),
+ array('field_name' => 'initial_date', 'wp_field' => 'initial_date','wptype'=>'meta'),
+ array('field_name' => 'final_date', 'wp_field' => 'final_date','wptype'=>'meta'),
+ array('field_name' => 'type_of_act', 'wp_field' => 'type_of_act', 'type' => 'taxonomy','wptype'=>'taxonomy'),
+ array('field_name' => 'area_corporal', 'wp_field' => 'area_corporal', 'type' => 'taxonomy', 'multiple' => true,'wptype'=>'taxonomy'),
+ array('field_name' => 'mediolesion', 'wp_field' => 'mediolesion', 'type' => 'taxonomy', 'multiple' => true,'wptype'=>'taxonomy'),
+ array('field_name' => 'act_location_latitude', 'wp_field' => 'location_latitude','wptype'=>'meta'),
+ array('field_name' => 'act_location_longitude', 'wp_field' => 'location_longitude','wptype'=>'meta'),
+ array('type' => 'victimedadhechos', 'wp_field' => 'edadhechos','wptype'=>'meta'),
+ array('type' => 'eventtitle', 'wp_field' => 'event_title','wptype'=>'meta'),
+ array('field_name' => 'circunstancias', 'wp_field' => 'circunstancias','wptype'=>'meta'),
+ array('field_name' => 'ubicacto', 'wp_field' => 'ubicacion', 'type' => 'taxonomy','wptype'=>'taxonomy'),
+ )
+ ));
+
+foreach ($sync['taxonomies'] as $taxonomy) {
+ $data = $taxonomy;
+ $data['data'] = array();
+ $taxonomyData = MtFieldWrapper::getMTList($taxonomy['list_code']);
+ foreach ($taxonomyData as $val) {
+ $data['data'][] = array('oe_id' => $val['vocab_number'], 'name' => $val['label'],'parent'=>$val['parent_vocab_number']);
+ }
+ $syncData['taxonomies'][] = $data;
+}
+
+$browse = new Browse();
+foreach ($sync['entities'] as $entity) {
+
+ $recordkeyName = get_primary_key($entity['entity']);
+ $sql = "select " . $recordkeyName . " from " . $entity['entity'];
+ $rows = $browse->ExecuteQuery($sql);
+ $classname = ucfirst($entity['entity']);
+
+ foreach ($rows as $row) {
+ $object = new $classname();
+ $object->LoadFromRecordNumber($row[$recordkeyName]);
+ $object->LoadRelationships();
+
+ $data = array();
+ $data['post_type'] = $entity['wp_post_type'];
+ $data['oe_id'] = $row[$recordkeyName];
+ foreach ($entity['fields'] as $field) {
+ $fieldName = $field['field_name'];
+ $fieldVal = $object->$fieldName;
+ $fieldData = null;
+ if ($field['type'] == 'taxonomy' && $field['multiple']) {
+ $fieldData = array();
+ foreach ($fieldVal as $val) {
+ $fieldData[] = $val->vocab_number;
+ }
+ } elseif ($field['type'] == "count_muerte") {
+ $sql = "SELECT count(*) as count FROM act a WHERE a.type_of_act ='51000000000004' and a.event='" . $row[$recordkeyName] . "'";
+ $count = $browse->ExecuteQuery($sql);
+ if ($count[0]['count']) {
+ $fieldData = $count[0]['count'];
+ }
+ } elseif ($field['type'] == "count_herida") {
+ $sql = "SELECT count(*) as count FROM act a WHERE a.type_of_act ='54010101000117' and a.event='" . $row[$recordkeyName] . "'";
+ $count = $browse->ExecuteQuery($sql);
+ if ($count[0]['count']) {
+ $fieldData = $count[0]['count'];
+ }
+ } elseif ($field['type'] == "victimname") {
+ $victim = new Person();
+ $victim->LoadFromRecordNumber($object->victim);
+ $fieldData = $victim->person_name . " " . $victim->other_names;
+ } elseif ($field['type'] == "victimedadhechos") {
+ $victim = new Person();
+ $victim->LoadFromRecordNumber($object->victim);
+ $fieldData = $victim->edadhechos;
+ } elseif ($field['type'] == "eventtitle") {
+ $event = new Event();
+ $event->LoadFromRecordNumber($object->event);
+ $fieldData = $event->event_title;
+ } else {
+ $fieldData = $fieldVal;
+ }
+ $wptype = $field['wptype'];
+ if(!$data[$wptype]){
+ $data[$wptype] = array();
+
+ }
+ $data[$wptype][$field['wp_field']] = $fieldData;
+
+
+ }
+ $syncData['entities'][] = $data;
+ }
+}
+
+file_put_contents($dataFile, json_encode($syncData));
+
+?>
View
7 www/res/js/adv-search.js
@@ -987,7 +987,7 @@ function queryBuilder(){
break;
case "mt_select":
- var mt_select = $("<select id=\"\" name=\"\" class=\"select searchval\" />");
+ var mt_select = $("<select id=\"\" name=\"\" class=\"select searchval\" data-val=\""+e.value+"\" />");
//$("<option />", {value: "", text: ""}).appendTo(select);
mt_select.qb_mt_select({
mt: od.getListCode(field_name, entity_name),
@@ -1003,7 +1003,7 @@ function queryBuilder(){
//mt_select.select2("val",e.value);
break;
case "mt_tree":
- var mt_tree = $('<select id=\"\" name=\"\" class=\"mt-tree select searchval\" />');
+ var mt_tree = $('<select id=\"\" name=\"\" class=\"mt-tree select searchval\" data-val=\""+e.value+"\" />');
mt_tree.qb_mt_tree({
mt: od.getListCode(field_name, entity_name),
'selected' : e.value
@@ -1356,6 +1356,9 @@ function queryBuilder(){
c.operator = $(this).find('select.operatorselect:first').val();
if($(this).find('.searchval').is("select")){
c.value = $(this).find('select.searchval:first').val();
+ if(c.value == null){
+ c.value = $(this).find('select.searchval:first').data('val')
+ }
}else{
c.value = $(this).find('.searchval:first').val();
}
Please sign in to comment.
Something went wrong with that request. Please try again.