/** * Filter the display of the Item Type element set, if present. * * @param array $elementsBySet * @return array */ protected function _filterItemTypeElements($elementsBySet) { if ($this->_record instanceof Item) { if ($this->_record->item_type_id) { // Overwrite elements assigned to the item type element set with only // those that belong to this item's particular item type. This is // necessary because, otherwise, all item type elements will be shown. $itemTypeElementSetName = $this->_record->getProperty('item_type_name') . ' ' . ElementSet::ITEM_TYPE_NAME; // Check to see if either the generic or specific Item Type element // set has been chosen, i.e. 'Item Type Metadata' or 'Document // Item Type Metadata', etc. $itemTypeElements = $this->_record->getItemTypeElements(); if (!empty($this->_elementSetsToShow)) { if (in_array($itemTypeElementSetName, $this->_elementSetsToShow) or in_array(ElementSet::ITEM_TYPE_NAME, $this->_elementSetsToShow)) { $elementsBySet[$itemTypeElementSetName] = $itemTypeElements; } } else { $elementsBySet[$itemTypeElementSetName] = $itemTypeElements; } } // Unset the existing 'Item Type' element set b/c it shows elements // for all item types. unset($elementsBySet[ElementSet::ITEM_TYPE_NAME]); } return $elementsBySet; }
/** * Get a property about this collection. * * Valid properties for a Collection include: * * (int) public * * (int) featured * * (string) added * * (string) modified * * (int) owner_id * * (int) total_items * * @param string $property The property to get, always lowercase. * @return mixed The value of the property */ public function getProperty($property) { switch ($property) { case 'total_items': return $this->totalItems(); default: return parent::getProperty($property); } }
/** * Get a property for display. * * @param string $property * @return mixed */ public function getProperty($property) { switch ($property) { case 'item_type_name': if ($type = $this->Type) { return $type->name; } else { return null; } case 'collection_name': if ($collection = $this->Collection) { return strip_formatting(metadata($collection, array('Dublin Core', 'Title'))); } else { return null; } case 'permalink': return record_url($this, null, true); case 'has_files': return (bool) $this->fileCount(); case 'file_count': return $this->fileCount(); case 'has_thumbnail': return $this->hasThumbnail(); case 'citation': return $this->getCitation(); default: return parent::getProperty($property); } }
/** * Get a property or special value of this record. * * @param string $property * @return mixed */ public function getProperty($property) { switch ($property) { case 'uri': return $this->getWebPath('original'); case 'fullsize_uri': return $this->getWebPath('fullsize'); case 'thumbnail_uri': return $this->getWebPath('thumbnail'); case 'square_thumbnail_uri': return $this->getWebPath('square_thumbnail'); case 'permalink': return absolute_url(array('controller' => 'files', 'action' => 'show', 'id' => $this->id)); case 'display_title': $titles = $this->getElementTexts('Dublin Core', 'Title'); if ($titles) { $title = strip_formatting($titles[0]->text); } else { $title = $this->original_filename; } return $title; default: return parent::getProperty($property); } }
/** * Get a property or special value of this record. * * @param string $property * @return mixed */ public function getProperty($property) { switch ($property) { case 'folder': return $this->getFolder(); case 'record': return $this->getRecord(); default: return parent::getProperty($property); } }
/** * Get a property or special value of this record. * * @param string $property * @return mixed */ public function getProperty($property) { switch ($property) { case 'uri': return $this->getWebPath('original'); case 'fullsize_uri': return $this->getWebPath('fullsize'); case 'thumbnail_uri': return $this->getWebPath('thumbnail'); case 'square_thumbnail_uri': return $this->getWebPath('square_thumbnail'); case 'permalink': return absolute_url(array('controller' => 'files', 'action' => 'show', 'id' => $this->id)); case 'display_title': return $this->getDisplayTitle(); default: return parent::getProperty($property); } }
public function getProperty($property) { switch ($property) { case 'added_username': $user = $this->getOwner(); return $user ? $user->username : __('Anonymous'); default: return parent::getProperty($property); } }
public function getProperty($property) { switch ($property) { case 'created_username': return $this->getCreatedByUser()->username; case 'modified_username': return $this->getModifiedByUser()->username; default: return parent::getProperty($property); } }
/** * Retrieve record metadata that is not stored as ElementTexts. * * @uses Omeka_Record_AbstractRecord::getProperty() * @param Omeka_Record_AbstractRecord $record * @param string $specialValue Field name. * @return mixed */ protected function _getRecordMetadata($record, $specialValue) { // Normalize to a valid record property. $property = str_replace(' ', '_', strtolower($specialValue)); return $record->getProperty($property); }