本文整理汇总了PHP中set_current_record函数的典型用法代码示例。如果您正苦于以下问题:PHP set_current_record函数的具体用法?PHP set_current_record怎么用?PHP set_current_record使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_current_record函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sckls_random_featured_collection
function sckls_random_featured_collection()
{
$html = '';
$collection = get_db()->getTable('Collection')->findRandomFeatured();
if ($collection) {
set_current_record('collection', $collection);
$html .= '<a href="' . record_url($collection, null, true) . '" class="featured">';
$html .= ' <h6 class="header-label">Featured Collection</h6>';
$html .= ' <div class="overlay"></div>';
$items = get_records('Item', array('collection' => $collection->id), 8);
set_loop_records('items', $items);
if (has_loop_records('items')) {
$image = $items[0]->Files;
if ($image) {
$html .= '<div style="background-image: url(' . file_display_url($image[0], 'fullsize') . ');" class="img"></div>';
} else {
$html .= '<div style="background-image: url(' . img('defaultImage@2x.jpg') . ');" class="img default"></div>';
}
} else {
$html .= '<div style="background-image: url(' . img('defaultImage@2x.jpg') . ');" class="img default"></div>';
}
$html .= ' <span class="title">' . metadata('collection', array('Dublin Core', 'Title')) . '</span>';
$html .= '</a>';
} else {
$html .= '<h4 class="not-featured">No featured collections.</h4>';
}
return $html;
}
示例2: nl_getItemMarkup
/**
* Compile item metadata for the lazy-loaded `item_body` record attribute.
*
* @param Item $item The parent item.
* @param NeatlineRecord|null $record The record.
* @return string The item metadata.
*/
function nl_getItemMarkup($item, $record = null)
{
// Set the item on the view.
set_current_record('item', $item);
if (!is_null($record)) {
// Get exhibit slug and tags.
$slug = $record->getExhibit()->slug;
$tags = nl_explode($record->tags);
// First, try to render an exhibit-specific `item-[tag].php` template.
foreach ($tags as $tag) {
try {
return get_view()->render('exhibits/themes/' . $slug . '/item-' . $tag . '.php');
} catch (Exception $e) {
}
}
// Next, try to render an exhibit-specific `item.php` template.
try {
return get_view()->render('exhibits/themes/' . $slug . '/item.php');
} catch (Exception $e) {
}
}
// Default to the global `item.php` template, which is included in the
// core plugin and can also be overridden in the public theme:
return get_view()->render('exhibits/item.php');
}
示例3: testWithNoItemOnView
/**
* Tests that all_element_texts behaves the same when an item is
* set on the view and when it is directly passed.
*/
public function testWithNoItemOnView()
{
$item = new Item();
$item->item_type_id = 1;
$metadataOutput = all_element_texts($item, array('return_type' => 'array'));
set_current_record('item', $item, true);
// Compare runs with and without item set on view, they should be
// the same.
$this->assertEquals($metadataOutput, all_element_texts('item', array('return_type' => 'array')));
}
示例4: _createItemCitationString
/**
* Creates a test Item and returns a citation string.
*
* @todo This function, like Item::getCitation(), uses date() to generate a date
* accessed for the citation. This should be changed when we
* internationalize date outputs.
*
* @param string|null The Item title.
* @param string|null The Item creator.
* @return string The Item's citation string.
*/
protected function _createItemCitationString($title = null, $creator = null)
{
$elementTexts = array('Dublin Core' => array('Title' => array(array('text' => $title, 'html' => false)), 'Creator' => array(array('text' => $creator, 'html' => false))));
$item = new Item();
$item->addElementTextsByArray($elementTexts);
$item->save();
set_current_record('item', $item, true);
$siteTitle = option('site_title');
$dateAccessed = format_date(time(), Zend_Date::DATE_LONG);
$itemUrl = record_url('item', null, true);
$citationHtml = "“{$title},” <em>{$siteTitle}</em>, accessed {$dateAccessed}, {$itemUrl}.";
if ($creator) {
$citationHtml = "{$creator}, {$citationHtml}";
}
return $citationHtml;
}
示例5: tourJsonifier
public function tourJsonifier($tour)
{
// Add enumarations of the ordered items in this tour.
$items = array();
foreach ($tour->Items as $item) {
set_current_record('item', $item);
$location = get_db()->getTable('Location')->findLocationByItem($item, true);
// If it has a location, we'll build the itemMetadata array and push it to items
if ($location) {
$item_metadata = array('id' => $item->id, 'title' => metadata('item', array('Dublin Core', 'Title')), 'latitude' => $location['latitude'], 'longitude' => $location['longitude']);
array_push($items, $item_metadata);
}
}
// Create the array of data
$tour_metadata = array('id' => $tour->id, 'title' => $tour->title, 'description' => $tour->description, 'items' => $items);
return $tour_metadata;
}
示例6: rhythm_display_random_featured_item_squarethumb
function rhythm_display_random_featured_item_squarethumb()
{
$featuredItems = get_random_featured_items(1);
$featuredItem = $featuredItems[0];
$html = '<h2>Featured <span class="type-featured">Item</span></h2>';
if ($featuredItem) {
set_current_record('item', $featuredItem);
// Needed for transparent access of item metadata.
if (metadata('item', 'has thumbnail')) {
$html .= link_to_item(item_square_thumbnail(), array('class' => 'image'));
}
// Grab the 1st Dublin Core description field (first 150 characters)
$itemDescription = metadata('item', array('Dublin Core', 'Description'), array('snippet' => 150));
$html .= '<p><span class="title">' . link_to_item() . '</span> ' . $itemDescription . '</p>';
} else {
$html .= '<p>No featured items are available.</p>';
}
return $html;
}
示例7: itemToRSS
protected function itemToRSS($item)
{
$entry = array();
set_current_record('item', $item, true);
// Title is a CDATA section, so no need for extra escaping.
$entry['title'] = strip_formatting(metadata($item, array('Dublin Core', 'Title'), array('no_escape' => true)));
$entry['description'] = $this->buildDescription($item);
$entry['link'] = xml_escape(record_url($item, null, true));
$entry['lastUpdate'] = strtotime($item->added);
//List the first file as an enclosure (only one per RSS feed)
if (($files = $item->Files) && ($file = current($files))) {
$entry['enclosure'] = array();
$fileDownloadUrl = file_display_url($file);
$enc['url'] = $fileDownloadUrl;
$enc['type'] = $file->mime_type;
$enc['length'] = (int) $file->size;
$entry['enclosure'][] = $enc;
}
return $entry;
}
示例8: get_first_collection_images
function get_first_collection_images()
{
if (metadata('collection', 'total_items') > 0) {
/* find child items */
$collectionId = metadata('collection', 'id');
$childArray = get_child_collections($collectionId);
$thumbnailCount = 0;
$childCount = 0;
while ($thumbnailCount <= 3) {
$childID = $childArray[$childCount]['id'];
set_current_record('collection', get_record_by_id('collection', $childID));
while (loop('items') and $thumbnailCount <= 3) {
echo item_thumbnail();
$thumbnailCount++;
}
$childCount++;
}
} else {
while (loop('items', 4)) {
echo item_thumbnail();
}
return $html;
}
}
示例9: append
//.........这里部分代码省略.........
?>
<?php
$items = get_records('item', array('collection' => metadata('item', 'collection id'), 'sort_field' => 'Streaming Video,Segment Start'), null);
?>
<?php
set_loop_records('items', $items);
if (has_loop_records('items')) {
$items = get_loop_records('items');
}
?>
<?php
foreach (loop('items') as $item) {
?>
<?php
if (metadata('item', array('Streaming Video', 'Segment Type')) == 'Scene' && metadata('item', array('Streaming Video', 'Video Filename')) == $orig_video) {
?>
<div class="scene" id="<?php
echo metadata('item', array('Streaming Video', 'Segment Start'));
?>
" title="<?php
echo metadata('item', array('Streaming Video', 'Segment End'));
?>
" style="display:none;">
<h2>Current video segment:</h2>
<h3><?php
echo link_to_item(metadata('item', array('Dublin Core', 'Title')));
?>
</h3>
<div style="overflow:auto; max-height:150px;">
<p> <?php
echo metadata('item', array('Dublin Core', 'Description'));
?>
</p>
</div>
<p>Segment: <?php
echo metadata('item', array('Streaming Video', 'Segment Start'));
?>
--
<?php
echo metadata('item', array('Streaming Video', 'Segment End'));
?>
</p>
</div> <!-- end of loop div for display -->
<?php
}
?>
<?php
}
?>
<hr style="color:lt-gray;"/>
<?php
set_current_record('item', $orig_item);
?>
<script type="text/javascript">
function getElementsByClass(searchClass, domNode, tagName)
{
if (domNode == null) {
domNode = document;
}
if (tagName == null) {
tagName = '*';
}
var el = new Array();
var tags = domNode.getElementsByTagName(tagName);
var tcl = " "+searchClass+" ";
for (i=0,j=0; i<tags.length; i++) {
var test = " " + tags[i].className + " ";
if (test.indexOf(tcl) != -1) {
el[j++] = tags[i];
}
}
return el;
}
jwplayer("jwplayer_plugin").onTime(function(event){
var ctime = "0:00:00";
var scenes;
var sel;
var i = 0;
ctime = getTimeString(jwplayer("jwplayer_plugin").getPosition());
scenes = getElementsByClass("scene");
for (i; i < scenes.length; i++) {
sel = scenes[i];
if (sel.getAttribute('id') <= ctime && sel.getAttribute('title') >= ctime) {
sel.style.display = 'block';
} else {
sel.style.display = 'none';
}
}
}
);
</script>
<?php
}
?>
<?php
}
示例10: get_record_by_id
<?php
if (!array_key_exists('timeline-id', $options)) {
return;
}
$timeline = get_record_by_id('NeatlineTimeTimeline', $options['timeline-id']);
if (!$timeline) {
return;
}
set_current_record('neatline_time_timeline', $timeline);
echo $this->partial('timelines/_timeline.php');
示例11: get_current_record
$currentPage = get_current_record('exhibit page');
?>
<?php
set_exhibit_pages_for_loop_by_exhibit();
?>
<?php
foreach (loop('exhibit_page') as $exhibitPage) {
?>
<?php
echo emiglio_exhibit_builder_page_nav($exhibitPage, $currentPageId);
?>
<?php
}
?>
<?php
set_current_record('exhibit page', $currentPage);
?>
</ul>
</nav>
</div>
<div id="exhibit-page-navigation">
<?php
if ($prevLink = exhibit_builder_link_to_previous_page()) {
?>
<div id="exhibit-nav-prev">
<?php
echo $prevLink;
?>
</div>
<?php
示例12: set_current_record
);
}
});
<?php
}
// end canProtect()
?>
});
</script>
<?php
$page_id = $this->doc->getId();
set_current_record('item', get_record_by_id('item', $page_id));
$collection = get_collection_for_item();
$collection_link = link_to_collection_for_item();
if (strpos($this->file['original_filename'], "/full/full/0/default.jpg")) {
$iiif_id = str_replace("/full/full/0/default.jpg", "", $this->file['original_filename']);
} else {
$iiif_id = str_replace("/full/90,/0/default.jpg", "", $this->file['original_filename']);
}
?>
<?php
$base_Dir = basename(getcwd());
?>
<?php
if (!is_admin_theme()) {
示例13: public_nav_tours
<?php
echo public_nav_tours();
?>
</nav>
<div class="pagination bottom"><?php
echo pagination_links();
?>
</div>
<?php
if (has_tours()) {
if (has_tours_for_loop()) {
$i = 1;
$tourimg = 0;
foreach ($tours as $tour) {
set_current_record('tour', $tour);
$tourdesc = nls2p(tour('description'));
echo '<article id="item-result-' . $i . '" class="item-result">';
echo '<h3>' . link_to_tour() . '</h3>';
if ($i <= 10) {
echo display_tour_thumb(get_tour_by_id(tour('id')), 0, $userDefined = null);
$tourimg++;
}
echo '<div class="item-description"><p>' . snippet($tourdesc, 0, 300) . '</p></div>';
echo '</article>';
$i++;
}
}
}
?>
示例14: get_view
<?php
/*
This is a hack.
Apparently, $this !== get_view().
So $this->simplePage != get_view()->simplePage
So when the subsequent helper functions try to get the current simple page, they would not find them,
Unless we explicitly set the current simple page.
If you try to fix this, see simple_pages_display_hierarchy, especially the call to get_view()->partial
*/
set_current_record('simple_pages_page', $this->simple_pages_page);
?>
<p><a href="<?php
echo html_escape(record_url($simple_pages_page));
?>
">
<?php
echo metadata('simple_pages_page', 'title');
?>
</a>
(<?php
echo metadata('simple_pages_page', 'slug');
?>
)<br/>
<?php
echo __('<strong>%1$s</strong> on %2$s', html_escape(metadata('simple_pages_page', 'modified_username')), html_escape(format_date(metadata('simple_pages_page', 'updated'), Zend_Date::DATETIME_SHORT)));
?>
<a class="edit" href="<?php
echo html_escape(record_url($simple_pages_page, 'edit'));
?>
示例15: __
?>
</h3>
<div style="overflow:auto; max-height:150px;">
<p><?php
echo $segmentDescription;
?>
</p>
</div>
<p><?php
echo __('Segment: %s - %s', $segmentStart, $segmentEnd);
?>
</p>
</div>
<?php
}
set_current_record('item', $orig_item);
?>
<hr style="color:lt-gray;" />
<script type="text/javascript">
function getElementsByClass(searchClass, domNode, tagName) {
if (domNode == null) {
domNode = document;
}
if (tagName == null) {
tagName = '*';
}
var el = new Array();
var tags = domNode.getElementsByTagName(tagName);
var tcl = " " + searchClass + " ";
for (i = 0, j = 0; i < tags.length; i++) {
var test = " " + tags[i].className + " ";