本文整理汇总了PHP中get_current_record函数的典型用法代码示例。如果您正苦于以下问题:PHP get_current_record函数的具体用法?PHP get_current_record怎么用?PHP get_current_record使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_current_record函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: emiglio_exhibit_builder_page_nav
function emiglio_exhibit_builder_page_nav($exhibitPage = null, $currentPageId)
{
if (!$exhibitPage) {
$exhibitPage = get_current_record('exhibit_page');
}
$parents = array();
$currentPage = get_record_by_id('Exhibit Page', $currentPageId);
while ($currentPage->parent_id) {
$currentPage = $currentPage->getParent();
array_unshift($parents, $currentPage->id);
}
$class = '';
$class .= $exhibitPage->id == $currentPageId ? 'current' : '';
$parent = array_search($exhibitPage->id, $parents) !== false ? ' parent' : '';
$html = '<li class="' . $class . $parent . '">' . '<a href="' . exhibit_builder_exhibit_uri(get_current_record('exhibit'), $exhibitPage) . '">' . metadata($exhibitPage, 'title') . '</a>';
$children = $exhibitPage->getChildPages();
if ($children) {
$html .= '<ul>';
foreach ($children as $child) {
$html .= emiglio_exhibit_builder_page_nav($child, $currentPageId);
release_object($child);
}
$html .= '</ul>';
}
$html .= '</li>';
return $html;
}
示例2: videoStreamSources
/**
* Get the sources for a video stream.
*
* @param Item $item
* @return array The list of sources.
*/
public function videoStreamSources($item = null)
{
$view = $this->view;
if (is_null($item)) {
$item = get_current_record('item');
}
$sources = array();
if (get_option('videostream_jwplayer_flash_streaming')) {
$segmentFlashUrl = metadata($item, array('Streaming Video', 'Video Streaming URL'));
$segmentFlashType = metadata($item, array('Streaming Video', 'Video Type'));
$segmentFlashFile = metadata($item, array('Streaming Video', 'Video Filename'));
$sources[] = array('file' => $segmentFlashUrl . $segmentFlashType . $segmentFlashFile);
}
if (get_option('videostream_jwplayer_http_streaming')) {
$segmentHttpDir = metadata($item, array('Streaming Video', 'HTTP Streaming Directory'));
$segmentHttpFile = metadata($item, array('Streaming Video', 'HTTP Video Filename'));
$sources[] = array('file' => $segmentHttpDir . $segmentHttpFile);
}
if (get_option('videostream_jwplayer_hls_streaming')) {
$segmentHlsDir = metadata($item, array('Streaming Video', 'HLS Streaming Directory'));
$segmentHlsFile = metadata($item, array('Streaming Video', 'HLS Video Filename'));
$sources[] = array('file' => $segmentHlsDir . $segmentHlsFile);
}
return $sources;
}
示例3: return_files_for_item
function return_files_for_item($options = array(), $wrapperAttributes = array('class' => 'item-file'), $item = null)
{
if (!$item) {
$item = get_current_record('item');
}
return return_files($item->Files, $options, $wrapperAttributes);
}
示例4: fc_isFedoraStream
/**
* Tests whether an item contains Fedora streams.
*
* @param Item $item The item.
* @return bool Is the item a Fedora stream?
* @author Eric Rochester <erochest@virginia.edu>
**/
function fc_isFedoraStream($item = null)
{
$item = $item ? $item : get_current_record('item');
$objects = get_db()->getTable('FedoraConnectorObject');
$isStream = $item && $objects->findByItem($item);
return $isStream;
}
示例5: filterDisplayElements
public function filterDisplayElements($elementSets)
{
if (!($item = get_current_record('item', false))) {
return $elementSets;
}
if (!metadata($item, array('Item Type Metadata', 'Player'))) {
return $elementSets;
}
$newElementSets = array();
foreach ($elementSets as $set => $elements) {
$newElements = $elements;
if ($set === "Moving Image Item Type Metadata") {
$newElements = array();
foreach ($elements as $key => $element) {
if ($key === "Player") {
$playerElement = $element;
} else {
$newElements[$key] = $element;
}
}
}
$newElementSets[$set] = $newElements;
}
if (isset($playerElement)) {
return array_merge(array('Player' => array('' => $playerElement)), $newElementSets);
} else {
return $elementSets;
}
}
示例6: _getRecordType
private function _getRecordType($params)
{
if (isset($params['module'])) {
switch ($params['module']) {
case 'exhibit-builder':
//ExhibitBuilder uses slugs in the params, so need to negotiate around those
//to dig up the record_id and model
if (!empty($params['page_slug_1'])) {
$page = get_current_record('exhibit_page', false);
$model = 'ExhibitPage';
} else {
if (!empty($params['item_id'])) {
$model = 'Item';
} else {
//TODO: check for other possibilities
}
}
break;
default:
$model = Inflector::camelize($params['module']) . ucfirst($params['controller']);
break;
}
} else {
$model = ucfirst(Inflector::singularize($params['controller']));
}
return $model;
}
示例7: rhythm_display_date_added
function rhythm_display_date_added($format = 'F j, Y', $item = null)
{
if (!$item) {
$item = get_current_record('item');
}
$dateAdded = metadata($item, 'added');
return date($format, strtotime($dateAdded));
}
示例8: __construct
/**
* Load viewer properties when instantiating class
*
* @param object the database object, defaults to standard Omeka db
* @return null
*/
public function __construct($db = null)
{
parent::__construct($db);
if (!empty($this->viewer)) {
$this->setViewerByName($this->viewer);
}
try {
$this->_item = get_current_record('Item');
} catch (Exception $e) {
//ignore for now
}
}
示例9: segmentTuningForm
/**
* Returns the form code for segmenting video for items.
*
* @param Item $item
* @return string Html string.
*/
public function segmentTuningForm($item = null)
{
$view = $this->view;
$db = get_db();
if (is_null($item)) {
$item = get_current_record('item');
}
$sources = $view->videoStreamSources($item);
$sources = version_compare(phpversion(), '5.4.0', '<') ? json_encode($sources) : json_encode($sources, JSON_UNESCAPED_SLASHES);
$html = $view->partial('common/segment-tuning-form.php', array('item' => $item, 'sources' => $sources, 'segment_start' => (string) metadata($item, array('Streaming Video', 'Segment Start')), 'segment_end' => (string) metadata($item, array('Streaming Video', 'Segment End')), 'segment_description' => (string) metadata($item, array('Dublin Core', 'Description'))));
return $html;
}
示例10: custom_item_image_gallery
function custom_item_image_gallery($attrs = array(), $imageType = 'square_thumbnail', $filesShow = false, $item = null)
{
if (!$item) {
$item = get_current_record('item');
}
$files = $item->Files;
if (!$files) {
return '';
}
$defaultAttrs = array('wrapper' => array('id' => 'item-images'), 'linkWrapper' => array(), 'link' => array(), 'image' => array());
$attrs = array_merge($defaultAttrs, $attrs);
$html = '';
if ($attrs['wrapper'] !== null) {
$html .= '<div ' . tag_attributes($attrs['wrapper']) . '>' . "\n";
}
foreach ($files as $file) {
if ($attrs['linkWrapper'] !== null) {
$html .= '<div ' . tag_attributes($attrs['linkWrapper']) . '>' . "\n";
}
$fileTitle = metadata($file, 'display title');
$webPath = $file->getWebPath('original');
// Taille de l'image en fonction du type de fichier
if (preg_match("/\\.jpg\$/", $webPath)) {
$imageType = 'fullsize';
$attrs['image'] = array('style' => 'max-width: 100%');
} else {
$imageType = 'thumbnail';
$attrs['image'] = array('style' => 'width:5em;vertical-align:middle;');
}
$image = file_image($imageType, $attrs['image'], $file);
$html .= '<h2 class="title" style="text-align:center;">' . $fileTitle . '</h2>' . "\n";
if ($filesShow) {
$html .= link_to($file, 'show', $image, $attrs['link']);
} else {
if (preg_match("/\\.pdf\$/", $webPath)) {
$html .= '<p style="padding:0 1em 1em 1em;color: #333333;">Télécharger le fichier PDF : ';
}
$linkAttrs = $attrs['link'] + array('href' => $webPath);
$html .= '<a ' . tag_attributes($linkAttrs) . '>' . $image . '</a>' . "\n";
if (preg_match("/\\.pdf\$/", $webPath)) {
$html .= '</p>';
}
}
if ($attrs['linkWrapper'] !== null) {
$html .= '</div>' . "\n";
}
}
if ($attrs['wrapper'] !== null) {
$html .= '</div>' . "\n";
}
return $html;
}
示例11: getBookReader
/**
* Get the specified BookReader.
*
* @param array $args Associative array of optional values:
* - (integer|Item) item: The item is the current one if not set.
* - (integer) page: set the page to be shown when including the iframe.
* - (boolean) embed_functions: include buttons (Zoom, Search...).
* - (integer) mode_page: allow to display 1 or 2 pages side-by-side.
* - (integer) part: can be used to display the specified part of a book.
*
* @return string. The html string corresponding to the BookReader.
*/
public function getBookReader($args = array())
{
if (!isset($args['item'])) {
$item = get_current_record('item');
} elseif ($args['item'] instanceof Item) {
$item = $args['item'];
} else {
$item = get_record_by_id('Item', (int) $args['item']);
}
if (empty($item)) {
return '';
}
$part = empty($args['part']) ? 0 : (int) $args['part'];
$page = empty($args['page']) ? '0' : $args['page'];
// Currently, all or none functions are enabled.
$embed_functions = isset($args['embed_functions']) ? $args['embed_functions'] : get_option('bookreader_embed_functions');
// TODO Count leaves, not files.
if ($item->fileCount() > 1) {
$mode_page = isset($args['mode_page']) ? $args['mode_page'] : get_option('bookreader_mode_page');
} else {
$mode_page = 1;
}
// Build url of the page with iframe.
$queryParams = array();
if ($part > 1) {
$queryParams['part'] = $part;
}
if (empty($embed_functions)) {
$queryParams['ui'] = 'embed';
}
$url = absolute_url(array('id' => $item->id), 'bookreader_viewer', $queryParams);
$url .= '#';
$url .= empty($page) ? '' : 'page/n' . $page . '/';
$url .= 'mode/' . $mode_page . 'up';
$class = get_option('bookreader_class');
if (!empty($class)) {
$class = ' class="' . $class . '"';
}
$width = get_option('bookreader_width');
if (!empty($width)) {
$width = ' width="' . $width . '"';
}
$height = get_option('bookreader_height');
if (!empty($height)) {
$height = ' height="' . $height . '"';
}
$html = '<div><iframe src="' . $url . '"' . $class . $width . $height . ' frameborder="0"></iframe></div>';
return $html;
}
示例12: videoStream
/**
* Get the specified JW Player to display a video stream.
*
* @param Item $item
* @return string Html string.
*/
public function videoStream($item = null)
{
$view = $this->view;
$db = get_db();
if (is_null($item)) {
$item = get_current_record('item');
}
$sources = $view->videoStreamSources($item);
$sources = version_compare(phpversion(), '5.4.0', '<') ? json_encode($sources) : json_encode($sources, JSON_UNESCAPED_SLASHES);
$partial = get_option('videostream_jwplayer_external_control') ? 'video-stream-external-control' : 'video-stream-internal-control';
$html = $view->partial('common/' . $partial . '.php', array('item' => $item, 'sources' => $sources, 'segment_start' => (string) metadata($item, array('Streaming Video', 'Segment Start')), 'segment_end' => (string) metadata($item, array('Streaming Video', 'Segment End')), 'segment_description' => (string) metadata($item, array('Dublin Core', 'Description'))));
if (get_option('videostream_display_current')) {
$html .= $view->partial('common/video-stream-current.php', array('item' => $item, 'video_filename' => (string) metadata($item, array('Streaming Video', 'Video Filename'))));
}
return $html;
}
示例13: testCanRetrieveCorrectExhibitPageValue
/**
* Tests whether metadata() returns the correct value for an exhibit page.
*
* @uses metadata()
**/
public function testCanRetrieveCorrectExhibitPageValue()
{
$exhibit = $this->helper->createNewExhibit(true, false, 'Exhibit Title', 'Exhibit Description', 'Exhibit Credits', 'exhibitslug');
$this->assertTrue($exhibit->exists());
$exhibitPage = $this->helper->createNewExhibitPage($exhibit, null, 'Exhibit Page Title', 'exhibitpageslug', 1, 'text');
$this->assertTrue($exhibitPage->exists());
$this->dispatch('exhibits/show/exhibitslug/exhibitpageslug');
$exhibitPage = get_current_record('exhibit_page');
$this->assertTrue($exhibitPage->exists());
$this->assertEquals('Exhibit Page Title', $exhibitPage->title);
$this->assertEquals('exhibitpageslug', $exhibitPage->slug);
// Exhibit Page Title
$this->assertEquals('Exhibit Page Title', metadata('exhibitPage', 'Title'));
// Exhibit Page Layout
$this->assertEquals('text', metadata('exhibitPage', 'Layout'));
// Exhibit Page Order
$this->assertEquals(1, metadata('exhibitPage', 'Order'));
// Exhibit Page Slug
$this->assertEquals('exhibitpageslug', metadata('exhibitPage', 'Slug'));
}
示例14: iiifCollection
/**
* Get the IIIF manifest for the specified collection.
*
* @param Record|integer|null $record Collection
* @param boolean $asJson Return manifest as object or as a json string.
* @return Object|string|null. The object or the json string corresponding to the
* manifest.
*/
public function iiifCollection($record = null, $asJson = true)
{
if (is_null($record)) {
$record = get_current_record('collection');
} elseif (is_numeric($record)) {
$record = get_record_by_id('Collection', (int) $record);
}
if (empty($record)) {
return null;
}
$recordClass = get_class($record);
if ($recordClass != 'Collection') {
return null;
}
$result = $this->_buildManifestCollection($record);
if ($asJson) {
return version_compare(phpversion(), '5.4.0', '<') ? json_encode($result) : json_encode($result, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
}
// Return as array
return $result;
}
示例15: iiifManifest
/**
* Get the IIIF manifest for the specified record.
*
* @param Record|integer|null $record
* @param boolean $asJson Return manifest as object or as a json string.
* @return Object|string|null. The object or the json string corresponding to the
* manifest.
*/
public function iiifManifest($record = null, $asJson = true, $alternative = false, $currentImage = false)
{
if (is_null($record)) {
$record = get_current_record('item');
} elseif (is_numeric($record)) {
$record = get_record_by_id('Item', (int) $record);
}
if (empty($record)) {
return null;
}
$recordClass = get_class($record);
if ($recordClass == 'Item') {
$result = $this->_buildManifestItem($record, $alternative, $currentImage);
} elseif ($recordClass == 'Collection') {
return $this->view->iiifCollection($record, $asJson);
} else {
return null;
}
if ($asJson) {
return version_compare(phpversion(), '5.4.0', '<') ? json_encode($result) : json_encode($result, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
}
// Return as array
return $result;
}