C# Class Rock.Lava.RockFilters

Afficher le fichier Open project: SparkDevNetwork/Rock

Méthodes publiques

Méthode Description
AddLinkTagToHead ( string input, string attributeName, string attributeValue ) : string

adds a link tag to the head of the document

AddMetaTagToHead ( string input, string attributeName, string attributeValue ) : string

adds a meta tag to the head of the document

Address ( DotLiquid context, object input, string addressType, string qualifier = "" ) : string

Gets an address for a person object

Append ( object input, string @string ) : string

Appends the specified input.

Attribute ( DotLiquid context, object input, string attributeKey, string qualifier = "" ) : object

DotLiquid Attribute Filter

Campus ( DotLiquid context, object input, object option = null ) : object

Returns the Campus (or Campuses) that the Person belongs to

Ceiling ( object input ) : object

Ceilings the specified input.

Children ( DotLiquid context, object input ) : List

Gets the children of the person

Date ( object input, string format ) : string

Formats a date using a .NET date format string

DateAdd ( object input, int amount, string interval = "d" ) : DateTime?

Adds a time interval to a date

DateDiff ( object sStartDate, object sEndDate, string unit ) : Int64?

takes two datetimes and returns the difference in the unit you provide

DatesFromICal ( object input, object option = null ) : List

Dateses from i cal.

DaysFromNow ( object input ) : string

Dayses from now.

Default ( object input, string defaultString ) : string

Returns the passed default value if the value is undefined or empty, otherwise the value of the variable

DividedBy ( object input, object operand, int precision = 2 ) : object

Divideds the by.

EscapeDataString ( string input ) : string

Converts a string to its escaped representation using Uri.EscapeDataString

Floor ( object input ) : object

Floors the specified input.

Format ( object input, string format ) : string

Formats the specified input.

FormatAsCurrency ( object input ) : string

Formats the specified input as currency using the CurrencySymbol from Global Attributes

FromJSON ( object input ) : object

Returns a dynamic object from a JSON string

FromMarkdown ( string input ) : string

Converts Markdown to HTML

GeofencingGroupMembers ( DotLiquid context, object input, string groupTypeId, string groupTypeRoleId ) : List

Gets the groups of selected type that geofence the selected person

GeofencingGroups ( DotLiquid context, object input, string groupTypeId ) : List

Gets the groups of selected type that geofence the selected person

Group ( DotLiquid context, object input, string groupId, string status = "Active" ) : List

Groups the specified context.

Groups ( DotLiquid context, object input, string groupTypeId, string status = "Active" ) : List

Gets the groups of selected type that person is a member of

GroupsAttended ( DotLiquid context, object input, string groupTypeId ) : List

Gets the groups of selected type that person is a member of which they have attended at least once

HasRightsTo ( DotLiquid context, object input, string verb, string typeName = "" ) : bool

Determines whether [has rights to] [the specified context].

HtmlDecode ( string input ) : string

Decodes an HTML string.

Humanize ( string input ) : string

takes computer-readible-formats and makes them human readable

HumanizeDateTime ( object input, object compareDate = null ) : string

takes a date time and compares it to RockDateTime.Now and returns a human friendly string like 'yesterday' or '2 hours ago'

HumanizeTimeSpan ( object sStartDate, object sEndDate, object precision ) : string

takes two datetimes and humanizes the difference like '1 day'. Supports 'Now' as end date

HumanizeTimeSpan ( object sStartDate, object sEndDate, string unit = "Day", string direction = "min" ) : string

Humanizes the time span.

LastAttendedGroupOfType ( DotLiquid context, object input, string groupTypeId ) : Attendance

Gets the last attendance item for a given person in a group of type provided

Minus ( object input, object operand ) : object

Minus - Overriding this to change the logic. This one does the math if the input can be parsed as a int

NearestGroup ( DotLiquid context, object input, string groupTypeId ) : Rock.Model.Group

Returnes the nearest group of a specific type.

NumberToOrdinal ( string input ) : string

takes 1, 2 and returns 1st, 2nd

NumberToOrdinalWords ( string input ) : string

takes 1,2 and returns first, second

NumberToRomanNumerals ( string input ) : string

takes 1,2 and returns I, II, IV

NumberToWords ( string input ) : string

takes 1,2 and returns one, two

ObfuscateEmail ( string input ) : string

obfuscate a given email

Page ( string input, string parm ) : object

Pages the specified input.

PageRedirect ( string input ) : string

Redirects the specified input.

Parents ( DotLiquid context, object input ) : List

Gets the parents of the person

PersonByAliasId ( DotLiquid context, object input ) : Person

Persons the by alias identifier.

PersonByGuid ( DotLiquid context, object input ) : Person

Persons the by unique identifier.

PersonById ( DotLiquid context, object input ) : Person

Persons the by identifier.

PhoneNumber ( DotLiquid context, object input, string phoneType = "Home", bool countryCode = false ) : string

Gets an number for a person object

Pluralize ( string input ) : string

pluralizes string

PluralizeForQuantity ( string input, object quantity ) : string

pluralizes string based on the value for quantity

Plus ( object input, object operand ) : object

Addition - Overriding this to change the logic. The default filter will concat if the type is string. This one does the math if the input can be parsed as a int

Possessive ( string input ) : string

Possessives the specified input.

Postback ( object input, string command ) : string

creates a postback javascript function

Prepend ( object input, string @string ) : string

Prepend a string to another - this is a Rock version on this filter which takes any object

Property ( DotLiquid context, object input, string propertyKey, string qualifier = "" ) : object

Properties the specified context.

PropertyToKeyValue ( object input ) : object>.Dictionary

Converts a lava property to a key value pair

RegExMatch ( string input, string expression ) : bool

Tests if the inputted string matches the regex

Remove ( object input, string @string ) : string

Remove a substring - this is a Rock version on this filter which takes any object

RemoveFirst ( object input, string @string ) : string

Remove the first occurrence of a substring - this is a Rock version on this filter which takes any object

Replace ( object input, object @string, object replacement = null ) : string

Replace occurrences of a string with another - this is a Rock version on this filter which takes any object

ReplaceFirst ( object input, string @string, string replacement = "" ) : string

Replace the first occurrence of a string with another - this is a Rock version on this filter which takes any object

ReplaceLast ( object input, string search, string replacement = "" ) : string

Replace the last occurrence of a string with another - this is a Rock version on this filter which takes any object

Select ( object input, string selectKey ) : object

Selects the specified input.

SentenceCase ( string input ) : string

returns sentence in 'Sentence case'

SetPageTitle ( string input ) : string

adds a link tag to the head of the document

Shuffle ( object input ) : object

Rearranges an array in a random order

Singularize ( string input ) : string

singularize string

Slice ( string input, int start, int length = 1 ) : String

The slice filter returns a substring, starting at the specified index.

SortByAttribute ( DotLiquid context, object input, string attributeKey ) : object

Sorts the list of items by the specified attribute's value

SundayDate ( object input ) : string

Sundays the date.

Times ( object input, object operand ) : object

Times - Overriding this to change the logic. This one does the math if the input can be parsed as a int

TitleCase ( string input ) : string

returns sentence in 'Title Case'

ToCssClass ( string input ) : string

returns sentence in 'PascalCase'

ToJSON ( object input ) : string

To the json.

ToPascal ( string input ) : string

returns sentence in 'PascalCase'

ToQuantity ( string input, object quantity ) : string

formats string to be appropriate for a quantity

ToString ( int input ) : string

convert a integer to a string

Trim ( object input ) : string

Trims the specified input.

Where ( object input, string filterKey, object filterValue ) : object

Wheres the specified input.

WithFallback ( object input, string successText, string fallbackText ) : string

Withes the fallback.

ZebraPhoto ( DotLiquid context, object input, string size ) : string

Gets the profile photo for a person object in a string that zebra printers can use. If the person has no photo, a default silhouette photo (adult/child, male/female) photo is used. See http://www.rockrms.com/lava/person#ZebraPhoto for details.

ZebraPhoto ( DotLiquid context, object input, string size, double brightness = 1.0, double contrast = 1.0 ) : string

Gets the profile photo for a person object in a string that zebra printers can use. If the person has no photo, a default silhouette photo (adult/child, male/female) photo is used. See http://www.rockrms.com/lava/person#ZebraPhoto for details.

Private Methods

Méthode Description
GetCurrentPerson ( DotLiquid context ) : Person

Gets the current person.

GetDateFromObject ( object date ) : System.DateTime

Gets the date from object.

GetMonthsBetween ( System.DateTime from, System.DateTime to ) : int
GetOccurrenceDates ( string iCalString, int returnCount ) : List

Gets the occurrence dates.

GetPerson ( object input ) : Person

Gets the person.

GetRockContext ( DotLiquid context ) : RockContext

Gets the rock context.

ImageAdjust ( Bitmap originalImage, float brightness = 1.0f, float contrast = 1.0f, float gamma = 1.0f ) : Bitmap

Adjust the brightness, contrast or gamma of the given image.

Method Details

AddLinkTagToHead() public static méthode

adds a link tag to the head of the document
public static AddLinkTagToHead ( string input, string attributeName, string attributeValue ) : string
input string The input to use for the href of the tag.
attributeName string Name of the attribute.
attributeValue string The attribute value.
Résultat string

AddMetaTagToHead() public static méthode

adds a meta tag to the head of the document
public static AddMetaTagToHead ( string input, string attributeName, string attributeValue ) : string
input string The input to use for the content attribute of the tag.
attributeName string Name of the attribute.
attributeValue string The attribute value.
Résultat string

Address() public static méthode

Gets an address for a person object
public static Address ( DotLiquid context, object input, string addressType, string qualifier = "" ) : string
context DotLiquid The context.
input object The input.
addressType string Type of the address.
qualifier string The qualifier.
Résultat string

Append() public static méthode

Appends the specified input.
public static Append ( object input, string @string ) : string
input object The input.
@string string
Résultat string

Attribute() public static méthode

DotLiquid Attribute Filter
public static Attribute ( DotLiquid context, object input, string attributeKey, string qualifier = "" ) : object
context DotLiquid The context.
input object The input.
attributeKey string The attribute key.
qualifier string The qualifier.
Résultat object

Campus() public static méthode

Returns the Campus (or Campuses) that the Person belongs to
public static Campus ( DotLiquid context, object input, object option = null ) : object
context DotLiquid The context.
input object The input.
option object The option.
Résultat object

Ceiling() public static méthode

Ceilings the specified input.
public static Ceiling ( object input ) : object
input object The input.
Résultat object

Children() public static méthode

Gets the children of the person
public static Children ( DotLiquid context, object input ) : List
context DotLiquid The context.
input object The input.
Résultat List

Date() public static méthode

Formats a date using a .NET date format string
public static Date ( object input, string format ) : string
input object
format string
Résultat string

DateAdd() public static méthode

Adds a time interval to a date
public static DateAdd ( object input, int amount, string interval = "d" ) : DateTime?
input object The input.
amount int The amount.
interval string The interval.
Résultat DateTime?

DateDiff() public static méthode

takes two datetimes and returns the difference in the unit you provide
public static DateDiff ( object sStartDate, object sEndDate, string unit ) : Int64?
sStartDate object The s start date.
sEndDate object The s end date.
unit string The unit.
Résultat Int64?

DatesFromICal() public static méthode

Dateses from i cal.
public static DatesFromICal ( object input, object option = null ) : List
input object The input.
option object The option.
Résultat List

DaysFromNow() public static méthode

Dayses from now.
public static DaysFromNow ( object input ) : string
input object The input.
Résultat string

Default() public static méthode

Returns the passed default value if the value is undefined or empty, otherwise the value of the variable
public static Default ( object input, string defaultString ) : string
input object The input.
defaultString string The default string.
Résultat string

DividedBy() public static méthode

Divideds the by.
public static DividedBy ( object input, object operand, int precision = 2 ) : object
input object The input.
operand object The operand.
precision int The precision.
Résultat object

EscapeDataString() public static méthode

Converts a string to its escaped representation using Uri.EscapeDataString
public static EscapeDataString ( string input ) : string
input string The input.
Résultat string

Floor() public static méthode

Floors the specified input.
public static Floor ( object input ) : object
input object The input.
Résultat object

Format() public static méthode

Formats the specified input.
public static Format ( object input, string format ) : string
input object The input.
format string The format.
Résultat string

FormatAsCurrency() public static méthode

Formats the specified input as currency using the CurrencySymbol from Global Attributes
public static FormatAsCurrency ( object input ) : string
input object The input.
Résultat string

FromJSON() public static méthode

Returns a dynamic object from a JSON string
public static FromJSON ( object input ) : object
input object The input.
Résultat object

FromMarkdown() public static méthode

Converts Markdown to HTML
public static FromMarkdown ( string input ) : string
input string The input.
Résultat string

GeofencingGroupMembers() public static méthode

Gets the groups of selected type that geofence the selected person
public static GeofencingGroupMembers ( DotLiquid context, object input, string groupTypeId, string groupTypeRoleId ) : List
context DotLiquid The context.
input object The input.
groupTypeId string The group type identifier.
groupTypeRoleId string The group type role identifier.
Résultat List

GeofencingGroups() public static méthode

Gets the groups of selected type that geofence the selected person
public static GeofencingGroups ( DotLiquid context, object input, string groupTypeId ) : List
context DotLiquid The context.
input object The input.
groupTypeId string The group type identifier.
Résultat List

Group() public static méthode

Groups the specified context.
public static Group ( DotLiquid context, object input, string groupId, string status = "Active" ) : List
context DotLiquid The context.
input object The input.
groupId string The group identifier.
status string The status.
Résultat List

Groups() public static méthode

Gets the groups of selected type that person is a member of
public static Groups ( DotLiquid context, object input, string groupTypeId, string status = "Active" ) : List
context DotLiquid The context.
input object The input.
groupTypeId string The group type identifier.
status string The status.
Résultat List

GroupsAttended() public static méthode

Gets the groups of selected type that person is a member of which they have attended at least once
public static GroupsAttended ( DotLiquid context, object input, string groupTypeId ) : List
context DotLiquid The context.
input object The input.
groupTypeId string The group type identifier.
Résultat List

HasRightsTo() public static méthode

Determines whether [has rights to] [the specified context].
Could not determine type for the input provided. Consider passing it in (e.g. 'Rock.Model.Person')
public static HasRightsTo ( DotLiquid context, object input, string verb, string typeName = "" ) : bool
context DotLiquid The context.
input object The input.
verb string The verb.
typeName string Name of the type.
Résultat bool

HtmlDecode() public static méthode

Decodes an HTML string.
public static HtmlDecode ( string input ) : string
input string The input.
Résultat string

Humanize() public static méthode

takes computer-readible-formats and makes them human readable
public static Humanize ( string input ) : string
input string
Résultat string

HumanizeDateTime() public static méthode

takes a date time and compares it to RockDateTime.Now and returns a human friendly string like 'yesterday' or '2 hours ago'
public static HumanizeDateTime ( object input, object compareDate = null ) : string
input object The input.
compareDate object The compare date.
Résultat string

HumanizeTimeSpan() public static méthode

takes two datetimes and humanizes the difference like '1 day'. Supports 'Now' as end date
public static HumanizeTimeSpan ( object sStartDate, object sEndDate, object precision ) : string
sStartDate object The s start date.
sEndDate object The s end date.
precision object The precision.
Résultat string

HumanizeTimeSpan() public static méthode

Humanizes the time span.
public static HumanizeTimeSpan ( object sStartDate, object sEndDate, string unit = "Day", string direction = "min" ) : string
sStartDate object The s start date.
sEndDate object The s end date.
unit string The minimum unit.
direction string The direction.
Résultat string

LastAttendedGroupOfType() public static méthode

Gets the last attendance item for a given person in a group of type provided
public static LastAttendedGroupOfType ( DotLiquid context, object input, string groupTypeId ) : Attendance
context DotLiquid The context.
input object The input.
groupTypeId string The group type identifier.
Résultat Attendance

Minus() public static méthode

Minus - Overriding this to change the logic. This one does the math if the input can be parsed as a int
public static Minus ( object input, object operand ) : object
input object
operand object
Résultat object

NearestGroup() public static méthode

Returnes the nearest group of a specific type.
public static NearestGroup ( DotLiquid context, object input, string groupTypeId ) : Rock.Model.Group
context DotLiquid The context.
input object The input.
groupTypeId string The group type identifier.
Résultat Rock.Model.Group

NumberToOrdinal() public static méthode

takes 1, 2 and returns 1st, 2nd
public static NumberToOrdinal ( string input ) : string
input string
Résultat string

NumberToOrdinalWords() public static méthode

takes 1,2 and returns first, second
public static NumberToOrdinalWords ( string input ) : string
input string
Résultat string

NumberToRomanNumerals() public static méthode

takes 1,2 and returns I, II, IV
public static NumberToRomanNumerals ( string input ) : string
input string
Résultat string

NumberToWords() public static méthode

takes 1,2 and returns one, two
public static NumberToWords ( string input ) : string
input string
Résultat string

ObfuscateEmail() public static méthode

obfuscate a given email
public static ObfuscateEmail ( string input ) : string
input string
Résultat string

Page() public static méthode

Pages the specified input.
public static Page ( string input, string parm ) : object
input string The input.
parm string The parm.
Résultat object

PageRedirect() public static méthode

Redirects the specified input.
public static PageRedirect ( string input ) : string
input string The input.
Résultat string

Parents() public static méthode

Gets the parents of the person
public static Parents ( DotLiquid context, object input ) : List
context DotLiquid The context.
input object The input.
Résultat List

PersonByAliasId() public static méthode

Persons the by alias identifier.
public static PersonByAliasId ( DotLiquid context, object input ) : Person
context DotLiquid The context.
input object The input.
Résultat Person

PersonByGuid() public static méthode

Persons the by unique identifier.
public static PersonByGuid ( DotLiquid context, object input ) : Person
context DotLiquid The context.
input object The input.
Résultat Person

PersonById() public static méthode

Persons the by identifier.
public static PersonById ( DotLiquid context, object input ) : Person
context DotLiquid The context.
input object The input.
Résultat Person

PhoneNumber() public static méthode

Gets an number for a person object
public static PhoneNumber ( DotLiquid context, object input, string phoneType = "Home", bool countryCode = false ) : string
context DotLiquid The context.
input object The input.
phoneType string Type of the phone number.
countryCode bool Whether or not there should be a country code returned
Résultat string

Pluralize() public static méthode

pluralizes string
public static Pluralize ( string input ) : string
input string
Résultat string

PluralizeForQuantity() public static méthode

pluralizes string based on the value for quantity
public static PluralizeForQuantity ( string input, object quantity ) : string
input string The input.
quantity object The quantity.
Résultat string

Plus() public static méthode

Addition - Overriding this to change the logic. The default filter will concat if the type is string. This one does the math if the input can be parsed as a int
public static Plus ( object input, object operand ) : object
input object
operand object
Résultat object

Possessive() public static méthode

Possessives the specified input.
public static Possessive ( string input ) : string
input string The input.
Résultat string

Postback() public static méthode

creates a postback javascript function
public static Postback ( object input, string command ) : string
input object The input.
command string The command.
Résultat string

Prepend() public static méthode

Prepend a string to another - this is a Rock version on this filter which takes any object
public static Prepend ( object input, string @string ) : string
input object
@string string
Résultat string

Property() public static méthode

Properties the specified context.
public static Property ( DotLiquid context, object input, string propertyKey, string qualifier = "" ) : object
context DotLiquid The context.
input object The input.
propertyKey string The property key.
qualifier string The qualifier.
Résultat object

PropertyToKeyValue() public static méthode

Converts a lava property to a key value pair
public static PropertyToKeyValue ( object input ) : object>.Dictionary
input object The input.
Résultat object>.Dictionary

RegExMatch() public static méthode

Tests if the inputted string matches the regex
public static RegExMatch ( string input, string expression ) : bool
input string The input.
expression string The regex expression.
Résultat bool

Remove() public static méthode

Remove a substring - this is a Rock version on this filter which takes any object
public static Remove ( object input, string @string ) : string
input object
@string string
Résultat string

RemoveFirst() public static méthode

Remove the first occurrence of a substring - this is a Rock version on this filter which takes any object
public static RemoveFirst ( object input, string @string ) : string
input object
@string string
Résultat string

Replace() public static méthode

Replace occurrences of a string with another - this is a Rock version on this filter which takes any object
public static Replace ( object input, object @string, object replacement = null ) : string
input object
@string object
replacement object
Résultat string

ReplaceFirst() public static méthode

Replace the first occurrence of a string with another - this is a Rock version on this filter which takes any object
public static ReplaceFirst ( object input, string @string, string replacement = "" ) : string
input object
@string string
replacement string
Résultat string

ReplaceLast() public static méthode

Replace the last occurrence of a string with another - this is a Rock version on this filter which takes any object
public static ReplaceLast ( object input, string search, string replacement = "" ) : string
input object The input.
search string The search.
replacement string The replacement.
Résultat string

Select() public static méthode

Selects the specified input.
public static Select ( object input, string selectKey ) : object
input object The input.
selectKey string The select key.
Résultat object

SentenceCase() public static méthode

returns sentence in 'Sentence case'
public static SentenceCase ( string input ) : string
input string
Résultat string

SetPageTitle() public static méthode

adds a link tag to the head of the document
public static SetPageTitle ( string input ) : string
input string The input to use for the href of the tag.
Résultat string

Shuffle() public static méthode

Rearranges an array in a random order
public static Shuffle ( object input ) : object
input object
Résultat object

Singularize() public static méthode

singularize string
public static Singularize ( string input ) : string
input string
Résultat string

Slice() public static méthode

The slice filter returns a substring, starting at the specified index.
public static Slice ( string input, int start, int length = 1 ) : String
input string The input string.
start int If the passed index is negative, it is counted from the end of the string.
length int An optional second parameter can be passed to specify the length of the substring. If no second parameter is given, a substring of one character will be returned.
Résultat String

SortByAttribute() public static méthode

Sorts the list of items by the specified attribute's value
public static SortByAttribute ( DotLiquid context, object input, string attributeKey ) : object
context DotLiquid The context.
input object The input.
attributeKey string The attribute key.
Résultat object

SundayDate() public static méthode

Sundays the date.
public static SundayDate ( object input ) : string
input object The input.
Résultat string

Times() public static méthode

Times - Overriding this to change the logic. This one does the math if the input can be parsed as a int
public static Times ( object input, object operand ) : object
input object
operand object
Résultat object

TitleCase() public static méthode

returns sentence in 'Title Case'
public static TitleCase ( string input ) : string
input string
Résultat string

ToCssClass() public static méthode

returns sentence in 'PascalCase'
public static ToCssClass ( string input ) : string
input string
Résultat string

ToJSON() public static méthode

To the json.
public static ToJSON ( object input ) : string
input object The input.
Résultat string

ToPascal() public static méthode

returns sentence in 'PascalCase'
public static ToPascal ( string input ) : string
input string
Résultat string

ToQuantity() public static méthode

formats string to be appropriate for a quantity
public static ToQuantity ( string input, object quantity ) : string
input string The input.
quantity object The quantity.
Résultat string

ToString() public static méthode

convert a integer to a string
public static ToString ( int input ) : string
input int
Résultat string

Trim() public static méthode

Trims the specified input.
public static Trim ( object input ) : string
input object The input.
Résultat string

Where() public static méthode

Wheres the specified input.
public static Where ( object input, string filterKey, object filterValue ) : object
input object The input.
filterKey string The filter key.
filterValue object The filter value.
Résultat object

WithFallback() public static méthode

Withes the fallback.
public static WithFallback ( object input, string successText, string fallbackText ) : string
input object The input.
successText string The success text.
fallbackText string The fallback text.
Résultat string

ZebraPhoto() public static méthode

Gets the profile photo for a person object in a string that zebra printers can use. If the person has no photo, a default silhouette photo (adult/child, male/female) photo is used. See http://www.rockrms.com/lava/person#ZebraPhoto for details.
public static ZebraPhoto ( DotLiquid context, object input, string size ) : string
context DotLiquid The context.
input object The input, which is the person.
size string The size.
Résultat string

ZebraPhoto() public static méthode

Gets the profile photo for a person object in a string that zebra printers can use. If the person has no photo, a default silhouette photo (adult/child, male/female) photo is used. See http://www.rockrms.com/lava/person#ZebraPhoto for details.
public static ZebraPhoto ( DotLiquid context, object input, string size, double brightness = 1.0, double contrast = 1.0 ) : string
context DotLiquid The context.
input object The input, which is the person.
size string The size.
brightness double The brightness adjustment (-1.0 to 1.0).
contrast double The contrast adjustment (-1.0 to 1.0).
Résultat string