Discussion list vault.
More...
|
| get_from_forum_id (int $forumid, bool $includehiddendiscussions, ?int $includepostsforuser, ?int $sortorder, int $limit, int $offset) |
| Get each discussion, first post, first and last post author for the given forum, considering timed posts, and pagination.
|
|
| get_from_forum_id_and_group_id (int $forumid, array $groupids, bool $includehiddendiscussions, ?int $includepostsforuser, ?int $sortorder, int $limit, int $offset) |
| Get each discussion, first post, first and last post author for the given forum, and the set of groups to display considering timed posts, and pagination.
|
|
| get_from_id (int $id) |
| Get the entity for the given id.
|
|
| get_from_ids (array $ids) |
| Get the list of entities for the given ids.
|
|
| get_total_discussion_count_from_forum_id (int $forumid, bool $includehiddendiscussions, ?int $includepostsforuser) |
| Count the number of discussions in the forum.
|
|
| get_total_discussion_count_from_forum_id_and_group_id (int $forumid, array $groupids, bool $includehiddendiscussions, ?int $includepostsforuser) |
| Count the number of discussions in all groups and the list of groups provided.
|
|
|
const | PAGESIZE_DEFAULT = 100 |
| Default limit.
|
|
const | SORTORDER_CREATED_ASC = 4 |
| Sort by created asc.
|
|
const | SORTORDER_CREATED_DESC = 3 |
| Sort by created desc.
|
|
const | SORTORDER_DISCUSSION_ASC = 8 |
| Sort by discussion name asc.
|
|
const | SORTORDER_DISCUSSION_DESC = 7 |
| Sort by discussion name desc.
|
|
const | SORTORDER_GROUP_ASC = 12 |
| Sort by group name asc.
|
|
const | SORTORDER_GROUP_DESC = 11 |
| Sort by group name desc.
|
|
const | SORTORDER_LASTPOST_ASC = 2 |
| Sort by oldest first.
|
|
const | SORTORDER_LASTPOST_DESC = 1 |
| Sort by newest first.
|
|
const | SORTORDER_REPLIES_ASC = 6 |
| Sort by number of replies desc.
|
|
const | SORTORDER_REPLIES_DESC = 5 |
| Sort by number of replies desc.
|
|
const | SORTORDER_STARTER_ASC = 10 |
| Sort by discussion starter's name asc.
|
|
const | SORTORDER_STARTER_DESC = 9 |
| Sort by discussion starter's name desc.
|
|
Discussion list vault.
This should be the only place that accessed the database.
This uses the repository pattern. See: https://designpatternsphp.readthedocs.io/en/latest/More/Repository/README.html
- Copyright
- 2019 Andrew Nicols andre.nosp@m.w@ni.nosp@m.cols..nosp@m.co.u.nosp@m.k
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ from_db_records()
mod_forum\local\vaults\discussion_list::from_db_records |
( |
array | $results | ) |
|
|
protected |
◆ generate_count_records_sql()
mod_forum\local\vaults\discussion_list::generate_count_records_sql |
( |
string | $wheresql = null | ) |
|
|
protected |
Build the SQL to be used in count_records_sql.
- Parameters
-
string | null | $wheresql | Where conditions for the SQL |
- Return values
-
◆ generate_get_records_sql() [1/2]
mod_forum\local\vaults\db_table_vault::generate_get_records_sql |
( |
string | $wheresql = null, |
|
|
string | $sortsql = null, |
|
|
?int | $userid = null ) |
|
abstractprotectedinherited |
◆ generate_get_records_sql() [2/2]
mod_forum\local\vaults\discussion_list::generate_get_records_sql |
( |
string | $wheresql = null, |
|
|
?string | $sortsql = null, |
|
|
?int | $userid = null ) |
|
protected |
Build the SQL to be used in get_records_sql.
- Parameters
-
string | null | $wheresql | Where conditions for the SQL |
string | null | $sortsql | Order by conditions for the SQL |
int | null | $userid | The ID of the user we are performing this query for |
- Return values
-
◆ get_db()
mod_forum\local\vaults\db_table_vault::get_db |
( |
| ) |
|
|
protectedinherited |
Get the moodle database.
- Return values
-
◆ get_entity_factory()
mod_forum\local\vaults\db_table_vault::get_entity_factory |
( |
| ) |
|
|
protectedinherited |
Get the entity factory.
- Return values
-
◆ get_favourite_alias()
mod_forum\local\vaults\discussion_list::get_favourite_alias |
( |
| ) |
|
|
protected |
Get the favourite table alias.
- Return values
-
◆ get_from_forum_id()
mod_forum\local\vaults\discussion_list::get_from_forum_id |
( |
int | $forumid, |
|
|
bool | $includehiddendiscussions, |
|
|
?int | $includepostsforuser, |
|
|
?int | $sortorder, |
|
|
int | $limit, |
|
|
int | $offset ) |
Get each discussion, first post, first and last post author for the given forum, considering timed posts, and pagination.
- Parameters
-
int | $forumid | The forum to fetch the discussion set for |
bool | $includehiddendiscussions | Whether to include hidden discussions or not |
int | null | $includepostsforuser | Which user to include posts for, if any |
int | $sortorder | The sort order to use |
int | $limit | The number of discussions to fetch |
int | $offset | The record offset |
- Return values
-
array | The set of data fetched |
◆ get_from_forum_id_and_group_id()
mod_forum\local\vaults\discussion_list::get_from_forum_id_and_group_id |
( |
int | $forumid, |
|
|
array | $groupids, |
|
|
bool | $includehiddendiscussions, |
|
|
?int | $includepostsforuser, |
|
|
?int | $sortorder, |
|
|
int | $limit, |
|
|
int | $offset ) |
Get each discussion, first post, first and last post author for the given forum, and the set of groups to display considering timed posts, and pagination.
- Parameters
-
int | $forumid | The forum to fetch the discussion set for |
int[] | $groupids | The list of real groups to filter on |
bool | $includehiddendiscussions | Whether to include hidden discussions or not |
int | null | $includepostsforuser | Which user to include posts for, if any |
int | $sortorder | The sort order to use |
int | $limit | The number of discussions to fetch |
int | $offset | The record offset |
- Return values
-
array | The set of data fetched |
◆ get_from_id()
mod_forum\local\vaults\db_table_vault::get_from_id |
( |
int | $id | ) |
|
|
inherited |
Get the entity for the given id.
- Parameters
-
int | $id | Identifier for the entity |
- Return values
-
◆ get_from_ids()
mod_forum\local\vaults\db_table_vault::get_from_ids |
( |
array | $ids | ) |
|
|
inherited |
Get the list of entities for the given ids.
- Parameters
-
- Return values
-
◆ get_hidden_post_sql()
mod_forum\local\vaults\discussion_list::get_hidden_post_sql |
( |
bool | $includehiddendiscussions, |
|
|
?int | $includepostsforuser ) |
|
protected |
Fetch any required SQL to respect timed posts.
- Parameters
-
bool | $includehiddendiscussions | Whether to include hidden discussions or not |
int | null | $includepostsforuser | Which user to include posts for, if any |
- Return values
-
array | The SQL and parameters to include |
◆ get_keyfield()
mod_forum\local\vaults\discussion_list::get_keyfield |
( |
?int | $sortmethod | ) |
|
|
protected |
Get the field to sort by.
- Parameters
-
- Return values
-
◆ get_legacy_factory()
mod_forum\local\vaults\db_table_vault::get_legacy_factory |
( |
| ) |
|
|
protectedinherited |
Get the legacy factory.
- Return values
-
◆ get_preprocessors()
mod_forum\local\vaults\discussion_list::get_preprocessors |
( |
| ) |
|
|
protected |
◆ get_sort_direction()
mod_forum\local\vaults\discussion_list::get_sort_direction |
( |
?int | $sortmethod | ) |
|
|
protected |
Get the sort direction.
- Parameters
-
- Return values
-
◆ get_table_alias()
mod_forum\local\vaults\discussion_list::get_table_alias |
( |
| ) |
|
|
protected |
◆ get_total_discussion_count_from_forum_id()
mod_forum\local\vaults\discussion_list::get_total_discussion_count_from_forum_id |
( |
int | $forumid, |
|
|
bool | $includehiddendiscussions, |
|
|
?int | $includepostsforuser ) |
Count the number of discussions in the forum.
- Parameters
-
int | $forumid | Id of the forum to count discussions in |
bool | $includehiddendiscussions | Include hidden dicussions in the count? |
int | null | $includepostsforuser | Include discussions created by this user in the count (only works if not including hidden discussions). |
- Return values
-
◆ get_total_discussion_count_from_forum_id_and_group_id()
mod_forum\local\vaults\discussion_list::get_total_discussion_count_from_forum_id_and_group_id |
( |
int | $forumid, |
|
|
array | $groupids, |
|
|
bool | $includehiddendiscussions, |
|
|
?int | $includepostsforuser ) |
Count the number of discussions in all groups and the list of groups provided.
- Parameters
-
int | $forumid | Id of the forum to count discussions in |
int[] | $groupids | List of group ids to include in the count (discussions in all groups will always be counted) |
bool | $includehiddendiscussions | Include hidden dicussions in the count? |
int | null | $includepostsforuser | Include discussions created by this user in the count (only works if not including hidden discussions). |
- Return values
-
◆ transform_db_records_to_entities()
mod_forum\local\vaults\db_table_vault::transform_db_records_to_entities |
( |
array | $records | ) |
|
|
protectedinherited |
Execute the defined preprocessors on the DB record results and then convert them into entities.
- Parameters
-
stdClass[] | $records | List of DB results |
- Return values
-
The documentation for this class was generated from the following file:
- mod/forum/classes/local/vaults/discussion_list.php