本文整理汇总了PHP中get_record_by_id函数的典型用法代码示例。如果您正苦于以下问题:PHP get_record_by_id函数的具体用法?PHP get_record_by_id怎么用?PHP get_record_by_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_record_by_id函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getCollectionName
public function getCollectionName()
{
if (is_numeric($this->collection_id) && $this->collection_id > 0) {
$collection = get_record_by_id('Collection', $this->collection_id);
return $collection->name;
}
}
开发者ID:bijanisa,项目名称:MultimediaDisplay,代码行数:7,代码来源:MmdAssign.php
示例2: afterSave
/**
* Update item after saving the tagging.
*/
protected function afterSave($args)
{
switch ($this->status) {
case 'proposed':
break;
case 'allowed':
case 'approved':
$item = get_record_by_id($this->record_type, $this->record_id);
$item->addTags($this->name);
try {
$item->save();
} catch (Exception $e) {
_log($e->getMessage());
}
break;
case 'rejected':
$item = get_record_by_id($this->record_type, $this->record_id);
$item->deleteTags($this->name);
try {
$item->save();
} catch (Exception $e) {
_log($e->getMessage());
}
break;
}
}
开发者ID:KelvinSmithLibrary,项目名称:playhouse,代码行数:29,代码来源:Tagging.php
示例3: 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;
}
开发者ID:sgbalogh,项目名称:peddler_clone4,代码行数:27,代码来源:custom.php
示例4: map
/**
* Map a row to an array that can be parsed by insert_item() or
* insert_files_for_item().
*
* @param array $row The row to map
* @param array $result
* @return array|false The result
*/
public function map($row, $result)
{
$collectionIdentifier = trim($row[$this->_columnName]);
// In "Manage" format, collection is determined at row level, according
// to field of the identifier, so only content of the cell is returned.
if ($this->_advanced) {
if (empty($collectionIdentifier) && !empty($this->_collectionId)) {
$collectionIdentifier = $this->_collectionId;
}
return $collectionIdentifier;
}
$result = false;
if ($collectionIdentifier !== '') {
if (is_numeric($collectionIdentifier) && (int) $collectionIdentifier > 0) {
$collection = get_record_by_id('Collection', $collectionIdentifier);
}
if (empty($collection)) {
$collection = $this->_getCollectionByTitle($collectionIdentifier);
}
if (empty($collection) && $this->_createCollection) {
$collection = $this->_createCollectionFromTitle($collectionIdentifier);
}
if ($collection) {
$result = $collection->id;
}
} else {
$result = $this->_collectionId;
}
return $result;
}
开发者ID:bulldozer2003,项目名称:CsvImport,代码行数:38,代码来源:Collection.php
示例5: viewAction
public function viewAction()
{
$id = $this->getParam('id');
$item = get_record_by_id('Item', $id);
if (empty($item)) {
throw new Omeka_Controller_Exception_404();
}
$relations = metadata($item, array('Dublin Core', 'Relation'), array('all' => true, 'no_escape' => true, 'no_filter' => true));
// Currently, only support gDoc urls.
$tableUrl = '';
$baseUrl = 'https://spreadsheets.google.com/feeds/list/';
$endUrl = '/public/values';
foreach ($relations as $relation) {
if (strpos($relation, $baseUrl) === 0 && substr_compare($relation, $endUrl, -strlen($endUrl), strlen($endUrl)) === 0) {
$tableUrl = $relation;
break;
}
}
if (empty($tableUrl)) {
$this->_helper->flashMessenger(__('This item has no table of images.'), 'error');
return $this->forward('show', 'items', 'default', array('module' => null, 'controller' => 'items', 'action' => 'show', 'id' => $item->id));
}
$this->_prepareViewer($item);
$this->view->tableUrl = $tableUrl . '?alt=json-in-script&callback=spreadsheetLoaded';
}
开发者ID:mjlassila,项目名称:BookReader,代码行数:25,代码来源:ViewerController.php
示例6: recordAction
public function recordAction()
{
$item = get_record_by_id("Item", $this->getParam('id'));
$this->view->item = $item;
$this->view->title = is_object($item) ? metadata($this->view->item, array('Dublin Core', 'Title')) : "Untitled";
$this->view->username = is_object($user = current_user()) ? $user->name : "";
$this->view->email = is_object($user) ? $user->email : "";
}
开发者ID:UCSCLibrary,项目名称:Omeka-AudioRecorder,代码行数:8,代码来源:RecordingController.php
示例7: setItem
/**
* Set item.
*
* @param integer|Item $item
*/
public function setItem($item)
{
if (empty($item)) {
$this->_item = null;
} elseif ($item instanceof Item) {
$this->_item = $item;
} else {
$this->_item = get_record_by_id('Item', (int) $item);
}
}
开发者ID:mjlassila,项目名称:BookReader,代码行数:15,代码来源:Creator.php
示例8: prepareObjectRelations
/**
* Prepare object item relations for display.
*
* @param Item $item
* @return array
*/
public static function prepareObjectRelations(Item $item)
{
$objects = get_db()->getTable('ItemRelationsRelation')->findByObjectItemId($item->id);
$objectRelations = array();
foreach ($objects as $object) {
if (!($item = get_record_by_id('item', $object->subject_item_id))) {
continue;
}
$objectRelations[] = array('item_relation_id' => $object->id, 'subject_item_id' => $object->subject_item_id, 'subject_item_title' => self::getItemTitle($item), 'relation_text' => $object->getPropertyText(), 'relation_description' => $object->property_description);
}
return $objectRelations;
}
开发者ID:uklibraries,项目名称:SpokeRelationships,代码行数:18,代码来源:SpokeRelationshipsPlugin.php
示例9: get_child_collections
function get_child_collections($collectionId)
{
if (plugin_is_active('CollectionTree')) {
$treeChildren = get_db()->getTable('CollectionTree')->getChildCollections($collectionId);
$childCollections = array();
foreach ($treeChildren as $treeChild) {
$childCollections[] = get_record_by_id('collection', $treeChild['id']);
}
return $childCollections;
}
return array();
}
开发者ID:AdrienneSerra,项目名称:Digitalsc,代码行数:12,代码来源:custom.php
示例10: playAction
public function playAction()
{
$id = $this->getParam('id');
if (empty($id)) {
throw new Omeka_Controller_Exception_404();
}
$recordType = $this->getParam('recordtype');
$record = get_record_by_id(Inflector::classify($recordType), $id);
if (empty($record)) {
throw new Omeka_Controller_Exception_404();
}
$this->view->record = $record;
}
开发者ID:pabalexa,项目名称:UniversalViewer4Omeka,代码行数:13,代码来源:PlayerController.php
示例11: getRecordByTitle
/**
* Get a record by title.
*
* @internal This function allows a quick check of records, because id can
* change between tests.
*/
protected function getRecordByTitle($title)
{
$record = null;
$elementSetName = 'Dublin Core';
$elementName = 'Title';
$element = $this->db->getTable('Element')->findByElementSetNameAndElementName($elementSetName, $elementName);
$elementTexts = $this->db->getTable('ElementText')->findBy(array('element_id' => $element->id, 'text' => $title), 1);
$elementText = reset($elementTexts);
if ($elementText) {
$record = get_record_by_id($elementText->record_type, $elementText->record_id);
}
return $record;
}
开发者ID:AdrienneSerra,项目名称:Digitalsc,代码行数:19,代码来源:CleanUrl_Test_AppTestCase.php
示例12: checkItemElement
public function checkItemElement()
{
$elements = false;
$title = "";
$elementTitle = "";
$output = "";
$returnLink = "<a href='javascript:window.history.back();'>" . __("Please return to the referring page.") . "</a>";
$itemId = isset($_GET["item"]) ? intval($_GET["item"]) : 0;
$elementId = isset($_GET["element"]) ? intval($_GET["element"]) : 0;
if (!$itemId) {
$output .= __("No item ID specified.") . " " . $returnLink;
} else {
if (!$elementId) {
$output .= __("No element ID specified.") . " " . $returnLink;
} else {
$db = get_db();
$itemExists = $db->fetchOne("SELECT count(*) FROM {$db->Items} WHERE id = {$itemId}");
$elementTitle = $db->fetchOne("SELECT name FROM {$db->Elements} WHERE id = {$elementId}");
if (!$itemExists) {
$output .= __("Item not found.") . " " . $returnLink;
} else {
if (!$elementTitle) {
$output .= __("Element not found.") . " " . $returnLink;
} else {
$sql = "SELECT * FROM {$db->ElementTexts}" . " WHERE record_id = {$itemId}" . " AND element_id = {$elementId}";
$elements = $db->fetchAll($sql);
if (!$elements) {
$output .= __("Specified elements not found in item.") . " " . $returnLink;
} else {
$title = __("Item") . " #" . $itemId;
$item = get_record_by_id('Item', $itemId);
$titleVerb = metadata($item, array('Dublin Core', 'Title'));
if ($titleVerb) {
$title .= ': "' . $titleVerb . '"';
}
$sql = "\n SELECT es.name\n FROM {$db->ElementSets} es\n JOIN {$db->Elements} el\n ON es.id = el.element_set_id\n WHERE el.id = {$elementId}\n ";
$elementSet = $db->fetchOne($sql);
$elementsFiltered = metadata($item, array($elementSet, $elementTitle), array('all' => true, 'no_filter' => false));
foreach (array_keys($elements) as $idx) {
$elements[$idx]["filtered"] = $elementsFiltered[$idx];
}
// echo "<pre>" . print_r($elements,true) . "</pre>"; die();
}
}
}
}
}
$result = array("elements" => $elements, "output" => $output, "title" => $title, "elementTitle" => $elementTitle);
// echo "<pre>" . print_r($result,true) . "</pre>"; die();
return $result;
}
开发者ID:GerZah,项目名称:plugin-ReorderElementTexts,代码行数:51,代码来源:IndexController.php
示例13: alternativeManifestAction
public function alternativeManifestAction()
{
$id = $this->getParam('id');
if (empty($id)) {
throw new Omeka_Controller_Exception_404();
}
$recordType = $this->getParam('recordtype');
$record = get_record_by_id(Inflector::classify($recordType), $id);
if (empty($record)) {
throw new Omeka_Controller_Exception_404();
}
$manifest = get_view()->iiifManifest($record, false, true, $this->getParam('image'));
$this->_sendJson($manifest);
}
开发者ID:kyfr59,项目名称:cg35,代码行数:14,代码来源:PresentationController.php
示例14: 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;
}
开发者ID:mjlassila,项目名称:BookReader,代码行数:61,代码来源:GetBookReader.php
示例15: perform
/**
* Perform this job.
*/
public function perform()
{
// Fetch file IDs according to the passed options.
$select = $this->_db->select()->from($this->_db->File, array('id'));
if ('has_derivative' == $this->_options['process_type']) {
$select->where('has_derivative_image = 1');
} else {
if ('has_no_derivative' == $this->_options['process_type']) {
$select->where('has_derivative_image = 0');
}
}
if (is_array($this->_options['mime_types'])) {
$select->where('mime_type IN (?)', $this->_options['mime_types']);
}
$fileIds = $select->query()->fetchAll(Zend_Db::FETCH_COLUMN);
// Iterate files and create derivatives.
foreach ($fileIds as $fileId) {
$file = get_record_by_id('file', $fileId);
// Register which image derivatives to create.
foreach ($this->_derivatives as $type => $constraint) {
$this->_imageCreator->addDerivative($type, $constraint);
}
// Create derivatives.
try {
$imageCreated = $this->_imageCreator->create(FILES_DIR . '/' . $file->getStoragePath('original'), $file->getDerivativeFilename(), $file->mime_type);
} catch (Exception $e) {
_log($e);
$imageCreated = false;
}
// Confirm that the file was derivable.
if (!$imageCreated) {
continue;
}
// Save the file record.
$file->has_derivative_image = 1;
$file->save();
// Delete existing derivative images and replace them with the
// temporary ones made during image creation above.
foreach ($this->_derivatives as $type => $constraint) {
$this->_storage->delete($file->getStoragePath($type));
$source = FILES_DIR . "/original/{$type}_" . $file->getDerivativeFilename();
$this->_storage->store($source, $file->getStoragePath($type));
}
// Release the file record to prevent memory leaks.
release_object($file);
}
}
开发者ID:kyfr59,项目名称:cg35,代码行数:50,代码来源:DerivativeImagesJob.php
示例16: fillPagesAction
/**
* Handle AJAX requests to fill transcription of an item from source
* element.
*/
public function fillPagesAction()
{
if (!$this->_checkAjax('fill-pages')) {
return;
}
// Handle action.
try {
$id = (int) $this->_getParam('id');
$scripto = ScriptoPlugin::getScripto();
if (!$scripto->documentExists($id)) {
$this->getResponse()->setHttpResponseCode(400);
return;
}
// Get some variables.
list($elementSetName, $elementName) = explode(':', get_option('scripto_source_element'));
$type = get_option('scripto_import_type');
$doc = $scripto->getDocument($id);
// Check all pages, created or not.
foreach ($doc->getPages() as $pageId => $pageName) {
// If the page doesn't exist, it is created automatically with
// text from source element.
$doc->setPage($pageId);
// Else, edit the transcription if the page is already created.
if ($doc->isCreatedPage()) {
$file = get_record_by_id('File', $pageId);
$transcription = $file->getElementTexts($elementSetName, $elementName);
$transcription = empty($transcription) ? '' : $transcription[0]->text;
$flagProtect = $doc->isProtectedTranscriptionPage();
if ($flagProtect) {
$doc->unprotectTranscriptionPage();
}
$doc->editTranscriptionPage($transcription);
// Automatic update of metadata.
$doc->setPageTranscriptionStatus();
$doc->setDocumentTranscriptionProgress();
$doc->setItemSortWeight();
$doc->exportPage($type);
if ($flagProtect) {
$doc->protectTranscriptionPage();
}
}
}
$this->getResponse()->setBody('success');
} catch (Exception $e) {
$this->getResponse()->setHttpResponseCode(500);
}
}
开发者ID:pulibrary,项目名称:Scripto,代码行数:51,代码来源:AjaxController.php
示例17: deleteAction
/**
* Delete display profile
*
* This action runs when a user deletes a given assignment.
*
* @return void
*/
public function deleteAction()
{
$flashMessenger = $this->_helper->FlashMessenger;
//delete the assignment
$assign_id = $this->_getParam('assign');
try {
if ($assign = get_record_by_id('MmdAssign', $assign_id)) {
$assign->delete();
$flashMessenger->addMessage('Assignment deleted successfully', 'success');
} else {
$flashMessenger->addMessage('Error deleting assignment. Profile not found.', 'error');
$this->forward('browse');
}
} catch (Exception $e) {
$flashMessenger->addMessage('Error deleting profile assignment', 'error');
}
//forward to browse
$this->forward('browse');
}
开发者ID:bijanisa,项目名称:MultimediaDisplay,代码行数:26,代码来源:AssignController.php
示例18: _registerElements
/**
* Define the form elements.
*
*@return void
*/
private function _registerElements($assign = null)
{
//require_once(dirname(dirname(__FILE__)).'/models/Assign.php');
//require_once(dirname(dirname(__FILE__)).'/models/Table/Assign.php');
if (is_object($assign)) {
$this->_assign = $assign;
} else {
if (is_numeric($assign)) {
$this->_assign = get_record_by_id('MmdAssign', $assign);
}
}
if (empty($this->_assign)) {
$this->_assign = new MmdAssign();
}
$assign = $this->_assign;
$db = get_db();
$table = $db->getTable('MmdProfile');
$profiles = $db->getTable('MmdProfile')->findPairsForSelectForm();
$types = $db->getTable('ItemType')->findPairsForSelectForm();
$itemTypes = array('0' => 'Assign No Item Type');
foreach ($types as $key => $value) {
$itemTypes[$key] = $value;
}
$cltns = $db->getTable('Collection')->findPairsForSelectForm();
$collections = array('0' => 'Assign No Collection');
foreach ($cltns as $key => $value) {
$collections[$key] = $value;
}
// Profile
$this->addElement('select', 'profile_id', array('label' => 'Display Profile', 'description' => 'Which display profile would you like to assign?', 'multiOptions' => $profiles, 'value' => (string) $assign->profile_id));
// Item Type
$this->addElement('select', 'item_type_id', array('label' => 'Item Type', 'description' => 'If you select an item type here, items of this type will be assigned to display using the selected profile.', 'multiOptions' => $itemTypes, 'value' => (string) $assign->item_type_id));
// Collection
$this->addElement('select', 'collection_id', array('label' => 'Collection', 'description' => 'If you select a collection here, items in this collection will be assigned to display using the selected profile.', 'multiOptions' => $collections, 'value' => (string) $assign->collection_id));
// Filetypes
$this->addElement('text', 'filetypes', array('label' => 'File Types', 'description' => 'Enter file extensions (without a period) here. Items with attached files with any of these extensions will be assigned to display with the selected profile. (e.g. "jpg,jpeg,png,gif,bmp")', 'value' => (string) $assign->filetypes));
$checked = $assign->default ? 0 : 1;
// Default
$this->addElement('select', 'default', array('label' => 'Default', 'description' => 'Should items assigned to this display profile use it by default, or display normally and include a link to this display?', 'multiOptions' => array('Use display profile by default', 'Link to display profile'), 'value' => $checked));
if (version_compare(OMEKA_VERSION, '2.2.1') >= 0) {
$this->addElement('hash', 'csrf_token');
}
}
开发者ID:bijanisa,项目名称:MultimediaDisplay,代码行数:48,代码来源:AssignForm.php
示例19: deleteAction
/**
* Handle AJAX requests to delete a record.
*/
public function deleteAction()
{
if (!$this->_checkAjax('delete')) {
return;
}
// Handle action.
try {
$id = (int) $this->_getParam('id');
$contributedItem = get_record_by_id('ContributionContributedItem', $id);
if (!$contributedItem) {
$this->getResponse()->setHttpResponseCode(400);
return;
}
// The contributed item is automatically deleted when the item is
// deleted.
$contributedItem->Item->delete();
} catch (Exception $e) {
$this->getResponse()->setHttpResponseCode(500);
}
}
开发者ID:KelvinSmithLibrary,项目名称:playhouse,代码行数:23,代码来源:AjaxController.php
示例20: get_type_description_old
function get_type_description_old($search_string)
{
_log("2 BEFORE GET_DB: ");
$db = get_db();
$sql = "\n SELECT items.id \n FROM {$db->Item} items \n JOIN {$db->ElementText} element_texts \n ON items.id = element_texts.record_id \n JOIN {$db->Element} elements \n ON element_texts.element_id = elements.id \n JOIN {$db->ElementSet} element_sets \n ON elements.element_set_id = element_sets.id \n WHERE element_sets.name = 'Dublin Core' \n AND elements.name = 'Identifier' \n AND element_texts.text = ?";
_log("3 BEFORE FETCHING: ");
$itemIds = $db->fetchAll($sql, $search_string);
# $itemIds = array("1000");
_log("4 AFTER FETCHING: ");
if (count($itemIds) > 0) {
//NOG EVEN MEE VERDER STOEIEN
$found_item = get_record_by_id('item', $itemIds[0]["id"]);
# print_pre($found_item);
# metadata($found_item, array('Dublin Core', 'Title'));
$temp_return = metadata($found_item, array('Dublin Core', 'Title')) . " - " . metadata($found_item, array('Dublin Core', 'Description'), array("snippet" => 140));
# print_pre($temp_return);
return $temp_return;
return "DOES exist";
}
return "Type doesn't exist";
}
开发者ID:CATCH-FACT,项目名称:plugin-VerhalenbankFunctions,代码行数:21,代码来源:functions_graveyard.php
注:本文中的get_record_by_id函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论