5 * This file is include from view.php and print.php
10 * This file defines, or redefines, the following variables:
12 * bool $userispivot Whether the user is the pivot.
13 * bool $fullpivot Whether the pivot should be displayed in full.
14 * bool $printpivot Whether the pivot should be displayed.
15 * string $pivotkey The property of the record at which the pivot is.
16 * int $count The number of records matching the request.
17 * array $allentries The entries matching the request.
18 * mixed $field Unset in this file.
19 * mixed $entry Unset in this file.
20 * mixed $canapprove Unset in this file.
22 * It relies on the following variables:
24 * object $glossary The glossary object.
25 * context $context The glossary context.
26 * mixed $hook The hook for the selected tab.
27 * string $sortkey The key to sort the records.
28 * string $sortorder The order of the sorting.
29 * int $offset The number of records to skip.
30 * int $entriesbypage The number of entries per page.
31 * string $mode The mode of browsing.
32 * string $tab The tab selected.
37 $pivotkey = 'concept';
41 case GLOSSARY_AUTHOR_VIEW
:
44 $field = ($sortkey == 'LASTNAME' ?
'LASTNAME' : 'FIRSTNAME');
45 list($allentries, $count) = glossary_get_entries_by_author($glossary, $context, $hook,
46 $field, $sortorder, $offset, $entriesbypage);
50 case GLOSSARY_CATEGORY_VIEW
:
51 $hook = (int) $hook; // Make sure it's properly casted to int.
52 list($allentries, $count) = glossary_get_entries_by_category($glossary, $context, $hook, $offset, $entriesbypage);
53 $pivotkey = 'categoryname';
54 if ($hook != GLOSSARY_SHOW_ALL_CATEGORIES
) {
59 case GLOSSARY_DATE_VIEW
:
61 $field = ($sortkey == 'CREATION' ?
'CREATION' : 'UPDATE');
62 list($allentries, $count) = glossary_get_entries_by_date($glossary, $context, $field, $sortorder,
63 $offset, $entriesbypage);
67 case GLOSSARY_APPROVAL_VIEW
:
70 list($allentries, $count) = glossary_get_entries_to_approve($glossary, $context, $hook, $sortkey, $sortorder,
71 $offset, $entriesbypage);
74 case GLOSSARY_STANDARD_VIEW
:
79 list($allentries, $count) = glossary_get_entries_by_search($glossary, $context, $hook, $fullsearch,
80 $sortkey, $sortorder, $offset, $entriesbypage);
85 list($allentries, $count) = glossary_get_entries_by_term($glossary, $context, $hook, $offset, $entriesbypage);
90 $entry = glossary_get_entry_by_id($hook);
91 $canapprove = has_capability('mod/glossary:approve', $context);
92 if ($entry && ($entry->glossaryid
== $glossary->id ||
$entry->sourceglossaryid
!= $glossary->id
)
93 && (!empty($entry->approved
) ||
$entry->userid
== $USER->id ||
$canapprove)) {
95 $allentries = array($entry);
98 $allentries = array();
100 unset($entry, $canapprove);
105 list($allentries, $count) = glossary_get_entries_by_letter($glossary, $context, $hook, $offset, $entriesbypage);