本文整理汇总了PHP中iform_map_get_ol_options函数的典型用法代码示例。如果您正苦于以下问题:PHP iform_map_get_ol_options函数的具体用法?PHP iform_map_get_ol_options怎么用?PHP iform_map_get_ol_options使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了iform_map_get_ol_options函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_form
/**
* Return the Indicia form code
* @param array $args Input parameters.
* @param array $node Drupal node object
* @param array $response Response from Indicia services after posting.
* @return HTML string
*/
public static function get_form($args, $node, $response)
{
iform_load_helpers(array('report_helper', 'map_helper'));
$auth = report_helper::get_read_auth($args['website_id'], $args['password']);
$reportOptions = iform_report_get_report_options($args, $auth);
$r = '<div class="ui-helper-clearfix">';
$reportOptions['geoserverLayer'] = $args['geoserver_layer'];
$reportOptions['geoserverLayerStyle'] = $args['geoserver_layer_style'];
$reportOptions['cqlTemplate'] = $args['cql_template'];
$reportOptions['clickable'] = $args['click_on_map_mode'] != 'none';
$reportOptions['clickableLayersOutputDiv'] = $args['click_on_map_div'];
if (!empty($args['click_on_map_columns'])) {
$reportOptions['clickableLayersOutputColumns'] = helper_base::explode_lines_key_value_pairs($args['click_on_map_columns']);
}
if ($args['click_on_map_mode'] != 'none') {
$reportOptions['clickableLayersOutputMode'] = $args['click_on_map_mode'];
}
// Use the proxy module if enabled, to get round limitations in URL length for
// filtered WMS requests.
if (defined('DRUPAL_BOOTSTRAP_CONFIGURATION') && module_exists('iform_proxy')) {
global $base_url;
$reportOptions['proxy'] = $base_url . '/?q=' . variable_get('iform_proxy_path', 'proxy') . '&url=';
}
$r .= '<br/>' . report_helper::report_map($reportOptions);
$options = iform_map_get_map_options($args, $readAuth);
$olOptions = iform_map_get_ol_options($args);
// This is used for drawing, so need an editlayer, but not used for input
$options['editLayer'] = true;
$options['editLayerInSwitcher'] = true;
$options['clickForSpatialRef'] = false;
if ($args['layer_picker'] != 'none') {
$picker = array('id' => 'map-layer-picker', 'includeIcons' => false, 'includeSwitchers' => true, 'includeHiddenLayers' => true);
if ($args['layer_picker'] == 'before') {
$r .= map_helper::layer_list($picker);
}
// as we have a layer picker, we can drop the layerSwitcher from the OL map.
if (array_search('layerSwitcher', $options['standardControls']) !== false) {
unset($options['standardControls'][array_search('layerSwitcher', $options['standardControls'])]);
}
}
if ($args['legend'] != 'none') {
$legend = array('id' => 'map-legend', 'includeIcons' => true, 'includeSwitchers' => false, 'includeHiddenLayers' => false);
if ($args['legend'] == 'before') {
$r .= map_helper::layer_list($legend);
}
}
if (isset($args['map_toolbar_pos'])) {
$options['toolbarDiv'] = $args['map_toolbar_pos'];
}
$r .= map_helper::map_panel($options, $olOptions);
if ($args['layer_picker'] == 'after') {
$r .= map_helper::layer_list($picker);
}
if ($args['legend'] == 'after') {
$r .= map_helper::layer_list($legend);
}
$r .= '</div>';
return $r;
}
示例2: get_form
/**
* Return the generated form output.
* @return Form HTML.
* @todo: Implement this method
*/
public static function get_form($args)
{
global $user;
$lang = isset($user) ? iform_lang_iso_639_2($user->lang) : 'eng';
if (function_exists('iform_load_helpers')) {
iform_load_helpers(array('map_helper'));
} else {
require_once dirname(dirname(__FILE__)) . '/map_helper.php';
}
$readAuth = data_entry_helper::get_read_auth($args['website_id'], $args['password']);
$r = '';
// setup the map options
$options = iform_map_get_map_options($args, $readAuth);
$olOptions = iform_map_get_ol_options($args);
if (array_key_exists('table', $_GET) && $_GET['table'] == 'sample') {
// Use a cUrl request to get the data from Indicia which contains the value we need to filter against
// Read the record that was just posted.
$fetchOpts = array('dataSource' => 'reports_for_prebuilt_forms/my_dot_map/occurrences_list', 'mode' => 'report', 'readAuth' => $readAuth, 'extraParams' => array('sample_id' => $_GET['id'], 'language' => $lang));
// @todo Error handling on the response
$occurrence = data_entry_helper::get_report_data($fetchOpts);
self::prepare_layer_titles($args, $occurrence);
// Add the 3 distribution layers if present. Reverse the order so 1st layer is topmost
$layerName = self::build_distribution_layer(3, $args, $occurrence);
if ($layerName) {
$options['layers'][] = $layerName;
}
$layerName = self::build_distribution_layer(2, $args, $occurrence);
if ($layerName) {
$options['layers'][] = $layerName;
}
$layerName = self::build_distribution_layer(1, $args, $occurrence);
if ($layerName) {
$options['layers'][] = $layerName;
}
if ($layerName) {
$options['layers'][] = $layerName;
}
// This is not a map used for input
$options['editLayer'] = false;
if ($args['hide_grid'] == false) {
// Now output a grid of the occurrences that were just saved.
$r .= "<table class=\"submission\"><thead><tr><th>" . lang::get('Species') . "</th><th>" . lang::get('Latin Name') . "</th><th>" . lang::get('Date') . "</th><th>" . lang::get('Spatial Ref') . "</th></tr></thead>\n";
$r .= "<tbody>\n";
foreach ($occurrence as $record) {
$r .= '<tr class="biota"><td>' . $record['lt4_taxon'] . '</td><td class="binomial"><em>' . $record['lt7_taxon'] . '</em></td><td>' . $record['lt0_date_start'] . '</td><td>' . $record['lt0_entered_sref'] . "</td></tr>\n";
}
$r .= "</tbody></table>\n";
}
}
$r .= '<div id="mapandlegend">';
$r .= map_helper::layer_list(array('id' => 'legend', 'includeSwitchers' => false, 'includeHiddenLayers' => false, 'includeIcons' => true, 'layerTypes' => array('overlay')));
$r .= map_helper::map_panel($options, $olOptions);
$r .= '</div>';
return $r;
}
示例3: get_form
/**
* Return the generated form output.
* @return Form HTML.
*/
public static function get_form($args)
{
iform_load_helpers(array('map_helper'));
$readAuth = map_helper::get_read_auth($args['website_id'], $args['password']);
// setup the map options
$options = iform_map_get_map_options($args, $readAuth);
$olOptions = iform_map_get_ol_options($args);
for ($layer = 1; $layer <= 3; $layer++) {
$argTitle = $args["layer_title_{$layer}"];
if (isset($argTitle) && !empty($argTitle)) {
//if there is no title then ignore the layer
$meaningId = self::get_meaning_id($layer, $args, $readAuth);
$taxon = self::get_taxon($meaningId, $readAuth);
$layerTitle = str_replace('{species}', $taxon, $argTitle);
$layerTitle = str_replace("'", "\\'", $layerTitle);
$url = map_helper::$geoserver_url . 'wms';
$argFeature = $args["wms_feature_type_{$layer}"];
$layers = "layers: '{$argFeature}'";
$argStyle = $args["wms_style_{$layer}"];
$style = $argStyle ? ", styles: '{$argStyle}'" : '';
$argWebsite = $args["website_id"];
$filter = ", CQL_FILTER: 'website_id={$argWebsite} AND taxon_meaning_id={$meaningId}";
$argCql = $args["cql_filter_{$layer}"];
if ($argCql) {
$arg = str_replace("'", "\\'", $argCql);
$filter .= " AND({$argCql})'";
} else {
$filter .= "'";
}
$script = " var distLayer{$layer} = new OpenLayers.Layer.WMS(";
$script .= "'{$layerTitle}', '{$url}',";
$script .= "{" . "{$layers}, transparent: true {$filter} {$style}},";
$script .= "{isBaseLayer: false, sphericalMercator: true, singleTile: true}";
$script .= ");\n";
map_helper::$onload_javascript .= $script;
$options['layers'][] = "distLayer{$layer}";
}
}
// This is not a map used for input
$options['editLayer'] = false;
// output a legend
$r .= map_helper::layer_list(array('includeSwitchers' => true, 'includeHiddenLayers' => true));
// output a map
$r .= map_helper::map_panel($options, $olOptions);
// Set up a page refresh for dynamic update of the map at set intervals
if ($args['refresh_timer'] !== 0 && is_numeric($args['refresh_timer'])) {
// is_int prevents injection
if (isset($args['load_on_refresh']) && !empty($args['load_on_refresh'])) {
map_helper::$javascript .= "setTimeout('window.location=\"" . $args['load_on_refresh'] . "\";', " . $args['refresh_timer'] . "*1000 );\n";
} else {
map_helper::$javascript .= "setTimeout('window.location.reload( false );', " . $args['refresh_timer'] . "*1000 );\n";
}
}
return $r;
}
示例4: get_form
/**
* Return the generated form output.
* @return Form HTML.
* @todo: Implement this method
*/
public static function get_form($args)
{
global $user;
$readAuth = data_entry_helper::get_read_auth($args['website_id'], $args['password']);
// setup the map options
$options = iform_map_get_map_options($args, $readAuth);
$olOptions = iform_map_get_ol_options($args);
if (array_key_exists('table', $_GET) && $_GET['table'] == 'sample') {
// Use a cUrl request to get the data from Indicia which contains the value we need to filter against
// Read the record that was just posted.
$fetchOpts = array('dataSource' => 'reports_for_prebuilt_forms/my_dot_map/occurrences_list', 'mode' => 'report', 'readAuth' => $readAuth, 'extraParams' => array('sample_id' => $_GET['id'], 'language' => iform_lang_iso_639_2($user->lang)));
// @todo Error handling on the response
$occurrence = data_entry_helper::get_report_data($fetchOpts);
$legend = '';
self::prepare_layer_titles($args, $occurrence);
// Add the 3 distribution layers if present. Reverse the order so 1st layer is topmost
$layerName = self::build_distribution_layer(3, $args, $occurrence);
if ($layerName) {
$options['layers'][] = $layerName;
$legend = '<div><img src="' . data_entry_helper::$geoserver_url . 'wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&LAYER=detail_occurrences&Format=image/jpeg' . '&STYLE=' . $args["wms_dist_3_style"] . '" alt=""/>' . $args["wms_dist_3_title"] . '</div>' . $legend;
}
$layerName = self::build_distribution_layer(2, $args, $occurrence);
if ($layerName) {
$options['layers'][] = $layerName;
$legend = '<div><img src="' . data_entry_helper::$geoserver_url . 'wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&LAYER=detail_occurrences&Format=image/jpeg' . '&STYLE=' . $args["wms_dist_2_style"] . '" alt=""/>' . $args["wms_dist_2_title"] . '</div>' . $legend;
}
$layerName = self::build_distribution_layer(1, $args, $occurrence);
if ($layerName) {
$options['layers'][] = $layerName;
$legend = '<div><img src="' . data_entry_helper::$geoserver_url . 'wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&LAYER=detail_occurrences&Format=image/png' . '&STYLE=' . $args["wms_dist_1_style"] . '" alt=""/>' . $args["wms_dist_1_title"] . '</div>' . $legend;
}
if ($layerName) {
$options['layers'][] = $layerName;
}
// This is not a map used for input
$options['editLayer'] = false;
// Now output a grid of the occurrences that were just saved.
$r .= "<table class=\"submission\"><thead><tr><th>" . lang::get('Species') . "</th><th>" . lang::get('Latin Name') . "</th><th>" . lang::get('Date') . "</th><th>" . lang::get('Spatial Ref') . "</th></tr></thead>\n";
$r .= "<tbody>\n";
foreach ($occurrence as $record) {
$r .= '<tr class="biota"><td>' . $record['lt4_taxon'] . '</td><td class="binomial"><em>' . $record['lt7_taxon'] . '</em></td><td>' . $record['lt0_date_start'] . '</td><td>' . $record['lt0_entered_sref'] . "</td></tr>\n";
}
$r .= "</tbody></table>\n";
$r .= '<div id="legend" class="ui-widget ui-widget-content ui-corner-all">' . $legend . '</div>';
}
$r .= data_entry_helper::map_panel($options, $olOptions);
return $r;
}
示例5: count_by_location_map
/**
* Outputs a map with an overlay of regions, showing a count for each. Default is to count records, but can
* be configured to count taxa.
*
* @param array $auth Authorisation tokens.
* @param array $args Form arguments (the settings on the form edit tab).
* @param string $tabalias The alias of the tab this is being loaded onto.
* @param array $options The options passed to this control using @option=value settings in the form structure.
* Options supported are those which can be passed to the report_helper::report_map method. In addition
* set @output=species to configure the report to show a species counts map.
* @param string $path The page reload path, in case it is required for the building of links.
* @return string HTML to insert into the page for the location map. JavaScript is added to the variables in helper_base.
*
* @link http://www.biodiverseit.co.uk/indicia/dev/docs/classes/report_helper.html#method_report_map API docs for report_helper::report_map
*/
public static function count_by_location_map($auth, $args, $tabalias, $options, $path)
{
iform_load_helpers(array('map_helper', 'report_helper'));
require_once iform_client_helpers_path() . 'prebuilt_forms/includes/map.php';
$mapOptions = iform_map_get_map_options($args, $auth['read']);
$olOptions = iform_map_get_ol_options($args);
$mapOptions['clickForSpatialRef'] = false;
$r = map_helper::map_panel($mapOptions, $olOptions);
if (!empty($options['output']) && $options['output'] === 'species') {
$type = 'species';
} else {
$type = 'occurrence';
}
$reportOptions = array_merge(iform_report_get_report_options($args, $auth['read']), array('dataSource' => "library/locations/{$type}_counts_mappable_for_event", 'featureDoubleOutlineColour' => '#f7f7f7', 'rowId' => 'id'), $options);
$r .= report_helper::report_map($reportOptions);
return $r;
}
示例6: count_by_location_map
/**
* Outputs a map with an overlay of regions, showing a count for each. Default is to count records, but can
* be configured to count taxa.
*
* @param array $auth Authorisation tokens.
* @param array $args Form arguments (the settings on the form edit tab).
* @param string $tabalias The alias of the tab this is being loaded onto.
* @param array $options The options passed to this control using @option=value settings in the form structure.
* Options supported are those which can be passed to the report_helper::report_map method. In addition
* set @output=species to configure the report to show a species counts map and set @title=... to
* include a heading in the output.
* @param string $path The page reload path, in case it is required for the building of links.
* @return string HTML to insert into the page for the location map. JavaScript is added to the variables in helper_base.
*
* @link http://www.biodiverseit.co.uk/indicia/dev/docs/classes/report_helper.html#method_report_map API docs for report_helper::report_map
*/
public static function count_by_location_map($auth, $args, $tabalias, $options, $path)
{
iform_load_helpers(array('map_helper', 'report_helper'));
require_once iform_client_helpers_path() . 'prebuilt_forms/includes/map.php';
$mapOptions = iform_map_get_map_options($args, $auth['read']);
$olOptions = iform_map_get_ol_options($args);
$mapOptions['clickForSpatialRef'] = false;
if ($args['interface'] !== 'one_page') {
$mapOptions['tabDiv'] = $tabalias;
}
$r = self::output_title($options);
$r .= map_helper::map_panel($mapOptions, $olOptions);
if (!empty($options['output']) && $options['output'] === 'species') {
$type = 'species';
} else {
$type = 'occurrence';
}
$subtype = empty($options['linked']) || $options['linked'] === false ? '' : '_linked';
$reportOptions = array_merge(iform_report_get_report_options($args, $auth['read']), array('dataSource' => "library/locations/filterable_{$type}_counts_mappable{$subtype}", 'featureDoubleOutlineColour' => '#f7f7f7', 'rowId' => 'id', 'caching' => true, 'cachePerUser' => false), $options);
$r .= report_helper::report_map($reportOptions);
return $r;
}
示例7: get_form
/**
* Return the generated form output.
* @return Form HTML.
* @todo: Implement this method
*/
public static function get_form($args)
{
$readAuth = data_entry_helper::get_read_auth($args['website_id'], $args['password']);
// setup the map options
$options = iform_map_get_map_options($args, $readAuth);
$olOptions = iform_map_get_ol_options($args);
if (array_key_exists('table', $_GET) && $_GET['table'] == 'sample') {
// Use a cUrl request to get the data from Indicia which contains the value we need to filter against
// Read the record that was just posted.
$fetchOpts = array('table' => 'occurrence', 'extraParams' => $readAuth + array('sample_id' => $_GET['id'], 'view' => 'detail'));
// @todo Error handling on the response
$occurrence = data_entry_helper::get_population_data($fetchOpts);
}
// Add the 3 distribution layers if present. Reverse the order so 1st layer is topmost
$layerName = self::build_distribution_layer(3, $args, $occurrence);
if ($layerName) {
$options['layers'][] = $layerName;
}
$layerName = self::build_distribution_layer(2, $args, $occurrence);
if ($layerName) {
$options['layers'][] = $layerName;
}
$layerName = self::build_distribution_layer(1, $args, $occurrence);
if ($layerName) {
$options['layers'][] = $layerName;
}
// Now output a grid of the occurrences that were just saved.
if (isset($occurrence)) {
$r .= "<table class=\"submission\"><thead><tr><th>Species</th><th>Date</th><th>Spatial Reference</th></tr></thead>\n";
$r .= "<tbody>\n";
foreach ($occurrence as $record) {
$r .= "<tr><td>" . $record['taxon'] . "</td><td>" . $record['date_start'] . "</td><td>" . $record['entered_sref'] . "</td></tr>\n";
}
$r .= "</tbody></table>\n";
}
$r .= data_entry_helper::map_panel($options, $olOptions);
return $r;
}
示例8: get_control_map
/**
* Get the map control.
*/
protected static function get_control_map($auth, $args, $tabalias, $options)
{
$options = array_merge(iform_map_get_map_options($args, $auth['read']), $options);
if (isset(data_entry_helper::$entity_to_load['sample:geom'])) {
$options['initialFeatureWkt'] = data_entry_helper::$entity_to_load['sample:wkt'];
}
if ($args['interface'] !== 'one_page') {
$options['tabDiv'] = $tabalias;
}
$olOptions = iform_map_get_ol_options($args);
if (!isset($options['standardControls'])) {
$options['standardControls'] = array('layerSwitcher', 'panZoom');
}
return data_entry_helper::map_panel($options, $olOptions);
}
示例9: get_template_with_map
private static function get_template_with_map($args, $readAuth, $extraParams, $paramDefaults)
{
$r = '<div id="outer-with-map" class="ui-helper-clearfix">';
$r .= '<div id="grid" class="left" style="width:65%">{paramsForm}{grid}';
// Insert a button to verify all visible, only available if viewing the clean records.
if (isset($_POST['verification-rule']) && $_POST['verification-rule'] === 'none' && empty($_POST['verification-id'])) {
$r .= '<button type="button" id="btn-verify-all">' . lang::get('Verify all visible') . '</button>';
}
$r .= '</div>';
$r .= '<div id="map-and-record" class="right" style="width: 34%"><div id="summary-map">';
$options = iform_map_get_map_options($args, $readAuth);
$olOptions = iform_map_get_ol_options($args);
// This is used for drawing, so need an editlayer, but not used for input
$options['editLayer'] = true;
$options['editLayerInSwitcher'] = true;
$options['clickForSpatialRef'] = false;
$options['featureIdField'] = 'occurrence_id';
$r .= map_helper::map_panel($options, $olOptions);
$reportMapOpts = array('dataSource' => !empty($args['mapping_report_name']) ? $args['mapping_report_name'] : $args['report_name'], 'mode' => 'report', 'readAuth' => $readAuth, 'autoParamsForm' => false, 'extraParams' => $extraParams, 'paramDefaults' => $paramDefaults, 'reportGroup' => 'verification', 'clickableLayersOutputMode' => 'report', 'rowId' => 'occurrence_id', 'sharing' => 'verification', 'ajax' => TRUE);
if (!empty($args['mapping_report_name_lores'])) {
$reportMapOpts['dataSourceLoRes'] = $args['mapping_report_name_lores'];
}
$r .= report_helper::report_map($reportMapOpts);
$r .= '</div>';
global $user;
if (function_exists('hostsite_get_user_field') && ($locationId = hostsite_get_user_field('location_expertise', false))) {
iform_map_zoom_to_location($locationId, $readAuth);
}
$r .= '<div id="record-details-wrap" class="ui-widget ui-widget-content">';
$r .= self::instructions('grid on the left');
$r .= '<div id="record-details-content" style="display: none">';
$r .= '<div id="record-details-toolbar">';
$r .= '<label>Set status:</label>';
$r .= '<button type="button" id="btn-verify">' . lang::get('Verify') . '</button>';
$r .= '<button type="button" id="btn-reject">' . lang::get('Reject') . '</button>';
$r .= '<button type="button" id="btn-query">' . lang::get('Query') . '</button>';
$r .= '<button type="button" id="btn-multiple" title="' . lang::get('Select this tool to tick off a list of records and action all of the ticked records in one go') . '">' . lang::get('Select records') . '</button>';
$r .= '<br/><label>Contact:</label>';
$r .= '<button type="button" id="btn-email-expert" class="default-button">' . lang::get('Another expert') . '</button>';
$r .= '<button type="button" id="btn-email-recorder" class="default-button">' . lang::get('Recorder') . '</button>';
$r .= '</div>';
$r .= '<div id="record-details-tabs">';
// note - there is a dependency in the JS that comments is the last tab and images the 2nd to last.
$r .= data_entry_helper::tab_header(array('tabs' => array('#details-tab' => lang::get('Details'), '#experience-tab' => lang::get('Experience'), '#phenology-tab' => lang::get('Phenology'), '#images-tab' => lang::get('Images'), '#comments-tab' => lang::get('Comments'))));
data_entry_helper::$javascript .= "indiciaData.detailsTabs = ['details','experience','phenology','images','comments'];\n";
data_entry_helper::enable_tabs(array('divId' => 'record-details-tabs'));
$r .= '<div id="details-tab"></div>';
$r .= self::other_tab_html();
$r .= '</div></div></div></div></div>';
return $r;
}
示例10: get_control_map
protected static function get_control_map($auth, $args, $tabalias, $options)
{
iform_load_helpers(array('map_helper', 'report_helper'));
// $_GET data for standard params can override displayed location
if (isset($_GET['filter-location_id']) || isset($_GET['filter-indexed_location_id'])) {
$args['display_user_profile_location'] = false;
if (!empty($_GET['filter-indexed_location_id'])) {
$args['location_boundary_id'] = $_GET['filter-indexed_location_id'];
} elseif (!empty($_GET['filter-location_id'])) {
$args['location_boundary_id'] = $_GET['filter-location_id'];
}
}
// allow us to call iform_report_get_report_options to get a default report setup, then override report_name
$args['report_name'] = '';
$sharing = empty($args['sharing']) ? 'reporting' : $args['sharing'];
$reportOptions = array_merge(iform_report_get_report_options($args, $auth['read']), array('reportGroup' => 'dynamic', 'autoParamsForm' => false, 'sharing' => $sharing, 'readAuth' => $auth['read'], 'dataSource' => $options['dataSource'], 'reportGroup' => 'dynamic', 'rememberParamsReportGroup' => 'dynamic', 'clickableLayersOutputMode' => 'report', 'rowId' => 'occurrence_id', 'ajax' => TRUE), $options);
if (self::$applyUserPrefs) {
iform_report_apply_explore_user_own_preferences($reportOptions);
}
$r = report_helper::report_map($reportOptions);
$options = array_merge(iform_map_get_map_options($args, $auth['read']), array('featureIdField' => 'occurrence_id', 'clickForSpatialRef' => false, 'reportGroup' => 'explore', 'toolbarDiv' => 'top'), $options);
$olOptions = iform_map_get_ol_options($args);
$r .= map_helper::map_panel($options, $olOptions);
return $r;
}
示例11: get_site_tab
//.........这里部分代码省略.........
$r .= '<input type="hidden" name="location:id" id="location:id" value="' . $settings['locationId'] . "\" />\n";
}
$r .= data_entry_helper::text_input(array('fieldname' => 'location:name', 'label' => lang::get('Site Name'), 'class' => 'control-width-4 required', 'disabled' => $settings['canEditBody'] ? '' : ' disabled="disabled" '));
if (!$settings['canEditBody']) {
$r .= '<p>' . lang::get('This site cannot be edited because there are walks recorded on it. Please contact the site administrator if you think there are details which need changing.') . '</p>';
} else {
if (count($settings['walks']) > 0) {
// can edit it
$r .= '<p>' . lang::get('This site has walks recorded on it. Please do not change the site details without considering the impact on the existing data.') . '</p>';
}
}
$list = explode(',', str_replace(' ', '', $args['spatial_systems']));
foreach ($list as $system) {
$systems[$system] = lang::get($system);
}
if (isset(data_entry_helper::$entity_to_load['location:centroid_sref_system']) && in_array(data_entry_helper::$entity_to_load['location:centroid_sref_system'], array('osgb', 'osie'))) {
data_entry_helper::$entity_to_load['location:centroid_sref_system'] = strtoupper(data_entry_helper::$entity_to_load['location:centroid_sref_system']);
}
$r .= data_entry_helper::sref_and_system(array('fieldname' => 'location:centroid_sref', 'geomFieldname' => 'location:centroid_geom', 'label' => 'Grid Ref.', 'systems' => $systems, 'class' => 'required', 'helpText' => lang::get('Click on the map to set the central grid reference.'), 'disabled' => $settings['canEditBody'] ? '' : ' disabled="disabled" '));
if ($settings['locationId'] && data_entry_helper::$entity_to_load['location:code'] != '' && data_entry_helper::$entity_to_load['location:code'] != null) {
$r .= data_entry_helper::text_input(array('fieldname' => 'location:code', 'label' => lang::get('Site Code'), 'class' => 'control-width-4', 'disabled' => ' readonly="readonly" '));
} else {
$r .= "<p>" . lang::get('The Site Code will be allocated by the Administrator.') . "</p>";
}
// setup the map options
$options = iform_map_get_map_options($args, $auth['read']);
// find the form blocks that need to go below the map.
$bottom = '';
$bottomBlocks = explode("\n", isset($args['bottom_blocks']) ? $args['bottom_blocks'] : '');
foreach ($bottomBlocks as $block) {
$bottom .= get_attribute_html($settings['attributes'], $args, array('extraParams' => $auth['read'], 'disabled' => $settings['canEditBody'] ? '' : ' disabled="disabled" '), $block);
}
// other blocks to go at the top, next to the map
if (isset($args['site_help']) && $args['site_help'] != '') {
$r .= '<p class="ui-state-highlight page-notice ui-corner-all">' . t($args['site_help']) . '</p>';
}
$r .= get_attribute_html($settings['attributes'], $args, array('extraParams' => $auth['read']));
$r .= '</fieldset>';
$r .= "</div>";
// left
$r .= '<div class="right" style="width: 44%">';
if (!$settings['locationId']) {
$help = t('Use the search box to find a nearby town or village, then drag the map to pan and click on the map to set the centre grid reference of the transect. ' . 'Alternatively if you know the grid reference you can enter it in the Grid Ref box on the left.');
$r .= '<p class="ui-state-highlight page-notice ui-corner-all">' . $help . '</p>';
$r .= data_entry_helper::georeference_lookup(array('label' => lang::get('Search for place'), 'driver' => $args['georefDriver'], 'georefPreferredArea' => $args['georefPreferredArea'], 'georefCountry' => $args['georefCountry'], 'georefLang' => $args['language'], 'readAuth' => $auth['read']));
}
if (isset($args['maxPrecision']) && $args['maxPrecision'] != '') {
$options['clickedSrefPrecisionMax'] = $args['maxPrecision'];
}
if (isset($args['minPrecision']) && $args['minPrecision'] != '') {
$options['clickedSrefPrecisionMin'] = $args['minPrecision'];
}
$olOptions = iform_map_get_ol_options($args);
$options['clickForSpatialRef'] = $settings['canEditBody'];
$r .= map_helper::map_panel($options, $olOptions);
$r .= '</div></div>';
// right
if (!empty($bottom)) {
$r .= $bottom;
}
if ($args['branch_assignment_permission'] != '') {
if ($settings['canAllocBranch'] || $settings['locationId']) {
$r .= self::get_branch_assignment_control($auth['read'], $settings['branchCmsUserAttr'], $args, $settings);
}
}
if ($args['allow_user_assignment']) {
if ($settings['canAllocUser']) {
$r .= self::get_user_assignment_control($auth['read'], $settings['cmsUserAttr'], $args);
} else {
if (!$settings['locationId']) {
// for a new record, we need to link the current user to the location if they are not admin.
global $user;
$r .= '<input type="hidden" name="locAttr:' . self::$cmsUserAttrId . '" value="' . $user->uid . '">';
}
}
}
if ($settings['canEditBody']) {
$r .= '<button type="submit" class="indicia-button right">' . lang::get('Save') . '</button>';
}
if ($settings['canEditBody'] && $settings['locationId']) {
$r .= '<button type="button" class="indicia-button right" id="delete-transect">' . lang::get('Delete') . '</button>';
}
$r .= '</form>';
$r .= '</div>';
// site-details
// This must go after the map panel, so it has created its toolbar
data_entry_helper::$onload_javascript .= "\$('#current-section').change(selectSection);\n";
if ($settings['canEditBody'] && $settings['locationId']) {
$walkIDs = array();
foreach ($settings['walks'] as $walk) {
$walkIDs[] = $walk['id'];
}
$sectionIDs = array();
foreach ($settings['sections'] as $code => $section) {
$sectionIDs[] = $section['id'];
}
data_entry_helper::$javascript .= "\r\ndeleteSurvey = function(){\r\n if(confirm(\"" . (count($settings['walks']) > 0 ? count($settings['walks']) . ' ' . lang::get('walks will also be deleted when you delete this location.') . ' ' : '') . lang::get('Are you sure you wish to delete this location?') . "\")){\r\n deleteWalks([" . implode(',', $walkIDs) . "]);\r\n deleteSections([" . implode(',', $sectionIDs) . "]);\r\n \$('#delete-transect').html('Deleting Site');\r\n deleteLocation(" . $settings['locationId'] . ");\r\n \$('#delete-transect').html('Done');\r\n window.location='" . url($args['sites_list_path']) . "';\r\n };\r\n};\r\n\$('#delete-transect').click(deleteSurvey);\r\n";
}
return $r;
}
示例12: get_control_map
/**
* Get the map control.
*/
private static function get_control_map($auth, $args, $tabalias, $options)
{
$options = array_merge(iform_map_get_map_options($args, $auth['read']), $options);
if ($args['interface'] !== 'one_page') {
$options['tabDiv'] = $tabalias;
}
if (self::$want_location_layer) {
$options['layers'][] = 'locationLayer';
// Create vector layers to display a selected location onto
$options['setupJs'] = "\n locStyleMap = new OpenLayers.StyleMap({\n \"default\": new OpenLayers.Style({\n fillColor: \"Green\",\n strokeColor: \"Black\",\n fillOpacity: 0.3,\n strokeWidth: 1\n })\n });\n locationLayer = new OpenLayers.Layer.Vector(\"" . lang::get("LANG_Location_Layer") . "\",\n {styleMap: locStyleMap});\n";
}
$olOptions = iform_map_get_ol_options($args);
return data_entry_helper::map_panel($options, $olOptions);
}
示例13: get_control_map
/**
* Draw Map section of the page.
* @return string The output map panel.
*
* @package Client
* @subpackage PrebuiltForms
*/
protected static function get_control_map($auth, $args, $tabalias, $options)
{
iform_load_helpers(array('data_entry_helper'));
self::load_record($auth);
$options = array_merge(iform_map_get_map_options($args, $auth['read']), array('maxZoom' => 14), $options);
if (isset(self::$record['geom'])) {
$options['initialFeatureWkt'] = self::$record['geom'];
}
if ($args['interface'] !== 'one_page') {
$options['tabDiv'] = $tabalias;
}
$olOptions = iform_map_get_ol_options($args);
if (!isset($options['standardControls'])) {
$options['standardControls'] = array('layerSwitcher', 'panZoom');
}
return '<div class="detail-panel" id="detail-panel-map"><h3>Map</h3>' . data_entry_helper::map_panel($options, $olOptions) . '</div>';
}
示例14: get_form
/**
* Return the generated form output.
* @return Form HTML.
*/
public static function get_form($args)
{
require_once drupal_get_path('module', 'iform') . '/client_helpers/map_helper.php';
$hidden = str_replace("\r\n", "\n", $args['hide_fields']);
$hidden = explode("\n", $hidden);
if (empty($_GET['occurrence_id'])) {
return 'This form requires an occurrence_id parameter in the URL.';
}
// Get authorisation tokens to update and read from the Warehouse.
$auth = data_entry_helper::get_read_auth($args['website_id'], $args['password']);
data_entry_helper::load_existing_record($auth, 'occurrence', $_GET['occurrence_id']);
data_entry_helper::load_existing_record($auth, 'sample', data_entry_helper::$entity_to_load['occurrence:sample_id']);
$r .= "<div id=\"controls\">\n";
$r .= "<table>\n";
if (!in_array('Species', $hidden)) {
$r .= "<tr><td><strong>" . lang::get('Species') . "</strong></td><td>" . data_entry_helper::$entity_to_load['occurrence:taxon'] . "</td></tr>\n";
}
if (!in_array('Date', $hidden)) {
$r .= "<tr><td><strong>Date</strong></td><td>" . data_entry_helper::$entity_to_load['sample:date'] . "</td></tr>\n";
}
if (!in_array('Grid Reference', $hidden)) {
$r .= "<tr><td><strong>Grid Reference</strong></td><td>" . data_entry_helper::$entity_to_load['sample:entered_sref'] . "</td></tr>\n";
}
$siteLabels = array();
if (!empty(data_entry_helper::$entity_to_load['sample:location'])) {
$siteLabels[] = data_entry_helper::$entity_to_load['sample:location'];
}
if (!empty(data_entry_helper::$entity_to_load['sample:location_name'])) {
$siteLabels[] = data_entry_helper::$entity_to_load['sample:location_name'];
}
if (!in_array('Site', $hidden) && !empty($siteLabels)) {
$r .= "<tr><td><strong>Site</strong></td><td>" . implode(' | ', $siteLabels) . "</td></tr>\n";
}
$smpAttrs = data_entry_helper::getAttributes(array('id' => data_entry_helper::$entity_to_load['sample:id'], 'valuetable' => 'sample_attribute_value', 'attrtable' => 'sample_attribute', 'key' => 'sample_id', 'extraParams' => $auth, 'survey_id' => data_entry_helper::$entity_to_load['occurrence:survey_id']));
$occAttrs = data_entry_helper::getAttributes(array('id' => $_GET['occurrence_id'], 'valuetable' => 'occurrence_attribute_value', 'attrtable' => 'occurrence_attribute', 'key' => 'occurrence_id', 'extraParams' => $auth, 'survey_id' => data_entry_helper::$entity_to_load['occurrence:survey_id']));
$attributes = array_merge($smpAttrs, $occAttrs);
foreach ($attributes as $attr) {
if (!in_array($attr['caption'], $hidden)) {
$r .= "<tr><td><strong>" . lang::get($attr['caption']) . "</strong></td><td>" . $attr['displayValue'] . "</td></tr>\n";
}
}
$r .= "</table>\n";
$r .= "</div>\n";
$options = iform_map_get_map_options($args, $readAuth);
$olOptions = iform_map_get_ol_options($args);
$options['initialFeatureWkt'] = data_entry_helper::$entity_to_load['occurrence:wkt'];
$r .= map_helper::map_panel($options, $olOptions);
return $r;
}
示例15: get_control_map
/**
* Get the map control.
*/
protected static function get_control_map($auth, $args, $tabalias, $options)
{
$options = array_merge(iform_map_get_map_options($args, $auth['read']), $options);
// If a drawing tool is on the map we can support boundaries or if automatic plot creation is enabled.
$boundaries = false;
if (!empty($options['clickForPlot']) && $options['clickForPlot'] == true) {
$boundaries = true;
}
foreach ($options['standardControls'] as $ctrl) {
if (substr($ctrl, 0, 4) === 'draw') {
$boundaries = true;
break;
}
}
if (isset(data_entry_helper::$entity_to_load['location:centroid_geom'])) {
$options['initialFeatureWkt'] = data_entry_helper::$entity_to_load['location:centroid_geom'];
}
if ($boundaries && isset(data_entry_helper::$entity_to_load['location:boundary_geom'])) {
$options['initialBoundaryWkt'] = data_entry_helper::$entity_to_load['location:boundary_geom'];
}
if ($args['interface'] !== 'one_page') {
$options['tabDiv'] = $tabalias;
}
$olOptions = iform_map_get_ol_options($args);
if (!isset($options['standardControls'])) {
$options['standardControls'] = array('layerSwitcher', 'panZoom');
}
$r = '';
$r .= data_entry_helper::map_panel($options, $olOptions);
// Add a geometry hidden field for boundary support
if ($boundaries) {
if (!empty(data_entry_helper::$entity_to_load['location:boundary_geom'])) {
$impBoundaryGeomVal = data_entry_helper::$entity_to_load['location:boundary_geom'];
} else {
$impBoundaryGeomVal = '';
}
$r .= '<input type="hidden" name="location:boundary_geom" id="imp-boundary-geom" value="' . $impBoundaryGeomVal . '"/>';
}
return $r;
}