Example #1
0
<?php

/**
 * Elgg News plugin
 * @package amapnews
 */
elgg_load_library('elgg:amapnews');
$entity_guid = elgg_extract('guid', $vars, '');
$entity_unit = get_entity($entity_guid);
if (!elgg_instanceof($entity_unit, 'object', 'amapnews') || !$entity_unit->canEdit()) {
    register_error(elgg_echo('amapnews:unknown_amapnews'));
    forward(REFERRER);
}
$page_owner = elgg_get_page_owner_entity();
$title = elgg_echo('amapnews:edit');
elgg_push_breadcrumb($title);
$form_vars = array('name' => 'amapnews', 'enctype' => 'multipart/form-data');
$vars = amapnews_prepare_form_vars($entity_unit);
if (allow_post_on_groups() && elgg_instanceof($page_owner, 'group') && $page_owner->canEdit()) {
    $vars['group_guid'] = $page_owner->guid;
}
$content = elgg_view_form('amapnews/add', $form_vars, $vars);
$body = elgg_view_layout('content', array('filter' => '', 'content' => $content, 'title' => $title));
echo elgg_view_page($title, $body);
Example #2
0
<?php

/**
 * Elgg News plugin
 * @package amapnews
 */
elgg_load_library('elgg:amapnews');
$group_guid = (int) get_input('group_guid');
$group_entity = get_entity($group_guid);
$user = elgg_get_logged_in_user_entity();
$staff = $user->news_staff;
// post news only for admins or groups owners and staff (if allowed by admins)
if (elgg_is_admin_logged_in() || allow_post_on_groups() && elgg_instanceof($group_entity, 'group') && $group_entity->canEdit() || $staff) {
    // Get variables
    $title = get_input("title");
    $description = get_input("description");
    $excerpt = get_input("excerpt");
    $featured = get_input("featured");
    $photo = get_input("photo");
    $tags = get_input("tags");
    $access_id = (int) get_input("access_id");
    $guid = (int) get_input('amapnews_guid');
    $connected_guid = (int) get_input('connected_guid');
    $container_guid = get_input('container_guid', elgg_get_logged_in_user_guid());
    $comments_on = get_input("comments_on");
    elgg_make_sticky_form('amapnews');
    if (!$title) {
        register_error(elgg_echo('amapnews:save:missing_title'));
        forward(REFERER);
    }
    if (!$excerpt) {
Example #3
0
<?php

/**
 * Elgg News plugin
 * @package amapnews
 */
elgg_load_library('elgg:amapnews');
elgg_load_css('amapnews_css');
$connected_guid = elgg_extract('cguid', $vars, '');
$entity_unit = get_entity($connected_guid);
if ($entity_unit && !elgg_instanceof($entity_unit, 'object', 'amapnews')) {
    $vars = amapnews_prepare_form_vars();
    $vars['cguid'] = $connected_guid;
    $container = $entity_unit->getContainerEntity();
    if (allow_post_on_groups() && elgg_instanceof($container, 'group') && $container->canEdit()) {
        elgg_set_page_owner_guid($container->getGUID());
        $vars['group_guid'] = $container->getGUID();
    }
    $form_vars = array('name' => 'amapnewsForm', 'enctype' => 'multipart/form-data');
    $body = elgg_view_form('amapnews/add', $form_vars, $vars);
    echo $body;
} else {
    echo elgg_echo("amapnews:add:novalidentity");
}
Example #4
0
 * @package amapnews
 */
elgg_load_library('elgg:amapnews');
$guid = elgg_extract('guid', $vars, '');
$submitter = get_entity($guid);
$user = elgg_get_logged_in_user_entity();
$staff = $user->news_staff;
// post news only for admins or groups owners (if allowed by admins)
if (elgg_is_admin_logged_in() || allow_post_on_groups() && elgg_instanceof($submitter, 'group') && $submitter->canEdit() || $staff) {
    $title = elgg_echo('amapnews:add');
    $page_owner = elgg_get_page_owner_entity();
    $crumbs_title = $page_owner->name;
    if (elgg_instanceof($page_owner, 'group')) {
        elgg_push_breadcrumb($crumbs_title, "news/group/{$page_owner->guid}/all");
    }
    elgg_push_breadcrumb($title);
    // build sidebar
    $sidebar = '';
    // create form
    $form_vars = array('name' => 'amapnewsForm', 'enctype' => 'multipart/form-data');
    $vars = amapnews_prepare_form_vars();
    if (allow_post_on_groups() && elgg_instanceof($submitter, 'group') && $submitter->canEdit()) {
        $vars['group_guid'] = $submitter->guid;
    }
    $content = elgg_view_form('amapnews/add', $form_vars, $vars);
    $body = elgg_view_layout('content', array('content' => $content, 'title' => $title, 'sidebar' => $sidebar, 'filter' => ''));
    echo elgg_view_page($title, $body);
} else {
    register_error(elgg_echo('amapnews:add:noaccessforpost'));
    forward(REFERER);
}
Example #5
0
<?php

/**
 * Elgg News plugin
 * @package amapnews
 */
elgg_load_library('elgg:amapnews');
$page_owner = elgg_get_page_owner_entity();
if (!$page_owner) {
    forward('amapnews/all');
}
$user = elgg_get_logged_in_user_entity();
$staff = $user->news_staff;
// post news only for admins or groups owners (if allowed by admins)
if (elgg_is_admin_logged_in() || allow_post_on_groups() && elgg_instanceof($page_owner, 'group') && $page_owner->canEdit() || $staff) {
    elgg_register_title_button();
}
$options = array('type' => 'object', 'subtype' => 'amapnews', 'container_guid' => $page_owner->guid, 'limit' => 10, 'full_view' => false, 'view_toggle_type' => false);
$crumbs_title = $page_owner->name;
$title = elgg_echo('amapnews:owner', array($page_owner->name));
if (elgg_instanceof($page_owner, 'group')) {
    elgg_push_breadcrumb($crumbs_title);
} else {
    elgg_push_breadcrumb($crumbs_title);
}
$content = elgg_list_entities($options);
if (!$content) {
    $content = elgg_echo('amapnews:none');
}
$filter_context = '';
if ($page_owner->getGUID() == elgg_get_logged_in_user_guid()) {