本文整理汇总了PHP中Browse::getEntityLocationFields方法的典型用法代码示例。如果您正苦于以下问题:PHP Browse::getEntityLocationFields方法的具体用法?PHP Browse::getEntityLocationFields怎么用?PHP Browse::getEntityLocationFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Browse
的用法示例。
在下文中一共展示了Browse::getEntityLocationFields方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: act_facetsearchresults
//.........这里部分代码省略.........
}
$terms = array();
switch ($fieldType) {
case 'radio':
$label = _t('YES');
if (isset($facetcounts["y"])) {
$label .= " (" . $facetcounts["y"] . ")";
}
$resp["facets"][$field]["terms"][] = array('term' => 'y', 'label' => $label);
$label = _t('NO');
if (isset($facetcounts["n"])) {
$label .= " (" . $facetcounts["n"] . ")";
}
$resp["facets"][$field]["terms"][] = array('term' => 'n', 'label' => $label);
$resp["facets"][$field]["entity"] = $entity;
break;
case 'mt_select':
$data_array = MtFieldWrapper::getMTList($listCode);
$size = count($data_array);
$options[''] = ' ';
for ($i = 0; $i < $size; $i++) {
$label = $data_array[$i]['label'];
if (isset($facetcounts[$data_array[$i]['vocab_number']])) {
$label .= " (" . $facetcounts[$data_array[$i]['vocab_number']] . ")";
}
$terms[] = array('term' => $data_array[$i]['vocab_number'], 'label' => $label);
}
$resp["facets"][$field] = array("terms" => $terms, "entity" => $entity);
break;
case 'mt_tree':
$data_array = MtFieldWrapper::getMTList($listCode);
$count = count($data_array);
for ($i = 0; $i < $count;) {
$element1 = $data_array[$i];
$label = $element1['label'];
if (isset($facetcounts[$element1['vocab_number']])) {
$label .= " (" . $facetcounts[$element1['vocab_number']] . ")";
}
$terms[] = array('term' => $element1['vocab_number'], 'label' => $label, 'level' => (int) $element1["term_level"]);
$i++;
}
$resp["facets"][$field] = array("terms" => $terms, "field_type" => "mt_tree", "entity" => $entity);
break;
}
}
}
$locationFields = Browse::getEntityLocationFields($selEntity);
$field_names = array();
$fieldsArray = array();
$markers = array();
if ($locationFields) {
$selectFields = array();
$sel = new stdClass();
$sel->entity = $selEntityOriginal;
$sel->field = get_primary_key($selEntity);
// . "_record_number";
$selectFields[] = $sel;
foreach ($locationFields as $locationField) {
$field_names[] = $locationField["field_name"];
/* $fieldsArray[] = $locationField["field_name"] . "_latitude";
$fieldsArray[] = $locationField["field_name"] . "_longitude"; */
$sel = new stdClass();
$sel->entity = $selEntityOriginal;
$sel->field = $locationField["field_name"] . "_latitude";
$selectFields[] = $sel;
$sel = new stdClass();
$sel->entity = $selEntityOriginal;
$sel->field = $locationField["field_name"] . "_longitude";
$selectFields[] = $sel;
}
$query->select = $selectFields;
$searchSql = new SearchResultGenerator();
$sqlArray = $searchSql->sqlForJsonQuery(json_encode($query));
$sql = $sqlArray['result'];
if ($limit != -1) {
// $sql .= " LIMIT $start , $limit";
}
//$sql = "select " . $selEntity . "_record_number," . implode(",", $fieldsArray) . " from " . $selEntity;
try {
$res = $global['db']->GetAll($sql);
} catch (Exception $e) {
$response->error = "error";
//$e->getMessage();
}
foreach ($res as $val) {
$url = get_record_url($val[0], $selEntity);
$i = 1;
foreach ($field_names as $field_name) {
if ($val[$i] && $val[$i + 1]) {
$markers[] = array("latitude" => $val[$i], "longitude" => $val[$i + 1], "title" => $val[0], "content" => "<a href='" . $url . "' target='_blank'>" . $val[0] . "</a>");
}
$i = $i + 2;
}
}
}
$resp["markers"] = $markers;
}
echo json_encode($resp);
exit;
}