dolibarr 23.0.3
commongeofield.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2025 Open-Dsi <support@open-dsi.fr>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
24require_once DOL_DOCUMENT_ROOT . '/core/class/fields/commonfield.class.php';
25
26
31{
35 public $emptyValues = array('');
36
37
50 public function printInputSearchField($fieldInfos, $key, $value, $keyPrefix = '', $keySuffix = '', $moreCss = '', $moreAttrib = '')
51 {
52 return '';
53 }
54
67 public function printInputField($fieldInfos, $key, $value, $keyPrefix = '', $keySuffix = '', $moreCss = '', $moreAttrib = '')
68 {
69 $htmlName = $keyPrefix . $key . $keySuffix;
70
71 return self::$form->inputGeoPoint($htmlName, (string) $value, $fieldInfos->type);
72 }
73
86 public function printOutputField($fieldInfos, $key, $value, $keyPrefix = '', $keySuffix = '', $moreCss = '', $moreAttrib = '')
87 {
88 return !$this->isEmptyValue($fieldInfos, $value) ? self::$form->outputGeoPoint((string) $value, $fieldInfos->type) : '';
89 }
90
100 public function getInputCss($fieldInfos, $moreCss = '', $defaultCss = '')
101 {
102 return parent::getInputCss($fieldInfos, $moreCss, $defaultCss);
103 }
104
114 public function verifyFieldValue($fieldInfos, $key, $value)
115 {
116 // Todo make the validator test for geo point
117 return parent::verifyFieldValue($fieldInfos, $key, $value);
118 }
119
130 public function verifyPostFieldValue($fieldInfos, $key, $keyPrefix = '', $keySuffix = '')
131 {
132 return parent::verifyPostFieldValue($fieldInfos, $key, $keyPrefix, $keySuffix);
133 }
134
146 public function getPostFieldValue($fieldInfos, $key, $defaultValue = null, $keyPrefix = '', $keySuffix = '')
147 {
148 $htmlName = $keyPrefix . $key . $keySuffix;
149
150 if (GETPOSTISSET($htmlName)) {
151 $value = GETPOST($htmlName, 'restricthtml');
152 if ($value != '{}') {
153 require_once DOL_DOCUMENT_ROOT . '/core/class/dolgeophp.class.php';
154 $dolgeophp = new DolGeoPHP($this->db);
155 $value = $dolgeophp->getWkt($value);
156 } else {
157 $value = '';
158 }
159 } else {
160 $value = $defaultValue;
161 }
162
163 return $value;
164 }
165
177 public function getPostSearchFieldValue($fieldInfos, $key, $defaultValue = null, $keyPrefix = '', $keySuffix = '')
178 {
179 return '';
180 }
181
191 public function sqlFilterSearchField($fieldInfos, $key, $value)
192 {
193 return '';
194 }
195}
Class to common field.
isEmptyValue($fieldInfos, $value, $emptyValues=null)
Check if the value is deemed as empty.
Class to common geo field (for linestrg, multipts, point, polygon, ...)
sqlFilterSearchField($fieldInfos, $key, $value)
Get sql filter for search field.
getPostSearchFieldValue($fieldInfos, $key, $defaultValue=null, $keyPrefix='', $keySuffix='')
Get search field value from GET/POST.
verifyFieldValue($fieldInfos, $key, $value)
Verify if the field value is valid.
getInputCss($fieldInfos, $moreCss='', $defaultCss='')
Get input CSS.
getPostFieldValue($fieldInfos, $key, $defaultValue=null, $keyPrefix='', $keySuffix='')
Get field value from GET/POST.
printInputField($fieldInfos, $key, $value, $keyPrefix='', $keySuffix='', $moreCss='', $moreAttrib='')
Return HTML string to put an input field into a page.
printInputSearchField($fieldInfos, $key, $value, $keyPrefix='', $keySuffix='', $moreCss='', $moreAttrib='')
Return HTML string to put an input search field into a page.
verifyPostFieldValue($fieldInfos, $key, $keyPrefix='', $keySuffix='')
Verify if the field value from GET/POST is valid.
printOutputField($fieldInfos, $key, $value, $keyPrefix='', $keySuffix='', $moreCss='', $moreAttrib='')
Return HTML string to show a field into a page.
Class to manage Geo processing Usage: $dolgeophp=new DolGeoPHP($db);.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.