protected function get_mt_value($values, $mt_index) { global $conf; $locale = $conf['locale']; if (!is_array($values)) { $object = new stdClass(); $object->vocab_number = $values; $values = array($object); } $browse = new Browse(); $results = []; $table = 'mt_vocab'; $property = 'english'; $index_name = 'vocab_number'; if ($locale !== 'en') { $table = 'mt_vocab_l10n'; $property = $locale; $index_name = 'msgid'; } foreach ($values as $mtObject) { $sql = "SELECT * FROM `{$table}` WHERE `{$index_name}` LIKE '" . $mtObject->vocab_number . "'"; $result = $browse->ExecuteQuery($sql); array_push($results, $result[0][$property]); } return $results; }
public function l10n($subformat) { global $conf; $locale = $conf['locale']; $sql = "SELECT field_label, field_number FROM data_dict WHERE field_name = '{$subformat}'"; $browse = new Browse(); $field = $browse->ExecuteQuery($sql)[0]; $result = $field['field_label']; if ($locale != 'en') { $field_number = $field['field_number']; $sql = "SELECT msgstr FROM data_dict_l10n WHERE msgid = {$field_number} AND locale = '{$locale}'"; $l10n = $browse->ExecuteQuery($sql); if (!is_null($l10n)) { $result = $l10n[0]['msgstr']; } } return $result; }
public function act_get_help() { global $global; global $conf; $browse = new Browse(); $id = $_GET['id']; $sql = "SELECT * FROM help WHERE field_number='{$id}'"; $res = $browse->ExecuteQuery($sql); $result_data = $res[0]; if ($result_data['definition'] == "") { $resultSet = $browse->ExecuteNonQuery("INSERT INTO help (field_number, definition) VALUES('" . $id . "', '<p style=small>No Help Available</p>')"); echo "<p style=small>No Help Available</p>"; } else { echo $result_data['definition']; } exit(0); }
public function getAllHuriTerms($fieldName) { if (is_numeric($fieldName)) { $listCode = (int) $fieldName; $fieldName = $this->getFieldNameforListCode($listCode); } else { $listCode = $this->getListCodeforMTField($fieldName); } if ($listCode != null || trim($listCode) != '') { //var_dump($listCode); $mtTable = "mt_{$listCode}_{$fieldName}"; $consistancyJoin = "INNER JOIN {$mtTable} ON m.vocab_number = {$mtTable}.vocab_number"; } global $conf; $sql = "SELECT m.vocab_number , IFNULL(l.msgstr , english) as 'label',\n term_order,parent_vocab_number ,term_level ,huri_code\n FROM mt_vocab m \n LEFT JOIN mt_vocab_l10n l ON ( l.msgid = m.vocab_number AND l.locale = '{$conf['locale']}' )\n {$consistancyJoin}\n WHERE TRIM(list_code)='{$listCode}' AND (visible = 'y' or visible IS NULL) ORDER BY term_order"; //echo $sql;exit; $browse = new Browse(); $res = $browse->ExecuteQuery($sql); //print_r($res); return $res; }
function get_data_array() { global $dataFile, $dataCols, $fields, $lists, $docsCount, $biosCount; if (($handle = fopen($dataFile, "r")) === FALSE) { return array(); } $results = array(); $j = 0; while (($cols = fgetcsv($handle, 0, "\t")) !== FALSE) { $glData = array(); $row = array(); if ($cols && $cols[1]) { //var_dump($cols);exit; foreach ($cols as $key => $val) { $val = trim($val, '"'); $val = trim($val); $row[$key] = $val; $entityField = $dataCols[$key]; if ($entityField) { $ent = $entityField["ent"]; $list_code = $entityField['list_code']; $type = $entityField['field_type']; $mlt = trim($entityField['is_repeat']) == 'Y' || trim($entityField['is_repeat']) == 'y' ? true : false; if ($list_code == 39) { if ($val == "M") { $val = "Hombre"; } elseif ($val == "F") { $val = "Mujer"; } } if ($list_code && !$lists[$list_code]) { $options = array(); $data_array = MtFieldWrapper::getMTList($list_code); $size = count($data_array); for ($i = 0; $i < $size; $i++) { $options[$data_array[$i]['vocab_number']] = strtolower($data_array[$i]['label']); } $lists[$list_code] = $options; } if ($list_code) { if ($mlt) { $val2 = explode(";", $val); $val = array(); foreach ($val2 as $v) { $v = trim($v); $vocab_number = array_search(strtolower($v), $lists[$list_code]); if ($vocab_number) { $val[] = $vocab_number; } } } else { $vocab_number = array_search(strtolower($val), $lists[$list_code]); if ($vocab_number) { $val = $vocab_number; } else { $val = null; } } } if ($type == "date") { if ($val) { $d = date_create_from_format("m/d/Y", $val); if ($d) { $val = date_format($d, 'Y-m-d'); } else { $val = null; } } else { $val = null; } } elseif ($type == "location") { $val2 = explode(",", $val); //$row[$entityField['field_name'] . "_latitude"] = -floatval($val2[0]); //$row[$entityField['field_name'] . "_longitude"] = -floatval($val2[1]); $glData[$ent][$entityField['field_name'] . "_latitude"] = -floatval($val2[0]); $glData[$ent][$entityField['field_name'] . "_longitude"] = -floatval($val2[1]); $val = null; } elseif ($type == "radio") { if ($val == "NO" || $val == "no") { $val = "n"; } elseif ($val == "SÍ" || $val == "sí") { $val = "y"; } else { $val = null; } } if (!is_null($val)) { //$row[$entityField['field_name']] = $val; $glData[$ent][$entityField['field_name']] = $val; } } } if (!$glData['act']['ubicacto']) { $v = $row[25]; $vocab_number = array_search(strtolower($v), $lists[71]); if ($vocab_number) { $glData['act']['ubicacto'] = $vocab_number; } } if (!$glData['act']['ubicacto']) { $v = $row[24]; $vocab_number = array_search(strtolower($v), $lists[71]); if ($vocab_number) { $glData['act']['ubicacto'] = $vocab_number; } } $browse = new Browse(); $rows = $browse->ExecuteQuery("select event_record_number as id from event where event_title='" . $glData['event']['event_title'] . "'"); if ($rows && $rows[0]['id']) { $event = new Event(); $event->LoadFromRecordNumber($rows[0]['id']); } else { $form = event_form('new'); $event = new Event(); $event->event_record_number = shn_create_uuid('event'); form_objects($form, $event, $glData['event']); $event->SaveAll(); } $browse = new Browse(); $person = null; if ($glData['person']['person_name'] != "NN") { $rows = $browse->ExecuteQuery("select person_record_number as id from person where person_name='" . $glData['person']['person_name'] . "' \n\t\t\t\tand other_names='" . $glData['person']['other_names'] . "' "); if ($rows && $rows[0]['id']) { $person = new Person(); $person->LoadFromRecordNumber($rows[0]['id']); } } if (!$person) { $person_form = person_form('new'); $person = new Person(); form_objects($person_form, $person, $glData['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; } if (isset($person->dependants) && !$person->dependants) { $person->dependants = Null; } $person->SaveAll(); } $victim = $person; $act_form = act_form('new'); $act = new Act(); $act->act_record_number = shn_create_uuid('act'); $glData['act']['victim'] = $victim->person_record_number; form_objects($act_form, $act, $glData['act']); $act->event = $event->event_record_number; $act->SaveAll(); if ($glData['perpetrator']['person_name']) { $browse = new Browse(); $rows = $browse->ExecuteQuery("select person_record_number as id from person where person_name='" . $glData['perpetrator']['person_name'] . "' "); if ($rows && $rows[0]['id']) { $person = new Person(); $person->LoadFromRecordNumber($rows[0]['id']); } else { $person_form = person_form('new'); $person = new Person(); form_objects($person_form, $person, $glData['perpetrator']); $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; } if (isset($person->dependants) && !$person->dependants) { $person->dependants = Null; } $person->SaveAll(); } $perpetrator = $person; $inv = new Involvement(); $inv->involvement_record_number = shn_create_uuid('inv'); $inv->degree_of_involvement = "54010101001921"; //placeholder $inv->event = $event->event_record_number; $inv->act = $act->act_record_number; $inv->perpetrator = $perpetrator->person_record_number; $inv->SaveAll(); } $supporting_documents = array(); if (trim($row[9])) { $document_form = document_form('new'); unset($document_form['doc_id']); $supporting_docs = new SupportingDocs(); $supporting_docs_meta = new SupportingDocsMeta(); $type = null; $doc_uuid = shn_create_uuid('doc'); $supporting_docs->doc_id = $doc_uuid; $supporting_docs_meta->doc_id = $doc_uuid; $supporting_docs->uri = ''; form_objects($document_form, $supporting_docs, array('title' => $row[9])); form_objects($document_form, $supporting_docs_meta, array('title' => $row[9])); $supporting_docs_meta->format = $type; $supporting_docs->Save(); $supporting_docs_meta->Save(); $supporting_documents[] = $doc_uuid; } for ($j = 1; $j <= $docsCount; $j++) { if ($glData["supporting_docs_meta" . $j]) { if (!$glData["supporting_docs_meta" . $j]['title']) { continue; } $document_form = document_form('new'); unset($document_form['doc_id']); $supporting_docs = new SupportingDocs(); $supporting_docs_meta = new SupportingDocsMeta(); $type = null; $doc_uuid = shn_create_uuid('doc'); $supporting_docs->doc_id = $doc_uuid; $supporting_docs_meta->doc_id = $doc_uuid; $supporting_docs->uri = ''; form_objects($document_form, $supporting_docs, $glData["supporting_docs_meta" . $j]); form_objects($document_form, $supporting_docs_meta, $glData["supporting_docs_meta" . $j]); $supporting_docs_meta->format = $type; $supporting_docs->Save(); $supporting_docs_meta->SaveAll(); $supporting_documents[] = $doc_uuid; } } if ($supporting_documents) { $act->supporting_documents = $supporting_documents; $act->SaveDocs(); } $bio_details = array(); for ($j = 1; $j <= $biosCount; $j++) { if ($glData["bio_details" . $j] && $glData["bio_details" . $j]["type_of_relationship"]) { $browse = new Browse(); $rows = $browse->ExecuteQuery("select person_record_number as id from person where person_name='" . $glData["bio_details" . $j]['person_name'] . "' \n\t\t\t\t\tand other_names='" . $glData['bio_details']['other_names'] . "' "); if ($rows && $rows[0]['id']) { $person = new Person(); $person->LoadFromRecordNumber($rows[0]['id']); } else { $person_form = person_form('new'); $person = new Person(); form_objects($person_form, $person, $glData["bio_details" . $j]); $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; } if (isset($person->dependants) && !$person->dependants) { $person->dependants = Null; } $person->SaveAll(); } if ($glData["bio_details" . $j]["phone"] || $glData["bio_details" . $j]["email"]) { $address = new Address(); $address_form = address_form('new'); form_objects($address_form, $address, $glData["bio_details" . $j]); $address->person = $person->person_record_number; $address->Save(); } $biography_form = biographic_form('new'); $biography = new BiographicDetail(); //$biography->LoadfromRecordNumber(); $biography->biographic_details_record_number = shn_create_uuid('biography'); $glData["bio_details" . $j]['person_id'] = $person->person_record_number; form_objects($biography_form, $biography, $glData["bio_details" . $j]); $biography->person = $victim->person_record_number; $biography->related_person = $person->person_record_number; if ($biography->related_person == '') { $biography->related_person = null; } $biography->SaveAll(); } } } $results[] = $row; $j++; } return $results; }
function get_data_array() { global $dataFile, $dataCols, $fields, $lists, $docsCount, $biosCount; if (($handle = fopen($dataFile, "r")) === FALSE) { return array(); } $results = array(); $i = 0; while (($cols = fgetcsv($handle, 0, "\t")) !== FALSE) { $glData = array(); $row = array(); if ($cols && $cols[1]) { foreach ($cols as $key => $val) { $val = trim($val, '"'); $val = trim($val); $row[$key] = $val; $entityField = $dataCols[$key]; if ($entityField) { $ent = $entityField["ent"]; $list_code = $entityField['list_code']; $type = $entityField['field_type']; $mlt = trim($entityField['is_repeat']) == 'Y' || trim($entityField['is_repeat']) == 'y' ? true : false; if ($list_code == 39) { if ($val == "M") { $val == "Hombre"; } elseif ($val == "F") { $val == "Mujer"; } } if ($list_code && !$lists[$list_code]) { $options = array(); $data_array = MtFieldWrapper::getMTList($list_code); $size = count($data_array); for ($i = 0; $i < $size; $i++) { $options[$data_array[$i]['vocab_number']] = strtolower($data_array[$i]['label']); } $lists[$list_code] = $options; } if ($list_code) { if ($mlt) { $val2 = explode(";", $val); $val = array(); foreach ($val2 as $v) { $vocab_number = array_search(strtolower($v), $lists[$list_code]); if ($vocab_number) { $val[] = $vocab_number; } } } else { $vocab_number = array_search(strtolower($val), $lists[$list_code]); if ($vocab_number) { $val = $vocab_number; } else { $val = null; } } } if ($type == "date") { if ($val) { $d = date_create_from_format("m/d/Y", $val); if ($d) { $val = date_format($d, 'Y-m-d'); } else { $val = null; } } else { $val = null; } } elseif ($type == "location") { $val2 = explode(",", $val); //$row[$entityField['field_name'] . "_latitude"] = -floatval($val2[0]); //$row[$entityField['field_name'] . "_longitude"] = -floatval($val2[1]); $glData[$ent][$entityField['field_name'] . "_latitude"] = -floatval($val2[0]); $glData[$ent][$entityField['field_name'] . "_longitude"] = -floatval($val2[1]); $val = null; } elseif ($type == "radio") { if ($val == "NO") { $val = "n"; } elseif ($val == "SÍ") { $val = "y"; } else { $val = null; } } if ($val) { //$row[$entityField['field_name']] = $val; $glData[$ent][$entityField['field_name']] = $val; } } } //var_dump($glData);exit; $browse = new Browse(); $rows = $browse->ExecuteQuery("select event_record_number as id from event where event_title='" . $glData['event']['event_title'] . "'"); if ($rows && $rows[0]['id']) { $event = new Event(); $event->LoadFromRecordNumber($rows[0]['id']); $event->LoadRelationships(); } else { continue; } if ($event->supporting_documents) { $supporting_documents = $event->supporting_documents; } else { $supporting_documents = array(); } for ($j = 1; $j <= $docsCount; $j++) { if ($glData["supporting_docs_meta" . $j]) { if (!$glData["supporting_docs_meta" . $j]['title']) { continue; } $document_form = document_form('new'); unset($document_form['doc_id']); $supporting_docs = new SupportingDocs(); $supporting_docs_meta = new SupportingDocsMeta(); $type = null; $doc_uuid = shn_create_uuid('doc'); $supporting_docs->doc_id = $doc_uuid; $supporting_docs_meta->doc_id = $doc_uuid; $supporting_docs->uri = ''; form_objects($document_form, $supporting_docs, $glData["supporting_docs_meta" . $j]); form_objects($document_form, $supporting_docs_meta, $glData["supporting_docs_meta" . $j]); $supporting_docs_meta->format = $type; $supporting_docs->Save(); $supporting_docs_meta->SaveAll(); $supporting_documents[] = $doc_uuid; } } if ($supporting_documents) { $event->supporting_documents = $supporting_documents; $event->SaveDocs(); } } $results[] = $row; $i++; } return $results; }
public function act_field_customization() { global $conf; include_once APPROOT . 'mod/admin/lib_form_customization.inc'; $this->entity_select = $_REQUEST['entity_select']; $this->sub_act = isset($_REQUEST['sub_act']) ? $_REQUEST['sub_act'] : 'label'; $_REQUEST['sub_act'] = $this->sub_act; $this->browse_needed = false; if ($this->entity_select == 'event' || $this->entity_select == 'person' || $this->entity_select == 'supporting_docs_meta') { $this->browse_needed = true; } if ($this->entity_select == 'biographic_details' && $conf['menus']['biography_list']) { $this->browse_needed = true; } include_once APPROOT . 'mod/admin/customization_form.inc'; //include select entity form $this->customization_form = $customization_form; //if the locale is changed need to display extra column in label customization //if(is_locale_changed()) $this->locale = $conf['locale']; include_once APPROOT . 'inc/i18n/lib_l10n.inc'; $this->locales = l10n_get_locals(); if (isset($this->entity_select)) { if ($this->sub_act == 'help') { if ($_POST['save_help']) { form_customization_update_help($_POST, $this->entity_select); } $this->help_texts = Browse::getHelpText($this->entity_select, $this->locales); return; } elseif ($this->sub_act == 'order' && isset($_POST['itemsorder'])) { form_customization_update_fields_order($this->entity_select); } else { //if update is sent save data //OES-28. By pressing enter forms submited. if there no reset nor update - entered data will be lost. //so better to save changes. update by default //if($_POST['update']){ if ('POST' == $_SERVER['REQUEST_METHOD']) { form_customization_process_entity_form($this->entity_select); } /* if (isset($_POST['reset'])) { form_customization_reset_all($this->entity_select); } */ // OES-28 /* $reset_fields = form_customization_get_reset_fields(); foreach ($reset_fields as $post_value => $table_field) { if (isset($_POST[$post_value])) { form_customization_reset_field($this->entity_select, $table_field); } } */ } //include field form include_once APPROOT . 'mod/admin/entity_form.inc'; $this->entity_form = $entity_form; if ($this->sub_act == 'label') { $this->res = Browse::getFieldsTranslations($this->entity_select, $this->locales); } else { $this->res = form_customization_get_field_table($this->entity_select); } if ($this->sub_act == 'visibility') { $fields_form = generate_formarray($this->entity_select, "new"); $fields_form2 = array(); foreach ($fields_form as $k => $f) { if ($f["type"] == 'mt_tree' || $f['type'] == 'mt_select' || $f['type'] == 'radio') { $fields_form2[$k] = $f; } } $this->fields_form = $fields_form2; $res = Browse::getFields($this->entity_select); $fields = array(); $field_numbers = array(); foreach ($res as $record) { if ($record['enabled'] == 'y' && $record['visible_new'] == 'y' && ($record['field_type'] == 'mt_tree' || $record['field_type'] == 'mt_select' || $record['field_type'] == 'radio')) { $fields[$record['field_number']] = $record; } $field_numbers[] = $record['field_number']; } $this->fields_for_hide = $fields; $browse = new Browse(); $sql = "SELECT * from data_dict_visibility where field_number in ('" . implode("','", $field_numbers) . "') order by field_number,field_number2"; $this->visibility_fields = $browse->ExecuteQuery($sql); } } }
public function act_entity_relations() { $entity_relations = ['event' => ['act', 'victim', 'perpetrator', 'involvement', 'intervention', 'information', 'source', 'chain_of_events'], 'act' => ['involvement', 'victim', 'perpetrator', 'arrest', 'torture', 'killing', 'destruction'], 'victim' => ['involvement', 'perpetrator'], 'involvement' => ['perpetrator'], 'perpetrator' => [], 'information' => ['source'], 'source' => [], 'intervention' => ['intervening_party', 'victim'], 'intervening_party' => [], 'supporting_docs_meta' => [], 'person' => ['address', 'biographic_details'], 'biographic_details' => [], 'address' => [], 'chain_of_events' => [], 'arrest' => ['involvement', 'victim', 'perpetrator'], 'torture' => ['involvement', 'victim', 'perpetrator'], 'killing' => ['involvement', 'victim', 'perpetrator'], 'destruction' => ['involvement', 'victim', 'perpetrator']]; $subformats_array = []; foreach ((new Subformats())->get_all() as $subformat) { $subformats_array[] = $subformat['value']; } global $global; $db = $global['db']; $dbname = $db->database; $subformats = "('" . implode("', '", $subformats_array) . "')"; $sql = "SELECT\n `TABLE_NAME`,\n `COLUMN_NAME`,\n `REFERENCED_TABLE_NAME`,\n `REFERENCED_COLUMN_NAME`\n FROM `information_schema`.`KEY_COLUMN_USAGE`\n WHERE `CONSTRAINT_SCHEMA` = '{$dbname}' AND\n `REFERENCED_TABLE_SCHEMA` IS NOT NULL AND\n `REFERENCED_TABLE_NAME` IS NOT NULL AND\n `REFERENCED_COLUMN_NAME` IS NOT NULL AND\n `TABLE_NAME` IN {$subformats}"; $browse = new Browse(); $subformat_relations = $browse->ExecuteQuery($sql); foreach ($subformat_relations as $relation) { $entity_relations[$relation['REFERENCED_TABLE_NAME']][] = $relation['TABLE_NAME']; $entity_relations[$relation['TABLE_NAME']] = []; } echo json_encode($entity_relations); exit; }
public static function getEventsDocList($event_record_number, $get_data = null) { if ($get_data['filter'] != null) { $filter_where = ''; $filter_where .= $get_data['doc_id'] != null ? ' AND sdm.doc_id LIKE ' . "'%{$get_data['doc_id']}%'" : null; //$filter_where .= ($get_data['entity_type'] != null) ? ' AND entity_type LIKE ' . "'%{$get_data['entity_type']}%'" : null; $filter_where .= $get_data['title'] != null ? ' AND sdm.title LIKE ' . "'%{$get_data['title']}%'" : null; $filter_where .= $get_data['type'] != null ? ' AND sdm.type LIKE ' . "'%{$get_data['type']}%'" : null; $filter_where .= $get_data['format'] != null ? ' AND sdm.format LIKE ' . "'%{$get_data['format']}%'" : null; } $order_by = $get_data['sort'] != null ? "ORDER BY " . $get_data['sort'] . ' ' . $get_data['sortorder'] : ''; $sql = "(SELECT 'event' AS 'entity_type', e.event_record_number AS 'record_number', sdm.*, sd.uri FROM supporting_docs_meta AS sdm\n\t\t\t\tINNER JOIN supporting_docs AS sd ON sdm.doc_id = sd.doc_id\n\t\t\t\tINNER JOIN event_doc AS ed ON sdm.doc_id = ed.doc_id\n\t\t\t\tINNER JOIN event AS e ON ed.record_number = e.event_record_number\n\t\t\t\tWHERE e.event_record_number = '{$event_record_number}' {$filter_where})\n\t\t\t\tUNION\n\t\t\t\t(SELECT 'act' AS 'entity_type', a.act_record_number AS 'record_number', sdm.*, sd.uri FROM supporting_docs_meta AS sdm\n\t\t\t\tINNER JOIN supporting_docs AS sd ON sdm.doc_id = sd.doc_id\n\t\t\t\tINNER JOIN act_doc AS ad ON sdm.doc_id = ad.doc_id\n\t\t\t\tINNER JOIN act AS a ON a.act_record_number = ad.record_number\n\t\t\t\tINNER JOIN event AS e ON a.event = e.event_record_number\n\t\t\t\tWHERE e.event_record_number = '{$event_record_number}' {$filter_where})\n\t\t\t\tUNION\n\t\t\t\t(SELECT 'information' AS 'entity_type', info.information_record_number AS 'record_number', sdm.*, sd.uri FROM supporting_docs_meta AS sdm\n\t\t\t\tINNER JOIN supporting_docs AS sd ON sdm.doc_id = sd.doc_id\n\t\t\t\tINNER JOIN information_doc AS infod ON sdm.doc_id = infod.doc_id\n\t\t\t\tINNER JOIN information AS info ON info.information_record_number = infod.record_number\n\t\t\t\tINNER JOIN event AS e ON info.event = e.event_record_number\n\t\t\t\tWHERE e.event_record_number = '{$event_record_number}' {$filter_where})\n\t\t\t\tUNION\n\t\t\t\t(SELECT 'intervention' AS 'entity_type', intv.intervention_record_number AS 'record_number', sdm.*, sd.uri FROM supporting_docs_meta AS sdm\n\t\t\t\tINNER JOIN supporting_docs AS sd ON sdm.doc_id = sd.doc_id\n\t\t\t\tINNER JOIN intervention_doc AS intvd ON sdm.doc_id = intvd.doc_id\n\t\t\t\tINNER JOIN intervention AS intv ON intv.intervention_record_number = intvd.record_number\n\t\t\t\tINNER JOIN event AS e ON intv.event = e.event_record_number\n\t\t\t\tWHERE e.event_record_number = '{$event_record_number}' {$filter_where})\n\t\t\t\tUNION\n\t\t\t\t(SELECT 'involvement' AS 'entity_type', inv.involvement_record_number AS 'record_number', sdm.*, sd.uri FROM supporting_docs_meta AS sdm\n\t\t\t\tINNER JOIN supporting_docs AS sd ON sdm.doc_id = sd.doc_id\n\t\t\t\tINNER JOIN involvement_doc AS invd ON sdm.doc_id = invd.doc_id\n\t\t\t\tINNER JOIN involvement AS inv ON inv.involvement_record_number = invd.record_number\n\t\t\t\tINNER JOIN event AS e ON inv.event = e.event_record_number\n\t\t\t\tWHERE e.event_record_number = '{$event_record_number}' {$filter_where})\n\t\t\t\tUNION\n\t\t\t\t(SELECT 'victim' AS 'entity_type', a.victim AS 'record_number', sdm.*, sd.uri FROM supporting_docs_meta AS sdm\n\t\t\t\tINNER JOIN supporting_docs AS sd ON sdm.doc_id = sd.doc_id\n\t\t\t\tINNER JOIN person_doc AS pd ON sdm.doc_id = pd.doc_id\n\t\t\t\tINNER JOIN act AS a ON a.victim = pd.record_number\n\t\t\t\tINNER JOIN event AS e ON a.event = e.event_record_number\n\t\t\t\tWHERE e.event_record_number = '{$event_record_number}' {$filter_where})\n\t\t\t\tUNION\n\t\t\t\t(SELECT 'source' AS 'entity_type', info.source AS 'record_number', sdm.*, sd.uri FROM supporting_docs_meta AS sdm\n\t\t\t\tINNER JOIN supporting_docs AS sd ON sdm.doc_id = sd.doc_id\n\t\t\t\tINNER JOIN person_doc AS pd ON sdm.doc_id = pd.doc_id\n\t\t\t\tINNER JOIN information AS info ON info.source = pd.record_number\n\t\t\t\tINNER JOIN event AS e ON info.event = e.event_record_number\n\t\t\t\tWHERE e.event_record_number = '{$event_record_number}' {$filter_where})\n\t\t\t\tUNION\n\t\t\t\t(SELECT 'intervening_party' AS 'entity_type', intv.intervening_party AS 'record_number', sdm.*, sd.uri FROM supporting_docs_meta AS sdm\n\t\t\t\tINNER JOIN supporting_docs AS sd ON sdm.doc_id = sd.doc_id\n\t\t\t\tINNER JOIN person_doc AS pd ON sdm.doc_id = pd.doc_id\n\t\t\t\tINNER JOIN intervention AS intv ON intv.intervening_party = pd.record_number\n\t\t\t\tINNER JOIN event AS e ON intv.event = e.event_record_number\n\t\t\t\tWHERE e.event_record_number = '{$event_record_number}' {$filter_where})\n\t\t\t\tUNION\n\t\t\t\t(SELECT 'perpetrator' AS 'entity_type', inv.perpetrator AS 'record_number', sdm.*, sd.uri FROM supporting_docs_meta AS sdm\n\t\t\t\tINNER JOIN supporting_docs AS sd ON sdm.doc_id = sd.doc_id\n\t\t\t\tINNER JOIN person_doc AS pd ON sdm.doc_id = pd.doc_id\n\t\t\t\tINNER JOIN involvement AS inv ON inv.perpetrator = pd.record_number\n\t\t\t\tINNER JOIN event AS e ON inv.event = e.event_record_number\n\t\t\t\tWHERE e.event_record_number = '{$event_record_number}' {$filter_where}) {$order_by}"; $browse = new Browse(); $results = $browse->ExecuteQuery($sql); return $sql; }
if (in_array($module, array("events", "person", "docu", "analysis", "home")) && !in_array($action, array("browse", "browse_act", "browse_intervention", "browse_biography", "add_act_full"))) { $defaultMenuItems = getDefaultMenuItems(); $activemenu = $module . "_menu"; $topMenuItems = getMenu($activemenu); if ($conf[$activemenu]) { $acMenu = @unserialize($conf[$activemenu]); if ($acMenu) { $topMenuItems = $acMenu; } } global $global; global $conf; $locale = $conf['locale']; $sql = "SELECT * FROM data_dict WHERE field_type = 'subformat' AND entity = '" . $module . "' AND visible_view = 'y'"; $browse = new Browse(); $subformats = $browse->ExecuteQuery($sql); foreach ($subformats as $subformat) { $field_number = $subformat['field_number']; $sql = "SELECT msgstr FROM data_dict_l10n WHERE msgid = {$field_number} AND locale = '{$locale}'"; $l10n = $browse->ExecuteQuery($sql); $title = $subformat['field_label']; if (!is_null($l10n)) { $title = $l10n[0]['msgstr']; } $urlParams = array_merge(array(), $_GET); unset($urlParams['mod']); unset($urlParams['act']); $urlParams['subformat'] = $subformat['field_name']; $menuItem = array('id' => $subformat['field_number'], 'url' => get_url($module, 'subformat_list', null, $urlParams, null, true), 'title' => $title, 'module' => $module, 'action' => 'subformat', 'aclmod' => $module); $topMenuItems[] = $menuItem; }