Table_Item¶
Package: Db\Table
- class Table_Item¶
extends Omeka_Db_Table
- Table_Item::filterByRange($select, $range)¶
Can specify a range of valid Item IDs or an individual ID
Parameters:
- $select (Omeka_Db_Select) –
- $range (string) – Example: 1-4, 75, 89
Returns: void
- Table_Item::filterBySearch($select, $params)¶
Run the search filter on the SELECT statement
Parameters:
- $select –
- $params –
Returns: void
- Table_Item::_simpleSearch($select, $terms)¶
Build the simple search.
The search query consists of a derived table that is INNER JOINed to the main SQL query. That derived table is a union of two SELECT queries. The first query searches the FULLTEXT index on the items_elements table, and the second query searches the tags table for every word in the search terms and assigns each found result a rank of ‘1’. That should make tagged items show up higher on the found results list for a given search.
Parameters:
- $select (Zend_Db_Select) –
- $terms –
- Table_Item::_advancedSearch($select, $terms)¶
Build the advanced search.
Parameters:
- $select (Zend_Db_Select) –
- $terms –
- Table_Item::filterByCollection($select, $collection)¶
Filter the SELECT statement based on an item’s collection
Parameters:
- $select –
- $collection –
Returns: void
- Table_Item::filterByItemType($select, $type)¶
Filter the SELECT statement based on the item Type
Parameters:
- $select –
- $type –
Returns: void
- Table_Item::filterByTags($select, $tags)¶
Query must look like the following in order to correctly retrieve items that have all the tags provided (in this example, all items that are tagged both ‘foo’ and ‘bar’):
SELECT i.id FROM omeka_items i WHERE ( i.id IN (SELECT tg.record_id as id FROM omeka_records_tags tg INNER JOIN omeka_tags t ON t.id = tg.tag_id WHERE t.name = ‘foo’ AND tg.record_type = ‘Item’) AND i.id IN (SELECT tg.record_id as id FROM omeka_records_tags tg INNER JOIN omeka_tags t ON t.id = tg.tag_id WHERE t.name = ‘bar’ AND tg.record_type = ‘Item’) ) ...
Parameters:
- $select –
- $tags –
Returns: void
- Table_Item::filterByExcludedTags($select, $tags)¶
Filter SELECT statement based on items that are not tagged with a specific set of tags
Parameters:
- $select –
- $tags –
Returns: void
- Table_Item::filterByHasDerivativeImage($select, $hasDerivativeImage = true)¶
Filter SELECT statement based on whether items have a derivative image file.
Parameters:
- $select –
- $hasDerivativeImage (boolean) – Whether items should have a derivative image file.
Returns: void
- Table_Item::applySearchFilters($select, $params)¶
Parameters:
- $select –
- $params –
Returns: void
- Table_Item::applySorting($select, $sortField, $sortDir)¶
Enables sorting based on ElementSet,Element field strings.
Parameters:
- $select (Omeka_Db_Select) –
- $sortField (string) – Field to sort on
- $sortDir (string) – Sorting direction (ASC or DESC)
- Table_Item::getSelect()¶
This is a kind of simple factory that spits out proper beginnings of SQL statements when retrieving items
Returns: Omeka_Db_Select
- Table_Item::findFirst()¶
Return the first item accessible to the current user.
Returns: Item|null
- Table_Item::findLast()¶
Return the last item accessible to the current user.
Returns: Item|null
- Table_Item::findPrevious($item)¶
Parameters:
- $item –
- Table_Item::findNext($item)¶
Parameters:
- $item –
- Table_Item::findNearby($item, $position = 'next')¶
Parameters:
- $item –
- $position –