Updated documentation
This commit is contained in:
@@ -8,6 +8,7 @@ export(MNR.DB.Geometries)
|
|||||||
export(MNR.DB.Organisations)
|
export(MNR.DB.Organisations)
|
||||||
export(MNR.DB.Users)
|
export(MNR.DB.Users)
|
||||||
export(MNR.GeoPlot)
|
export(MNR.GeoPlot)
|
||||||
|
export(attachResourcePaths)
|
||||||
export(resourcePrefix)
|
export(resourcePrefix)
|
||||||
export(use_mnr_ui)
|
export(use_mnr_ui)
|
||||||
import(dplyr)
|
import(dplyr)
|
||||||
|
|||||||
9
R/db.R
9
R/db.R
@@ -1,8 +1,13 @@
|
|||||||
|
#' MNR database queries base class
|
||||||
|
#'
|
||||||
#' @export
|
#' @export
|
||||||
# nolint next: object_name_linter. R6Class
|
# nolint next: object_name_linter. R6Class
|
||||||
MNR.DB <- R6::R6Class(
|
MNR.DB <- R6::R6Class(
|
||||||
"MNR.DB",
|
"MNR.DB",
|
||||||
public = list(
|
public = list(
|
||||||
|
#' @description Initialises the instance with a database client
|
||||||
|
#' \link[AVSDevR.DBClient]{DBClient}
|
||||||
|
#' @param db_client <\link[AVSDevR.DBClient]{DBClient}> A DBClient instance
|
||||||
initialize = function(db_client) {
|
initialize = function(db_client) {
|
||||||
if (is.null(db_client) || !inherits(db_client, "DBClient")) {
|
if (is.null(db_client) || !inherits(db_client, "DBClient")) {
|
||||||
rlang::abort(
|
rlang::abort(
|
||||||
@@ -11,6 +16,10 @@ MNR.DB <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
private$db_client <- db_client
|
private$db_client <- db_client
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#' @description Returns the current DBClient instance in use
|
||||||
|
#' @returns <\link[AVSDevR.DBClient]{DBClient}> The DBClient instance used
|
||||||
|
#' by the class instance
|
||||||
getDBClient = function() {
|
getDBClient = function() {
|
||||||
private$db_client
|
private$db_client
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,14 @@
|
|||||||
|
#' MNR database queries for Actuals
|
||||||
|
#'
|
||||||
#' @export
|
#' @export
|
||||||
# nolint next: object_name_linter. R6Class
|
# nolint next: object_name_linter. R6Class
|
||||||
MNR.DB.Actuals <- R6::R6Class(
|
MNR.DB.Actuals <- R6::R6Class(
|
||||||
"MNR.DB.Actuals",
|
"MNR.DB.Actuals",
|
||||||
inherit = MNR.DB,
|
inherit = MNR.DB,
|
||||||
public = list(
|
public = list(
|
||||||
|
#' @description Select the actuals for `refs`
|
||||||
|
#' @param refs <character> The MNR application noise source references
|
||||||
|
#' @returns A tibble of Actuals for `refs`
|
||||||
selectActuals = function(refs) {
|
selectActuals = function(refs) {
|
||||||
cat("Actuals:\n")
|
cat("Actuals:\n")
|
||||||
private$db_client$table("actual_activities") %>%
|
private$db_client$table("actual_activities") %>%
|
||||||
@@ -25,6 +30,11 @@ MNR.DB.Actuals <- R6::R6Class(
|
|||||||
dplyr::collect() %>%
|
dplyr::collect() %>%
|
||||||
dplyr::glimpse()
|
dplyr::glimpse()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#' @description Returns the current actuals for a application or builds a
|
||||||
|
#' default actuals list from the proposed locations if there are none
|
||||||
|
#' @param refs <character> The MNR application noise source references
|
||||||
|
#' @returns A tibble of the proposed actuals
|
||||||
selectProposedActuals = function(refs) {
|
selectProposedActuals = function(refs) {
|
||||||
partA <- private$db_client$table("proposed_activities") %>%
|
partA <- private$db_client$table("proposed_activities") %>%
|
||||||
dplyr::filter(is.null(deleted_at), is.null(cancelled_at)) %>%
|
dplyr::filter(is.null(deleted_at), is.null(cancelled_at)) %>%
|
||||||
@@ -91,9 +101,12 @@ MNR.DB.Actuals <- R6::R6Class(
|
|||||||
dplyr::bind_rows(partA, partB) %>%
|
dplyr::bind_rows(partA, partB) %>%
|
||||||
dplyr::glimpse()
|
dplyr::glimpse()
|
||||||
},
|
},
|
||||||
upsertActuals = function(actuals.sf, geometries) {
|
|
||||||
|
#' @description Upserts the actuals in the actuals.sf into the database
|
||||||
|
#' @param actuals.sf <sf> An sf table containing the new actuals
|
||||||
|
upsertActuals = function(actuals.sf) {
|
||||||
if (length(actuals.sf) == 0 || (nrow(actuals.sf) == 0)) {
|
if (length(actuals.sf) == 0 || (nrow(actuals.sf) == 0)) {
|
||||||
return(TRUE)
|
return(invisible(NULL))
|
||||||
}
|
}
|
||||||
|
|
||||||
self$deleteActuals(unique(actuals.sf$ref))
|
self$deleteActuals(unique(actuals.sf$ref))
|
||||||
@@ -115,7 +128,7 @@ MNR.DB.Actuals <- R6::R6Class(
|
|||||||
|
|
||||||
if (nrow(actuals) == 0) {
|
if (nrow(actuals) == 0) {
|
||||||
cat("## No actuals to insert\n")
|
cat("## No actuals to insert\n")
|
||||||
return(TRUE)
|
return(invisible(NULL))
|
||||||
}
|
}
|
||||||
|
|
||||||
cat("## Inserting locations for actuals\n")
|
cat("## Inserting locations for actuals\n")
|
||||||
@@ -171,8 +184,11 @@ MNR.DB.Actuals <- R6::R6Class(
|
|||||||
"location_conservation_area_distances", sac_distance_rows
|
"location_conservation_area_distances", sac_distance_rows
|
||||||
)
|
)
|
||||||
|
|
||||||
TRUE
|
invisible(NULL)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#' @description Deletes actuals for `refs`
|
||||||
|
#' @param refs <character> The MNR application noise source references
|
||||||
deleteActuals = function(refs) {
|
deleteActuals = function(refs) {
|
||||||
cat("## Deleting old actuals for", paste(refs, collapse = ","), "\n")
|
cat("## Deleting old actuals for", paste(refs, collapse = ","), "\n")
|
||||||
old_references <- private$db_client$table("actual_activities") %>%
|
old_references <- private$db_client$table("actual_activities") %>%
|
||||||
@@ -199,6 +215,8 @@ MNR.DB.Actuals <- R6::R6Class(
|
|||||||
"locations", old_locations %>% dplyr::rename(id = location_id)
|
"locations", old_locations %>% dplyr::rename(id = location_id)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
invisible(NULL)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,15 +1,26 @@
|
|||||||
|
#' MNR database queries for Applications
|
||||||
|
#'
|
||||||
#' @export
|
#' @export
|
||||||
# nolint next: object_name_linter. R6Class
|
# nolint next: object_name_linter. R6Class
|
||||||
MNR.DB.Applications <- R6::R6Class(
|
MNR.DB.Applications <- R6::R6Class(
|
||||||
"MNR.DB.Applications",
|
"MNR.DB.Applications",
|
||||||
inherit = MNR.DB,
|
inherit = MNR.DB,
|
||||||
public = list(
|
public = list(
|
||||||
|
#' @description Initialises the instance with a database client from
|
||||||
|
#' \link[AVSDevR.DBClient]{DBClient}
|
||||||
|
#' @param db_client <\link[AVSDevR.DBClient]{DBClient}> A DBClient instance
|
||||||
initialize = function(db_client) {
|
initialize = function(db_client) {
|
||||||
super$initialize(db_client)
|
super$initialize(db_client)
|
||||||
private$db_users <- MNR.DB.Users$new(db_client)
|
private$db_users <- MNR.DB.Users$new(db_client)
|
||||||
private$db_orgs <- MNR.DB.Organisations$new(db_client)
|
private$db_orgs <- MNR.DB.Organisations$new(db_client)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#' @description Fetch application details from a permissions query
|
||||||
|
#' @param perm_query A permissions_query object
|
||||||
|
#' @param collect <logical> Collect the query before returning (TRUE) or
|
||||||
|
#' return the built query object (FALSE)
|
||||||
|
#' @returns A query details object (collect = FALSE) or a collected tibble
|
||||||
|
#' of application details
|
||||||
collectFromPermissions = function(perm_query, collect = TRUE) {
|
collectFromPermissions = function(perm_query, collect = TRUE) {
|
||||||
# nolint end
|
# nolint end
|
||||||
if (getOption("debug", FALSE)) {
|
if (getOption("debug", FALSE)) {
|
||||||
@@ -22,6 +33,15 @@ MNR.DB.Applications <- R6::R6Class(
|
|||||||
private$db_client$collectOrReturn()
|
private$db_client$collectOrReturn()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#' @description Fetch applications details from the database without any
|
||||||
|
#' filtering applied
|
||||||
|
#' @param as_permissions <logical> Returns a permissions_query if TRUE else
|
||||||
|
#' the applications if FALSE
|
||||||
|
#' @param collect <logical> Collect the query before returning (TRUE) or
|
||||||
|
#' return the built query object (FALSE)
|
||||||
|
#' @returns A permissions_query object (as_permissions = TRUE,
|
||||||
|
#' collect = FALSE) or query details object (as_permissions = FALSE,
|
||||||
|
#' collect = FALSE) or a collected tibble of application details
|
||||||
getUnfilteredApplications = function(
|
getUnfilteredApplications = function(
|
||||||
as_permissions = FALSE, collect = TRUE
|
as_permissions = FALSE, collect = TRUE
|
||||||
) {
|
) {
|
||||||
@@ -42,6 +62,16 @@ MNR.DB.Applications <- R6::R6Class(
|
|||||||
self$collectFromPermissions(perm_qry, collect)
|
self$collectFromPermissions(perm_qry, collect)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#' @description Fetch application details from the database with filtering
|
||||||
|
#' for administration rights applied (assuming the user has the role)
|
||||||
|
#' @param user_id <integer> The user to check
|
||||||
|
#' @param as_permissions <logical> Returns a permissions_query if TRUE else
|
||||||
|
#' the applications if FALSE
|
||||||
|
#' @param collect <logical> Collect the query before returning (TRUE) or
|
||||||
|
#' return the built query object (FALSE)
|
||||||
|
#' @returns A permissions_query object (as_permissions = TRUE,
|
||||||
|
#' collect = FALSE) or query details object (as_permissions = FALSE,
|
||||||
|
#' collect = FALSE) or a collected tibble of application details
|
||||||
getAdminApplications = function(
|
getAdminApplications = function(
|
||||||
user_id = -1, as_permissions = FALSE, collect = TRUE
|
user_id = -1, as_permissions = FALSE, collect = TRUE
|
||||||
) {
|
) {
|
||||||
@@ -61,6 +91,16 @@ MNR.DB.Applications <- R6::R6Class(
|
|||||||
self$collectFromPermissions(perm_qry, collect)
|
self$collectFromPermissions(perm_qry, collect)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#' @description Fetch application details from the database filtered to
|
||||||
|
#' those that are publicly available (ie. not draft or what-if)
|
||||||
|
#' @param user_id <integer> The user to check
|
||||||
|
#' @param as_permissions <logical> Returns a permissions_query if TRUE else
|
||||||
|
#' the applications if FALSE
|
||||||
|
#' @param collect <logical> Collect the query before returning (TRUE) or
|
||||||
|
#' return the built query object (FALSE)
|
||||||
|
#' @returns A permissions_query object (as_permissions = TRUE,
|
||||||
|
#' collect = FALSE) or query details object (as_permissions = FALSE,
|
||||||
|
#' collect = FALSE) or a collected tibble of application details
|
||||||
getPublicOnlyApplications = function(
|
getPublicOnlyApplications = function(
|
||||||
user_id = -1, as_permissions = FALSE, collect = TRUE
|
user_id = -1, as_permissions = FALSE, collect = TRUE
|
||||||
) {
|
) {
|
||||||
@@ -80,6 +120,17 @@ MNR.DB.Applications <- R6::R6Class(
|
|||||||
self$collectFromPermissions(perm_qry, collect)
|
self$collectFromPermissions(perm_qry, collect)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#' @description Fetch application details from the database filtered to
|
||||||
|
#' those that are related to a user (via submitter, organisation or
|
||||||
|
#' agent/recipient)
|
||||||
|
#' @param user_id <integer> The user to check
|
||||||
|
#' @param as_permissions <logical> Returns a permissions_query if TRUE else
|
||||||
|
#' the applications if FALSE
|
||||||
|
#' @param collect <logical> Collect the query before returning (TRUE) or
|
||||||
|
#' return the built query object (FALSE)
|
||||||
|
#' @returns A permissions_query object (as_permissions = TRUE,
|
||||||
|
#' collect = FALSE) or query details object (as_permissions = FALSE,
|
||||||
|
#' collect = FALSE) or a collected tibble of application details
|
||||||
getRelatedApplications = function(
|
getRelatedApplications = function(
|
||||||
user_id, as_permissions = FALSE, collect = TRUE
|
user_id, as_permissions = FALSE, collect = TRUE
|
||||||
) {
|
) {
|
||||||
@@ -102,6 +153,16 @@ MNR.DB.Applications <- R6::R6Class(
|
|||||||
self$collectFromPermissions(perm_qry, collect)
|
self$collectFromPermissions(perm_qry, collect)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#' @description Fetch application details from the database filtered to
|
||||||
|
#' those that are related to a user's organisation
|
||||||
|
#' @param user_id <integer> The user to check
|
||||||
|
#' @param as_permissions <logical> Returns a permissions_query if TRUE else
|
||||||
|
#' the applications if FALSE
|
||||||
|
#' @param collect <logical> Collect the query before returning (TRUE) or
|
||||||
|
#' return the built query object (FALSE)
|
||||||
|
#' @returns A permissions_query object (as_permissions = TRUE,
|
||||||
|
#' collect = FALSE) or query details object (as_permissions = FALSE,
|
||||||
|
#' collect = FALSE) or a collected tibble of application details
|
||||||
# nolint next: object_length_linter. Descriptive function name
|
# nolint next: object_length_linter. Descriptive function name
|
||||||
getUserOrganisationApplications = function(
|
getUserOrganisationApplications = function(
|
||||||
user_id, as_permissions = FALSE, collect = TRUE
|
user_id, as_permissions = FALSE, collect = TRUE
|
||||||
@@ -123,6 +184,15 @@ MNR.DB.Applications <- R6::R6Class(
|
|||||||
self$collectFromPermissions(perm_qry, collect)
|
self$collectFromPermissions(perm_qry, collect)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#' @description Fetch a list of applications belonging to a user
|
||||||
|
#' @param user_id <integer> The user to check
|
||||||
|
#' @param as_permissions <logical> Returns a permissions_query if TRUE else
|
||||||
|
#' the applications if FALSE
|
||||||
|
#' @param collect <logical> Collect the query before returning (TRUE) or
|
||||||
|
#' return the built query object (FALSE)
|
||||||
|
#' @returns A permissions_query object (as_permissions = TRUE,
|
||||||
|
#' collect = FALSE) or query details object (as_permissions = FALSE,
|
||||||
|
#' collect = FALSE) or a collected tibble of application details
|
||||||
getUserApplications = function(
|
getUserApplications = function(
|
||||||
user_id, as_permissions = FALSE, collect = TRUE
|
user_id, as_permissions = FALSE, collect = TRUE
|
||||||
) {
|
) {
|
||||||
@@ -145,6 +215,11 @@ MNR.DB.Applications <- R6::R6Class(
|
|||||||
self$collectFromPermissions(perm_qry, collect)
|
self$collectFromPermissions(perm_qry, collect)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#' @description Fetches the state of an application from the database
|
||||||
|
#' @param application_id <integer> The id of the application to check
|
||||||
|
#' @param collect <logical> Collect the query before returning (TRUE) or
|
||||||
|
#' return the built query object (FALSE)
|
||||||
|
#' @returns A list containing the state flags of an application
|
||||||
getApplicationState = function(application_id, collect = TRUE) {
|
getApplicationState = function(application_id, collect = TRUE) {
|
||||||
if (length(application_id) == 0) {
|
if (length(application_id) == 0) {
|
||||||
application_id <- -1
|
application_id <- -1
|
||||||
|
|||||||
@@ -1,9 +1,17 @@
|
|||||||
|
#' MNR database queries for Gemoetries
|
||||||
|
#'
|
||||||
#' @export
|
#' @export
|
||||||
# nolint next: object_name_linter. R6Class
|
# nolint next: object_name_linter. R6Class
|
||||||
MNR.DB.Geometries <- R6::R6Class(
|
MNR.DB.Geometries <- R6::R6Class(
|
||||||
"MNR.DB.Geometries",
|
"MNR.DB.Geometries",
|
||||||
inherit = MNR.DB,
|
inherit = MNR.DB,
|
||||||
public = list(
|
public = list(
|
||||||
|
#' @description Fetches the Oil & Gas block information from the database
|
||||||
|
#' @param with_geometries <logical> Also fetch the block geometries
|
||||||
|
#' @param ordered <logical> Sort the blocks (has an overhead)
|
||||||
|
#' @param collect <logical> Collect the query before returning (TRUE) or
|
||||||
|
#' return the built query object (FALSE)
|
||||||
|
#' @returns A query object or a collected sf of the blocks
|
||||||
getBlocks = function(
|
getBlocks = function(
|
||||||
with_geometries = TRUE, ordered = FALSE, collect = TRUE
|
with_geometries = TRUE, ordered = FALSE, collect = TRUE
|
||||||
) {
|
) {
|
||||||
@@ -45,6 +53,11 @@ MNR.DB.Geometries <- R6::R6Class(
|
|||||||
qry
|
qry
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#' @description Retrieves the Conservation Areas from the database
|
||||||
|
#' @param with_geometries <logical> Also fetch the geometries
|
||||||
|
#' @param collect <logical> Collect the query before returning (TRUE) or
|
||||||
|
#' return the built query object (FALSE)
|
||||||
|
#' @returns A query object or a collected sf of the conservation areas
|
||||||
getConservationAreas = function(with_geometries = TRUE, collect = TRUE) {
|
getConservationAreas = function(with_geometries = TRUE, collect = TRUE) {
|
||||||
qry <- private$db_client$table("conservation_areas")
|
qry <- private$db_client$table("conservation_areas")
|
||||||
|
|
||||||
@@ -60,6 +73,11 @@ MNR.DB.Geometries <- R6::R6Class(
|
|||||||
qry
|
qry
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#' @description Retrieves the Marine Regions from the database
|
||||||
|
#' @param with_geometries <logical> Also fetch the geometries
|
||||||
|
#' @param collect <logical> Collect the query before returning (TRUE) or
|
||||||
|
#' return the built query object (FALSE)
|
||||||
|
#' @returns A query object or a collected sf of the marine regions
|
||||||
getMarineRegions = function(with_geometries = TRUE, collect = TRUE) {
|
getMarineRegions = function(with_geometries = TRUE, collect = TRUE) {
|
||||||
qry <- private$db_client$table("marine_regions")
|
qry <- private$db_client$table("marine_regions")
|
||||||
|
|
||||||
@@ -75,11 +93,22 @@ MNR.DB.Geometries <- R6::R6Class(
|
|||||||
qry
|
qry
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#' @description Retrieves the block marine region map table from the
|
||||||
|
#' database
|
||||||
|
#' @param collect <logical> Collect the query before returning (TRUE) or
|
||||||
|
#' return the built query object (FALSE)
|
||||||
|
#' @returns A query object or collected query of the block marine regions
|
||||||
getBlockMarineRegions = function(collect = TRUE) {
|
getBlockMarineRegions = function(collect = TRUE) {
|
||||||
qry <- private$db_client$table("block_marine_regions")
|
qry <- private$db_client$table("block_marine_regions")
|
||||||
private$db_client$collectOrReturn(qry)
|
private$db_client$collectOrReturn(qry)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#' @description Retrieves the block conservation areas map table from the
|
||||||
|
#' database
|
||||||
|
#' @param collect <logical> Collect the query before returning (TRUE) or
|
||||||
|
#' return the built query object (FALSE)
|
||||||
|
#' @returns A query object or collected query of the block conservation
|
||||||
|
#' areas
|
||||||
# nolint next: object_length_linter. Descriptive function name required
|
# nolint next: object_length_linter. Descriptive function name required
|
||||||
getBlockConservationAreaDistances = function(collect = TRUE) {
|
getBlockConservationAreaDistances = function(collect = TRUE) {
|
||||||
qry <- private$db_client$table("block_conservation_area_distances")
|
qry <- private$db_client$table("block_conservation_area_distances")
|
||||||
|
|||||||
@@ -1,9 +1,17 @@
|
|||||||
|
#' MNR database queries for Organsiations
|
||||||
|
#'
|
||||||
#' @export
|
#' @export
|
||||||
# nolint next: object_name_linter. R6Class
|
# nolint next: object_name_linter. R6Class
|
||||||
MNR.DB.Organisations <- R6::R6Class(
|
MNR.DB.Organisations <- R6::R6Class(
|
||||||
"MNR.DB.Organisations",
|
"MNR.DB.Organisations",
|
||||||
inherit = MNR.DB,
|
inherit = MNR.DB,
|
||||||
public = list(
|
public = list(
|
||||||
|
#' @description Fetch the details of an organisation from the database
|
||||||
|
#' @param org_id <integer> The id of the organisation to fetch
|
||||||
|
#' @param collect <logical> Collect the query before returning (TRUE) or
|
||||||
|
#' return the built query object (FALSE)
|
||||||
|
#' @returns A query object for an organsation (collect = FALSE) or a
|
||||||
|
#' tibble with the organisation details
|
||||||
getOrganisation = function(org_id, collect = TRUE) {
|
getOrganisation = function(org_id, collect = TRUE) {
|
||||||
private$db_client$table("organisations") %>%
|
private$db_client$table("organisations") %>%
|
||||||
dplyr::filter(flag_approved == TRUE) %>%
|
dplyr::filter(flag_approved == TRUE) %>%
|
||||||
@@ -11,6 +19,14 @@ MNR.DB.Organisations <- R6::R6Class(
|
|||||||
private$db_client$collectOrReturn()
|
private$db_client$collectOrReturn()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#' @description Fetch the details of all organisations from the database
|
||||||
|
#' @param as_int <logical> Return only the ids (TRUE)
|
||||||
|
#' @param name_only <logical> Return only the name (TRUE)
|
||||||
|
#' @param collect <logical> Collect the query before returning (TRUE) or
|
||||||
|
#' return the built query object (FALSE)
|
||||||
|
#' @returns The organisation ids if as_int is TRUE, the organisation names
|
||||||
|
#' if as_int is FALSE and name_only is TRUE, else the organisations or an
|
||||||
|
#' uncollected query object
|
||||||
getAllOrganisations = function(
|
getAllOrganisations = function(
|
||||||
as_int = FALSE, name_only = TRUE, collect = TRUE
|
as_int = FALSE, name_only = TRUE, collect = TRUE
|
||||||
) {
|
) {
|
||||||
@@ -29,6 +45,9 @@ MNR.DB.Organisations <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#' @description Check if an organisation is a regulator
|
||||||
|
#' @param org_id <integer> The id of the organisation to check
|
||||||
|
#' @returns TRUE if the organisation is a regulator
|
||||||
isRegulator = function(org_id) {
|
isRegulator = function(org_id) {
|
||||||
private$db_client$table("organisations") %>%
|
private$db_client$table("organisations") %>%
|
||||||
dplyr::filter(flag_approved == TRUE) %>%
|
dplyr::filter(flag_approved == TRUE) %>%
|
||||||
@@ -39,6 +58,14 @@ MNR.DB.Organisations <- R6::R6Class(
|
|||||||
magrittr::is_greater_than(0)
|
magrittr::is_greater_than(0)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#' @description Fetch the details of all the regulators from the database
|
||||||
|
#' @param as_int <logical> Return only the ids (TRUE)
|
||||||
|
#' @param name_only <logical> Return only the name (TRUE)
|
||||||
|
#' @param collect <logical> Collect the query before returning (TRUE) or
|
||||||
|
#' return the built query object (FALSE)
|
||||||
|
#' @returns The regulator ids if as_int is TRUE, the regulator names if
|
||||||
|
#' as_int is FALSE and name_only is TRUE, else the regulator or an
|
||||||
|
#' uncollected query object
|
||||||
getRegulators = function(as_int = FALSE, name_only = TRUE, collect = TRUE) {
|
getRegulators = function(as_int = FALSE, name_only = TRUE, collect = TRUE) {
|
||||||
qry <- private$db_client$table("organisations") %>%
|
qry <- private$db_client$table("organisations") %>%
|
||||||
dplyr::filter(flag_approved == TRUE) %>%
|
dplyr::filter(flag_approved == TRUE) %>%
|
||||||
@@ -56,6 +83,12 @@ MNR.DB.Organisations <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#' @description Fetch the members of an organisation
|
||||||
|
#' @param org_name <character> The name of the organisation to check
|
||||||
|
#' @param org_id <integer> The id of the organisation to check
|
||||||
|
#' @param collect <logical> Collect the query before returning (TRUE) or
|
||||||
|
#' return the built query object (FALSE)
|
||||||
|
#' @returns A tibble of the organisation members or an uncollected query
|
||||||
getOrganisationMembers = function(
|
getOrganisationMembers = function(
|
||||||
org_name = "", org_id = -1, collect = TRUE
|
org_name = "", org_id = -1, collect = TRUE
|
||||||
) {
|
) {
|
||||||
@@ -80,45 +113,25 @@ MNR.DB.Organisations <- R6::R6Class(
|
|||||||
private$db_client$collectOrReturn()
|
private$db_client$collectOrReturn()
|
||||||
},
|
},
|
||||||
|
|
||||||
#' @depricated
|
#' @description Check if user's organisation is an agent for another
|
||||||
getUsersFromOrg = function(org_name = "", org_id = -1, collect = TRUE) {
|
#' organisation
|
||||||
.Deprecated(new = "getOrganisationMembers")
|
#' @param org_id <integer> The id of the organisation to check
|
||||||
|
#' @returns TRUE if the user's organisation is an agent
|
||||||
private$db_client$table("users") %>%
|
isAgent = function(org_id) {
|
||||||
dplyr::filter(flag_enabled == TRUE) %>%
|
|
||||||
dplyr::filter(flag_verified == TRUE) %>%
|
|
||||||
dplyr::mutate(known_as = paste(first_name, last_name)) %>%
|
|
||||||
dplyr::left_join(
|
|
||||||
private$db_client$table("organisation_members") %>%
|
|
||||||
dplyr::filter(flag_approved == TRUE) %>%
|
|
||||||
dplyr::select(user_id, organisation_id),
|
|
||||||
by = c(id = "user_id")
|
|
||||||
) %>%
|
|
||||||
dplyr::inner_join(
|
|
||||||
private$db_client$table("organisations") %>%
|
|
||||||
dplyr::filter(flag_approved == TRUE) %>%
|
|
||||||
dplyr::filter((id == !!org_id) | (name == !!org_name)) %>%
|
|
||||||
dplyr::select(id),
|
|
||||||
by = c(organisation_id = "id")
|
|
||||||
) %>%
|
|
||||||
dplyr::select(-organisation_id) %>%
|
|
||||||
private$db_client$collectOrReturn()
|
|
||||||
},
|
|
||||||
|
|
||||||
isAgent = function(user_id) {
|
|
||||||
private$db_client$table("organisation_members") %>%
|
|
||||||
dplyr::filter(flag_approved == TRUE) %>%
|
|
||||||
dplyr::filter(user_id == !!user_id) %>%
|
|
||||||
dplyr::inner_join(
|
|
||||||
private$db_client$table("organisation_agents") %>%
|
private$db_client$table("organisation_agents") %>%
|
||||||
dplyr::filter(flag_approved == TRUE),
|
dplyr::filter(flag_approved == TRUE) %>%
|
||||||
by = c(organisation_id = "agent_id")
|
dplyr::filter(agent_id == !!org_id) %>%
|
||||||
) %>%
|
|
||||||
dplyr::count() %>%
|
dplyr::count() %>%
|
||||||
dplyr::pull() %>%
|
dplyr::pull() %>%
|
||||||
magrittr::is_greater_than(0)
|
magrittr::is_greater_than(0)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#' @description Fetch the agents of an organisation
|
||||||
|
#' @param org_id <integer> The id of the organisation to check
|
||||||
|
#' @param as_int <logical> Return only the id (TRUE)
|
||||||
|
#' @param collect <logical> Collect the query before returning (TRUE) or
|
||||||
|
#' return the built query object (FALSE)
|
||||||
|
#' @returns An uncollected query object or a tibble of agents
|
||||||
getOrganisationAgents = function(org_id, as_int = FALSE, collect = TRUE) {
|
getOrganisationAgents = function(org_id, as_int = FALSE, collect = TRUE) {
|
||||||
qry <- private$db_client$table("organisation_agents") %>%
|
qry <- private$db_client$table("organisation_agents") %>%
|
||||||
dplyr::filter(flag_approved == TRUE) %>%
|
dplyr::filter(flag_approved == TRUE) %>%
|
||||||
@@ -140,6 +153,12 @@ MNR.DB.Organisations <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#' @description Fetch the recipients of an organisation
|
||||||
|
#' @param agent_id <integer> The id of the organisation (agent) to check
|
||||||
|
#' @param as_int <logical> Return only the id (TRUE)
|
||||||
|
#' @param collect <logical> Collect the query before returning (TRUE) or
|
||||||
|
#' return the built query object (FALSE)
|
||||||
|
#' @returns An uncollected query object or a tibble of recipients
|
||||||
getAgentRecipients = function(agent_id, as_int = FALSE, collect = TRUE) {
|
getAgentRecipients = function(agent_id, as_int = FALSE, collect = TRUE) {
|
||||||
qry <- private$db_client$table("organisation_agents") %>%
|
qry <- private$db_client$table("organisation_agents") %>%
|
||||||
dplyr::filter(flag_approved == TRUE) %>%
|
dplyr::filter(flag_approved == TRUE) %>%
|
||||||
@@ -161,94 +180,15 @@ MNR.DB.Organisations <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
#' @depricated
|
#' @description Fetch the organisation of a user
|
||||||
getAgentForOrganisations = function(
|
#' @param user_id <integer> The id of the user to fetch the organisation of
|
||||||
org_ids, as_int = FALSE, name_only = TRUE, collect = TRUE
|
#' @param as_int <logical> Return only the id (TRUE)
|
||||||
) {
|
#' @param name_only <logical> Return only the name (TRUE)
|
||||||
.Deprecated(new = "getOrganisationAgents")
|
#' @param collect <logical> Collect the query before returning (TRUE) or
|
||||||
|
#' return the built query object (FALSE)
|
||||||
qry <- private$db_client$table("organisations") %>%
|
#' @returns The organisation id if as_int is TRUE, the organisation name if
|
||||||
dplyr::filter(flag_approved == TRUE) %>%
|
#' as_int is FALSE and name_only is TRUE, else the organisation or an
|
||||||
dplyr::inner_join(
|
#' uncollected query object
|
||||||
private$db_client$table("organisation_agents") %>%
|
|
||||||
dplyr::filter(flag_approved == TRUE) %>%
|
|
||||||
dplyr::filter(organisation_id %in% !!org_ids) %>%
|
|
||||||
dplyr::select(agent_id) %>%
|
|
||||||
dplyr::collapse(),
|
|
||||||
by = c(id = "agent_id")
|
|
||||||
) %>%
|
|
||||||
dplyr::distinct()
|
|
||||||
|
|
||||||
if (as_int) {
|
|
||||||
qry %>%
|
|
||||||
dplyr::pull(id)
|
|
||||||
} else if (name_only) {
|
|
||||||
qry %>%
|
|
||||||
dplyr::pull(name)
|
|
||||||
} else {
|
|
||||||
qry %>%
|
|
||||||
private$db_client$collectOrReturn()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
#' @depricated
|
|
||||||
getRecipientOrganisations = function(
|
|
||||||
org_id, as_int = FALSE, name_only = TRUE, collect = TRUE
|
|
||||||
) {
|
|
||||||
.Deprecated(new = "getAgentRecipients")
|
|
||||||
|
|
||||||
qry <- private$db_client$table("organisations") %>%
|
|
||||||
dplyr::filter(flag_approved == TRUE) %>%
|
|
||||||
dplyr::inner_join(
|
|
||||||
private$db_client$table("organisation_agents") %>%
|
|
||||||
dplyr::filter(flag_approved == TRUE) %>%
|
|
||||||
dplyr::filter(agent_id %in% !!org_id) %>%
|
|
||||||
dplyr::select(organisation_id) %>%
|
|
||||||
dplyr::collapse(),
|
|
||||||
by = c(id = "organisation_id")
|
|
||||||
) %>%
|
|
||||||
dplyr::distinct()
|
|
||||||
|
|
||||||
if (as_int) {
|
|
||||||
qry %>%
|
|
||||||
dplyr::pull(id)
|
|
||||||
} else if (name_only) {
|
|
||||||
qry %>%
|
|
||||||
dplyr::pull(name)
|
|
||||||
} else {
|
|
||||||
qry %>%
|
|
||||||
private$db_client$collectOrReturn()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
#' @depricated
|
|
||||||
getUserOrgs = function(
|
|
||||||
user_id, as_int = TRUE, name_only = TRUE, collect = TRUE
|
|
||||||
) {
|
|
||||||
.Deprecated(new = "getUserOrganisation")
|
|
||||||
|
|
||||||
qry <- private$db_client$table("organisations") %>%
|
|
||||||
dplyr::filter(flag_approved == TRUE) %>%
|
|
||||||
dplyr::left_join(
|
|
||||||
private$db_client$table("organisation_members") %>%
|
|
||||||
dplyr::filter(flag_approved == TRUE) %>%
|
|
||||||
dplyr::select(user_id, organisation_id),
|
|
||||||
by = c(id = "organisation_id")
|
|
||||||
) %>%
|
|
||||||
dplyr::filter(user_id == !!user_id)
|
|
||||||
|
|
||||||
if (as_int) {
|
|
||||||
qry %>%
|
|
||||||
dplyr::pull(id)
|
|
||||||
} else if (name_only) {
|
|
||||||
qry %>%
|
|
||||||
dplyr::pull(name)
|
|
||||||
} else {
|
|
||||||
qry %>%
|
|
||||||
private$db_client$collectOrReturn()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
getUserOrganisation = function(
|
getUserOrganisation = function(
|
||||||
user_id, as_int = TRUE, name_only = TRUE, collect = TRUE
|
user_id, as_int = TRUE, name_only = TRUE, collect = TRUE
|
||||||
) {
|
) {
|
||||||
|
|||||||
26
R/db_users.R
26
R/db_users.R
@@ -1,9 +1,17 @@
|
|||||||
|
#' MNR database queries for Users
|
||||||
|
#'
|
||||||
#' @export
|
#' @export
|
||||||
# nolint next: object_name_linter. R6Class
|
# nolint next: object_name_linter. R6Class
|
||||||
MNR.DB.Users <- R6::R6Class(
|
MNR.DB.Users <- R6::R6Class(
|
||||||
"MNR.DB.Users",
|
"MNR.DB.Users",
|
||||||
inherit = MNR.DB,
|
inherit = MNR.DB,
|
||||||
public = list(
|
public = list(
|
||||||
|
#' @description Initialises the instance with a database client from
|
||||||
|
#' \link[AVSDevR.DBClient]{DBClient}
|
||||||
|
#' @param db_client <\link[AVSDevR.DBClient]{DBClient}> A DBClient instance
|
||||||
|
#' @param admin_role_slug <character> The slug of the application
|
||||||
|
#' administrator role within UserFrosting
|
||||||
|
#' (Defaults to: "application-admin")
|
||||||
initialize = function(db_client, admin_role_slug = NULL) {
|
initialize = function(db_client, admin_role_slug = NULL) {
|
||||||
super$initialize(db_client)
|
super$initialize(db_client)
|
||||||
private$db_uf <- AVSDevR.UserFrosting::UFDatabase$new(db_client)
|
private$db_uf <- AVSDevR.UserFrosting::UFDatabase$new(db_client)
|
||||||
@@ -13,16 +21,34 @@ MNR.DB.Users <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#' @description Get user information from the database
|
||||||
|
#' @param user_id <integer> The user id to fetch
|
||||||
|
#' @param collect <logical> Collect the query before returning (TRUE) or
|
||||||
|
#' return the built query object (FALSE)
|
||||||
|
#' @returns <list> Details of the user denoted by user_id
|
||||||
getUser = function(user_id, collect = TRUE) {
|
getUser = function(user_id, collect = TRUE) {
|
||||||
private$db_uf$getUser(user_id, collect)
|
private$db_uf$getUser(user_id, collect)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#' @description Get user name from the database
|
||||||
|
#' @param user_id <integer> The user id to fetch
|
||||||
|
#' @returns <character> The user's name
|
||||||
getUserName = function(user_id) {
|
getUserName = function(user_id) {
|
||||||
private$db_uf$getUserName(user_id)
|
private$db_uf$getUserName(user_id)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#' @description Get user roles from the database
|
||||||
|
#' @param user_id <integer> The user id to fetch
|
||||||
|
#' @param collect <logical> Collect the query before returning (TRUE) or
|
||||||
|
#' return the built query object (FALSE)
|
||||||
|
#' @returns <character> A list of user roles
|
||||||
getUserRoles = function(user_id, collect = TRUE) {
|
getUserRoles = function(user_id, collect = TRUE) {
|
||||||
private$db_uf$getUserRoles(user_id, collect)
|
private$db_uf$getUserRoles(user_id, collect)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#' @description Check if a user is an application administrator
|
||||||
|
#' @param user_id <integer> The user id to fetch
|
||||||
|
#' @returns <logical> TRUE if the user is an administrator
|
||||||
isApplicationsAdmin = function(user_id) {
|
isApplicationsAdmin = function(user_id) {
|
||||||
self$getUserRoles(user_id, collect = FALSE) %>%
|
self$getUserRoles(user_id, collect = FALSE) %>%
|
||||||
dplyr::filter(slug == !!private$admin_role_slug) %>%
|
dplyr::filter(slug == !!private$admin_role_slug) %>%
|
||||||
|
|||||||
125
R/geoPlot.R
125
R/geoPlot.R
@@ -1,14 +1,32 @@
|
|||||||
|
mnr_geoplot_env <- new.env()
|
||||||
|
|
||||||
|
#' MNR GIS plot base map generator
|
||||||
|
#'
|
||||||
|
#' Base layers are loaded and cached on first call to each of the boot methods.
|
||||||
|
#'
|
||||||
#' @export
|
#' @export
|
||||||
# nolint next: object_name_linter. R6Class
|
# nolint next: object_name_linter. R6Class
|
||||||
MNR.GeoPlot <- R6::R6Class(
|
MNR.GeoPlot <- R6::R6Class(
|
||||||
"MNR.GeoPlot",
|
"MNR.GeoPlot",
|
||||||
public = list(
|
public = list(
|
||||||
|
#' @description Initialises the object by building the grid lines
|
||||||
initialize = function() {
|
initialize = function() {
|
||||||
private$bootGridLines()
|
private$bootGridLines()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#' @description Loads the JNCC layers required from file for the base map
|
||||||
bootLayers = function() {
|
bootLayers = function() {
|
||||||
private$boundaryIoM <- sf::st_read(
|
if (exists("layers_loaded", envir = mnr_geoplot_env)) {
|
||||||
|
private$boundaryIoM <- get("boundaryIoM", envir = mnr_geoplot_env)
|
||||||
|
private$boundaryMSFD <- get("boundaryMSFD", envir = mnr_geoplot_env)
|
||||||
|
private$boundaryUKCS <- get("boundaryUKCS", envir = mnr_geoplot_env)
|
||||||
|
private$boundaryUKTerritorial <- get(
|
||||||
|
"boundaryUKTerritorial", envir = mnr_geoplot_env
|
||||||
|
)
|
||||||
|
return(invisible(NULL))
|
||||||
|
}
|
||||||
|
|
||||||
|
boundaryIoM <- sf::st_read(
|
||||||
file.path(
|
file.path(
|
||||||
system.file(package = "AVSDevR.MarineNoiseRegistry"),
|
system.file(package = "AVSDevR.MarineNoiseRegistry"),
|
||||||
"layers",
|
"layers",
|
||||||
@@ -16,7 +34,7 @@ MNR.GeoPlot <- R6::R6Class(
|
|||||||
),
|
),
|
||||||
quiet = TRUE
|
quiet = TRUE
|
||||||
)
|
)
|
||||||
private$boundaryMSFD <- sf::st_read(
|
boundaryMSFD <- sf::st_read(
|
||||||
file.path(
|
file.path(
|
||||||
system.file(package = "AVSDevR.MarineNoiseRegistry"),
|
system.file(package = "AVSDevR.MarineNoiseRegistry"),
|
||||||
"layers",
|
"layers",
|
||||||
@@ -24,7 +42,7 @@ MNR.GeoPlot <- R6::R6Class(
|
|||||||
),
|
),
|
||||||
quiet = TRUE
|
quiet = TRUE
|
||||||
)
|
)
|
||||||
private$boundaryUKCS <- sf::st_read(
|
boundaryUKCS <- sf::st_read(
|
||||||
file.path(
|
file.path(
|
||||||
system.file(package = "AVSDevR.MarineNoiseRegistry"),
|
system.file(package = "AVSDevR.MarineNoiseRegistry"),
|
||||||
"layers",
|
"layers",
|
||||||
@@ -32,7 +50,7 @@ MNR.GeoPlot <- R6::R6Class(
|
|||||||
),
|
),
|
||||||
quiet = TRUE
|
quiet = TRUE
|
||||||
)
|
)
|
||||||
private$boundaryUKTerritorial <- sf::st_read(
|
boundaryUKTerritorial <- sf::st_read(
|
||||||
file.path(
|
file.path(
|
||||||
system.file(package = "AVSDevR.MarineNoiseRegistry"),
|
system.file(package = "AVSDevR.MarineNoiseRegistry"),
|
||||||
"layers",
|
"layers",
|
||||||
@@ -40,15 +58,34 @@ MNR.GeoPlot <- R6::R6Class(
|
|||||||
),
|
),
|
||||||
quiet = TRUE
|
quiet = TRUE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
assign("boundaryIoM", boundaryIoM, envir = mnr_geoplot_env)
|
||||||
|
assign("boundaryMSFD", boundaryMSFD, envir = mnr_geoplot_env)
|
||||||
|
assign("boundaryUKCS", boundaryUKCS, envir = mnr_geoplot_env)
|
||||||
|
assign(
|
||||||
|
"boundaryUKTerritorial", boundaryUKTerritorial, envir = mnr_geoplot_env
|
||||||
|
)
|
||||||
|
assign("layers_loaded", TRUE, envir = mnr_geoplot_env)
|
||||||
|
|
||||||
|
invisible(self$bootLayers())
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#' @description Loads the Oil & Gas quadrants from file for the base map
|
||||||
bootQuadrants = function() {
|
bootQuadrants = function() {
|
||||||
|
if (exists("quadrants_loaded", envir = mnr_geoplot_env)) {
|
||||||
|
private$quadrants <- get("quadrants", envir = mnr_geoplot_env)
|
||||||
|
private$quadrant_annotations <- get(
|
||||||
|
"quadrant_annotations", envir = mnr_geoplot_env
|
||||||
|
)
|
||||||
|
return(invisible(NULL))
|
||||||
|
}
|
||||||
|
|
||||||
old_opts <- options(sf_use_s2 = FALSE)
|
old_opts <- options(sf_use_s2 = FALSE)
|
||||||
on.exit({
|
on.exit({
|
||||||
options(old_opts)
|
options(old_opts)
|
||||||
})
|
})
|
||||||
|
|
||||||
private$quadrants <- sf::st_read(
|
quadrants <- sf::st_read(
|
||||||
file.path(
|
file.path(
|
||||||
system.file(package = "AVSDevR.MarineNoiseRegistry"),
|
system.file(package = "AVSDevR.MarineNoiseRegistry"),
|
||||||
"layers",
|
"layers",
|
||||||
@@ -56,26 +93,47 @@ MNR.GeoPlot <- R6::R6Class(
|
|||||||
),
|
),
|
||||||
quiet = TRUE
|
quiet = TRUE
|
||||||
)
|
)
|
||||||
private$quadrant_annotations <- suppressWarnings({
|
quadrant_annotations <- suppressWarnings({
|
||||||
private$quadrants %>%
|
quadrants %>%
|
||||||
dplyr::select(quadrnt) %>%
|
dplyr::select(quadrnt) %>%
|
||||||
sf::st_centroid()
|
sf::st_centroid()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
assign("quadrants", quadrants, envir = mnr_geoplot_env)
|
||||||
|
assign(
|
||||||
|
"quadrant_annotations", quadrant_annotations, envir = mnr_geoplot_env
|
||||||
|
)
|
||||||
|
assign("quadrants_loaded", TRUE, envir = mnr_geoplot_env)
|
||||||
|
|
||||||
|
invisible(self$bootQuadrants())
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#' @description Loads the Conservation Areas from the database for the base
|
||||||
|
#' map.
|
||||||
|
#' @param db_client <\link[AVSDevR.DBClient]{DBClient}> A DBClient instance
|
||||||
bootConservationAreas = function(db_client) {
|
bootConservationAreas = function(db_client) {
|
||||||
|
if (exists("conservation_areas_loaded", envir = mnr_geoplot_env)) {
|
||||||
|
private$conservation_areas <- get(
|
||||||
|
"conservation_areas", envir = mnr_geoplot_env
|
||||||
|
)
|
||||||
|
private$conservation_area_colours <- get(
|
||||||
|
"conservation_area_colours", envir = mnr_geoplot_env
|
||||||
|
)
|
||||||
|
return(invisible(NULL))
|
||||||
|
}
|
||||||
|
|
||||||
old_opts <- options(sf_use_s2 = FALSE)
|
old_opts <- options(sf_use_s2 = FALSE)
|
||||||
on.exit({
|
on.exit({
|
||||||
options(old_opts)
|
options(old_opts)
|
||||||
})
|
})
|
||||||
|
|
||||||
private$conservation_areas <- db_client$table("conservation_areas") %>%
|
conservation_areas <- db_client$table("conservation_areas") %>%
|
||||||
dplyr::select(name, season, geom) %>%
|
dplyr::select(name, season, geom) %>%
|
||||||
db_client$collectGeometries() %>%
|
db_client$collectGeometries() %>%
|
||||||
sf::st_sf() %>%
|
sf::st_sf() %>%
|
||||||
sf::st_cast("MULTIPOLYGON")
|
sf::st_cast("MULTIPOLYGON")
|
||||||
|
|
||||||
colour_palette <- private$conservation_areas %>%
|
colour_palette <- conservation_areas %>%
|
||||||
dplyr::mutate(
|
dplyr::mutate(
|
||||||
colour = sapply(season, function(s) {
|
colour = sapply(season, function(s) {
|
||||||
switch(
|
switch(
|
||||||
@@ -88,13 +146,31 @@ MNR.GeoPlot <- R6::R6Class(
|
|||||||
) %>%
|
) %>%
|
||||||
dplyr::pull(colour)
|
dplyr::pull(colour)
|
||||||
|
|
||||||
private$conservation_area_colours <- private$conservation_areas %>%
|
conservation_area_colours <- conservation_areas %>%
|
||||||
sf::st_coordinates() %>%
|
sf::st_coordinates() %>%
|
||||||
tibble::as_tibble() %>%
|
tibble::as_tibble() %>%
|
||||||
dplyr::mutate(colour = colour_palette[L3]) %>%
|
dplyr::mutate(colour = colour_palette[L3]) %>%
|
||||||
dplyr::pull(colour)
|
dplyr::pull(colour)
|
||||||
|
|
||||||
|
assign("conservation_areas", conservation_areas, envir = mnr_geoplot_env)
|
||||||
|
assign(
|
||||||
|
"conservation_area_colours", conservation_area_colours,
|
||||||
|
envir = mnr_geoplot_env
|
||||||
|
)
|
||||||
|
assign("conservation_areas", TRUE, envir = mnr_geoplot_env)
|
||||||
|
|
||||||
|
invisible(self$bootConservationAreas())
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#' @description Generates a base plotly map with optional layers included
|
||||||
|
#' @param ... Options to call plotly::plot_ly with
|
||||||
|
#' @param with_jncc_layers <logical> Includes the JNCC base layers if TRUE
|
||||||
|
#' (call obj$bootLayers() first)
|
||||||
|
#' @param with_quadrants <logical> Includes the Oil & Gas Quadrants if TRUE
|
||||||
|
#' (call obj$bootQuadrants() first)
|
||||||
|
#' @param with_conservation_areas <logical> Includes the Conservation Areas
|
||||||
|
#' if TRUE (call obj$bootConservationAreas() first)
|
||||||
|
#' @returns A plolty object base map
|
||||||
makeBasePlot = function(
|
makeBasePlot = function(
|
||||||
..., with_jncc_layers = TRUE, with_quadrants = FALSE,
|
..., with_jncc_layers = TRUE, with_quadrants = FALSE,
|
||||||
with_conservation_areas = FALSE
|
with_conservation_areas = FALSE
|
||||||
@@ -151,6 +227,16 @@ MNR.GeoPlot <- R6::R6Class(
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#' @description Bounds a mapbox map to a specific area and zoom
|
||||||
|
#' @param p A plotly mapbox map object
|
||||||
|
#' @param c_lat <numeric> Center latitude
|
||||||
|
#' @param c_lon <numeric> Center longitude
|
||||||
|
#' @param zoom <numeric> A mapbox zoom level
|
||||||
|
#' @param xmin <numeric> Minimum longitude to bound with
|
||||||
|
#' @param ymin <numeric> Minimum latitude to bound with
|
||||||
|
#' @param xmax <numeric> Maximum longitude to bound with
|
||||||
|
#' @param ymax <numeric> Maximum latitude to bound with
|
||||||
|
#' @returns The plotly object
|
||||||
boundMap = function(
|
boundMap = function(
|
||||||
p, c_lat = 56, c_lon = -5.5, zoom = 3.5, xmin = -25, ymin = 45, xmax = 5,
|
p, c_lat = 56, c_lon = -5.5, zoom = 3.5, xmin = -25, ymin = 45, xmax = 5,
|
||||||
ymax = 65
|
ymax = 65
|
||||||
@@ -186,6 +272,13 @@ MNR.GeoPlot <- R6::R6Class(
|
|||||||
|
|
||||||
|
|
||||||
bootGridLines = function() {
|
bootGridLines = function() {
|
||||||
|
if (exists("gridlines_loaded", envir = mnr_geoplot_env)) {
|
||||||
|
private$major_lines <- get("major_lines", envir = mnr_geoplot_env)
|
||||||
|
private$minor_lines <- get("minor_lines", envir = mnr_geoplot_env)
|
||||||
|
private$zero_lines <- get("zero_lines", envir = mnr_geoplot_env)
|
||||||
|
return(invisible(NULL))
|
||||||
|
}
|
||||||
|
|
||||||
old_opts <- options(sf_use_s2 = FALSE)
|
old_opts <- options(sf_use_s2 = FALSE)
|
||||||
on.exit({
|
on.exit({
|
||||||
options(old_opts)
|
options(old_opts)
|
||||||
@@ -215,25 +308,31 @@ MNR.GeoPlot <- R6::R6Class(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
suppressMessages({
|
suppressMessages({
|
||||||
private$major_lines <- points %>%
|
major_lines <- points %>%
|
||||||
dplyr::filter(is_major) %>%
|
dplyr::filter(is_major) %>%
|
||||||
sf::st_as_sf(coords = c("lon", "lat"), crs = 4326) %>%
|
sf::st_as_sf(coords = c("lon", "lat"), crs = 4326) %>%
|
||||||
dplyr::group_by(grp) %>%
|
dplyr::group_by(grp) %>%
|
||||||
dplyr::summarise() %>%
|
dplyr::summarise() %>%
|
||||||
sf::st_cast("LINESTRING")
|
sf::st_cast("LINESTRING")
|
||||||
private$minor_lines <- points %>%
|
minor_lines <- points %>%
|
||||||
dplyr::filter(!is_major) %>%
|
dplyr::filter(!is_major) %>%
|
||||||
sf::st_as_sf(coords = c("lon", "lat"), crs = 4326) %>%
|
sf::st_as_sf(coords = c("lon", "lat"), crs = 4326) %>%
|
||||||
dplyr::group_by(grp) %>%
|
dplyr::group_by(grp) %>%
|
||||||
dplyr::summarise() %>%
|
dplyr::summarise() %>%
|
||||||
sf::st_cast("LINESTRING")
|
sf::st_cast("LINESTRING")
|
||||||
private$zero_lines <- points %>%
|
zero_lines <- points %>%
|
||||||
dplyr::filter((lat == 0) | (lon == 0)) %>%
|
dplyr::filter((lat == 0) | (lon == 0)) %>%
|
||||||
sf::st_as_sf(coords = c("lon", "lat"), crs = 4326) %>%
|
sf::st_as_sf(coords = c("lon", "lat"), crs = 4326) %>%
|
||||||
dplyr::group_by(grp) %>%
|
dplyr::group_by(grp) %>%
|
||||||
dplyr::summarise() %>%
|
dplyr::summarise() %>%
|
||||||
sf::st_cast("LINESTRING")
|
sf::st_cast("LINESTRING")
|
||||||
|
assign("major_lines", major_lines, envir = mnr_geoplot_env)
|
||||||
|
assign("minor_lines", minor_lines, envir = mnr_geoplot_env)
|
||||||
|
assign("zero_lines", zero_lines, envir = mnr_geoplot_env)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
assign("gridlines_loaded", TRUE, envir = mnr_geoplot_env)
|
||||||
|
private$bootGridLines()
|
||||||
},
|
},
|
||||||
|
|
||||||
addGridLines = function(p) {
|
addGridLines = function(p) {
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#' Attaches the MNR stylesheets and scripts to the UI
|
||||||
|
#'
|
||||||
#' @export
|
#' @export
|
||||||
use_mnr_ui <- function() {
|
use_mnr_ui <- function() {
|
||||||
attachResourcePaths()
|
attachResourcePaths()
|
||||||
@@ -21,11 +23,16 @@ use_mnr_ui <- function() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#' Provides the resource path for MNR specific files
|
||||||
|
#'
|
||||||
#' @export
|
#' @export
|
||||||
resourcePrefix <- function() {
|
resourcePrefix <- function() {
|
||||||
paste0("avsdev_mnr_", utils::packageVersion("AVSDevR.MarineNoiseRegistry"))
|
paste0("avsdev_mnr_", utils::packageVersion("AVSDevR.MarineNoiseRegistry"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#' Attaches the MNR resource path to Shiny if not already attached
|
||||||
|
#'
|
||||||
|
#' @export
|
||||||
attachResourcePaths <- function() {
|
attachResourcePaths <- function() {
|
||||||
if (!(resourcePrefix() %in% names(shiny::resourcePaths()))) {
|
if (!(resourcePrefix() %in% names(shiny::resourcePaths()))) {
|
||||||
shiny::addResourcePath(
|
shiny::addResourcePath(
|
||||||
@@ -33,4 +40,5 @@ attachResourcePaths <- function() {
|
|||||||
system.file("www", package = "AVSDevR.MarineNoiseRegistry")
|
system.file("www", package = "AVSDevR.MarineNoiseRegistry")
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
invisible(NULL)
|
||||||
}
|
}
|
||||||
|
|||||||
123
man/MNR.DB.Actuals.Rd
Normal file
123
man/MNR.DB.Actuals.Rd
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
% Generated by roxygen2: do not edit by hand
|
||||||
|
% Please edit documentation in R/db_actuals.R
|
||||||
|
\name{MNR.DB.Actuals}
|
||||||
|
\alias{MNR.DB.Actuals}
|
||||||
|
\title{MNR database queries for Actuals}
|
||||||
|
\value{
|
||||||
|
A tibble of Actuals for \code{refs}
|
||||||
|
|
||||||
|
A tibble of the proposed actuals
|
||||||
|
}
|
||||||
|
\description{
|
||||||
|
MNR database queries for Actuals
|
||||||
|
|
||||||
|
MNR database queries for Actuals
|
||||||
|
}
|
||||||
|
\section{Super class}{
|
||||||
|
\code{\link[AVSDevR.MarineNoiseRegistry:MNR.DB]{AVSDevR.MarineNoiseRegistry::MNR.DB}} -> \code{MNR.DB.Actuals}
|
||||||
|
}
|
||||||
|
\section{Methods}{
|
||||||
|
\subsection{Public methods}{
|
||||||
|
\itemize{
|
||||||
|
\item \href{#method-MNR.DB.Actuals-selectActuals}{\code{MNR.DB.Actuals$selectActuals()}}
|
||||||
|
\item \href{#method-MNR.DB.Actuals-selectProposedActuals}{\code{MNR.DB.Actuals$selectProposedActuals()}}
|
||||||
|
\item \href{#method-MNR.DB.Actuals-upsertActuals}{\code{MNR.DB.Actuals$upsertActuals()}}
|
||||||
|
\item \href{#method-MNR.DB.Actuals-deleteActuals}{\code{MNR.DB.Actuals$deleteActuals()}}
|
||||||
|
\item \href{#method-MNR.DB.Actuals-clone}{\code{MNR.DB.Actuals$clone()}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{
|
||||||
|
<details open><summary>Inherited methods</summary>
|
||||||
|
<ul>
|
||||||
|
<li><span class="pkg-link" data-pkg="AVSDevR.MarineNoiseRegistry" data-topic="MNR.DB" data-id="getDBClient"><a href='../../AVSDevR.MarineNoiseRegistry/html/MNR.DB.html#method-MNR.DB-getDBClient'><code>AVSDevR.MarineNoiseRegistry::MNR.DB$getDBClient()</code></a></span></li>
|
||||||
|
<li><span class="pkg-link" data-pkg="AVSDevR.MarineNoiseRegistry" data-topic="MNR.DB" data-id="initialize"><a href='../../AVSDevR.MarineNoiseRegistry/html/MNR.DB.html#method-MNR.DB-initialize'><code>AVSDevR.MarineNoiseRegistry::MNR.DB$initialize()</code></a></span></li>
|
||||||
|
</ul>
|
||||||
|
</details>
|
||||||
|
}}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Actuals-selectActuals"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Actuals-selectActuals}{}}}
|
||||||
|
\subsection{Method \code{selectActuals()}}{
|
||||||
|
Select the actuals for \code{refs}
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Actuals$selectActuals(refs)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{refs}}{\if{html}{\out{<character>}} The MNR application noise source references}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Actuals-selectProposedActuals"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Actuals-selectProposedActuals}{}}}
|
||||||
|
\subsection{Method \code{selectProposedActuals()}}{
|
||||||
|
Returns the current actuals for a application or builds a
|
||||||
|
default actuals list from the proposed locations if there are none
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Actuals$selectProposedActuals(refs)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{refs}}{\if{html}{\out{<character>}} The MNR application noise source references}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Actuals-upsertActuals"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Actuals-upsertActuals}{}}}
|
||||||
|
\subsection{Method \code{upsertActuals()}}{
|
||||||
|
Upserts the actuals in the actuals.sf into the database
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Actuals$upsertActuals(actuals.sf)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{actuals.sf}}{\if{html}{\out{<sf>}} An sf table containing the new actuals}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Actuals-deleteActuals"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Actuals-deleteActuals}{}}}
|
||||||
|
\subsection{Method \code{deleteActuals()}}{
|
||||||
|
Deletes actuals for \code{refs}
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Actuals$deleteActuals(refs)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{refs}}{\if{html}{\out{<character>}} The MNR application noise source references}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Actuals-clone"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Actuals-clone}{}}}
|
||||||
|
\subsection{Method \code{clone()}}{
|
||||||
|
The objects of this class are cloneable with this method.
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Actuals$clone(deep = FALSE)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{deep}}{Whether to make a deep clone.}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
306
man/MNR.DB.Applications.Rd
Normal file
306
man/MNR.DB.Applications.Rd
Normal file
@@ -0,0 +1,306 @@
|
|||||||
|
% Generated by roxygen2: do not edit by hand
|
||||||
|
% Please edit documentation in R/db_applications.R
|
||||||
|
\name{MNR.DB.Applications}
|
||||||
|
\alias{MNR.DB.Applications}
|
||||||
|
\title{MNR database queries for Applications}
|
||||||
|
\value{
|
||||||
|
A query details object (collect = FALSE) or a collected tibble
|
||||||
|
of application details
|
||||||
|
|
||||||
|
A permissions_query object (as_permissions = TRUE,
|
||||||
|
collect = FALSE) or query details object (as_permissions = FALSE,
|
||||||
|
collect = FALSE) or a collected tibble of application details
|
||||||
|
|
||||||
|
A permissions_query object (as_permissions = TRUE,
|
||||||
|
collect = FALSE) or query details object (as_permissions = FALSE,
|
||||||
|
collect = FALSE) or a collected tibble of application details
|
||||||
|
|
||||||
|
A permissions_query object (as_permissions = TRUE,
|
||||||
|
collect = FALSE) or query details object (as_permissions = FALSE,
|
||||||
|
collect = FALSE) or a collected tibble of application details
|
||||||
|
|
||||||
|
A permissions_query object (as_permissions = TRUE,
|
||||||
|
collect = FALSE) or query details object (as_permissions = FALSE,
|
||||||
|
collect = FALSE) or a collected tibble of application details
|
||||||
|
|
||||||
|
A permissions_query object (as_permissions = TRUE,
|
||||||
|
collect = FALSE) or query details object (as_permissions = FALSE,
|
||||||
|
collect = FALSE) or a collected tibble of application details
|
||||||
|
|
||||||
|
A permissions_query object (as_permissions = TRUE,
|
||||||
|
collect = FALSE) or query details object (as_permissions = FALSE,
|
||||||
|
collect = FALSE) or a collected tibble of application details
|
||||||
|
|
||||||
|
A list containing the state flags of an application
|
||||||
|
}
|
||||||
|
\description{
|
||||||
|
MNR database queries for Applications
|
||||||
|
|
||||||
|
MNR database queries for Applications
|
||||||
|
}
|
||||||
|
\section{Super class}{
|
||||||
|
\code{\link[AVSDevR.MarineNoiseRegistry:MNR.DB]{AVSDevR.MarineNoiseRegistry::MNR.DB}} -> \code{MNR.DB.Applications}
|
||||||
|
}
|
||||||
|
\section{Methods}{
|
||||||
|
\subsection{Public methods}{
|
||||||
|
\itemize{
|
||||||
|
\item \href{#method-MNR.DB.Applications-new}{\code{MNR.DB.Applications$new()}}
|
||||||
|
\item \href{#method-MNR.DB.Applications-collectFromPermissions}{\code{MNR.DB.Applications$collectFromPermissions()}}
|
||||||
|
\item \href{#method-MNR.DB.Applications-getUnfilteredApplications}{\code{MNR.DB.Applications$getUnfilteredApplications()}}
|
||||||
|
\item \href{#method-MNR.DB.Applications-getAdminApplications}{\code{MNR.DB.Applications$getAdminApplications()}}
|
||||||
|
\item \href{#method-MNR.DB.Applications-getPublicOnlyApplications}{\code{MNR.DB.Applications$getPublicOnlyApplications()}}
|
||||||
|
\item \href{#method-MNR.DB.Applications-getRelatedApplications}{\code{MNR.DB.Applications$getRelatedApplications()}}
|
||||||
|
\item \href{#method-MNR.DB.Applications-getUserOrganisationApplications}{\code{MNR.DB.Applications$getUserOrganisationApplications()}}
|
||||||
|
\item \href{#method-MNR.DB.Applications-getUserApplications}{\code{MNR.DB.Applications$getUserApplications()}}
|
||||||
|
\item \href{#method-MNR.DB.Applications-getApplicationState}{\code{MNR.DB.Applications$getApplicationState()}}
|
||||||
|
\item \href{#method-MNR.DB.Applications-clone}{\code{MNR.DB.Applications$clone()}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{
|
||||||
|
<details open><summary>Inherited methods</summary>
|
||||||
|
<ul>
|
||||||
|
<li><span class="pkg-link" data-pkg="AVSDevR.MarineNoiseRegistry" data-topic="MNR.DB" data-id="getDBClient"><a href='../../AVSDevR.MarineNoiseRegistry/html/MNR.DB.html#method-MNR.DB-getDBClient'><code>AVSDevR.MarineNoiseRegistry::MNR.DB$getDBClient()</code></a></span></li>
|
||||||
|
</ul>
|
||||||
|
</details>
|
||||||
|
}}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Applications-new"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Applications-new}{}}}
|
||||||
|
\subsection{Method \code{new()}}{
|
||||||
|
Initialises the instance with a database client from
|
||||||
|
\link[AVSDevR.DBClient]{DBClient}
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Applications$new(db_client)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{db_client}}{<\link[AVSDevR.DBClient]{DBClient}> A DBClient instance}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Applications-collectFromPermissions"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Applications-collectFromPermissions}{}}}
|
||||||
|
\subsection{Method \code{collectFromPermissions()}}{
|
||||||
|
Fetch application details from a permissions query
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Applications$collectFromPermissions(perm_query, collect = TRUE)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{perm_query}}{A permissions_query object}
|
||||||
|
|
||||||
|
\item{\code{collect}}{\if{html}{\out{<logical>}} Collect the query before returning (TRUE) or
|
||||||
|
return the built query object (FALSE)}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Applications-getUnfilteredApplications"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Applications-getUnfilteredApplications}{}}}
|
||||||
|
\subsection{Method \code{getUnfilteredApplications()}}{
|
||||||
|
Fetch applications details from the database without any
|
||||||
|
filtering applied
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Applications$getUnfilteredApplications(
|
||||||
|
as_permissions = FALSE,
|
||||||
|
collect = TRUE
|
||||||
|
)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{as_permissions}}{\if{html}{\out{<logical>}} Returns a permissions_query if TRUE else
|
||||||
|
the applications if FALSE}
|
||||||
|
|
||||||
|
\item{\code{collect}}{\if{html}{\out{<logical>}} Collect the query before returning (TRUE) or
|
||||||
|
return the built query object (FALSE)}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Applications-getAdminApplications"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Applications-getAdminApplications}{}}}
|
||||||
|
\subsection{Method \code{getAdminApplications()}}{
|
||||||
|
Fetch application details from the database with filtering
|
||||||
|
for administration rights applied (assuming the user has the role)
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Applications$getAdminApplications(
|
||||||
|
user_id = -1,
|
||||||
|
as_permissions = FALSE,
|
||||||
|
collect = TRUE
|
||||||
|
)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{user_id}}{\if{html}{\out{<integer>}} The user to check}
|
||||||
|
|
||||||
|
\item{\code{as_permissions}}{\if{html}{\out{<logical>}} Returns a permissions_query if TRUE else
|
||||||
|
the applications if FALSE}
|
||||||
|
|
||||||
|
\item{\code{collect}}{\if{html}{\out{<logical>}} Collect the query before returning (TRUE) or
|
||||||
|
return the built query object (FALSE)}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Applications-getPublicOnlyApplications"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Applications-getPublicOnlyApplications}{}}}
|
||||||
|
\subsection{Method \code{getPublicOnlyApplications()}}{
|
||||||
|
Fetch application details from the database filtered to
|
||||||
|
those that are publicly available (ie. not draft or what-if)
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Applications$getPublicOnlyApplications(
|
||||||
|
user_id = -1,
|
||||||
|
as_permissions = FALSE,
|
||||||
|
collect = TRUE
|
||||||
|
)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{user_id}}{\if{html}{\out{<integer>}} The user to check}
|
||||||
|
|
||||||
|
\item{\code{as_permissions}}{\if{html}{\out{<logical>}} Returns a permissions_query if TRUE else
|
||||||
|
the applications if FALSE}
|
||||||
|
|
||||||
|
\item{\code{collect}}{\if{html}{\out{<logical>}} Collect the query before returning (TRUE) or
|
||||||
|
return the built query object (FALSE)}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Applications-getRelatedApplications"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Applications-getRelatedApplications}{}}}
|
||||||
|
\subsection{Method \code{getRelatedApplications()}}{
|
||||||
|
Fetch application details from the database filtered to
|
||||||
|
those that are related to a user (via submitter, organisation or
|
||||||
|
agent/recipient)
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Applications$getRelatedApplications(
|
||||||
|
user_id,
|
||||||
|
as_permissions = FALSE,
|
||||||
|
collect = TRUE
|
||||||
|
)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{user_id}}{\if{html}{\out{<integer>}} The user to check}
|
||||||
|
|
||||||
|
\item{\code{as_permissions}}{\if{html}{\out{<logical>}} Returns a permissions_query if TRUE else
|
||||||
|
the applications if FALSE}
|
||||||
|
|
||||||
|
\item{\code{collect}}{\if{html}{\out{<logical>}} Collect the query before returning (TRUE) or
|
||||||
|
return the built query object (FALSE)}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Applications-getUserOrganisationApplications"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Applications-getUserOrganisationApplications}{}}}
|
||||||
|
\subsection{Method \code{getUserOrganisationApplications()}}{
|
||||||
|
Fetch application details from the database filtered to
|
||||||
|
those that are related to a user's organisation
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Applications$getUserOrganisationApplications(
|
||||||
|
user_id,
|
||||||
|
as_permissions = FALSE,
|
||||||
|
collect = TRUE
|
||||||
|
)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{user_id}}{\if{html}{\out{<integer>}} The user to check}
|
||||||
|
|
||||||
|
\item{\code{as_permissions}}{\if{html}{\out{<logical>}} Returns a permissions_query if TRUE else
|
||||||
|
the applications if FALSE}
|
||||||
|
|
||||||
|
\item{\code{collect}}{\if{html}{\out{<logical>}} Collect the query before returning (TRUE) or
|
||||||
|
return the built query object (FALSE)}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Applications-getUserApplications"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Applications-getUserApplications}{}}}
|
||||||
|
\subsection{Method \code{getUserApplications()}}{
|
||||||
|
Fetch a list of applications belonging to a user
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Applications$getUserApplications(
|
||||||
|
user_id,
|
||||||
|
as_permissions = FALSE,
|
||||||
|
collect = TRUE
|
||||||
|
)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{user_id}}{\if{html}{\out{<integer>}} The user to check}
|
||||||
|
|
||||||
|
\item{\code{as_permissions}}{\if{html}{\out{<logical>}} Returns a permissions_query if TRUE else
|
||||||
|
the applications if FALSE}
|
||||||
|
|
||||||
|
\item{\code{collect}}{\if{html}{\out{<logical>}} Collect the query before returning (TRUE) or
|
||||||
|
return the built query object (FALSE)}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Applications-getApplicationState"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Applications-getApplicationState}{}}}
|
||||||
|
\subsection{Method \code{getApplicationState()}}{
|
||||||
|
Fetches the state of an application from the database
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Applications$getApplicationState(application_id, collect = TRUE)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{application_id}}{\if{html}{\out{<integer>}} The id of the application to check}
|
||||||
|
|
||||||
|
\item{\code{collect}}{\if{html}{\out{<logical>}} Collect the query before returning (TRUE) or
|
||||||
|
return the built query object (FALSE)}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Applications-clone"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Applications-clone}{}}}
|
||||||
|
\subsection{Method \code{clone()}}{
|
||||||
|
The objects of this class are cloneable with this method.
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Applications$clone(deep = FALSE)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{deep}}{Whether to make a deep clone.}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
166
man/MNR.DB.Geometries.Rd
Normal file
166
man/MNR.DB.Geometries.Rd
Normal file
@@ -0,0 +1,166 @@
|
|||||||
|
% Generated by roxygen2: do not edit by hand
|
||||||
|
% Please edit documentation in R/db_geometries.R
|
||||||
|
\name{MNR.DB.Geometries}
|
||||||
|
\alias{MNR.DB.Geometries}
|
||||||
|
\title{MNR database queries for Gemoetries}
|
||||||
|
\value{
|
||||||
|
A query object or a collected sf of the blocks
|
||||||
|
|
||||||
|
A query object or a collected sf of the conservation areas
|
||||||
|
|
||||||
|
A query object or a collected sf of the marine regions
|
||||||
|
|
||||||
|
A query object or collected query of the block marine regions
|
||||||
|
|
||||||
|
A query object or collected query of the block conservation
|
||||||
|
areas
|
||||||
|
}
|
||||||
|
\description{
|
||||||
|
MNR database queries for Gemoetries
|
||||||
|
|
||||||
|
MNR database queries for Gemoetries
|
||||||
|
}
|
||||||
|
\section{Super class}{
|
||||||
|
\code{\link[AVSDevR.MarineNoiseRegistry:MNR.DB]{AVSDevR.MarineNoiseRegistry::MNR.DB}} -> \code{MNR.DB.Geometries}
|
||||||
|
}
|
||||||
|
\section{Methods}{
|
||||||
|
\subsection{Public methods}{
|
||||||
|
\itemize{
|
||||||
|
\item \href{#method-MNR.DB.Geometries-getBlocks}{\code{MNR.DB.Geometries$getBlocks()}}
|
||||||
|
\item \href{#method-MNR.DB.Geometries-getConservationAreas}{\code{MNR.DB.Geometries$getConservationAreas()}}
|
||||||
|
\item \href{#method-MNR.DB.Geometries-getMarineRegions}{\code{MNR.DB.Geometries$getMarineRegions()}}
|
||||||
|
\item \href{#method-MNR.DB.Geometries-getBlockMarineRegions}{\code{MNR.DB.Geometries$getBlockMarineRegions()}}
|
||||||
|
\item \href{#method-MNR.DB.Geometries-getBlockConservationAreaDistances}{\code{MNR.DB.Geometries$getBlockConservationAreaDistances()}}
|
||||||
|
\item \href{#method-MNR.DB.Geometries-clone}{\code{MNR.DB.Geometries$clone()}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{
|
||||||
|
<details open><summary>Inherited methods</summary>
|
||||||
|
<ul>
|
||||||
|
<li><span class="pkg-link" data-pkg="AVSDevR.MarineNoiseRegistry" data-topic="MNR.DB" data-id="getDBClient"><a href='../../AVSDevR.MarineNoiseRegistry/html/MNR.DB.html#method-MNR.DB-getDBClient'><code>AVSDevR.MarineNoiseRegistry::MNR.DB$getDBClient()</code></a></span></li>
|
||||||
|
<li><span class="pkg-link" data-pkg="AVSDevR.MarineNoiseRegistry" data-topic="MNR.DB" data-id="initialize"><a href='../../AVSDevR.MarineNoiseRegistry/html/MNR.DB.html#method-MNR.DB-initialize'><code>AVSDevR.MarineNoiseRegistry::MNR.DB$initialize()</code></a></span></li>
|
||||||
|
</ul>
|
||||||
|
</details>
|
||||||
|
}}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Geometries-getBlocks"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Geometries-getBlocks}{}}}
|
||||||
|
\subsection{Method \code{getBlocks()}}{
|
||||||
|
Fetches the Oil & Gas block information from the database
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Geometries$getBlocks(
|
||||||
|
with_geometries = TRUE,
|
||||||
|
ordered = FALSE,
|
||||||
|
collect = TRUE
|
||||||
|
)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{with_geometries}}{\if{html}{\out{<logical>}} Also fetch the block geometries}
|
||||||
|
|
||||||
|
\item{\code{ordered}}{\if{html}{\out{<logical>}} Sort the blocks (has an overhead)}
|
||||||
|
|
||||||
|
\item{\code{collect}}{\if{html}{\out{<logical>}} Collect the query before returning (TRUE) or
|
||||||
|
return the built query object (FALSE)}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Geometries-getConservationAreas"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Geometries-getConservationAreas}{}}}
|
||||||
|
\subsection{Method \code{getConservationAreas()}}{
|
||||||
|
Retrieves the Conservation Areas from the database
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Geometries$getConservationAreas(with_geometries = TRUE, collect = TRUE)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{with_geometries}}{\if{html}{\out{<logical>}} Also fetch the geometries}
|
||||||
|
|
||||||
|
\item{\code{collect}}{\if{html}{\out{<logical>}} Collect the query before returning (TRUE) or
|
||||||
|
return the built query object (FALSE)}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Geometries-getMarineRegions"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Geometries-getMarineRegions}{}}}
|
||||||
|
\subsection{Method \code{getMarineRegions()}}{
|
||||||
|
Retrieves the Marine Regions from the database
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Geometries$getMarineRegions(with_geometries = TRUE, collect = TRUE)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{with_geometries}}{\if{html}{\out{<logical>}} Also fetch the geometries}
|
||||||
|
|
||||||
|
\item{\code{collect}}{\if{html}{\out{<logical>}} Collect the query before returning (TRUE) or
|
||||||
|
return the built query object (FALSE)}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Geometries-getBlockMarineRegions"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Geometries-getBlockMarineRegions}{}}}
|
||||||
|
\subsection{Method \code{getBlockMarineRegions()}}{
|
||||||
|
Retrieves the block marine region map table from the
|
||||||
|
database
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Geometries$getBlockMarineRegions(collect = TRUE)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{collect}}{\if{html}{\out{<logical>}} Collect the query before returning (TRUE) or
|
||||||
|
return the built query object (FALSE)}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Geometries-getBlockConservationAreaDistances"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Geometries-getBlockConservationAreaDistances}{}}}
|
||||||
|
\subsection{Method \code{getBlockConservationAreaDistances()}}{
|
||||||
|
Retrieves the block conservation areas map table from the
|
||||||
|
database
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Geometries$getBlockConservationAreaDistances(collect = TRUE)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{collect}}{\if{html}{\out{<logical>}} Collect the query before returning (TRUE) or
|
||||||
|
return the built query object (FALSE)}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Geometries-clone"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Geometries-clone}{}}}
|
||||||
|
\subsection{Method \code{clone()}}{
|
||||||
|
The objects of this class are cloneable with this method.
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Geometries$clone(deep = FALSE)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{deep}}{Whether to make a deep clone.}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
294
man/MNR.DB.Organisations.Rd
Normal file
294
man/MNR.DB.Organisations.Rd
Normal file
@@ -0,0 +1,294 @@
|
|||||||
|
% Generated by roxygen2: do not edit by hand
|
||||||
|
% Please edit documentation in R/db_organisations.R
|
||||||
|
\name{MNR.DB.Organisations}
|
||||||
|
\alias{MNR.DB.Organisations}
|
||||||
|
\title{MNR database queries for Organsiations}
|
||||||
|
\value{
|
||||||
|
A query object for an organsation (collect = FALSE) or a
|
||||||
|
tibble with the organisation details
|
||||||
|
|
||||||
|
The organisation ids if as_int is TRUE, the organisation names
|
||||||
|
if as_int is FALSE and name_only is TRUE, else the organisations or an
|
||||||
|
uncollected query object
|
||||||
|
|
||||||
|
TRUE if the organisation is a regulator
|
||||||
|
|
||||||
|
The regulator ids if as_int is TRUE, the regulator names if
|
||||||
|
as_int is FALSE and name_only is TRUE, else the regulator or an
|
||||||
|
uncollected query object
|
||||||
|
|
||||||
|
A tibble of the organisation members or an uncollected query
|
||||||
|
|
||||||
|
TRUE if the user's organisation is an agent
|
||||||
|
|
||||||
|
An uncollected query object or a tibble of agents
|
||||||
|
|
||||||
|
An uncollected query object or a tibble of recipients
|
||||||
|
|
||||||
|
The organisation id if as_int is TRUE, the organisation name if
|
||||||
|
as_int is FALSE and name_only is TRUE, else the organisation or an
|
||||||
|
uncollected query object
|
||||||
|
}
|
||||||
|
\description{
|
||||||
|
MNR database queries for Organsiations
|
||||||
|
|
||||||
|
MNR database queries for Organsiations
|
||||||
|
}
|
||||||
|
\section{Super class}{
|
||||||
|
\code{\link[AVSDevR.MarineNoiseRegistry:MNR.DB]{AVSDevR.MarineNoiseRegistry::MNR.DB}} -> \code{MNR.DB.Organisations}
|
||||||
|
}
|
||||||
|
\section{Methods}{
|
||||||
|
\subsection{Public methods}{
|
||||||
|
\itemize{
|
||||||
|
\item \href{#method-MNR.DB.Organisations-getOrganisation}{\code{MNR.DB.Organisations$getOrganisation()}}
|
||||||
|
\item \href{#method-MNR.DB.Organisations-getAllOrganisations}{\code{MNR.DB.Organisations$getAllOrganisations()}}
|
||||||
|
\item \href{#method-MNR.DB.Organisations-isRegulator}{\code{MNR.DB.Organisations$isRegulator()}}
|
||||||
|
\item \href{#method-MNR.DB.Organisations-getRegulators}{\code{MNR.DB.Organisations$getRegulators()}}
|
||||||
|
\item \href{#method-MNR.DB.Organisations-getOrganisationMembers}{\code{MNR.DB.Organisations$getOrganisationMembers()}}
|
||||||
|
\item \href{#method-MNR.DB.Organisations-isAgent}{\code{MNR.DB.Organisations$isAgent()}}
|
||||||
|
\item \href{#method-MNR.DB.Organisations-getOrganisationAgents}{\code{MNR.DB.Organisations$getOrganisationAgents()}}
|
||||||
|
\item \href{#method-MNR.DB.Organisations-getAgentRecipients}{\code{MNR.DB.Organisations$getAgentRecipients()}}
|
||||||
|
\item \href{#method-MNR.DB.Organisations-getUserOrganisation}{\code{MNR.DB.Organisations$getUserOrganisation()}}
|
||||||
|
\item \href{#method-MNR.DB.Organisations-clone}{\code{MNR.DB.Organisations$clone()}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{
|
||||||
|
<details open><summary>Inherited methods</summary>
|
||||||
|
<ul>
|
||||||
|
<li><span class="pkg-link" data-pkg="AVSDevR.MarineNoiseRegistry" data-topic="MNR.DB" data-id="getDBClient"><a href='../../AVSDevR.MarineNoiseRegistry/html/MNR.DB.html#method-MNR.DB-getDBClient'><code>AVSDevR.MarineNoiseRegistry::MNR.DB$getDBClient()</code></a></span></li>
|
||||||
|
<li><span class="pkg-link" data-pkg="AVSDevR.MarineNoiseRegistry" data-topic="MNR.DB" data-id="initialize"><a href='../../AVSDevR.MarineNoiseRegistry/html/MNR.DB.html#method-MNR.DB-initialize'><code>AVSDevR.MarineNoiseRegistry::MNR.DB$initialize()</code></a></span></li>
|
||||||
|
</ul>
|
||||||
|
</details>
|
||||||
|
}}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Organisations-getOrganisation"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Organisations-getOrganisation}{}}}
|
||||||
|
\subsection{Method \code{getOrganisation()}}{
|
||||||
|
Fetch the details of an organisation from the database
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Organisations$getOrganisation(org_id, collect = TRUE)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{org_id}}{\if{html}{\out{<integer>}} The id of the organisation to fetch}
|
||||||
|
|
||||||
|
\item{\code{collect}}{\if{html}{\out{<logical>}} Collect the query before returning (TRUE) or
|
||||||
|
return the built query object (FALSE)}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Organisations-getAllOrganisations"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Organisations-getAllOrganisations}{}}}
|
||||||
|
\subsection{Method \code{getAllOrganisations()}}{
|
||||||
|
Fetch the details of all organisations from the database
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Organisations$getAllOrganisations(
|
||||||
|
as_int = FALSE,
|
||||||
|
name_only = TRUE,
|
||||||
|
collect = TRUE
|
||||||
|
)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{as_int}}{\if{html}{\out{<logical>}} Return only the ids (TRUE)}
|
||||||
|
|
||||||
|
\item{\code{name_only}}{\if{html}{\out{<logical>}} Return only the name (TRUE)}
|
||||||
|
|
||||||
|
\item{\code{collect}}{\if{html}{\out{<logical>}} Collect the query before returning (TRUE) or
|
||||||
|
return the built query object (FALSE)}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Organisations-isRegulator"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Organisations-isRegulator}{}}}
|
||||||
|
\subsection{Method \code{isRegulator()}}{
|
||||||
|
Check if an organisation is a regulator
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Organisations$isRegulator(org_id)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{org_id}}{\if{html}{\out{<integer>}} The id of the organisation to check}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Organisations-getRegulators"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Organisations-getRegulators}{}}}
|
||||||
|
\subsection{Method \code{getRegulators()}}{
|
||||||
|
Fetch the details of all the regulators from the database
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Organisations$getRegulators(
|
||||||
|
as_int = FALSE,
|
||||||
|
name_only = TRUE,
|
||||||
|
collect = TRUE
|
||||||
|
)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{as_int}}{\if{html}{\out{<logical>}} Return only the ids (TRUE)}
|
||||||
|
|
||||||
|
\item{\code{name_only}}{\if{html}{\out{<logical>}} Return only the name (TRUE)}
|
||||||
|
|
||||||
|
\item{\code{collect}}{\if{html}{\out{<logical>}} Collect the query before returning (TRUE) or
|
||||||
|
return the built query object (FALSE)}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Organisations-getOrganisationMembers"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Organisations-getOrganisationMembers}{}}}
|
||||||
|
\subsection{Method \code{getOrganisationMembers()}}{
|
||||||
|
Fetch the members of an organisation
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Organisations$getOrganisationMembers(
|
||||||
|
org_name = "",
|
||||||
|
org_id = -1,
|
||||||
|
collect = TRUE
|
||||||
|
)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{org_name}}{\if{html}{\out{<character>}} The name of the organisation to check}
|
||||||
|
|
||||||
|
\item{\code{org_id}}{\if{html}{\out{<integer>}} The id of the organisation to check}
|
||||||
|
|
||||||
|
\item{\code{collect}}{\if{html}{\out{<logical>}} Collect the query before returning (TRUE) or
|
||||||
|
return the built query object (FALSE)}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Organisations-isAgent"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Organisations-isAgent}{}}}
|
||||||
|
\subsection{Method \code{isAgent()}}{
|
||||||
|
Check if user's organisation is an agent for another
|
||||||
|
organisation
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Organisations$isAgent(org_id)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{org_id}}{\if{html}{\out{<integer>}} The id of the organisation to check}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Organisations-getOrganisationAgents"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Organisations-getOrganisationAgents}{}}}
|
||||||
|
\subsection{Method \code{getOrganisationAgents()}}{
|
||||||
|
Fetch the agents of an organisation
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Organisations$getOrganisationAgents(
|
||||||
|
org_id,
|
||||||
|
as_int = FALSE,
|
||||||
|
collect = TRUE
|
||||||
|
)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{org_id}}{\if{html}{\out{<integer>}} The id of the organisation to check}
|
||||||
|
|
||||||
|
\item{\code{as_int}}{\if{html}{\out{<logical>}} Return only the id (TRUE)}
|
||||||
|
|
||||||
|
\item{\code{collect}}{\if{html}{\out{<logical>}} Collect the query before returning (TRUE) or
|
||||||
|
return the built query object (FALSE)}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Organisations-getAgentRecipients"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Organisations-getAgentRecipients}{}}}
|
||||||
|
\subsection{Method \code{getAgentRecipients()}}{
|
||||||
|
Fetch the recipients of an organisation
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Organisations$getAgentRecipients(
|
||||||
|
agent_id,
|
||||||
|
as_int = FALSE,
|
||||||
|
collect = TRUE
|
||||||
|
)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{agent_id}}{\if{html}{\out{<integer>}} The id of the organisation (agent) to check}
|
||||||
|
|
||||||
|
\item{\code{as_int}}{\if{html}{\out{<logical>}} Return only the id (TRUE)}
|
||||||
|
|
||||||
|
\item{\code{collect}}{\if{html}{\out{<logical>}} Collect the query before returning (TRUE) or
|
||||||
|
return the built query object (FALSE)}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Organisations-getUserOrganisation"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Organisations-getUserOrganisation}{}}}
|
||||||
|
\subsection{Method \code{getUserOrganisation()}}{
|
||||||
|
Fetch the organisation of a user
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Organisations$getUserOrganisation(
|
||||||
|
user_id,
|
||||||
|
as_int = TRUE,
|
||||||
|
name_only = TRUE,
|
||||||
|
collect = TRUE
|
||||||
|
)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{user_id}}{\if{html}{\out{<integer>}} The id of the user to fetch the organisation of}
|
||||||
|
|
||||||
|
\item{\code{as_int}}{\if{html}{\out{<logical>}} Return only the id (TRUE)}
|
||||||
|
|
||||||
|
\item{\code{name_only}}{\if{html}{\out{<logical>}} Return only the name (TRUE)}
|
||||||
|
|
||||||
|
\item{\code{collect}}{\if{html}{\out{<logical>}} Collect the query before returning (TRUE) or
|
||||||
|
return the built query object (FALSE)}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Organisations-clone"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Organisations-clone}{}}}
|
||||||
|
\subsection{Method \code{clone()}}{
|
||||||
|
The objects of this class are cloneable with this method.
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Organisations$clone(deep = FALSE)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{deep}}{Whether to make a deep clone.}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
68
man/MNR.DB.Rd
Normal file
68
man/MNR.DB.Rd
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
% Generated by roxygen2: do not edit by hand
|
||||||
|
% Please edit documentation in R/db.R
|
||||||
|
\name{MNR.DB}
|
||||||
|
\alias{MNR.DB}
|
||||||
|
\title{MNR database queries base class}
|
||||||
|
\value{
|
||||||
|
<\link[AVSDevR.DBClient]{DBClient}> The DBClient instance used
|
||||||
|
by the class instance
|
||||||
|
}
|
||||||
|
\description{
|
||||||
|
MNR database queries base class
|
||||||
|
|
||||||
|
MNR database queries base class
|
||||||
|
}
|
||||||
|
\section{Methods}{
|
||||||
|
\subsection{Public methods}{
|
||||||
|
\itemize{
|
||||||
|
\item \href{#method-MNR.DB-new}{\code{MNR.DB$new()}}
|
||||||
|
\item \href{#method-MNR.DB-getDBClient}{\code{MNR.DB$getDBClient()}}
|
||||||
|
\item \href{#method-MNR.DB-clone}{\code{MNR.DB$clone()}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB-new"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB-new}{}}}
|
||||||
|
\subsection{Method \code{new()}}{
|
||||||
|
Initialises the instance with a database client
|
||||||
|
\link[AVSDevR.DBClient]{DBClient}
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB$new(db_client)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{db_client}}{<\link[AVSDevR.DBClient]{DBClient}> A DBClient instance}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB-getDBClient"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB-getDBClient}{}}}
|
||||||
|
\subsection{Method \code{getDBClient()}}{
|
||||||
|
Returns the current DBClient instance in use
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB$getDBClient()}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB-clone"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB-clone}{}}}
|
||||||
|
\subsection{Method \code{clone()}}{
|
||||||
|
The objects of this class are cloneable with this method.
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB$clone(deep = FALSE)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{deep}}{Whether to make a deep clone.}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
154
man/MNR.DB.Users.Rd
Normal file
154
man/MNR.DB.Users.Rd
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
% Generated by roxygen2: do not edit by hand
|
||||||
|
% Please edit documentation in R/db_users.R
|
||||||
|
\name{MNR.DB.Users}
|
||||||
|
\alias{MNR.DB.Users}
|
||||||
|
\title{MNR database queries for Users}
|
||||||
|
\value{
|
||||||
|
\if{html}{\out{<list>}} Details of the user denoted by user_id
|
||||||
|
|
||||||
|
\if{html}{\out{<character>}} The user's name
|
||||||
|
|
||||||
|
\if{html}{\out{<character>}} A list of user roles
|
||||||
|
|
||||||
|
\if{html}{\out{<logical>}} TRUE if the user is an administrator
|
||||||
|
}
|
||||||
|
\description{
|
||||||
|
MNR database queries for Users
|
||||||
|
|
||||||
|
MNR database queries for Users
|
||||||
|
}
|
||||||
|
\section{Super class}{
|
||||||
|
\code{\link[AVSDevR.MarineNoiseRegistry:MNR.DB]{AVSDevR.MarineNoiseRegistry::MNR.DB}} -> \code{MNR.DB.Users}
|
||||||
|
}
|
||||||
|
\section{Methods}{
|
||||||
|
\subsection{Public methods}{
|
||||||
|
\itemize{
|
||||||
|
\item \href{#method-MNR.DB.Users-new}{\code{MNR.DB.Users$new()}}
|
||||||
|
\item \href{#method-MNR.DB.Users-getUser}{\code{MNR.DB.Users$getUser()}}
|
||||||
|
\item \href{#method-MNR.DB.Users-getUserName}{\code{MNR.DB.Users$getUserName()}}
|
||||||
|
\item \href{#method-MNR.DB.Users-getUserRoles}{\code{MNR.DB.Users$getUserRoles()}}
|
||||||
|
\item \href{#method-MNR.DB.Users-isApplicationsAdmin}{\code{MNR.DB.Users$isApplicationsAdmin()}}
|
||||||
|
\item \href{#method-MNR.DB.Users-clone}{\code{MNR.DB.Users$clone()}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{
|
||||||
|
<details open><summary>Inherited methods</summary>
|
||||||
|
<ul>
|
||||||
|
<li><span class="pkg-link" data-pkg="AVSDevR.MarineNoiseRegistry" data-topic="MNR.DB" data-id="getDBClient"><a href='../../AVSDevR.MarineNoiseRegistry/html/MNR.DB.html#method-MNR.DB-getDBClient'><code>AVSDevR.MarineNoiseRegistry::MNR.DB$getDBClient()</code></a></span></li>
|
||||||
|
</ul>
|
||||||
|
</details>
|
||||||
|
}}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Users-new"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Users-new}{}}}
|
||||||
|
\subsection{Method \code{new()}}{
|
||||||
|
Initialises the instance with a database client from
|
||||||
|
\link[AVSDevR.DBClient]{DBClient}
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Users$new(db_client, admin_role_slug = NULL)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{db_client}}{<\link[AVSDevR.DBClient]{DBClient}> A DBClient instance}
|
||||||
|
|
||||||
|
\item{\code{admin_role_slug}}{\if{html}{\out{<character>}} The slug of the application
|
||||||
|
administrator role within UserFrosting
|
||||||
|
(Defaults to: "application-admin")}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Users-getUser"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Users-getUser}{}}}
|
||||||
|
\subsection{Method \code{getUser()}}{
|
||||||
|
Get user information from the database
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Users$getUser(user_id, collect = TRUE)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{user_id}}{\if{html}{\out{<integer>}} The user id to fetch}
|
||||||
|
|
||||||
|
\item{\code{collect}}{\if{html}{\out{<logical>}} Collect the query before returning (TRUE) or
|
||||||
|
return the built query object (FALSE)}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Users-getUserName"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Users-getUserName}{}}}
|
||||||
|
\subsection{Method \code{getUserName()}}{
|
||||||
|
Get user name from the database
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Users$getUserName(user_id)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{user_id}}{\if{html}{\out{<integer>}} The user id to fetch}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Users-getUserRoles"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Users-getUserRoles}{}}}
|
||||||
|
\subsection{Method \code{getUserRoles()}}{
|
||||||
|
Get user roles from the database
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Users$getUserRoles(user_id, collect = TRUE)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{user_id}}{\if{html}{\out{<integer>}} The user id to fetch}
|
||||||
|
|
||||||
|
\item{\code{collect}}{\if{html}{\out{<logical>}} Collect the query before returning (TRUE) or
|
||||||
|
return the built query object (FALSE)}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Users-isApplicationsAdmin"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Users-isApplicationsAdmin}{}}}
|
||||||
|
\subsection{Method \code{isApplicationsAdmin()}}{
|
||||||
|
Check if a user is an application administrator
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Users$isApplicationsAdmin(user_id)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{user_id}}{\if{html}{\out{<integer>}} The user id to fetch}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.DB.Users-clone"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.DB.Users-clone}{}}}
|
||||||
|
\subsection{Method \code{clone()}}{
|
||||||
|
The objects of this class are cloneable with this method.
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.DB.Users$clone(deep = FALSE)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{deep}}{Whether to make a deep clone.}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
167
man/MNR.GeoPlot.Rd
Normal file
167
man/MNR.GeoPlot.Rd
Normal file
@@ -0,0 +1,167 @@
|
|||||||
|
% Generated by roxygen2: do not edit by hand
|
||||||
|
% Please edit documentation in R/geoPlot.R
|
||||||
|
\name{MNR.GeoPlot}
|
||||||
|
\alias{MNR.GeoPlot}
|
||||||
|
\title{MNR GIS plot base map generator}
|
||||||
|
\value{
|
||||||
|
A plolty object base map
|
||||||
|
|
||||||
|
The plotly object
|
||||||
|
}
|
||||||
|
\description{
|
||||||
|
MNR GIS plot base map generator
|
||||||
|
|
||||||
|
MNR GIS plot base map generator
|
||||||
|
}
|
||||||
|
\details{
|
||||||
|
Base layers are loaded and cached on first call to each of the boot methods.
|
||||||
|
}
|
||||||
|
\section{Methods}{
|
||||||
|
\subsection{Public methods}{
|
||||||
|
\itemize{
|
||||||
|
\item \href{#method-MNR.GeoPlot-new}{\code{MNR.GeoPlot$new()}}
|
||||||
|
\item \href{#method-MNR.GeoPlot-bootLayers}{\code{MNR.GeoPlot$bootLayers()}}
|
||||||
|
\item \href{#method-MNR.GeoPlot-bootQuadrants}{\code{MNR.GeoPlot$bootQuadrants()}}
|
||||||
|
\item \href{#method-MNR.GeoPlot-bootConservationAreas}{\code{MNR.GeoPlot$bootConservationAreas()}}
|
||||||
|
\item \href{#method-MNR.GeoPlot-makeBasePlot}{\code{MNR.GeoPlot$makeBasePlot()}}
|
||||||
|
\item \href{#method-MNR.GeoPlot-boundMap}{\code{MNR.GeoPlot$boundMap()}}
|
||||||
|
\item \href{#method-MNR.GeoPlot-clone}{\code{MNR.GeoPlot$clone()}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.GeoPlot-new"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.GeoPlot-new}{}}}
|
||||||
|
\subsection{Method \code{new()}}{
|
||||||
|
Initialises the object by building the grid lines
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.GeoPlot$new()}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.GeoPlot-bootLayers"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.GeoPlot-bootLayers}{}}}
|
||||||
|
\subsection{Method \code{bootLayers()}}{
|
||||||
|
Loads the JNCC layers required from file for the base map
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.GeoPlot$bootLayers()}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.GeoPlot-bootQuadrants"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.GeoPlot-bootQuadrants}{}}}
|
||||||
|
\subsection{Method \code{bootQuadrants()}}{
|
||||||
|
Loads the Oil & Gas quadrants from file for the base map
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.GeoPlot$bootQuadrants()}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.GeoPlot-bootConservationAreas"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.GeoPlot-bootConservationAreas}{}}}
|
||||||
|
\subsection{Method \code{bootConservationAreas()}}{
|
||||||
|
Loads the Conservation Areas from the database for the base
|
||||||
|
map.
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.GeoPlot$bootConservationAreas(db_client)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{db_client}}{<\link[AVSDevR.DBClient]{DBClient}> A DBClient instance}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.GeoPlot-makeBasePlot"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.GeoPlot-makeBasePlot}{}}}
|
||||||
|
\subsection{Method \code{makeBasePlot()}}{
|
||||||
|
Generates a base plotly map with optional layers included
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.GeoPlot$makeBasePlot(
|
||||||
|
...,
|
||||||
|
with_jncc_layers = TRUE,
|
||||||
|
with_quadrants = FALSE,
|
||||||
|
with_conservation_areas = FALSE
|
||||||
|
)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{...}}{Options to call plotly::plot_ly with}
|
||||||
|
|
||||||
|
\item{\code{with_jncc_layers}}{\if{html}{\out{<logical>}} Includes the JNCC base layers if TRUE
|
||||||
|
(call obj$bootLayers() first)}
|
||||||
|
|
||||||
|
\item{\code{with_quadrants}}{\if{html}{\out{<logical>}} Includes the Oil & Gas Quadrants if TRUE
|
||||||
|
(call obj$bootQuadrants() first)}
|
||||||
|
|
||||||
|
\item{\code{with_conservation_areas}}{\if{html}{\out{<logical>}} Includes the Conservation Areas
|
||||||
|
if TRUE (call obj$bootConservationAreas() first)}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.GeoPlot-boundMap"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.GeoPlot-boundMap}{}}}
|
||||||
|
\subsection{Method \code{boundMap()}}{
|
||||||
|
Bounds a mapbox map to a specific area and zoom
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.GeoPlot$boundMap(
|
||||||
|
p,
|
||||||
|
c_lat = 56,
|
||||||
|
c_lon = -5.5,
|
||||||
|
zoom = 3.5,
|
||||||
|
xmin = -25,
|
||||||
|
ymin = 45,
|
||||||
|
xmax = 5,
|
||||||
|
ymax = 65
|
||||||
|
)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{p}}{A plotly mapbox map object}
|
||||||
|
|
||||||
|
\item{\code{c_lat}}{\if{html}{\out{<numeric>}} Center latitude}
|
||||||
|
|
||||||
|
\item{\code{c_lon}}{\if{html}{\out{<numeric>}} Center longitude}
|
||||||
|
|
||||||
|
\item{\code{zoom}}{\if{html}{\out{<numeric>}} A mapbox zoom level}
|
||||||
|
|
||||||
|
\item{\code{xmin}}{\if{html}{\out{<numeric>}} Minimum longitude to bound with}
|
||||||
|
|
||||||
|
\item{\code{ymin}}{\if{html}{\out{<numeric>}} Minimum latitude to bound with}
|
||||||
|
|
||||||
|
\item{\code{xmax}}{\if{html}{\out{<numeric>}} Maximum longitude to bound with}
|
||||||
|
|
||||||
|
\item{\code{ymax}}{\if{html}{\out{<numeric>}} Maximum latitude to bound with}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\if{html}{\out{<hr>}}
|
||||||
|
\if{html}{\out{<a id="method-MNR.GeoPlot-clone"></a>}}
|
||||||
|
\if{latex}{\out{\hypertarget{method-MNR.GeoPlot-clone}{}}}
|
||||||
|
\subsection{Method \code{clone()}}{
|
||||||
|
The objects of this class are cloneable with this method.
|
||||||
|
\subsection{Usage}{
|
||||||
|
\if{html}{\out{<div class="r">}}\preformatted{MNR.GeoPlot$clone(deep = FALSE)}\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
|
||||||
|
\subsection{Arguments}{
|
||||||
|
\if{html}{\out{<div class="arguments">}}
|
||||||
|
\describe{
|
||||||
|
\item{\code{deep}}{Whether to make a deep clone.}
|
||||||
|
}
|
||||||
|
\if{html}{\out{</div>}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
man/attachResourcePaths.Rd
Normal file
11
man/attachResourcePaths.Rd
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
% Generated by roxygen2: do not edit by hand
|
||||||
|
% Please edit documentation in R/use_mnr_ui.R
|
||||||
|
\name{attachResourcePaths}
|
||||||
|
\alias{attachResourcePaths}
|
||||||
|
\title{Attaches the MNR resource path to Shiny if not already attached}
|
||||||
|
\usage{
|
||||||
|
attachResourcePaths()
|
||||||
|
}
|
||||||
|
\description{
|
||||||
|
Attaches the MNR resource path to Shiny if not already attached
|
||||||
|
}
|
||||||
11
man/resourcePrefix.Rd
Normal file
11
man/resourcePrefix.Rd
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
% Generated by roxygen2: do not edit by hand
|
||||||
|
% Please edit documentation in R/use_mnr_ui.R
|
||||||
|
\name{resourcePrefix}
|
||||||
|
\alias{resourcePrefix}
|
||||||
|
\title{Provides the resource path for MNR specific files}
|
||||||
|
\usage{
|
||||||
|
resourcePrefix()
|
||||||
|
}
|
||||||
|
\description{
|
||||||
|
Provides the resource path for MNR specific files
|
||||||
|
}
|
||||||
11
man/use_mnr_ui.Rd
Normal file
11
man/use_mnr_ui.Rd
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
% Generated by roxygen2: do not edit by hand
|
||||||
|
% Please edit documentation in R/use_mnr_ui.R
|
||||||
|
\name{use_mnr_ui}
|
||||||
|
\alias{use_mnr_ui}
|
||||||
|
\title{Attaches the MNR stylesheets and scripts to the UI}
|
||||||
|
\usage{
|
||||||
|
use_mnr_ui()
|
||||||
|
}
|
||||||
|
\description{
|
||||||
|
Attaches the MNR stylesheets and scripts to the UI
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user