function iform_mnhnl_locModTool($auth, $args, $node) { global $indicia_templates; if (!isset($args['clientSideValidation']) || $args['clientSideValidation']) { data_entry_helper::enable_validation('entry_form'); } if ($args['locationMode'] == 'multi') { $args['locationMode'] = 'parent'; } data_entry_helper::$entity_to_load = array(); $retVal = "<div id=\"locations\">"; if ($args['shpFileDownloadURL'] != "") { $request = $args['shpFileDownloadURL'] . "/geoserver/wfs?request=GetFeature&service=wfs&version=1.0.0&outputformat=SHAPE-ZIP&srsName=EPSG:2169"; if ($args['LocationTypeTerm'] == '' && isset($args['loctoolsLocTypeID'])) { $args['LocationTypeTerm'] = $args['loctoolsLocTypeID']; } $primary = iform_mnhnl_getTermID($auth, 'indicia:location_types', $args['LocationTypeTerm']); $request .= "&cql_filter=website_id=" . $args['website_id'] . " AND "; if ($args['SecondaryLocationTypeTerm'] != '') { $secondary = iform_mnhnl_getTermID($auth, 'indicia:location_types', $args['SecondaryLocationTypeTerm']); $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; }
protected static function get_control_pointgrid($auth, $args, $tabalias, $options) { return iform_mnhnl_PointGrid($auth, $args, $options); }
protected static function get_control_pointgrid($auth, $args, $tabalias, $options) { if (self::$mode === self::MODE_EXISTING_RO) { return ""; } return iform_mnhnl_PointGrid($auth, $args, $options); }