tp TouchPointWP Meeting - TenthPres/TouchPoint-WP GitHub Wiki
tp\TouchPointWP\Meeting
Handle meeting content, particularly RSVPs.
- Full name:
\tp\TouchPointWP\Meeting - Parent class:
\tp\TouchPointWP\PostTypeCapable - This class implements:
\tp\TouchPointWP\Interfaces\api,\tp\TouchPointWP\Interfaces\module,\tp\TouchPointWP\Interfaces\involvementMeetingCommon
Constants
| Constant | Visibility | Type | Value |
|---|---|---|---|
POST_TYPE_WO_PRE |
public | "meeting" | |
POST_TYPE |
public | \tp\TouchPointWP\TouchPointWP::HOOK_PREFIX . self::POST_TYPE_WO_PRE | |
MEETING_META_KEY |
public | \tp\TouchPointWP\TouchPointWP::SETTINGS_PREFIX . "mtgId" | |
MEETING_START_META_KEY |
public | \tp\TouchPointWP\TouchPointWP::SETTINGS_PREFIX . "mtgStartDt" | |
MEETING_END_META_KEY |
public | \tp\TouchPointWP\TouchPointWP::SETTINGS_PREFIX . "mtgEndDt" | |
MEETING_FEAT_META_KEY |
public | \tp\TouchPointWP\TouchPointWP::SETTINGS_PREFIX . "mtgFeatured" | |
MEETING_STATUS_META_KEY |
public | \tp\TouchPointWP\TouchPointWP::SETTINGS_PREFIX . "status" | |
MEETING_INV_ID_META_KEY |
public | \tp\TouchPointWP\TouchPointWP::SETTINGS_PREFIX . "mtgInvId" | |
MEETING_IS_GROUP_MEMBER |
public | \tp\TouchPointWP\TouchPointWP::SETTINGS_PREFIX . "isGroupMember" | |
MEETING_GROUP_ROLE_META_KEY |
public | \tp\TouchPointWP\TouchPointWP::SETTINGS_PREFIX . "mtgGroupRole" | |
MEETING_GROUP_MEMBERS_META_KEY |
public | \tp\TouchPointWP\TouchPointWP::SETTINGS_PREFIX . "groupMtgId" | |
EDITION_MEETING_META_KEY |
public | \tp\TouchPointWP\TouchPointWP::SETTINGS_PREFIX . "editionMtgId" | |
GROUP_NONE |
public | "none" | |
GROUP_UNSCHEDULED |
public | "unscheduled" | |
GROUP_ALL |
public | "all" | |
SHORTCODE_GRID |
public | \tp\TouchPointWP\TouchPointWP::SHORTCODE_PREFIX . "Calendar" | |
STATUS_CANCELLED |
public | "cancelled" | |
STATUS_SCHEDULED |
public | "scheduled" | |
STATUS_UNKNOWN |
public | "unknown" | |
MEETING_LOCATION_META_KEY |
public | \tp\TouchPointWP\TouchPointWP::SETTINGS_PREFIX . "locationName" |
Properties
startDt
public ?\DateTimeImmutable $startDt
endDt
public ?\DateTimeImmutable $endDt
Methods
mtgId
Get the Meeting ID.
public mtgId(): int
registerScriptsAndStyles
Register scripts and styles to be used on display pages.
public static registerScriptsAndStyles(): void
- This method is static.
getTypeSettings
Get the PostTypeSettings object for Meeting Involvements.
public static getTypeSettings(): \tp\TouchPointWP\Involvement_PostTypeSettings
- This method is static.
fromPost
Create a Meeting object from an object from a WP_Post object.
public static fromPost(\WP_Post $post): \tp\TouchPointWP\Meeting
- This method is static. Parameters:
| Parameter | Type | Description |
|---|---|---|
$post |
\WP_Post |
Throws:
If the meeting can't be created from the post, an exception is thrown.
involvementId
Get the involvement ID (without necessarily instantiating the Involvement)
public involvementId(): int
involvement
Get the Involvement object associated with this Meeting.
public involvement(): \tp\TouchPointWP\Involvement
Throws:
getParent
Get the parent of this object which is a different class.
public getParent(): mixed
Returns null if there is no parent.
In cases where a meeting post is also an involvement post, it will return the involvement, which has the same post_id.
Otherwise, the parent is the post this meeting is under: the group (Edition or Cluster) it's in, or the involvement whose post it's under. With Meeting Grouping, that involvement can be a structure owner rather than the meeting's own involvement, which may be hidden. If neither applies, the meeting's own involvement is returned.
scheduleString
Get the meeting date/time in human-readable form.
public static scheduleString(int $objId, ?\tp\TouchPointWP\Meeting $obj = null): ?string
- This method is static. Parameters:
| Parameter | Type | Description |
|---|---|---|
$objId |
int | |
$obj |
?\tp\TouchPointWP\Meeting |
scheduleStringArray
Get the human-readable schedule for the meeting as a string or set of strings in an array.
public scheduleStringArray(): \tp\TouchPointWP\Utilities\StringableArray
notableAttributes
Get notable attributes, such as gender restrictions, as strings.
public notableAttributes(array|\tp\TouchPointWP\Utilities\StringableArray $exclude = []): \tp\TouchPointWP\Utilities\NotableAttributes
Parameters:
| Parameter | Type | Description |
|---|---|---|
$exclude |
array|\tp\TouchPointWP\Utilities\StringableArray | Attributes listed here will be excluded. (e.g. if shown for a parent, not |
| needed here.) |
getActionButtons
public getActionButtons(string|null $context = null, string $btnClass = "", bool $withTouchPointLink = true, bool $absoluteLinks = false): \tp\TouchPointWP\Utilities\StringableArray
Parameters:
| Parameter | Type | Description |
|---|---|---|
$context |
string|null | A string that gives filters some context for where the request is coming from |
$btnClass |
string | HTML class names to put into the buttons/links |
$withTouchPointLink |
bool | Whether to include a link to the item within TouchPoint. |
$absoluteLinks |
bool | Set true to make the links absolute, so they work from apps or emails. |
isMeetingGroup
public isMeetingGroup(): bool
groupRole
Get the grouping type of this group: one of the MeetingArray::ROLE_ constants. The previous behavior's collections have no stored role, and are treated as Clusters. Returns null if this isn't a group.
public groupRole(): ?string
isMeetingGroupMember
public isMeetingGroupMember(): bool
isFeatured
public isFeatured(): bool
status
Get the status of the meeting, in a code-oriented name (for css, etc.)
public status(): string
status_i18n
public status_i18n(bool $excludeScheduled = false): string|null
Parameters:
| Parameter | Type | Description |
|---|---|---|
$excludeScheduled |
bool | "Scheduled" is the default (and correct) status for most events. Set this to true |
| to return null instead of "Scheduled". |
api
Handle API requests
public static api(array $uri): bool
- This method is static. Parameters:
| Parameter | Type | Description |
|---|---|---|
$uri |
array | The request URI already parsed by parse_url() |
Return Value:
False if endpoint is not found. Should print the result.
getJsInstantiationString
public static getJsInstantiationString(): string
- This method is static.
getTouchPointId
Gets a TouchPoint item ID number, regardless of what type of object this is.
public getTouchPointId(): int
getRsvpButton
public getRsvpButton(string $btnClass = ""): string
Parameters:
| Parameter | Type | Description |
|---|---|---|
$btnClass |
string |
getRsvpLink
Get a link to RSVP for the meeting that can be used in emails, apps, or other contexts. This is a link to the RSVP function in WordPress, not an RSVP magic link used in TouchPoint emails.
public getRsvpLink(string $btnClass = ""): string
Parameters:
| Parameter | Type | Description |
|---|---|---|
$btnClass |
string |
postIsType
Indicates if the given post can be instantiated as a Meeting.
public static postIsType(\WP_Post $post): bool
- This method is static. Parameters:
| Parameter | Type | Description |
|---|---|---|
$post |
\WP_Post |
postTypeMatches
Indicates if the given post type name is the post type for this class.
public static postTypeMatches(string $postType): bool
- This method is static. Parameters:
| Parameter | Type | Description |
|---|---|---|
$postType |
string |
load
Loads the module and initializes the other actions.
public static load(): bool
- This method is static.
init
public static init(): void
- This method is static.
isSpanningMeetingOf
Whether a post is the spanning meeting of the post it's listed under, and so shouldn't be listed there. The parent is then an Edition, whose title and dates already come from that meeting.
public static isSpanningMeetingOf(\WP_Post $child, \WP_Post $parent): bool
- This method is static. Parameters:
| Parameter | Type | Description |
|---|---|---|
$child |
\WP_Post | A post being listed. |
$parent |
\WP_Post | The post it's listed under. |
filterTitle
Filters the titles of Editions. An Edition's title gets its year when two or more Editions under the same parent have the same title, so they can be told apart (e.g. "Christmas at Tenth 2025" and "Christmas at Tenth 2026").
public static filterTitle(string $title, int $postId = 0): string
If two of them start in the same year, the year wouldn't tell them apart, so none of them gets it. The stored title isn't changed.
- This method is static. Parameters:
| Parameter | Type | Description |
|---|---|---|
$title |
string | |
$postId |
int |
tense
Indicate the tense of the meeting.
public tense(): string
isPast
Indicates if the meeting is in the past.
public isPast(): bool
isMultiDay
Indicates if the meeting is multi-day.
public isMultiDay(): bool
isAllDay
Indicates if the meeting is labeled as all-day.
public isAllDay(): bool
Currently, TouchPoint doesn't have the capacity for this.
TODO When TouchPoint supports an all-day marker, add it here. #184
dateString
Get the date portion for the meeting start, formatted.
public dateString(): string
startTimeString
Get the time portion for the meeting start, formatted.
public startTimeString(): ?string
endTimeString
Get the time portion for the meeting end, formatted. Null if no end is defined or end is same as start.
public endTimeString(): ?string
hasGeo
Indicates whether a map of a single item can be displayed.
public hasGeo(): bool
asGeoIFace
Returns a standardized stdObject, or null if not viable.
public asGeoIFace(string $type = "unknown"): object|null
Parameters:
| Parameter | Type | Description |
|---|---|---|
$type |
string | 'loc' for navigator location, or 'ip' for ip address location |
locationName
Get the name of the location.
public locationName(): ?string
Inherited methods
post_id
Get the Post_id.
public post_id(): int
getPost
Get the WP_Post object corresponding to the object.
public getPost(bool $create = false): \WP_Post|null
Parameters:
| Parameter | Type | Description |
|---|---|---|
$create |
bool | Set true if the post should be created if it doesn't exist. This would need to be |
| implemented in each module, and is not implemented in most. |
fromPost
Create relevant objects from a given post
public static fromPost(\WP_Post $post): ?\tp\TouchPointWP\PostTypeCapable
- This method is static. Parameters:
| Parameter | Type | Description |
|---|---|---|
$post |
\WP_Post |
Throws:
permalink
Get the link for the post.
public permalink(): string
titleWithinParent
Get the title for display within its parent, such as in the parent's list of its parts. If the title starts with the parent's title and a separator, the parent's title is left out, since the parent's title is already visible: "Global Outreach Conference: Q&A Luncheon" is displayed as "Q&A Luncheon" within "Global Outreach Conference". The stored title isn't changed.
public titleWithinParent(?\WP_Post $parent = null): string
The result is filtered like any other title, so it can be printed in place of the_title().
Parameters:
| Parameter | Type | Description |
|---|---|---|
$parent |
?\WP_Post | The parent to display this within. Default is its own parent. |
titleInList
Get the title for display in a list. If the list is on the page of this one's parent, this is the title within its parent (see titleWithinParent()). Otherwise, such as in an archive or a list on some other page, this is displayed on its own, and its full title is needed.
public titleInList(): string
notableAttributes
Get notable attributes.
public notableAttributes(array|\tp\TouchPointWP\Utilities\StringableArray $exclude = []): \tp\TouchPointWP\Utilities\NotableAttributes
- This method is abstract. Parameters:
| Parameter | Type | Description |
|---|---|---|
$exclude |
array|\tp\TouchPointWP\Utilities\StringableArray | Attributes listed here will be excluded. (e.g. if shown for a parent, not needed here.) |
postIsType
Indicates if the given post can be instantiated as the given post type.
public static postIsType(\WP_Post $post): bool
- This method is static.* This method is abstract. Parameters:
| Parameter | Type | Description |
|---|---|---|
$post |
\WP_Post |
postTypeMatches
Indicates if the given post type name is the post type for this class.
public static postTypeMatches(string $postType): bool
- This method is static.* This method is abstract. Parameters:
| Parameter | Type | Description |
|---|---|---|
$postType |
string |
getTouchPointId
Gets a TouchPoint item ID number, regardless of what type of object this is.
public getTouchPointId(): int
- This method is abstract.
requireAllObjectsInJs
If all objects need to be included in the JS,
public static requireAllObjectsInJs(bool $require = true): void
- This method is static. Parameters:
| Parameter | Type | Description |
|---|---|---|
$require |
bool | Whether all objects should be required. Almost always should be left with the default. |
jsonSerialize
Get the JS for instantiation.
public jsonSerialize(): object
getJsInstantiationString
Get the JS for instantiation.
public static getJsInstantiationString(): string
- This method is static.* This method is abstract.