Ejemplo n.º 1
0
function get_create_forms($page)
{
    $parent_guid = 0;
    switch ($page[0]) {
        case "blog":
            echo "<h2>Add a Blog</h2>";
            elgg_load_library('elgg:blog');
            $body_vars = blog_prepare_form_vars();
            echo elgg_view_form('blog/save', array(), array_merge($body_vars, $vars));
            exit;
        case "event":
            echo "<h2>Add an Event</h2>";
            elgg_set_page_owner_guid(elgg_get_logged_in_user_guid());
            echo elgg_view("event_manager/forms/event/edit");
            exit;
        case "group":
            echo "<h2>" . elgg_echo('groups:add') . "</h2>";
            elgg_load_library('elgg:groups');
            elgg_set_page_owner_guid(elgg_get_logged_in_user_guid());
            elgg_push_breadcrumb($title);
            if (elgg_get_plugin_setting('limited_groups', 'groups') != 'yes' || elgg_is_admin_logged_in()) {
                $content = elgg_view('groups/edit');
            } else {
                $content = elgg_echo('groups:cantcreate');
            }
            echo $content;
            exit;
        case "project":
            echo "<h2>" . elgg_echo('projects:add') . "</h2>";
            $vars = projects_prepare_form_vars(null, $parent_guid);
            $content = elgg_view_form('projects/edit', array('enctype' => 'multipart/form-data'), $vars);
            echo $content;
            exit;
        case "page":
            elgg_load_library('elgg:pages');
            echo "<h2>" . elgg_echo('pages:add') . "</h2>";
            $vars = pages_prepare_form_vars(null, $parent_guid);
            $content = elgg_view_form('pages/edit', array(), $vars);
            echo $content;
            exit;
        case "answer":
            echo "<h2>" . elgg_echo('answers:add') . "</h2>";
            elgg_set_page_owner_guid(elgg_get_logged_in_user_guid());
            echo elgg_view("answers/forms/question", array('container_guid' => elgg_get_page_owner_guid()));
            exit;
        case "task":
            elgg_load_library('elgg:tasks');
            echo "<h2>" . elgg_echo('tasks:add') . "</h2>";
            $vars = tasks_prepare_form_vars(null, $parent_guid);
            $content = elgg_view_form('tasks/edit', array(), $vars);
            echo $content;
            exit;
    }
}
Ejemplo n.º 2
0
<?php

/**
 * Create a request for a project
 *
 * @package ElggPages
 */
gatekeeper();
$container_guid = (int) get_input('guid');
$container = get_entity($container_guid);
if (!$container) {
}
$parent_guid = 0;
$project_owner = $container;
if (elgg_instanceof($container, 'object')) {
    $parent_guid = $container->getGUID();
    $project_owner = $container->getContainerEntity();
}
elgg_set_page_owner_guid($project_owner->getGUID());
elgg_pop_breadcrumb();
elgg_push_breadcrumb(elgg_echo('projects'), elgg_get_site_url() . "projects");
$title = elgg_echo('requests:add');
elgg_push_breadcrumb($title);
$vars = projects_prepare_form_vars(null, $parent_guid);
$content = elgg_view_form('requests/add', array('enctype' => 'multipart/form-data'), $vars);
$sidebar .= elgg_view('projects/sidebar/search');
$sidebar .= elgg_view('projects/sidebar/searchByTag');
$body = elgg_view_layout('content', array('filter' => '', 'content' => $content, 'title' => $title, 'sidebar' => $sidebar));
echo elgg_view_page($title, $body);
Ejemplo n.º 3
0
 * Edit a project
 *
 * @package ElggPages
 */
gatekeeper();
$project_guid = (int) get_input('guid');
$project = get_entity($project_guid);
if (!$project) {
    register_error(elgg_echo('noaccess'));
    forward('');
}
$container = $project->getContainerEntity();
if (!$container) {
    register_error(elgg_echo('noaccess'));
    forward('');
}
elgg_set_page_owner_guid($container->getGUID());
elgg_pop_breadcrumb();
elgg_push_breadcrumb(elgg_echo('projects'), elgg_get_site_url() . "projects");
elgg_push_breadcrumb($project->title, $project->getURL());
if ($project->canEdit()) {
    $title = elgg_echo("projects:edit");
    $vars = projects_prepare_form_vars($project);
    $content = elgg_view_form('projects/edit', array('enctype' => 'multipart/form-data'), $vars);
} else {
    $content = elgg_echo("projects:noaccess");
}
$sidebar = elgg_view('projects/sidebar/search');
$sidebar .= elgg_view('projects/sidebar/searchByTag');
$body = elgg_view_layout('content', array('filter' => '', 'content' => $content, 'title' => $title, 'sidebar' => $sidebar));
echo elgg_view_page($title, $body);