當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Browse::getEntityLocationFields方法代碼示例

本文整理匯總了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;
 }
開發者ID:GeraldScott,項目名稱:OpenEvSys,代碼行數:101,代碼來源:analysisModule.class.php


注:本文中的Browse::getEntityLocationFields方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。