本文整理汇总了PHP中Browse::ExecuteQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP Browse::ExecuteQuery方法的具体用法?PHP Browse::ExecuteQuery怎么用?PHP Browse::ExecuteQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Browse
的用法示例。
在下文中一共展示了Browse::ExecuteQuery方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_mt_value
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;
}
示例2: l10n
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;
}
示例3: act_get_help
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);
}
示例4: getAllHuriTerms
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;
}
示例5: get_data_array
//.........这里部分代码省略.........
$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();
}
示例6: get_data_array
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;
}
//.........这里部分代码省略.........
示例7: act_field_customization
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);
}
}
}
示例8: act_entity_relations
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;
}
示例9: getEventsDocList
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;
}
示例10: getDefaultMenuItems
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;
}