本文整理汇总了PHP中PMA_Util::getGISDatatypes方法的典型用法代码示例。如果您正苦于以下问题:PHP PMA_Util::getGISDatatypes方法的具体用法?PHP PMA_Util::getGISDatatypes怎么用?PHP PMA_Util::getGISDatatypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMA_Util
的用法示例。
在下文中一共展示了PMA_Util::getGISDatatypes方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: factory
/**
* Returns the singleton instance of geometric class of the given type.
*
* @param string $type type of the geometric object
*
* @return PMA_GIS_Geometry the singleton instance of geometric class
* of the given type
*
* @access public
* @static
*/
public static function factory($type)
{
include_once './libraries/gis/GIS_Geometry.class.php';
$type_lower = strtolower($type);
$file = './libraries/gis/GIS_' . ucfirst($type_lower) . '.class.php';
if (!PMA_isValid($type_lower, PMA_Util::getGISDatatypes()) || !file_exists($file)) {
return false;
}
if (include_once $file) {
switch (strtoupper($type)) {
case 'MULTIPOLYGON':
return PMA_GIS_Multipolygon::singleton();
case 'POLYGON':
return PMA_GIS_Polygon::singleton();
case 'MULTIPOINT':
return PMA_GIS_Multipoint::singleton();
case 'POINT':
return PMA_GIS_Point::singleton();
case 'MULTILINESTRING':
return PMA_GIS_Multilinestring::singleton();
case 'LINESTRING':
return PMA_GIS_Linestring::singleton();
case 'GEOMETRYCOLLECTION':
return PMA_GIS_Geometrycollection::singleton();
default:
return false;
}
} else {
return false;
}
}
示例2: _getGeomFuncHtml
/**
* Generates HTML for a geometrical function column to be displayed in table
* search selection form
*
* @param integer $column_index index of current column in $columnTypes array
*
* @return string the generated HTML
*/
private function _getGeomFuncHtml($column_index)
{
$html_output = '';
// return if geometrical column is not present
if (!$this->_geomColumnFlag) {
return $html_output;
}
/**
* Displays 'Function' column if it is present
*/
$html_output .= '<td>';
$geom_types = PMA_Util::getGISDatatypes();
// if a geometry column is present
if (in_array($this->_columnTypes[$column_index], $geom_types)) {
$html_output .= '<select class="geom_func" name="geom_func[' . $column_index . ']">';
// get the relevant list of GIS functions
$funcs = PMA_Util::getGISFunctions($this->_columnTypes[$column_index], true, true);
/**
* For each function in the list of functions,
* add an option to select list
*/
foreach ($funcs as $func_name => $func) {
$name = isset($func['display']) ? $func['display'] : $func_name;
$html_output .= '<option value="' . htmlspecialchars($name) . '">' . htmlspecialchars($name) . '</option>';
}
$html_output .= '</select>';
} else {
$html_output .= ' ';
}
$html_output .= '</td>';
return $html_output;
}
示例3: PMA_getHtmlForInsertEditFormColumn
/**
* Function to get html for each insert/edit column
*
* @param array $table_columns table columns
* @param int $column_number column index in table_columns
* @param array $comments_map comments map
* @param bool $timestamp_seen whether timestamp seen
* @param array $current_result current result
* @param string $chg_evt_handler javascript change event handler
* @param string $jsvkey javascript validation key
* @param string $vkey validation key
* @param bool $insert_mode whether insert mode
* @param array $current_row current row
* @param bool $odd_row whether odd row
* @param int &$o_rows row offset
* @param int &$tabindex tab index
* @param int $columns_cnt columns count
* @param bool $is_upload whether upload
* @param int $tabindex_for_function tab index offset for function
* @param array $foreigners foreigners
* @param int $tabindex_for_null tab index offset for null
* @param int $tabindex_for_value tab index offset for value
* @param string $table table
* @param string $db database
* @param int $row_id row id
* @param array $titles titles
* @param int $biggest_max_file_size biggest max file size
* @param string $default_char_editing default char editing mode which is stored
* in the config.inc.php script
* @param string $text_dir text direction
* @param array $repopulate the data to be repopulated
* @param array $column_mime the mime information of column
* @param string $where_clause the where clause
*
* @return string
*/
function PMA_getHtmlForInsertEditFormColumn($table_columns, $column_number, $comments_map, $timestamp_seen, $current_result, $chg_evt_handler, $jsvkey, $vkey, $insert_mode, $current_row, $odd_row, &$o_rows, &$tabindex, $columns_cnt, $is_upload, $tabindex_for_function, $foreigners, $tabindex_for_null, $tabindex_for_value, $table, $db, $row_id, $titles, $biggest_max_file_size, $default_char_editing, $text_dir, $repopulate, $column_mime, $where_clause)
{
$column = $table_columns[$column_number];
if (!isset($column['processed'])) {
$column = PMA_analyzeTableColumnsArray($column, $comments_map, $timestamp_seen);
}
$as_is = false;
if (!empty($repopulate) && !empty($current_row)) {
$current_row[$column['Field']] = $repopulate[$column['Field_md5']];
$as_is = true;
}
$extracted_columnspec = PMA_Util::extractColumnSpec($column['Type']);
if (-1 === $column['len']) {
$column['len'] = $GLOBALS['dbi']->fieldLen($current_result, $column_number);
// length is unknown for geometry fields,
// make enough space to edit very simple WKTs
if (-1 === $column['len']) {
$column['len'] = 30;
}
}
//Call validation when the form submitted...
$onChangeClause = $chg_evt_handler . "=\"return verificationsAfterFieldChange('" . PMA_escapeJsString($column['Field_md5']) . "', '" . PMA_escapeJsString($jsvkey) . "','" . $column['pma_type'] . "')\"";
// Use an MD5 as an array index to avoid having special characters
// in the name attribute (see bug #1746964 )
$column_name_appendix = $vkey . '[' . $column['Field_md5'] . ']';
if ($column['Type'] === 'datetime' && !isset($column['Default']) && !is_null($column['Default']) && $insert_mode) {
$column['Default'] = date('Y-m-d H:i:s', time());
}
$html_output = PMA_getHtmlForFunctionOption($odd_row, $column, $column_name_appendix);
if ($GLOBALS['cfg']['ShowFieldTypesInDataEditView']) {
$html_output .= PMA_getHtmlForInsertEditColumnType($column);
}
//End if
// Get a list of GIS data types.
$gis_data_types = PMA_Util::getGISDatatypes();
// Prepares the field value
$real_null_value = false;
$special_chars_encoded = '';
if (!empty($current_row)) {
// (we are editing)
list($real_null_value, $special_chars_encoded, $special_chars, $data, $backup_field) = PMA_getSpecialCharsAndBackupFieldForExistingRow($current_row, $column, $extracted_columnspec, $real_null_value, $gis_data_types, $column_name_appendix, $as_is);
} else {
// (we are inserting)
// display default values
$tmp = $column;
if (isset($repopulate[$column['Field_md5']])) {
$tmp['Default'] = $repopulate[$column['Field_md5']];
}
list($real_null_value, $data, $special_chars, $backup_field, $special_chars_encoded) = PMA_getSpecialCharsAndBackupFieldForInsertingMode($tmp, $real_null_value);
unset($tmp);
}
$idindex = $o_rows * $columns_cnt + $column_number + 1;
$tabindex = $idindex;
// Get a list of data types that are not yet supported.
$no_support_types = PMA_Util::unsupportedDatatypes();
// The function column
// -------------------
if ($GLOBALS['cfg']['ShowFunctionFields']) {
$html_output .= PMA_getFunctionColumn($column, $is_upload, $column_name_appendix, $onChangeClause, $no_support_types, $tabindex_for_function, $tabindex, $idindex, $insert_mode);
}
// The null column
// ---------------
$foreignData = PMA_getForeignData($foreigners, $column['Field'], false, '', '');
$html_output .= PMA_getNullColumn($column, $column_name_appendix, $real_null_value, $tabindex, $tabindex_for_null, $idindex, $vkey, $foreigners, $foreignData);
//.........这里部分代码省略.........
示例4: PMA_getHtmlForInsertEditFormColumn
/**
* Function to get html for each insert/edit column
*
* @param array $table_columns table columns
* @param int $i row counter
* @param array $column column
* @param array $comments_map comments map
* @param bool $timestamp_seen whether timestamp seen
* @param array $current_result current result
* @param string $chg_evt_handler javascript change event handler
* @param string $jsvkey javascript validation key
* @param string $vkey validation key
* @param bool $insert_mode whether insert mode
* @param array $current_row current row
* @param bool $odd_row whether odd row
* @param int &$o_rows row offset
* @param int &$tabindex tab index
* @param int $columns_cnt columns count
* @param bool $is_upload whether upload
* @param int $tabindex_for_function tab index offset for function
* @param array $foreigners foreigners
* @param int $tabindex_for_null tab index offset for null
* @param int $tabindex_for_value tab index offset for value
* @param string $table table
* @param string $db database
* @param int $row_id row id
* @param array $titles titles
* @param int $biggest_max_file_size biggest max file size
* @param string $default_char_editing default char editing mode which is stroe
* in the config.inc.php script
* @param string $text_dir text direction
*
* @return string
*/
function PMA_getHtmlForInsertEditFormColumn($table_columns, $i, $column, $comments_map, $timestamp_seen, $current_result, $chg_evt_handler, $jsvkey, $vkey, $insert_mode, $current_row, $odd_row, &$o_rows, &$tabindex, $columns_cnt, $is_upload, $tabindex_for_function, $foreigners, $tabindex_for_null, $tabindex_for_value, $table, $db, $row_id, $titles, $biggest_max_file_size, $default_char_editing, $text_dir)
{
if (!isset($table_columns[$i]['processed'])) {
$column = $table_columns[$i];
$column = PMA_analyzeTableColumnsArray($column, $comments_map, $timestamp_seen);
}
$extracted_columnspec = PMA_Util::extractColumnSpec($column['Type']);
if (-1 === $column['len']) {
$column['len'] = $GLOBALS['dbi']->fieldLen($current_result, $i);
// length is unknown for geometry fields,
// make enough space to edit very simple WKTs
if (-1 === $column['len']) {
$column['len'] = 30;
}
}
//Call validation when the form submitted...
$unnullify_trigger = $chg_evt_handler . "=\"return verificationsAfterFieldChange('" . PMA_escapeJsString($column['Field_md5']) . "', '" . PMA_escapeJsString($jsvkey) . "','" . $column['pma_type'] . "')\"";
// Use an MD5 as an array index to avoid having special characters
// in the name atttibute (see bug #1746964 )
$column_name_appendix = $vkey . '[' . $column['Field_md5'] . ']';
if ($column['Type'] == 'datetime' && !isset($column['Default']) && !is_null($column['Default']) && ($insert_mode || !isset($current_row[$column['Field']]))) {
// INSERT case or
// UPDATE case with an NULL value
$current_row[$column['Field']] = date('Y-m-d H:i:s', time());
}
$html_output = PMA_getHtmlForFunctionOption($odd_row, $column, $column_name_appendix);
if ($GLOBALS['cfg']['ShowFieldTypesInDataEditView']) {
$html_output .= PMA_getHtmlForInsertEditColumnType($column);
}
//End if
// Get a list of GIS data types.
$gis_data_types = PMA_Util::getGISDatatypes();
// Prepares the field value
$real_null_value = false;
$special_chars_encoded = '';
if (isset($current_row)) {
// (we are editing)
list($real_null_value, $special_chars_encoded, $special_chars, $data, $backup_field) = PMA_getSpecialCharsAndBackupFieldForExistingRow($current_row, $column, $extracted_columnspec, $real_null_value, $gis_data_types, $column_name_appendix);
} else {
// (we are inserting)
// display default values
list($real_null_value, $data, $special_chars, $backup_field, $special_chars_encoded) = PMA_getSpecialCharsAndBackupFieldForInsertingMode($column, $real_null_value);
}
$idindex = $o_rows * $columns_cnt + $i + 1;
$tabindex = $idindex;
// Get a list of data types that are not yet supported.
$no_support_types = PMA_Util::unsupportedDatatypes();
// The function column
// -------------------
if ($GLOBALS['cfg']['ShowFunctionFields']) {
$html_output .= PMA_getFunctionColumn($column, $is_upload, $column_name_appendix, $unnullify_trigger, $no_support_types, $tabindex_for_function, $tabindex, $idindex, $insert_mode);
}
// The null column
// ---------------
$foreignData = PMA_getForeignData($foreigners, $column['Field'], false, '', '');
$html_output .= PMA_getNullColumn($column, $column_name_appendix, $real_null_value, $tabindex, $tabindex_for_null, $idindex, $vkey, $foreigners, $foreignData);
// The value column (depends on type)
// ----------------
// See bug #1667887 for the reason why we don't use the maxlength
// HTML attribute
$html_output .= ' <td>' . "\n";
// Will be used by js/tbl_change.js to set the default value
// for the "Continue insertion" feature
$html_output .= '<span class="default_value hide">' . $special_chars . '</span>';
$html_output .= PMA_getValueColumn($column, $backup_field, $column_name_appendix, $unnullify_trigger, $tabindex, $tabindex_for_value, $idindex, $data, $special_chars, $foreignData, $odd_row, array($table, $db), $row_id, $titles, $text_dir, $special_chars_encoded, $vkey, $is_upload, $biggest_max_file_size, $default_char_editing, $no_support_types, $gis_data_types, $extracted_columnspec);
$html_output .= '</td>' . '</tr>';
//.........这里部分代码省略.........
示例5: date
$current_row[$column['Field']] = date('Y-m-d H:i:s', time());
}
$html_output .= '<tr class="noclick ' . ($odd_row ? 'odd' : 'even' ) . '">'
. '<td ' . ($cfg['LongtextDoubleTextarea'] && strstr($column['True_Type'], 'longtext') ? 'rowspan="2"' : '') . 'class="center">'
. $column['Field_title']
. '<input type="hidden" name="fields_name' . $column_name_appendix . '" value="' . $column['Field_html'] . '"/>'
. '</td>';
if ($cfg['ShowFieldTypesInDataEditView']) {
$html_output .= '<td class="center' . $column['wrap'] . '">'
. '<span class="column_type">' . $column['pma_type'] . '</span>'
. '</td>';
} //End if
// Get a list of GIS data types.
$gis_data_types = PMA_Util::getGISDatatypes();
// Prepares the field value
$real_null_value = false;
$special_chars_encoded = '';
if (isset($current_row)) {
// (we are editing)
list(
$real_null_value, $special_chars_encoded, $special_chars,
$data, $backup_field
)
= PMA_getSpecialCharsAndBackupFieldForExistingRow(
$current_row, $column, $extracted_columnspec,
$real_null_value, $gis_data_types, $column_name_appendix
);
} else {
示例6: _getGeomWhereClause
/**
* Return the where clause for a geometrical column.
*
* @param mixed $criteriaValues Search criteria input
* @param string $names Name of the column on which search is submitted
* @param string $func_type Search function/operator
* @param string $types Type of the field
* @param bool $geom_func Whether geometry functions should be applied
*
* @return string part of where clause.
*/
private function _getGeomWhereClause($criteriaValues, $names, $func_type, $types, $geom_func = null)
{
$geom_unary_functions = array('IsEmpty' => 1, 'IsSimple' => 1, 'IsRing' => 1, 'IsClosed' => 1);
$where = '';
// Get details about the geometry functions
$geom_funcs = PMA_Util::getGISFunctions($types, true, false);
// New output type is the output type of the function being applied
$types = $geom_funcs[$geom_func]['type'];
// If the function takes a single parameter
if ($geom_funcs[$geom_func]['params'] == 1) {
$backquoted_name = $geom_func . '(' . PMA_Util::backquote($names) . ')';
} else {
// If the function takes two parameters
// create gis data from the criteria input
$gis_data = PMA_Util::createGISData($criteriaValues);
$where = $geom_func . '(' . PMA_Util::backquote($names) . ',' . $gis_data . ')';
return $where;
}
// If the where clause is something like 'IsEmpty(`spatial_col_name`)'
if (isset($geom_unary_functions[$geom_func]) && trim($criteriaValues) == '') {
$where = $backquoted_name;
} elseif (in_array($types, PMA_Util::getGISDatatypes()) && !empty($criteriaValues)) {
// create gis data from the criteria input
$gis_data = PMA_Util::createGISData($criteriaValues);
$where = $backquoted_name . ' ' . $func_type . ' ' . $gis_data;
}
return $where;
}