本文整理匯總了PHP中data_entry_helper::map_panel方法的典型用法代碼示例。如果您正苦於以下問題:PHP data_entry_helper::map_panel方法的具體用法?PHP data_entry_helper::map_panel怎麽用?PHP data_entry_helper::map_panel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類data_entry_helper
的用法示例。
在下文中一共展示了data_entry_helper::map_panel方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: tab_your_square
protected static function tab_your_square($args, $auth, $attrs)
{
$r = '<fieldset class="ui-corner-all" >';
$r .= '<legend>Place on map</legend>';
$r .= '<div class="two columns"><div class="column">';
$r .= data_entry_helper::georeference_lookup(array('label' => 'Enter the nearest place name', 'labelClass' => 'control-width-5', 'helpText' => 'Enter the name of a nearby town or village then click Search to quickly find the correct region on the map. ' . 'Or if you know the grid reference, type it into the following box.'));
$r .= data_entry_helper::sref_and_system(array('label' => 'Your 1km grid reference', 'labelClass' => 'control-width-5', 'fieldname' => 'sample:entered_sref', 'systems' => array('OSGB' => 'British National Grid', 'OSIE' => 'Irish Grid'), 'class' => 'ui-state-highlight'));
$sq_error = data_entry_helper::check_errors('smpAttr:' . $args['attr_surveyed_square']);
$r .= '<fieldset class="ui-state-highlight ui-corner-all' . ($sq_error ? ' ui-state-error' : '') . '">';
$r .= "<legend>Please also select one of the 3 choices below</legend>\n";
if ($sq_error) {
$r .= "{$sq_error}<br/>\n";
}
// manual output of radio buttons since data_entry_helper::radio_group does not support splicing in the textarea.
$whichSqrAttr = $attrs['smpAttr:' . $args['attr_surveyed_square']];
$reasonAttr = $attrs['smpAttr:' . $args['attr_surveyed_other_square_reason']];
$fieldname = $whichSqrAttr['fieldname'];
$value = $whichSqrAttr['default'];
$r .= '<label class="auto">';
$r .= '<input ';
if ($value == $args['term_surveyed_given_square']) {
$r .= 'checked="checked" ';
}
$r .= 'type="radio" id="attr_surveyed_given_square" value="' . $args['term_surveyed_given_square'] . '" name="' . $whichSqrAttr['fieldname'] . '"/> ';
$r .= "I have surveyed the random square that I was given</label><br/>\n";
$r .= '<label class="auto">';
$r .= '<input ';
if ($value == $args['term_surveyed_other_square']) {
$r .= 'checked="checked" ';
}
$r .= 'type="radio" id="attr_surveyed_other_square" value="' . $args['term_surveyed_other_square'] . '" name="' . $whichSqrAttr['fieldname'] . '"/> ';
$r .= "I have not surveyed the random square because</label><br/>\n";
$r .= data_entry_helper::textarea(array('fieldname' => $reasonAttr['fieldname'], 'class' => 'indented reason', 'default' => $reasonAttr['default'], 'cols' => 50));
$r .= "\n<label class=\"auto\">";
$r .= '<input ';
if ($value == $args['term_surveyed_same_square']) {
$r .= 'checked="checked" ';
}
$r .= 'type="radio" id="attr_surveyed_same_square" value="' . $args['term_surveyed_same_square'] . '" name="' . $whichSqrAttr['fieldname'] . '"/> ';
$r .= "I have resurveyed the same square as before</label>\n";
$r .= '</fieldset>';
$r .= '</div><div class="column">';
$r .= data_entry_helper::map_panel(array('presetLayers' => array('google_hybrid'), 'readAuth' => $auth, 'class' => 'ui-widget-content', 'clickedSrefPrecisionMin' => 4, 'clickedSrefPrecisionMax' => 4, 'initial_lat' => 54, 'initial_long' => -1, 'initial_zoom' => 5, 'width' => '100%', 'tabDiv' => 'your-square'));
$r .= "</div></div></fieldset>\n";
$r .= data_entry_helper::wizard_buttons(array('divId' => 'tabs', 'page' => 'middle'));
return $r;
}
示例2: get_form
//.........這裏部分代碼省略.........
onclick="if(this.value==\'' . lang::get('LANG_More_Precise') . '\'){this.value=\'\'; this.style.color=\'#000\'}"
onblur="if(this.value==\'\'){this.value=\'' . lang::get('LANG_More_Precise') . '\'; this.style.color=\'#555\'}" />
</div>
<div id="conditions-filter-header" class="ui-accordion-header ui-helper-reset ui-state-default ui-corner-all">
<div id="fold-conditions-button" class="ui-state-default ui-corner-all fold-button fold-button-folded"> </div>
<div id="reset-conditions-button" class="ui-state-default ui-corner-all reset-button">' . lang::get('LANG_Reset_Filter') . '</div>
<div id="conditions-filter-title">
<span>' . lang::get('LANG_Conditions_Filter_Title') . '</span>
</div>
</div>
<div id="conditions-filter-body" class="ui-accordion-content ui-helper-reset ui-widget-content ui-corner-all">
' . str_replace("\n", "", data_entry_helper::outputAttribute($sample_attributes[$args['sky_state_attr_id']], $defAttrOptions)) . str_replace("\n", "", data_entry_helper::outputAttribute($sample_attributes[$args['temperature_attr_id']], $defAttrOptions)) . str_replace("\n", "", data_entry_helper::outputAttribute($sample_attributes[$args['wind_attr_id']], $defAttrOptions)) . str_replace("\n", "", data_entry_helper::outputAttribute($sample_attributes[$args['shade_attr_id']], $defAttrOptions)) . '
</div>
<div id="location-filter-header" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-all">
<div id="fold-location-button" class="ui-state-default ui-corner-all fold-button"> </div>
<div id="reset-location-button" class="ui-state-default ui-corner-all reset-button">' . lang::get('LANG_Reset_Filter') . '</div>
<div id="location-filter-title">
<span>' . lang::get('LANG_Location_Filter_Title') . '</span>
</div>
</div>
<div id="location-filter-body" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active ui-corner-all">
<div id="location-entry">
' . data_entry_helper::georeference_lookup(iform_map_get_georef_options($args)) . '
<span id="location-georef-notes" >' . lang::get('LANG_Georef_Notes') . '</span>
<label for="place:INSEE">' . lang::get('LANG_Or') . '</label>
<input type="text" id="place:INSEE" name="place:INSEE" value="' . lang::get('LANG_INSEE') . '"
onclick="if(this.value==\'' . lang::get('LANG_INSEE') . '\'){this.value=\'\'; this.style.color=\'#000\'}"
onblur="if(this.value==\'\'){this.value=\'' . lang::get('LANG_INSEE') . '\'; this.style.color=\'#555\'}" />
<input type="button" id="search-insee-button" class="ui-corner-all ui-widget-content ui-state-default search-button" value="' . lang::get('search') . '" />
</div>';
// this is a bit of a hack, because the apply_template method is not public in data entry helper.
$tempScript = data_entry_helper::$onload_javascript;
data_entry_helper::$onload_javascript = '';
$r .= data_entry_helper::map_panel($options, $olOptions);
$map1JS = data_entry_helper::$onload_javascript;
data_entry_helper::$onload_javascript = $tempScript;
$r .= '
</div>
</div>
</div>
<div id="filter-footer" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active ui-corner-bottom">
<div id="search-insects-button" class="ui-state-default ui-corner-all search-button">' . lang::get('LANG_Search_Insects') . '</div>
<div id="search-collections-button" class="ui-state-default ui-corner-all search-button">' . lang::get('LANG_Search_Collections') . '</div>
</div>
<div id="results-collections-header" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-top">
<div id="results-collections-title">
<span>' . lang::get('LANG_Collections_Search_Results') . '</span>
</div>
</div>
<div id="results-collections-results" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active ui-corner-bottom">
</div>
<div id="results-insects-header" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-top">
<div id="results-insects-title">
<span>' . lang::get('LANG_Insects_Search_Results') . '</span>
</div>
</div>
<div id="results-insects-results" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active ui-corner-bottom">
</div>
</div>
<div id="focus-collection" class="ui-accordion ui-widget ui-helper-reset">
<div id="fc-header" class="ui-accordion-content ui-helper-reset ui-state-active ui-corner-top ui-accordion-content-active">
<div id="fc-header-buttons">';
if (user_access('IForm n' . $node->nid . ' add preferred collection')) {
$r .= '<span id="fc-add-preferred" class="ui-state-default ui-corner-all preferred-button">' . lang::get('LANG_Add_Preferred_Collection') . '</span>';
}
$r .= '
示例3: 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>';
}
示例4: iform_mnhnl_locModTool
//.........這裏部分代碼省略.........
$request .= "(type_id=" . $primary . "OR type_id=" . $secondary . ")";
} else {
$request .= "type_id=" . $primary;
}
$request .= "&typename=" . $args['shpFileFeaturePrefix'] . ':';
$filedetails = "&format_options=filename:" . $args['reportFilenamePrefix'];
$retValList = "";
if ($args['usePoints'] != 'none' || isset($args['shpDownloadPoints']) && $args['shpDownloadPoints']) {
$retValList .= "<a href=\"" . $request . "point_locations" . $filedetails . "_Points.zip\">" . lang::get('Points') . "</a>";
}
if ($args['useLines'] != 'none' || isset($args['shpDownloadLines']) && $args['shpDownloadLines']) {
$retValList .= ($retValList == "" ? "" : " : ") . "<a href=\"" . $request . "line_locations" . $filedetails . "_Lines.zip\">" . lang::get('Lines') . "</a>";
}
if ($args['usePolygons'] != 'none' || isset($args['shpDownloadPolygons']) && $args['shpDownloadPolygons']) {
$retValList .= ($retValList == "" ? "" : " : ") . "<a href=\"" . $request . "polygon_locations" . $filedetails . "_Polygons.zip\">" . lang::get('Polygons') . "</a>";
}
$retVal .= "<fieldset><legend>" . lang::get('LANG_SHP_Download_Legend') . "</legend>\n <p>" . lang::get('LANG_Shapefile_Download') . " " . $retValList . "</p></fieldset>";
}
$includeOutsideSquare = $args['locationMode'] == 'parent';
// includes multi - see above
// filtered
if ($args['locationMode'] == 'filtered') {
$filterAttrs = explode(',', $args['filterAttrs']);
foreach ($filterAttrs as $idx => $filterAttr) {
$filterAttr = explode(':', $filterAttr);
if ($filterAttr[0] == 'Parent' && $filterAttr[1] == "true") {
$includeOutsideSquare = true;
}
}
}
if ($includeOutsideSquare) {
$confirmedLocationTypeID = iform_mnhnl_getTermID($auth, 'indicia:location_types', $args['SecondaryLocationTypeTerm']);
if (is_null($confirmedLocationTypeID)) {
$confirmedLocationTypeID = "0";
}
$submittedLocationTypeID = iform_mnhnl_getTermID($auth, 'indicia:location_types', $args['LocationTypeTerm']);
$retVal .= "<fieldset><legend>" . lang::get('LANG_Outside_Square_Reports') . "</legend>\n \t<form method='post' action='" . data_entry_helper::$base_url . '/index.php/services/report/requestReport?report=reports_for_prebuilt_forms/MNHNL/luxbio_outside_squares_1.xml&reportSource=local&auth_token=' . $auth['read']['auth_token'] . '&nonce=' . $auth['read']['nonce'] . '&mode=csv&filename=' . $args['reportFilenamePrefix'] . "CentreOutsideSquaresReport'>\n <label style='width:auto;'>" . lang::get('LANG_Outside_Square_Download_1') . ":</label>\n <input type='hidden' name='params' value='{\"website_id\":" . $args['website_id'] . ", \"survey_id\":" . $args['survey_id'] . ", \"primary_loc_type_id\":" . $submittedLocationTypeID . ", \"secondary_loc_type_id\":" . $confirmedLocationTypeID . "}' />\n <input type='submit' class='ui-state-default ui-corner-all' value='" . lang::get('Download') . "'>\n </form>\n \t<form method='post' action='" . data_entry_helper::$base_url . '/index.php/services/report/requestReport?report=reports_for_prebuilt_forms/MNHNL/luxbio_outside_squares_2.xml&reportSource=local&auth_token=' . $auth['read']['auth_token'] . '&nonce=' . $auth['read']['nonce'] . '&mode=csv&filename=' . $args['reportFilenamePrefix'] . "BoundaryCutsSquaresReport'>\n <label style='width:auto;'>" . lang::get('LANG_Outside_Square_Download_2') . ":</label>\n <input type='hidden' name='params' value='{\"website_id\":" . $args['website_id'] . ", \"survey_id\":" . $args['survey_id'] . ", \"primary_loc_type_id\":" . $submittedLocationTypeID . ", \"secondary_loc_type_id\":" . $confirmedLocationTypeID . "}' />\n <input type='submit' class='ui-state-default ui-corner-all' value='" . lang::get('Download') . "'>\n </form>\n </fieldset>";
}
$retVal .= "<form method=\"post\" id=\"entry_form\">" . $auth['write'] . "<input type=\"hidden\" id=\"source\" name=\"source\" value=\"iform_mnhnl_locModTool\" />" . "<input type=\"hidden\" id=\"website_id\" name=\"website_id\" value=\"" . $args['website_id'] . "\" />" . "<input type=\"hidden\" id=\"survey_id\" name=\"survey_id\" value=\"" . $args['survey_id'] . "\" />";
$retVal .= iform_mnhnl_lux5kgridControl($auth, $args, $node, array('Instructions2' => lang::get('LANG_LocModTool_Instructions2'), 'MainFieldLabel' => lang::get('LANG_LocModTool_IDLabel'), 'NameLabel' => lang::get('LANG_LocModTool_NameLabel'), 'ParentLabel' => lang::get('LANG_LocModTool_ParentLabel'), 'AdminMode' => true));
$retVal .= "<label for=\"location-delete\">" . lang::get("LANG_LocModTool_DeleteLabel") . ":</label> <input type=checkbox id=\"location-delete\" name=\"location:deleted\" value='t'><br />\n <p>" . lang::get("LANG_LocModTool_DeleteInstructions") . "</p>";
// location comments are included as a separate control on the main form.
if (isset($args['includeLocationComment']) && $args['includeLocationComment']) {
$retVal .= data_entry_helper::textarea(array('id' => 'location-comment', 'fieldname' => 'location:comment', 'label' => lang::get("LANG_LocationModTool_CommentLabel"))) . "<br />";
}
$laArgs = array("lookUpKey" => "meaning_id", "sep" => " ", "class" => "wide", "tabNameFilter" => "", "numValues" => 10000);
$defs = array();
if (isset($args['siteTabSplitAttrs']) && $args['siteTabSplitAttrs'] != "") {
$defs = explode(':', $args['siteTabSplitAttrs']);
$defs1 = explode(',', $defs[0]);
$laArgs["tabNameFilter"] = $defs1[0];
$laArgs["class"] = $defs1[1];
}
$retVal .= iform_mnhnl_locationattributes($auth, $args, '', $laArgs);
$retVal .= iform_mnhnl_SrefFields($auth, $args, true);
if (count($defs) > 1) {
$defs1 = explode(',', $defs[1]);
$laArgs["tabNameFilter"] = $defs1[0];
$laArgs["class"] = $defs1[1];
$retVal .= iform_mnhnl_locationattributes($auth, $args, '', $laArgs);
}
$args['interface'] = 'Tabs';
$mapOptions = iform_map_get_map_options($args, $auth['read']);
$olOptions = iform_map_get_ol_options($args);
if ($args['locationMode'] != 'parent') {
// this includes multi as well (see above)
// can't call the protested control function
$georefOpts = iform_map_get_georef_options($args, $auth['read']);
// can't use place search without the driver API key
if ($georefOpts['driver'] == 'geoplanet' && empty(helper_config::$geoplanet_api_key)) {
$retVal .= '<p>The form structure includes a [place search] control but needs a geoplanet api key.</p>';
} else {
$retVal .= data_entry_helper::georeference_lookup($georefOpts);
}
$mapOptions['searchLayer'] = true;
$mapOptions['searchUpdatesSref'] = false;
$mapOptions['searchDisplaysPoint'] = false;
}
// For main page we force to Tabs to ensure map drawn correctly
$mapOptions['tabDiv'] = 'locations';
$mapOptions['standardControls'] = array('layerSwitcher', 'panZoomBar');
$mapOptions['editLayer'] = false;
$mapOptions['maxZoom'] = $args['zoomLevel'];
if (isset($args['locationLayerWMS']) && $args['locationLayerWMS'] != '') {
$mapOptions['layers'] = array('ParentWMSLayer', "ParentLocationLayer", "SiteLabelLayer", "SiteAreaLayer", "SitePathLayer", "SitePointLayer");
$mapOptions['clickableLayers'] = array('ParentWMSLayer');
$mapOptions['clickableLayersOutputMode'] = 'custom';
$mapOptions['clickableLayersOutputDiv'] = 'clickableLayersOutputDiv';
$mapOptions['clickableLayersOutputFn'] = 'setClickedParent';
} else {
$mapOptions['layers'] = array("ParentLocationLayer", "SiteLabelLayer", "SiteAreaLayer", "SitePathLayer", "SitePointLayer");
}
$retVal .= data_entry_helper::map_panel($mapOptions, $olOptions);
$retVal .= iform_mnhnl_PointGrid($auth, $args, array('srefs' => '2169,LUREF (m),X,Y,;4326,Lat/Long Deg,Lat,Long,D;4326,Lat/Long Deg:Min,Lat,Long,DM;4326,Lat/Long Deg:Min:Sec,Lat,Long,DMS'));
$retVal .= ' <input type="submit" class="ui-state-default ui-corner-all" value="' . lang::get('LANG_Submit') . '">
<a href="' . iform_mnhnl_getReloadPath() . '"><input class="ui-state-default ui-corner-all" type="button" name="cancel" value="' . lang::get('LANG_Cancel') . '" /></a>
</form></div>';
data_entry_helper::$javascript .= "\nmapInitialisationHooks.push(function(mapdiv) {\n// try to identify if this map is the secondary small one\n if(mapdiv.id=='map')\n jQuery(\"#dummy-parent-id\").val('').change();});\n";
return $retVal;
}
示例5: 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);
$options['layers'][] = 'locationLayer';
$options['tabDiv'] = $tabalias;
$olOptions = iform_map_get_ol_options($args);
return data_entry_helper::map_panel($options, $olOptions);
}
示例6: species_checklist
//.........這裏部分代碼省略.........
}
}
$numCtrls++;
$row .= str_replace(array('{label}', '{content}'), array($attributes[$attrId]['caption'], $oc), $indicia_templates[$options['attrCellTemplate']]);
$headerPreRow .= '<td class="ui-widget-content" ><label class="auto-width">' . $occAttrCaptions[$attrId] . ':</label></td>';
}
if ($maxCellsPerRow > $numCtrls) {
$row .= "<td class='ui-widget-content sg-filler' colspan=" . ($maxCellsPerRow - $numCtrls) . "></td>";
$headerPreRow .= "<td class='ui-widget-content sg-filler' colspan=" . ($maxCellsPerRow - $numCtrls) . "></td>";
}
if ($options['useCaptionsInPreRow']) {
$rows[] = '<tr class="scMeaning-' . $rec['taxon']['taxon_meaning_id'] . ' scDataRow">' . $headerPreRow . '</tr>';
}
// no images.
$rows[] = '<tr class="scMeaning-' . $rec['taxon']['taxon_meaning_id'] . ' scDataRow' . ($i == $numRows && !$options['includeOccurrenceComment'] ? ' last' : '') . '">' . $row . '</tr>';
// no images.
}
if ($options['includeOccurrenceComment']) {
$ctrlId = $ctrlName = $prefix . ":occurrence:comment";
self::_getCtrlNames($ctrlName, $oldCtrlName, false);
if (isset(data_entry_helper::$entity_to_load[$oldCtrlName])) {
$existing_value = data_entry_helper::$entity_to_load[$oldCtrlName];
} else {
$existing_value = '';
}
$rows[] = "<tr class='scMeaning-" . $rec['taxon']['taxon_meaning_id'] . " scDataRow last'>\n<td class='ui-widget-content scCommentCell' {$colspan}>\n <label for='{$ctrlId}' class='auto-width'>" . lang::get("Comment") . ":</label>\n <input type='text' class='scComment' name='{$ctrlName}' id='{$ctrlId}' value=\"" . htmlspecialchars($existing_value) . "\">\n</td></tr>";
}
$rowIdx++;
}
$grid .= "\n<tbody>\n";
if (count($rows) > 0) {
$grid .= implode("\n", $rows) . "\n";
} else {
$grid .= "<tr style=\"display: none\"><td></td></tr>\n";
}
$grid .= "</tbody>\n</table>\n";
// Javascript to add further rows to the grid
data_entry_helper::$javascript .= "scRow=" . $rowIdx . ";\n\$('.sg-filler').each(function(idx,elem){\n var colSpan = elem.colSpan;\n var prev = \$(elem).prev();\n prev[0].colSpan=colSpan+1;\n \$(elem).remove();\n});\nvar formatter = function(rowData,taxonCell) {\n taxonCell.html(\"" . lang::get('loading') . "\");\n jQuery.getJSON('" . data_entry_helper::$base_url . "/index.php/services/data/taxa_taxon_list/' + rowData.id +\n '?mode=json&view=detail&auth_token=" . $options['readAuth']['auth_token'] . "&nonce=" . $options['readAuth']["nonce"] . "&callback=?', function(mdata) {\n if(mdata instanceof Array && mdata.length>0){\n jQuery.getJSON('" . data_entry_helper::$base_url . "/index.php/services/data/taxa_taxon_list' +\n '?mode=json&view=detail&auth_token=" . $options['readAuth']['auth_token'] . "&nonce=" . $options['readAuth']["nonce"] . "&taxon_meaning_id='+mdata[0].taxon_meaning_id+'&taxon_list_id=" . $options["speciesListID"] . "&callback=?', function(data) {\n var taxaList = '';\n if(data instanceof Array && data.length>0){\n for (var i=0;i<data.length;i++){\n if(data[i].preferred == 'f')\n taxaList += (taxaList == '' ? '' : ', ')+data[i].taxon;\n else\n taxaList = '<em>'+data[i].taxon+'</em>'+(taxaList == '' ? '' : ', '+taxaList);\n }\n }\n taxonCell.html(taxaList).removeClass('extraCommonNames');\n });\n }})\n};\nbindSpeciesOptions = {selectorID: \"addTaxonControl\",\n url: \"" . data_entry_helper::$base_url . "index.php/services/data\",\n gridId: \"" . $options['id'] . "\",\n lookupListId: \"" . $options['speciesListID'] . "\",\n auth_token : \"" . $options['readAuth']['auth_token'] . "\",\n nonce : \"" . $options['readAuth']['nonce'] . "\",\n formatter: formatter,\n max: " . (isset($options['max_species_ids']) ? $options['max_species_ids'] : 25) . "};\n";
if (isset($options['unitSpeciesMeaning'])) {
data_entry_helper::$javascript .= "bindSpeciesOptions.unitSpeciesMeaning=\"" . $options['unitSpeciesMeaning'] . "\";\n";
}
if (isset($options['rowControl'])) {
$rowControls = explode(';', $options['rowControl']);
$controlArr = array();
for ($i = 2; $i < count($rowControls); $i++) {
$parts = explode(',', $rowControls[$i], 2);
$termList = helper_base::get_termlist_terms(parent::$auth, $rowControls[1], array($parts[0]));
$controlArr[] = '{meaning_id: "' . $termList[0]['meaning_id'] . '" , rows: [' . $parts[1] . ']}';
}
data_entry_helper::$javascript .= "bindSpeciesOptions.rowControl = {selector: 'sc" . str_replace(' ', '', ucWords($rowControls[0])) . "',\n controls: [" . implode(',', $controlArr) . "]};\n";
}
if (isset($options['singleSpeciesID'])) {
$fetchOpts = array('table' => 'taxa_taxon_list', 'extraParams' => array('auth_token' => $options['readAuth']['auth_token'], 'nonce' => $options['readAuth']['nonce'], 'id' => $options['singleSpeciesID'], 'view' => 'detail', 'taxon_list_id' => $options['speciesListID']));
$speciesRecord = data_entry_helper::get_population_data($fetchOpts);
$grid .= "<input id='addTaxonControl' type='button' value='" . lang::get('Add another record') . "'>";
data_entry_helper::$javascript .= "\nbindSpeciesOptions.speciesData = {id : \"" . $options['singleSpeciesID'] . "\", taxon_meaning_id: \"" . $speciesRecord[0]['taxon_meaning_id'] . "\"},\nbindSpeciesButton(bindSpeciesOptions);\n";
} else {
$grid .= "<label for='addTaxonControl' class='auto-width'>" . lang::get('Add species to list') . ":</label> <input id='addTaxonControl' name='addTaxonControl' >";
data_entry_helper::$javascript .= "bindSpeciesAutocomplete(bindSpeciesOptions);\n";
}
// No help text
if ($options['includeSubSample']) {
$mapOptions = iform_map_get_map_options($options['args'], $options['readAuth']);
$olOptions = iform_map_get_ol_options($options['args']);
$mapOptions['tabDiv'] = 'tab-species';
$mapOptions['divId'] = 'map2';
$mapOptions['width'] = isset($options['map2Width']) ? $options['map2Width'] : "250px";
$mapOptions['height'] = isset($options['map2Height']) ? $options['map2Height'] : "250px";
$mapOptions['layers'] = array("superSampleLocationLayer", "occurrencePointLayer");
$mapOptions['editLayer'] = true;
$mapOptions['maxZoomBuffer'] = 0.3;
$mapOptions['initialFeatureWkt'] = false;
$mapOptions['srefId'] = 'sg-imp-sref';
$mapOptions['srefLatId'] = 'sg-imp-srefX';
$mapOptions['srefLongId'] = 'sg-imp-srefY';
$mapOptions['standardControls'] = array('layerSwitcher', 'panZoomBar');
$mapOptions['fillColor'] = $mapOptions['strokeColor'] = 'Fuchsia';
$mapOptions['fillOpacity'] = 0.3;
$mapOptions['strokeWidth'] = 1;
$mapOptions['pointRadius'] = 6;
// $mapOptions['maxZoom']=$args['zoomLevel'];
}
$r = "<div><p>" . lang::get('LANG_SpeciesInstructions') . "</p>\n";
if ($options['includeSubSample'] && $options['mapPosition'] == 'top') {
$r .= '<div class="topMap-container">' . data_entry_helper::map_panel($mapOptions, $olOptions) . '</div>';
}
$r .= '<div class="grid-container">' . $grid . '</div>';
if ($options['includeSubSample'] && $options['mapPosition'] != 'top') {
$r .= '<div class="sideMap-container">' . data_entry_helper::map_panel($mapOptions, $olOptions) . '</div>';
}
if ($options['includeSubSample']) {
data_entry_helper::$javascript .= "var speciesMapTabHandler = function(event, ui) {\n panel = typeof ui.newPanel==='undefined' ? ui.panel : ui.newPanel[0];\n if (panel.id==='" . $mapOptions['tabDiv'] . "') {\n \$('.mnhnl-species-grid').find('tr').removeClass('highlight');\n var div=\$('#" . $mapOptions['divId'] . "')[0];\n div.map.editLayer.destroyFeatures();\n // show the geometry currently held in the main locations part as the parent\n var initialFeatureWkt = \$('#imp-boundary-geom').val();\n if(initialFeatureWkt=='') initialFeatureWkt = \$('#imp-geom').val();\n var parser = new OpenLayers.Format.WKT();\n var feature = parser.read(initialFeatureWkt);\n feature=convertFeature(feature, div.map.projection);\n superSampleLocationLayer.destroyFeatures();\n superSampleLocationLayer.addFeatures((typeof(feature)=='object'&&(feature instanceof Array) ? feature : [feature]));\n var bounds=superSampleLocationLayer.getDataExtent();\n occurrencePointLayer.removeAllFeatures();\n\t\$('.mnhnl-species-grid').find('.first').each(function(idx, elem){\n\t\tif(jQuery(elem).data('feature')!=null){\n\t\t\tjQuery(elem).data('feature').style=null;\n\t\t\toccurrencePointLayer.addFeatures([jQuery(elem).data('feature')]);\n\t\t}\n\t});\n bounds.extend(occurrencePointLayer.getDataExtent());\n // extend the boundary to include a buffer, so the map does not zoom too tight.\n bounds.scale(1.2);\n if (div.map.getZoomForExtent(bounds) > div.settings.maxZoom) {\n // if showing something small, don't zoom in too far\n div.map.setCenter(bounds.getCenterLonLat(), div.settings.maxZoom);\n } else {\n // Set the default view to show something triple the size of the grid square\n // assume this is within the map extent.\n div.map.zoomToExtent(bounds);\n }\n }\n};\nindiciaFns.bindTabsActivate(jQuery(jQuery('#" . $mapOptions['tabDiv'] . "').parent()), speciesMapTabHandler);\n";
}
// move the cloneable table outside the form, so allowing the validation to ignore it.
data_entry_helper::$javascript .= "var cloneableDiv = \$('<div style=\"display: none;\">');\ncloneableDiv.append(\$('#" . $options['id'] . "-scClonable'));\n\$('#entry_form').before(cloneableDiv);\n";
return $r . '</div>';
} else {
return $taxalist['error'];
}
}
示例7: array
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<html>
<head>
<title>Map helper test</title>
<link rel="stylesheet" href="demo.css" type="text/css" media="screen">
<link rel="stylesheet" href="../../media/css/default_site.css" type="text/css" media="screen">
</head>
<body>
<div id="wrap">
<h1>Default Map</h1>
<?php
include '../../client_helpers/data_entry_helper.php';
require 'data_entry_config.php';
/*
* Output a map. Don't use any preset base layers, but define a tile cache layer pointing to the OpenLayers
* demo tilecache. Note that the list of resolutions must match the tilecache.
*/
echo data_entry_helper::map_panel(array('presetLayers' => array(), 'tilecacheLayers' => array(array('caption' => 'My Tile Cache', 'servers' => array("http://c0.labs.metacarta.com/wms-c/cache/", "http://c1.labs.metacarta.com/wms-c/cache/", "http://c2.labs.metacarta.com/wms-c/cache/", "http://c3.labs.metacarta.com/wms-c/cache/", "http://c4.labs.metacarta.com/wms-c/cache/"), 'layerName' => 'basic', 'settings' => array('serverResolutions' => array(0.703125, 0.3515625, 0.17578125, 0.087890625, 0.0439453125, 0.02197265625, 0.010986328125, 0.0054931640625, 0.00274658203125, 0.001373291015625, 0.0006866455078125, 0.00034332275390625, 0.000171661376953125, 8.58306884765625E-5, 4.291534423828125E-5, 2.1457672119140625E-5))))), array('projection' => 4326, 'displayProjection' => 4326, 'resolutions' => array(0.087890625, 0.0439453125, 0.02197265625, 0.010986328125)));
echo data_entry_helper::dump_javascript();
?>
</div>
</body>
</html>
示例8: get_form
//.........這裏部分代碼省略.........
<div id="location-filter-header" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-all">
<div id="fold-location-button" class="ui-state-default ui-corner-all fold-button"> </div>
<div id="reset-location-button" class="ui-state-default ui-corner-all reset-button">' . lang::get('LANG_Reset_Filter') . '</div>
<div id="location-filter-title">
<span>' . lang::get('LANG_Location_Filter_Title') . '</span>
</div>
</div>
<div id="location-filter-body" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active ui-corner-all">
<div id="location-entry">';
$searches = explode(';', trim($args['Localisation_spec']));
if (count($searches) == 1) {
$parts = explode(':', $searches[0]);
$r .= '<input type="hidden" id="place:INSEE_Type" name="place:INSEE_Type" value="0"><label for="place:INSEE">' . lang::get('LANG_Search') . ' ' . $parts[0] . '</label>';
} else {
$r .= '<label for="place:INSEE_Type">' . lang::get('LANG_Search') . ' </label><select id="place:INSEE_Type" name="place:INSEE_Type">';
for ($i = 0; $i < count($searches); $i++) {
$parts = explode(':', $searches[$i]);
$r .= '<option value="' . $i . '">' . $parts[0] . '</option>';
}
$r .= '</select>';
}
$r .= '<input type="text" id="place:INSEE" name="place:INSEE" class="INSEE-search" value="' . lang::get('LANG_Enter_Location') . '"
onclick="if(this.value==\'' . lang::get('LANG_Enter_Location') . '\'){this.value=\'\'; this.style.color=\'#000\'}"
onblur="if(this.value==\'\'){this.value=\'' . lang::get('LANG_Enter_Location') . '\'; this.style.color=\'#555\'}" />
<input type="button" id="search-insee-button" class="ui-corner-all ui-widget-content ui-state-default search-button" value="' . lang::get('search') . '" />
<div class="ui-corner-all ui-widget-content ui-helper-hidden" id="imp-insee-div" style="display: none;">
<div id="imp-insee-output-div"></div>
<a id="imp-insee-close-btn" href="#" class="ui-corner-all ui-widget-content ui-state-default indicia-button">' . lang::get('close') . '</a>
</div>
</div>';
// this is a bit of a hack, because the apply_template method is not public in data entry helper.
$tempScript = data_entry_helper::$onload_javascript;
data_entry_helper::$onload_javascript = '';
$r .= data_entry_helper::map_panel($options, $olOptions);
$map1JS = data_entry_helper::$onload_javascript;
data_entry_helper::$onload_javascript = $tempScript;
$r .= '
</div>
</div>
</div>
<div id="filter-footer" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active ui-corner-bottom">
<div id="search-insects-button" class="ui-state-default ui-corner-all search-button">' . lang::get('LANG_Search_Insects') . '</div>
<div id="search-collections-button" class="ui-state-default ui-corner-all search-button">' . lang::get('LANG_Search_Collections') . '</div>
</div>
<div id="results-collections-header" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-top" style="display: none">
<div id="results-collections-title">
<span>' . lang::get('LANG_Collections_Search_Results') . '</span>
</div>
</div>
<div id="results-collections-results" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active ui-corner-bottom" style="display: none">
</div>
<div id="results-insects-header" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-top" style="display: none">
<div id="results-insects-title">
<span>' . lang::get('LANG_Insects_Search_Results') . '</span>
</div>
</div>
<div id="results-insects-results" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active ui-corner-bottom" style="display: none">
</div>';
if (user_access('IForm n' . $node->nid . ' insect expert') || user_access('IForm n' . $node->nid . ' flower expert')) {
$r .= '
<form id="bulk-validation-form" action="' . iform_ajaxproxy_url($node, 'determination') . '" method="POST" style="display:none;">
<input type="hidden" name="website_id" value="' . $args['website_id'] . '" />
<input type="hidden" name="determination:occurrence_id" value="" />
<input type="hidden" name="determination:cms_ref" value="' . $uid . '" />
<input type="hidden" name="determination:person_name" value="' . $username . '" />
<input type="hidden" name="determination:email_address" value="' . $email . '" />
示例9: get_form
//.........這裏部分代碼省略.........
$r .= "</select>";
}
}
}
$r .= "<input type=\"submit\" class=\"ui-state-default ui-corner-all\" value=\"" . lang::get('LANG_Save_Location_Allocations') . "\" />\n";
$r .= "</form></div>";
}
// Add the downloader if user has manager (superuser) rights.
if (iform_loctools_checkaccess($node, 'superuser')) {
$r .= '<div id="downloads" class="mnhnl-btw-datapanel">';
$r .= "<form method=\"post\" action=\"" . data_entry_helper::$base_url . "/index.php/services/report/requestReport?report=mnhnl_btw_transect_direction_report.xml&reportSource=local&auth_token=" . $readAuth['auth_token'] . "&nonce=" . $readAuth['nonce'] . "&mode=csv\">";
$r .= '<p>' . lang::get('LANG_Direction_Report') . '</p>';
$r .= "<input type=\"hidden\" id=\"params\" name=\"params\" value='{\"survey_id\":" . $args['survey_id'] . ", \"direction_attr_id\":" . $args['sample_walk_direction_id'] . ", \"closed_attr_id\":" . $args['sample_closure_id'] . "}' />";
$r .= "<input type=\"submit\" class=\"ui-state-default ui-corner-all\" value=\"" . lang::get('LANG_Direction_Report_Button') . "\">";
$r .= "</form>";
$r .= "<form method=\"post\" action=\"" . data_entry_helper::$base_url . "/index.php/services/report/requestReport?report=mnhnl_btw_download_report.xml&reportSource=local&auth_token=" . $readAuth['auth_token'] . "&nonce=" . $readAuth['nonce'] . "&mode=csv\">";
$r .= '<p>' . lang::get('LANG_Initial_Download') . '</p>';
$r .= "<input type=\"hidden\" id=\"params\" name=\"params\" value='{\"survey_id\":" . $args['survey_id'] . ", \"closed_attr_id\":" . $args['sample_closure_id'] . ", \"download\": \"INITIAL\"}' />";
$r .= "<input type=\"submit\" class=\"ui-state-default ui-corner-all\" value=\"" . lang::get('LANG_Initial_Download_Button') . "\">";
$r .= "</form>";
$r .= "<form method=\"post\" action=\"" . data_entry_helper::$base_url . "/index.php/services/report/requestReport?report=mnhnl_btw_download_report.xml&reportSource=local&auth_token=" . $readAuth['auth_token'] . "&nonce=" . $readAuth['nonce'] . "&mode=csv\">";
$r .= '<p>' . lang::get('LANG_Confirm_Download') . '</p>';
$r .= "<input type=\"hidden\" id=\"params\" name=\"params\" value='{\"survey_id\":" . $args['survey_id'] . ", \"closed_attr_id\":" . $args['sample_closure_id'] . ", \"download\": \"CONFIRM\"}' />";
$r .= "<input type=\"submit\" class=\"ui-state-default ui-corner-all\" value=\"" . lang::get('LANG_Confirm_Download_Button') . "\">";
$r .= "</form>";
$r .= "<form method=\"post\" action=\"" . data_entry_helper::$base_url . "/index.php/services/report/requestReport?report=mnhnl_btw_download_report.xml&reportSource=local&auth_token=" . $readAuth['auth_token'] . "&nonce=" . $readAuth['nonce'] . "&mode=csv\">";
$r .= '<p>' . lang::get('LANG_Final_Download') . '</p>';
$r .= "<input type=\"hidden\" id=\"params\" name=\"params\" value='{\"survey_id\":" . $args['survey_id'] . ", \"closed_attr_id\":" . $args['sample_closure_id'] . ", \"download\": \"FINAL\"}' />";
$r .= "<input type=\"submit\" class=\"ui-state-default ui-corner-all\" value=\"" . lang::get('LANG_Final_Download_Button') . "\">";
$r .= "</form></div>";
}
// Create Map
$r .= "<div class=\"mnhnl-btw-mappanel\">\n";
$r .= data_entry_helper::map_panel(array('presetLayers' => $presetLayers, 'layers' => array('baseLayer_1', 'baseLayer_2', 'locationLayer'), 'initialFeatureWkt' => null, 'width' => 'auto', 'height' => 490, 'editLayer' => false, 'initial_lat' => $args['map_centroid_lat'], 'initial_long' => $args['map_centroid_long'], 'initial_zoom' => (int) $args['map_zoom'], 'scroll_wheel_zoom' => false), array('projection' => $args['map_projection']));
// Add locations to the map on the locations layer.
// Zoom in to area which contains the users locations.
if ($locations != 'all') {
data_entry_helper::$javascript .= "locationList = [" . implode(',', $locations) . "];\n";
}
data_entry_helper::$javascript .= "\n// upload locations into map.\n// Change the location control requests the location's geometry to place on the map.\n\$.getJSON(\"{$svcUrl}\" + \"/data/location\" +\n \"?mode=json&view=detail&nonce=" . $readAuth['nonce'] . "&auth_token=" . $readAuth['auth_token'] . "\" +\n \"&parent_id=NULL&callback=?\", function(data) {\n // store value in saved field?\n locationLayer.destroyFeatures();\n if (data.length>0) {\n var newFeatures = [];\n var feature;\n var parser = new OpenLayers.Format.WKT();\n for (var i=0;i<data.length;i++)\n {\n";
if ($locations != 'all') {
// include restriction on locations if user does not have full access.
data_entry_helper::$javascript .= "\n for(var j=0; j<locationList.length; j++) {\n if(locationList[j] == data[i].id || locationList[j] == data[i].parent_id) {";
}
data_entry_helper::$javascript .= "\n if(data[i].boundary_geom){\n " . self::readBoundaryJs('data[i].boundary_geom', $args['map_projection']) . "\n feature.style = {label: data[i].name,\n strokeColor: \"Blue\",\n strokeWidth: 2};\n newFeatures.push(feature);\n }\n";
if ($locations != 'all') {
data_entry_helper::$javascript .= "\n }\n }\n";
}
data_entry_helper::$javascript .= "\n }\n locationLayer.addFeatures(newFeatures);\n locationLayer.map.zoomToExtent(locationLayer.getDataExtent());\n }\n});\n\$('#controls').bind('tabsshow', function(event, ui) {\n var y = \$('.mnhnl-btw-datapanel:visible').outerHeight(true) + \$('.mnhnl-btw-datapanel:visible').position().top;\n if(y < \$('.mnhnl-btw-mappanel').outerHeight(true)+ \$('.mnhnl-btw-mappanel').position().top){\n y = \$('.mnhnl-btw-mappanel').outerHeight(true)+ \$('.mnhnl-btw-mappanel').position().top;\n }\n \$('#controls').height(y - \$('#controls').position().top);\n});\n";
$r .= "</div>\n";
if (count($tabs) > 1) {
$r .= "</div>";
}
return $r;
}
///////////////////////////////////////////////////////////////////
$occReadOnly = false;
if ($childLoadID) {
$url = $svcUrl . '/data/occurrence/' . $childLoadID;
$url .= "?mode=json&view=detail&auth_token=" . $readAuth['auth_token'] . "&nonce=" . $readAuth["nonce"];
$session = curl_init($url);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$entity = json_decode(curl_exec($session), true);
$childSample = array();
foreach ($entity[0] as $key => $value) {
$childSample['occurrence:' . $key] = $value;
示例10: function
echo $base_url;
?>
/index.php/services/spatial/wkt_to_sref"+
"?wkt=POINT(" + lonlat.lon + " " + lonlat.lat + ")"+
"&system=" + $('#imp-sref-system').val() +
"&precision=" + precision +
"&callback=?", function(data)
{
$('#imp-sref').attr('value', data.sref);
}
);
}
</script>
</head>
<body>
<div id="wrap">
<h1>Polygon Capture Map</h1>
<p>Click on the map to define a polygon. Double click to finish.</p>
<?php
echo data_entry_helper::sref_and_system(array('label' => 'Spatial ref'));
echo data_entry_helper::map_panel(array('controls' => array('drawControl'), 'layers' => array('polygonLayer')));
echo data_entry_helper::dump_javascript();
?>
<script type='text/javascript'>
$(document).ready(function() {
drawControl.activate();
});
</script>
</body>
</html>
示例11: get_form
//.........這裏部分代碼省略.........
$r .= "</select>";
}
}
}
$r .= "\n <input type=\"submit\" class=\"ui-state-default ui-corner-all\" value=\"" . lang::get('LANG_Save_Location_Allocations') . "\" />\n </form>\n </div>";
}
// Add the downloader if user has manager (superuser) rights.
if (iform_loctools_checkaccess($node, 'superuser')) {
$r .= '
<div id="downloads" class="mnhnl-btw-datapanel">
<form method="post" action="' . data_entry_helper::$base_url . '/index.php/services/report/requestReport?report=mnhnl_btw_transect_direction_report.xml&reportSource=local&auth_token=' . $readAuth['auth_token'] . '&nonce=' . $readAuth['nonce'] . '&mode=csv">
<p>' . lang::get('LANG_Direction_Report') . '</p>
<input type="hidden" id="params" name="params" value=\'{"survey_id":' . $args['survey_id'] . ', "direction_attr_id":' . $args['sample_walk_direction_id'] . ', "closed_attr_id":' . $args['sample_closure_id'] . '}\' />
<input type="submit" class="ui-state-default ui-corner-all" value="' . lang::get('LANG_Direction_Report_Button') . '">
</form>
<form method="post" action="' . data_entry_helper::$base_url . '/index.php/services/report/requestReport?report=mnhnl_btw_download_report.xml&reportSource=local&auth_token=' . $readAuth['auth_token'] . '&nonce=' . $readAuth['nonce'] . '&mode=csv\\">
<p>' . lang::get('LANG_Initial_Download') . '</p>
<input type="hidden" id="params" name="params" value=\'{"survey_id":' . $args['survey_id'] . ', "closed_attr_id":' . $args['sample_closure_id'] . ', "download": "INITIAL"}\' />
<input type="submit" class=\\"ui-state-default ui-corner-all" value="' . lang::get('LANG_Initial_Download_Button') . '">
</form>
<form method="post" action="' . data_entry_helper::$base_url . '/index.php/services/report/requestReport?report=mnhnl_btw_download_report.xml&reportSource=local&auth_token=' . $readAuth['auth_token'] . '&nonce=' . $readAuth['nonce'] . '&mode=csv\\">
<p>' . lang::get('LANG_Confirm_Download') . '</p>
<input type="hidden" id="params" name="params" value=\'{"survey_id":' . $args['survey_id'] . ', "closed_attr_id":' . $args['sample_closure_id'] . ', "download": "CONFIRM"}\' />
<input type="submit" class="ui-state-default ui-corner-all" value="' . lang::get('LANG_Confirm_Download_Button') . '">
</form>
<form method="post" action="' . data_entry_helper::$base_url . '/index.php/services/report/requestReport?report=mnhnl_btw_download_report.xml&reportSource=local&auth_token=' . $readAuth['auth_token'] . '&nonce=' . $readAuth['nonce'] . '&mode=csv\\">
<p>' . lang::get('LANG_Final_Download') . '</p>
<input type="hidden" id="params" name="params" value=\'{"survey_id":' . $args['survey_id'] . ', "closed_attr_id":' . $args['sample_closure_id'] . ', "download": "FINAL"}\' />
<input type="submit" class="ui-state-default ui-corner-all" value="' . lang::get('LANG_Final_Download_Button') . '">
</form>
</div>';
}
// Create Map
$r .= "<div class=\"mnhnl-btw-mappanel\">\n" . data_entry_helper::map_panel(array('presetLayers' => $presetLayers, 'layers' => array('baseLayer_1', 'baseLayer_2', 'locationListLayer'), 'initialFeatureWkt' => null, 'width' => 'auto', 'height' => 490, 'editLayer' => false, 'initial_lat' => $args['map_centroid_lat'], 'initial_long' => $args['map_centroid_long'], 'initial_zoom' => (int) $args['map_zoom'], 'scroll_wheel_zoom' => false), array('projection' => $args['map_projection'])) . "</div>\n";
data_entry_helper::$javascript .= "\n\$('#controls').bind('tabsshow', function(event, ui) {\n var y = \$('.mnhnl-btw-datapanel:visible').outerHeight(true) + \$('.mnhnl-btw-datapanel:visible').position().top;\n if(y < \$('.mnhnl-btw-mappanel').outerHeight(true)+ \$('.mnhnl-btw-mappanel').position().top){\n y = \$('.mnhnl-btw-mappanel').outerHeight(true)+ \$('.mnhnl-btw-mappanel').position().top;\n }\n \$('#controls').height(y - \$('#controls').position().top);\n});\n";
if (count($tabs) > 1) {
// close tabs div if present
$r .= "</div>";
}
return $r;
}
///////////////////////////////////////////////////////////////////
$occReadOnly = false;
if ($childLoadID) {
// load the occurrence and its associated sample (which holds the position)
$url = $svcUrl . '/data/occurrence/' . $childLoadID;
$url .= "?mode=json&view=detail&auth_token=" . $readAuth['auth_token'] . "&nonce=" . $readAuth["nonce"];
$session = curl_init($url);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$entity = json_decode(curl_exec($session), true);
$childSample = array();
foreach ($entity[0] as $key => $value) {
$childSample['occurrence:' . $key] = $value;
}
if ($entity[0]['downloaded_flag'] == 'F') {
// Final download complete, now readonly
$occReadOnly = true;
}
$url = $svcUrl . '/data/sample/' . $childSample['occurrence:sample_id'];
$url .= "?mode=json&view=detail&auth_token=" . $readAuth['auth_token'] . "&nonce=" . $readAuth["nonce"];
$session = curl_init($url);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$entity = json_decode(curl_exec($session), true);
foreach ($entity[0] as $key => $value) {
$childSample['sample:' . $key] = $value;
}
示例12: 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;
}
示例13: get_form
//.........這裏部分代碼省略.........
<div id="flower-filter-title">
<span>' . lang::get('LANG_Flower_Filter_Title') . '</span>
</div>
</div>
<div id="flower-filter-body" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active ui-corner-all">
' . data_entry_helper::select($flower_ctrl_args) . data_entry_helper::outputAttribute($occurrence_attributes[$args['flower_type_attr_id']], $defAttrOptions) . data_entry_helper::outputAttribute($location_attributes[$args['habitat_attr_id']], $defAttrOptions) . '
</div>
<div id="insect-filter-header" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-all">
<div id="fold-insect-button" class="ui-state-default ui-corner-all fold-button"> </div>
<div id="reset-insect-button" class="ui-state-default ui-corner-all reset-button">' . lang::get('LANG_Reset_Filter') . '</div>
<div id="insect-filter-title">
<span>' . lang::get('LANG_Insect_Filter_Title') . '</span>
</div>
</div>
<div id="insect-filter-body" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active ui-corner-all">
' . data_entry_helper::select($insect_ctrl_args) . data_entry_helper::outputAttribute($sample_attributes[$args['sky_state_attr_id']], $defAttrOptions) . data_entry_helper::outputAttribute($sample_attributes[$args['temperature_attr_id']], $defAttrOptions) . data_entry_helper::outputAttribute($sample_attributes[$args['wind_attr_id']], $defAttrOptions) . data_entry_helper::outputAttribute($sample_attributes[$args['shade_attr_id']], $defAttrOptions) . '
</div>
<div id="location-filter-header" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-all">
<div id="fold-location-button" class="ui-state-default ui-corner-all fold-button"> </div>
<div id="reset-location-button" class="ui-state-default ui-corner-all reset-button">' . lang::get('LANG_Reset_Filter') . '</div>
<div id="location-filter-title">
<span>' . lang::get('LANG_Location_Filter_Title') . '</span>
</div>
</div>
<div id="location-filter-body" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active ui-corner-all">
<div id="location-entry">
' . data_entry_helper::georeference_lookup(array('label' => lang::get('LANG_Georef_Label'), 'georefPreferredArea' => $args['georefPreferredArea'], 'georefCountry' => $args['georefCountry'], 'georefLang' => $args['language'], 'suffixTemplate' => 'nosuffix')) . '
<label for="place:INSEE">' . lang::get('LANG_Or') . '</label>
<input type="text" id="place:INSEE" name="place:INSEE" value="' . lang::get('LANG_INSEE') . '"
onclick="if(this.value==\'' . lang::get('LANG_INSEE') . '\'){this.value=\'\'; this.style.color=\'#000\'}"
onblur="if(this.value==\'\'){this.value=\'' . lang::get('LANG_INSEE') . '\'; this.style.color=\'#555\'}" />
<input type="button" id="search-insee-button" class="ui-corner-all ui-widget-content ui-state-default search-button" value="Search" />
</div>
' . data_entry_helper::map_panel($options, $olOptions) . '
</div>
</div>
</div>
<div id="filter-footer" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active ui-corner-bottom">
<div id="search-insects-button" class="ui-state-default ui-corner-all search-button">' . lang::get('LANG_Search_Insects') . '</div>
<div id="search-collections-button" class="ui-state-default ui-corner-all search-button">' . lang::get('LANG_Search_Collections') . '</div>
</div>
<div id="results-collections-header" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-top">
<div id="results-collections-title">
<span>' . lang::get('LANG_Collections_Search_Results') . '</span>
</div>
</div>
<div id="results-collections-results" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active ui-corner-bottom">
</div>
<div id="results-insects-header" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-top">
<div id="results-insects-title">
<span>' . lang::get('LANG_Insects_Search_Results') . '</span>
</div>
</div>
<div id="results-insects-results" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active ui-corner-bottom">
</div>
</div>
<div id="focus-collection" class="ui-accordion ui-widget ui-helper-reset">
<div id="collection-header" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-all">
<div id="collection-title">
<span> </span>
</div>
</div>
<div id="collection-details" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active ui-corner-top">
<div id="flower-image">
</div>
<div id="collection-description">
示例14: get_sample_form
public static function get_sample_form($args, $node, $response)
{
global $user;
iform_load_helpers(array('map_helper'));
$auth = data_entry_helper::get_read_write_auth($args['website_id'], $args['password']);
// either looking at existing, creating a new one, or an error occurred: no successful posts...
// first check some conditions are met
$sampleMethods = helper_base::get_termlist_terms($auth, 'indicia:sample_methods', array('Timed Count'));
if (count($sampleMethods) == 0) {
return 'The sample method "Timed Count" must be defined in the termlist in order to use this form.';
}
$sampleId = isset($_GET['sample_id']) ? $_GET['sample_id'] : null;
if ($sampleId && !isset(data_entry_helper::$validation_errors)) {
data_entry_helper::load_existing_record($auth['read'], 'sample', $sampleId);
}
$r = '<form method="post" id="sample">' . $auth['write'];
// we pass through the read auth. This makes it possible for the get_submission method to authorise against the warehouse
// without an additional (expensive) warehouse call, so it can get location details.
$r .= '<input type="hidden" name="read_nonce" value="' . $auth['read']['nonce'] . '"/>';
$r .= '<input type="hidden" name="read_auth_token" value="' . $auth['read']['auth_token'] . '"/>';
if (isset(data_entry_helper::$entity_to_load['sample:id'])) {
$r .= '<input type="hidden" name="sample:id" value="' . data_entry_helper::$entity_to_load['sample:id'] . '"/>';
}
// pass a param that sets the next page to display
$r .= "<input type=\"hidden\" name=\"website_id\" value=\"" . $args['website_id'] . "\"/>\n<input type=\"hidden\" name=\"sample:survey_id\" value=\"" . $args['survey_id'] . "\"/>\n<input type=\"hidden\" name=\"page\" value=\"site\"/>";
$attributes = data_entry_helper::getAttributes(array('id' => $sampleId, 'valuetable' => 'sample_attribute_value', 'attrtable' => 'sample_attribute', 'key' => 'sample_id', 'fieldprefix' => 'smpAttr', 'extraParams' => $auth['read'], 'survey_id' => $args['survey_id'], 'sample_method_id' => $sampleMethods[0]['id']));
$r .= get_user_profile_hidden_inputs($attributes, $args, '', $auth['read']) . data_entry_helper::text_input(array('label' => lang::get('Site Name'), 'fieldname' => 'sample:location_name', 'validation' => array('required')));
$help = lang::get('The Year field is read-only, and is calculated automatically from the date(s) of the Counts.');
$r .= '<p class="ui-state-highlight page-notice ui-corner-all">' . $help . '</p>';
if ($sampleId == null) {
if (isset($_GET['date'])) {
data_entry_helper::$entity_to_load['C1:sample:date'] = $_GET['date'];
}
$r .= data_entry_helper::date_picker(array('label' => lang::get('Date of first count'), 'fieldname' => 'C1:sample:date', 'validation' => array('required', 'date')));
data_entry_helper::$javascript .= "jQuery('#C1\\\\:sample\\\\:date').change(function(){\n jQuery('#sample\\\\:date').val(jQuery(this).val() == '' ? '' : jQuery(this).datepicker('getDate').getFullYear());\n});\nif(jQuery('#C1\\\\:sample\\\\:date').val() != '') jQuery('#sample\\\\:date').val(jQuery('#C1\\\\:sample\\\\:date').datepicker('getDate').getFullYear());\n";
}
if (isset(data_entry_helper::$entity_to_load['sample:date']) && preg_match('/^(\\d{4})/', data_entry_helper::$entity_to_load['sample:date'])) {
// Date has 4 digit year first (ISO style) - only interested in Year.
$d = new DateTime(data_entry_helper::$entity_to_load['sample:date']);
data_entry_helper::$entity_to_load['sample:date'] = $d->format('Y');
}
unset(data_entry_helper::$default_validation_rules['sample:date']);
$r .= data_entry_helper::text_input(array('label' => lang::get('Year'), 'fieldname' => 'sample:date', 'readonly' => ' readonly="readonly" '));
// are there any option overrides for the custom attributes?
if (isset($args['custom_attribute_options']) && $args['custom_attribute_options']) {
$blockOptions = get_attr_options_array_with_user_data($args['custom_attribute_options']);
} else {
$blockOptions = array();
}
$r .= get_attribute_html($attributes, $args, array('extraParams' => $auth['read']), null, $blockOptions);
$r .= '<input type="hidden" name="sample:sample_method_id" value="' . $sampleMethods[0]['id'] . '" />';
$help = lang::get('Now draw the flight area for the timed count on the map below. The Grid Reference is filled in automatically when the site is drawn.');
$r .= '<p class="ui-state-highlight page-notice ui-corner-all">' . $help . '</p>';
$options = iform_map_get_map_options($args, $auth['read']);
$options['allowPolygonRecording'] = true;
$options['clickForSpatialRef'] = false;
if (isset($args['precision']) && $args['precision'] != '') {
$options['clickedSrefPrecisionMin'] = $args['precision'];
$options['clickedSrefPrecisionMax'] = $args['precision'];
}
$olOptions = iform_map_get_ol_options($args);
if (!in_array('drawPolygon', $options['standardControls'])) {
$options['standardControls'][] = 'drawPolygon';
}
if (!in_array('modifyFeature', $options['standardControls'])) {
$options['standardControls'][] = 'modifyFeature';
}
$systems = array();
$list = explode(',', str_replace(' ', '', $args['spatial_systems']));
foreach ($list as $system) {
$systems[$system] = lang::get($system);
}
$r .= "<label for=\"imp-sref\">" . lang::get('Grid Reference') . ":</label> <input type=\"text\" id=\"imp-sref\" name=\"sample:entered_sref\" value=\"" . data_entry_helper::$entity_to_load['sample:entered_sref'] . "\" readonly=\"readonly\" class=\"required\" />";
$r .= "<input type=\"hidden\" id=\"imp-geom\" name=\"sample:geom\" value=\"" . data_entry_helper::$entity_to_load['sample:geom'] . "\" />";
if (count($systems) == 1) {
// Hidden field for the system
$keys = array_keys($systems);
$r .= "<input type=\"hidden\" id=\"imp-sref-system\" name=\"sample:entered_sref_system\" value=\"" . $keys[0] . "\" />\n";
} else {
$r .= self::sref_system_select(array('fieldname' => 'sample:entered_sref_system'));
}
$r .= '<br />' . data_entry_helper::georeference_lookup(iform_map_get_georef_options($args, $auth['read']));
$r .= data_entry_helper::map_panel($options, $olOptions);
// switch off the sref functionality.
data_entry_helper::$javascript .= "mapInitialisationHooks.push(function(div){\n \$('#imp-sref').unbind('change');\n // Programatic activation does not rippleout, so deactivate Nav first, which is actibve by default.\n for(var i=0; i<div.map.controls.length; i++)\n if(div.map.controls[i].CLASS_NAME == \"OpenLayers.Control.Navigation\")\n div.map.controls[i].deactivate();\n activeCtrl = false;\n for(var i=0; i<div.map.controls.length; i++){\n if(div.map.controls[i].CLASS_NAME == \"" . (isset(data_entry_helper::$entity_to_load['sample:id']) ? "OpenLayers.Control.ModifyFeature" : "OpenLayers.Control.DrawFeature") . "\"){\n div.map.controls[i].activate();\n activeCtrl = div.map.controls[i];\n break;\n }}\n" . (isset(data_entry_helper::$entity_to_load['sample:id']) ? " if(activeCtrl && div.map.editLayer.features.length>0) activeCtrl.selectFeature(div.map.editLayer.features[0]);\n" : "") . "});\n";
$r .= data_entry_helper::textarea(array('label' => 'Comment', 'fieldname' => 'sample:comment', 'class' => 'wide'));
$r .= '<input type="submit" value="' . lang::get('Next') . '" />';
$r .= '<a href="' . $args['summary_page'] . '"><button type="button" class="ui-state-default ui-corner-all" />' . lang::get('Cancel') . '</button></a>';
// allow deletes if sample id is present: i.e. existing sample.
if (isset(data_entry_helper::$entity_to_load['sample:id'])) {
$r .= '<button id="delete-button" type="button" class="ui-state-default ui-corner-all" />' . lang::get('Delete') . '</button>';
// note we only require bare minimum in order to flag a sample as deleted.
$r .= '</form><form method="post" id="delete-form" style="display: none;">';
$r .= $auth['write'];
$r .= '<input type="hidden" name="page" value="delete"/>';
$r .= '<input type="hidden" name="website_id" value="' . $args['website_id'] . '"/>';
$r .= '<input type="hidden" name="sample:id" value="' . data_entry_helper::$entity_to_load['sample:id'] . '"/>';
$r .= '<input type="hidden" name="sample:deleted" value="t"/>';
data_entry_helper::$javascript .= "jQuery('#delete-button').click(function(){\n if(confirm(\"" . lang::get('Are you sure you want to delete this timed count?') . "\"))\n jQuery('#delete-form').submit();\n});\n";
}
//.........這裏部分代碼省略.........
示例15: get_form
//.........這裏部分代碼省略.........
<p>' . lang::get('LANG_Initial_Download') . '</p>
<input type="hidden" name="params" value=\'{"survey_id":' . $args['survey_id'] . ', "closed_attr_id":' . $sample_closure_id . ', "download": "INITIAL", "quality": "!R", "occattrs": "' . $occurrence_confidence_id . ',' . $occurrence_count_id . ',' . $occurrence_approximation_id . ',' . $occurrence_territorial_id . ',' . $occurrence_atlas_code_id . ',' . $occurrence_overflying_id . '", "smpattrs" : "' . $sample_walk_direction_id . ',' . $sample_reliability_id . ',' . $sample_visit_number_id . ',' . $sample_wind_id . ',' . $sample_precipitation_id . ',' . $sample_temperature_id . ',' . $sample_cloud_id . ',' . $sample_start_time_id . ',' . $sample_end_time_id . ',' . $sample_closure_id . ',' . $uid_attr_id . ',' . $email_attr_id . ',' . $username_attr_id . '"}\' />
<input type="submit" class="ui-state-default ui-corner-all" value="' . lang::get('LANG_Initial_Download_Button') . '">
</form>
<form method="post" action="' . data_entry_helper::$base_url . '/index.php/services/report/requestReport?report=reports_for_prebuilt_forms/MNHNL/mnhnl_btw_download_report_2.xml&reportSource=local&auth_token=' . $readAuth['auth_token'] . '&nonce=' . $readAuth['nonce'] . '&mode=csv">
<p>' . lang::get('LANG_Confirm_Download') . '</p>
<input type="hidden" name="params" value=\'{"survey_id":' . $args['survey_id'] . ', "closed_attr_id":' . $sample_closure_id . ', "download": "CONFIRM", "quality": "V", "occattrs": "' . $occurrence_confidence_id . ',' . $occurrence_count_id . ',' . $occurrence_approximation_id . ',' . $occurrence_territorial_id . ',' . $occurrence_atlas_code_id . ',' . $occurrence_overflying_id . '", "smpattrs" : "' . $sample_walk_direction_id . ',' . $sample_reliability_id . ',' . $sample_visit_number_id . ',' . $sample_wind_id . ',' . $sample_precipitation_id . ',' . $sample_temperature_id . ',' . $sample_cloud_id . ',' . $sample_start_time_id . ',' . $sample_end_time_id . ',' . $sample_closure_id . ',' . $uid_attr_id . ',' . $email_attr_id . ',' . $username_attr_id . '"}\' />
<input type="submit" class="ui-state-default ui-corner-all" value="' . lang::get('LANG_Confirm_Download_Button') . '">
</form>
<form method="post" action="' . data_entry_helper::$base_url . '/index.php/services/report/requestReport?report=reports_for_prebuilt_forms/MNHNL/mnhnl_btw_download_report_2.xml&reportSource=local&auth_token=' . $readAuth['auth_token'] . '&nonce=' . $readAuth['nonce'] . '&mode=csv">
<p>' . lang::get('LANG_Final_Download') . '</p>
<input type="hidden" name="params" value=\'{"survey_id":' . $args['survey_id'] . ', "closed_attr_id":' . $sample_closure_id . ', "download": "FINAL", "quality": "V", "occattrs": "' . $occurrence_confidence_id . ',' . $occurrence_count_id . ',' . $occurrence_approximation_id . ',' . $occurrence_territorial_id . ',' . $occurrence_atlas_code_id . ',' . $occurrence_overflying_id . '", "smpattrs" : "' . $sample_walk_direction_id . ',' . $sample_reliability_id . ',' . $sample_visit_number_id . ',' . $sample_wind_id . ',' . $sample_precipitation_id . ',' . $sample_temperature_id . ',' . $sample_cloud_id . ',' . $sample_start_time_id . ',' . $sample_end_time_id . ',' . $sample_closure_id . ',' . $uid_attr_id . ',' . $email_attr_id . ',' . $username_attr_id . '"}\' />
<input type="submit" class="ui-state-default ui-corner-all" value="' . lang::get('LANG_Final_Download_Button') . '">
</form>
<form method="post" action="' . data_entry_helper::$base_url . '/index.php/services/report/requestReport?report=reports_for_prebuilt_forms/MNHNL/mnhnl_btw_download_report_2.xml&reportSource=local&auth_token=' . $readAuth['auth_token'] . '&nonce=' . $readAuth['nonce'] . '&mode=csv">
<p>' . lang::get('LANG_Complete_Final_Download') . '</p>
<input type="hidden" name="params" value=\'{"survey_id":' . $args['survey_id'] . ', "closed_attr_id":' . $sample_closure_id . ', "download": "OFF", "quality": "NA", "occattrs": "' . $occurrence_confidence_id . ',' . $occurrence_count_id . ',' . $occurrence_approximation_id . ',' . $occurrence_territorial_id . ',' . $occurrence_atlas_code_id . ',' . $occurrence_overflying_id . '", "smpattrs" : "' . $sample_walk_direction_id . ',' . $sample_reliability_id . ',' . $sample_visit_number_id . ',' . $sample_wind_id . ',' . $sample_precipitation_id . ',' . $sample_temperature_id . ',' . $sample_cloud_id . ',' . $sample_start_time_id . ',' . $sample_end_time_id . ',' . $sample_closure_id . ',' . $uid_attr_id . ',' . $email_attr_id . ',' . $username_attr_id . '"}\' />
<input type="submit" class="ui-state-default ui-corner-all" value="' . lang::get('LANG_Complete_Final_Download_Button') . '">
</form>
</div>';
}
// Create Map
$options = iform_map_get_map_options($args, $readAuth);
$olOptions = iform_map_get_ol_options($args);
// if($locations == 'all' || $loclist != '-1')
// $options['layers'] = array('locationListLayer');
$options['searchLayer'] = 'false';
$options['editLayer'] = 'false';
$options['initialFeatureWkt'] = null;
$options['proxy'] = '';
$options['scroll_wheel_zoom'] = false;
$options['width'] = 'auto';
// TBD remove from arglist
$r .= "<div class=\"mnhnl-btw-mappanel\">\n" . data_entry_helper::map_panel($options, $olOptions) . "</div>\n";
data_entry_helper::$javascript .= "\n\$('#controls').bind('tabsshow', function(event, ui) {\n var y = \$('.mnhnl-btw-datapanel:visible').outerHeight(true) + \$('.mnhnl-btw-datapanel:visible').position().top;\n if(y < \$('.mnhnl-btw-mappanel').outerHeight(true)+ \$('.mnhnl-btw-mappanel').position().top){\n y = \$('.mnhnl-btw-mappanel').outerHeight(true)+ \$('.mnhnl-btw-mappanel').position().top;\n }\n \$('#controls').height(y - \$('#controls').position().top);\n});\n";
if (count($tabs) > 1) {
// close tabs div if present
$r .= "</div>";
}
if (method_exists(get_called_class(), 'getTrailerHTML')) {
$r .= call_user_func(array(get_called_class(), 'getTrailerHTML'), $args);
}
return $r;
}
///////////////////////////////////////////////////////////////////
// At this point there are 3 modes:
// Adding a new survey
// editing/showing an existing survey
// editing/showing an existing occurrence
// First load the occurrence (and its position sample) if provided
// Then load the parent sample if provided, or derived from occurrence.
// $occReadOnly is set if the occurrence has been downloaded. Not even an admin user can modify it in this case.
data_entry_helper::$javascript .= "\n// Create Layers.\nvar locationLayer, occListLayer, control;\nmapInitialisationHooks.push(function (div) {\n \"use strict\";\n // Create vector layers: one to display the location onto, and another for the occurrence list\n // the default edit layer is used for the occurrences themselves\n var locStyleMap = new OpenLayers.StyleMap({\n 'default': new OpenLayers.Style({\n fillColor: 'Green',\n strokeColor: 'Black',\n fillOpacity: 0.2,\n strokeWidth: 1\n })});\n locationLayer = new OpenLayers.Layer.Vector('" . lang::get("LANG_Location_Layer") . "', {styleMap: locStyleMap});\n var occStyleMap = new OpenLayers.StyleMap({\n 'default': new OpenLayers.Style({\n pointRadius: 3,\n fillColor: 'Red',\n fillOpacity: 0.3,\n strokeColor: 'Red',\n strokeWidth: 1\n })});\n occListLayer = new OpenLayers.Layer.Vector(\"" . lang::get("LANG_Occurrence_List_Layer") . "\", {styleMap: occStyleMap});\n div.map.addLayer(locationLayer);\n div.map.addLayer(occListLayer);\n var control = new OpenLayers.Control.SelectFeature(occListLayer);\n occListLayer.map.addControl(control);\n function onPopupClose(evt) {\n // 'this' is the popup.\n control.unselect(this.feature);\n }\n function onFeatureSelect(evt) {\n feature = evt.feature;\n popup = new OpenLayers.Popup.FramedCloud(\"featurePopup\",\n feature.geometry.getBounds().getCenterLonLat(),\n new OpenLayers.Size(100,100),\n feature.attributes.taxon + \" (\" + feature.attributes.count + \")\",\n null, true, onPopupClose);\n feature.popup = popup;\n popup.feature = feature;\n feature.layer.map.addPopup(popup);\n }\n function onFeatureUnselect(evt) {\n feature = evt.feature;\n if (feature.popup) {\n popup.feature = null;\n feature.layer.map.removePopup(feature.popup);\n feature.popup.destroy();\n feature.popup = null;\n }\n }\n occListLayer.events.on({\n 'featureselected': onFeatureSelect,\n 'featureunselected': onFeatureUnselect\n });\n control.activate();\n});\n";
$occReadOnly = false;
$childSample = array();
if ($childLoadID) {
// load the occurrence and its associated sample (which holds the position)
$url = $svcUrl . '/data/occurrence/' . $childLoadID;
$url .= "?mode=json&view=detail&auth_token=" . $readAuth['auth_token'] . "&nonce=" . $readAuth["nonce"];
$session = curl_init($url);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$entity = json_decode(curl_exec($session), true);
if (count($entity) == 0) {
return '<p>' . lang::get('LANG_No_Access_To_Occurrence') . '</p>';
}
foreach ($entity[0] as $key => $value) {