本文整理汇总了PHP中Publication::getGUID方法的典型用法代码示例。如果您正苦于以下问题:PHP Publication::getGUID方法的具体用法?PHP Publication::getGUID怎么用?PHP Publication::getGUID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Publication
的用法示例。
在下文中一共展示了Publication::getGUID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
$publication->title = $title;
if (!$publication->save()) {
// unable to save
continue;
}
}
if (!$publication instanceof Publication) {
// something went wrong
continue;
}
$publication->bibtext_reference = $ref;
$publication->pubtype = $type;
// set forwarding
$count++;
if ($forward_to_edit) {
$forward_url = "publications/edit/{$publication->getGUID()}";
} else {
$forward_url = $publication->getURL();
}
// start handling some custom fields
// start/end page
$pages = $entry->getPages();
if (is_array($pages)) {
$publication->page_from = elgg_extract('0', $pages);
$publication->page_to = elgg_extract('1', $pages);
} else {
$publication->page_from = $pages;
}
// authors
$authors = $entry->getRawAuthors();
if (!empty($authors)) {
示例2: saveBookEditors
/**
* Save book editors with a publication
*
* @param string $event the name of the event
* @param string $type the type of the event
* @param \Publication $entity supplied entity
*
* @return void
*/
public static function saveBookEditors($event, $type, $entity)
{
if (!$entity instanceof \Publication) {
return;
}
// cleanup book editors
$entity->deleteRelationships('book_editor');
unset($entity->book_editors);
$supported_types = ['book', 'inbook', 'incollection', 'proceedings', 'inproceedings'];
$type = get_input('type');
if (!in_array($type, $supported_types)) {
return;
}
$book_editors_guids = get_input('book_editors');
$book_editors_order = get_input('book_editors_order');
// save book editors
if (!empty($book_editors_guids)) {
foreach ($book_editors_guids as $book_editor) {
add_entity_relationship($entity->getGUID(), 'book_editor', $book_editor);
}
}
$pbook_editors = implode(',', $book_editors_order);
$entity->book_editors = $pbook_editors;
$entity->save();
}