GetDashboardData
in package
Use case for retrieving dashboard data.
Tags
Table of Contents
Methods
- execute() : array{language_count: int, current_language_id: int|null, current_language_text_count: int, current_text_id: int|null, current_text_info: array|null, is_wordpress: bool, is_multi_user: bool}
- Execute the use case.
- getCurrentLanguageId() : int|null
- Get the current language ID from settings.
- getCurrentTextId() : int|null
- Get the current text ID from settings.
- getCurrentTextInfo() : array{exists: bool, title?: string, language_id?: int, language_name?: string, annotated?: bool}|null
- Get current text information for the dashboard.
- getLanguageCount() : int
- Get the count of languages in the database.
- getLanguageName() : string
- Get language name by ID.
- getTextCountForLanguage() : int
- Get the count of active (non-archived) texts for a language.
- isWordPressSession() : bool
- Check if user is on WordPress server with active session.
Methods
execute()
Execute the use case.
public
execute() : array{language_count: int, current_language_id: int|null, current_language_text_count: int, current_text_id: int|null, current_text_info: array|null, is_wordpress: bool, is_multi_user: bool}
Return values
array{language_count: int, current_language_id: int|null, current_language_text_count: int, current_text_id: int|null, current_text_info: array|null, is_wordpress: bool, is_multi_user: bool}getCurrentLanguageId()
Get the current language ID from settings.
private
getCurrentLanguageId() : int|null
Return values
int|null —Current language ID or null if not set
getCurrentTextId()
Get the current text ID from settings.
private
getCurrentTextId() : int|null
Return values
int|null —Current text ID or null if not set
getCurrentTextInfo()
Get current text information for the dashboard.
private
getCurrentTextInfo(int $textId) : array{exists: bool, title?: string, language_id?: int, language_name?: string, annotated?: bool}|null
Parameters
- $textId : int
-
Text ID to retrieve information for
Return values
array{exists: bool, title?: string, language_id?: int, language_name?: string, annotated?: bool}|nullgetLanguageCount()
Get the count of languages in the database.
private
getLanguageCount() : int
Return values
int —Number of languages
getLanguageName()
Get language name by ID.
private
getLanguageName(int $languageId) : string
Parameters
- $languageId : int
-
Language ID
Return values
string —Language name or empty string if not found
getTextCountForLanguage()
Get the count of active (non-archived) texts for a language.
private
getTextCountForLanguage(int|null $languageId) : int
Parameters
- $languageId : int|null
-
Language ID
Return values
int —Number of texts, 0 if no language selected
isWordPressSession()
Check if user is on WordPress server with active session.
private
isWordPressSession() : bool
Return values
bool —True if WordPress session is active