Function __global->get_catalogue_entries

Definitions

sources/catalogues.php

  • Fetch entries from database, with sorting if possible.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: array

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$catalogue_name ID_TEXT No No required parameter N/A N/A Name of the catalogue
$category_id ?AUTO_LINK No No required parameter N/A N/A The ID of the category for which the entries are being collected (null: no limitation)
$max ?integer No No required parameter N/A N/A The maximum number of entries to show on a single page of this this category (ignored if $select is not null) (null: all)
$start integer No No required parameter N/A N/A The entry number to start at (ignored if $select is not null)
$select ?mixed No No required parameter N/A N/A The entries to show, may be from other categories. Can either be SQL fragment (produced from Selectcode?), or array (null: use $start and $max)
$do_sorting boolean No No required parameter N/A N/A Whether to perform sorting
$filtercode ?array No No required parameter N/A N/A List of filters to apply (null: none). Each filter is a triple: ORd comparison key(s) [separated by pipe symbols], comparison type (one of '<', '>', '<=', '>=', '=', '~=', or '~'), comparison value
$order_by ID_TEXT No No required parameter N/A N/A Orderer
$direction ID_TEXT No No required parameter N/A N/A Order direction
$extra_where string No No Blank (empty string) N/A N/A Additional WHERE SQL to add on to query
$viewing_member_id ?MEMBER No No Null N/A N/A Viewing member ID (null: current user)
$check_perms boolean No No False N/A N/A Whether to check permissions (we normally leave false as we have pre-checked permissions for $category_id)

Returns

  • A tuple: whether sorting was done, number of entries returned, list of entries
  • Type: array
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Fetch entries from database, with sorting if possible.
 *
 * @param  ID_TEXT $catalogue_name Name of the catalogue
 * @param  ?AUTO_LINK $category_id The ID of the category for which the entries are being collected (null: no limitation)
 * @param  ?integer $max The maximum number of entries to show on a single page of this this category (ignored if $select is not null) (null: all)
 * @param  integer $start The entry number to start at (ignored if $select is not null)
 * @param  ?mixed $select The entries to show, may be from other categories. Can either be SQL fragment (produced from Selectcode?), or array (null: use $start and $max)
 * @param  boolean $do_sorting Whether to perform sorting
 * @param  ?array $filtercode List of filters to apply (null: none). Each filter is a triple: ORd comparison key(s) [separated by pipe symbols], comparison type (one of '<', '>', '<=', '>=', '=', '~=', or '~'), comparison value
 * @param  ID_TEXT $order_by Orderer
 * @param  ID_TEXT $direction Order direction
 * @param  string $extra_where Additional WHERE SQL to add on to query
 * @param  ?MEMBER $viewing_member_id Viewing member ID (null: current user)
 * @param  boolean $check_perms Whether to check permissions (we normally leave false as we have pre-checked permissions for $category_id)
 * @return array A tuple: whether sorting was done, number of entries returned, list of entries
 */

function get_catalogue_entries(string $catalogue_name, ?int $category_id, ?int $max, int $start, $select, bool $do_sorting, ?array $filtercode, string $order_by, string $direction, string $extra_where = '', ?int $viewing_member_id = null, bool $check_perms = false) : array