示例#1
0
 * @author Roger Curry, Grid Research Centre [curry@cpsc.ucalgary.ca]
 * @author Tingxi Tan, Grid Research Centre [txtan@cpsc.ucalgary.ca]
 * @link http://grc.ucalgary.ca/
 */
$guid = (int) get_input('guid');
$title = get_input('publicationtitle');
$access = (int) get_input('access_id');
$tags = get_input('tags');
$tags = string_to_tag_array($tags);
$data = (array) get_input('data', []);
$type = get_input('type');
if (empty($title) || empty($type)) {
    register_error(elgg_echo('publication:blank'));
    forward(REFERER);
}
$types = publications_get_types();
if (!in_array($type, $types)) {
    register_error(elgg_echo('publication:type_not_supported'));
    forward(REFERER);
}
// allow the validation of custom type data
$params = ['type' => $type];
$input_validation = elgg_trigger_plugin_hook("input_validation:{$type}", 'publications', $params, true);
if ($input_validation !== true) {
    // input validation failed, errors should be set by the plugin hook
    forward(REFERER);
}
$new_entity = true;
if (!empty($guid)) {
    $publication = get_entity($guid);
    if (empty($publication)) {
<?php

elgg_gatekeeper();
$guid = (int) get_input('guid');
$type = get_input('type');
$entity = false;
if (!empty($guid)) {
    elgg_entity_gatekeeper($guid, 'object', Publication::SUBTYPE);
    $entity = get_entity($guid);
    if (!$entity->canEdit()) {
        return;
    }
}
$supported_types = publications_get_types();
if (!in_array($type, $supported_types)) {
    echo elgg_echo('publication:type_not_supported');
    return;
}
if (elgg_view_exists("publications/publication/edit/{$type}")) {
    echo elgg_view("publications/publication/edit/{$type}", ['entity' => $entity]);
    return;
}