本文整理汇总了PHP中elgg_view_form函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_view_form函数的具体用法?PHP elgg_view_form怎么用?PHP elgg_view_form使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_view_form函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _elgg_comments_page_handler
/**
* Page handler for generic comments manipulation.
*
* @param array $page
* @return bool
* @access private
*/
function _elgg_comments_page_handler($page)
{
switch ($page[0]) {
case 'edit':
elgg_gatekeeper();
if (empty($page[1])) {
register_error(elgg_echo('generic_comment:notfound'));
forward(REFERER);
}
$comment = get_entity($page[1]);
if (!$comment instanceof \ElggComment || !$comment->canEdit()) {
register_error(elgg_echo('generic_comment:notfound'));
forward(REFERER);
}
$target = $comment->getContainerEntity();
if (!$target instanceof \ElggEntity) {
register_error(elgg_echo('generic_comment:notfound'));
forward(REFERER);
}
$title = elgg_echo('generic_comments:edit');
elgg_push_breadcrumb($target->getDisplayName(), $target->getURL());
elgg_push_breadcrumb($title);
$params = array('entity' => $target, 'comment' => $comment, 'is_edit_page' => true);
$content = elgg_view_form('comment/save', null, $params);
$params = array('content' => $content, 'title' => $title, 'filter' => '');
$body = elgg_view_layout('content', $params);
echo elgg_view_page($title, $body);
return true;
break;
default:
return false;
break;
}
}
示例2: gvcontact_page_handler
/**
* gvcontact page handler
*
* @param array $page URL segements
* @param string $handler Handler identifier
* @return bool
*/
function gvcontact_page_handler($page, $handler)
{
$title = elgg_echo('gvcontact:contacttitle');
$content = elgg_view_form('gvcontact/contact');
$body = elgg_view_layout('one_column', array('content' => $content));
echo elgg_view_page($title, $body);
}
示例3: testCanRenderForm
public function testCanRenderForm()
{
$expected = elgg_view('forms/foo/bar.html');
$actual = elgg_view_form('foo/bar', ['class' => 'foo-bar'], ['baz2' => 'bar2']);
$this->assertNotEmpty($expected);
$this->assertNotEmpty($actual);
$normalize = function ($html) {
return preg_replace('~>\\s+~', ">", $html);
};
$this->assertEquals($normalize($expected), $normalize($actual));
}
示例4: reportedcontent_page_handler
/**
* Reported content page handler
*
* Serves the add report page
*
* @param array $page Array of page routing elements
*/
function reportedcontent_page_handler($page)
{
// only logged in users can report things
gatekeeper();
$content .= elgg_view_title(elgg_echo('reportedcontent:this'));
$content .= elgg_view_form('reportedcontent/add');
$sidebar = elgg_echo('reportedcontent:instructions');
$params = array('content' => $content, 'sidebar' => $sidebar);
$body = elgg_view_layout('one_sidebar', $params);
echo elgg_view_page(elgg_echo('reportedcontent:this'), $body);
}
示例5: poll_get_page_edit
function poll_get_page_edit($page_type, $guid = 0)
{
gatekeeper();
// Get the current page's owner
$page_owner = elgg_get_page_owner_entity();
if ($page_owner === false || is_null($page_owner)) {
$page_owner = elgg_get_logged_in_user_entity();
elgg_set_page_owner_guid($page_owner->guid);
}
$form_vars = array('id' => 'poll-edit-form');
// Get the post, if it exists
if ($page_type == 'edit') {
$poll = get_entity($guid);
if ($poll instanceof Poll) {
$container_guid = $poll->container_guid;
elgg_set_page_owner_guid($container_guid);
$title = elgg_echo('poll:editpost', array($poll->title));
$body_vars = array('fd' => poll_prepare_edit_body_vars($poll), 'entity' => $poll);
if ($poll->canEdit()) {
$content = elgg_view_form("poll/edit", $form_vars, $body_vars);
} else {
$content = elgg_echo('poll:permission_error');
}
$container = get_entity($container_guid);
if (elgg_instanceof($container, 'group')) {
elgg_push_breadcrumb($container->name, 'poll/group/' . $container->getGUID());
} else {
elgg_push_breadcrumb($container->name, 'poll/owner/' . $container->username);
}
elgg_push_breadcrumb(elgg_echo("poll:edit"));
} else {
$title = elgg_echo('poll:error_title');
$content = elgg_echo('poll:no_such_poll');
}
} else {
if ($guid) {
elgg_set_page_owner_guid($guid);
$container = get_entity($guid);
elgg_push_breadcrumb($container->name, 'poll/group/' . $container->getGUID());
} else {
$user = elgg_get_logged_in_user_entity();
elgg_set_page_owner_guid($user->getGUID());
elgg_push_breadcrumb($user->name, 'poll/owner/' . $user->username);
}
elgg_push_breadcrumb(elgg_echo('poll:add'));
$title = elgg_echo('poll:addpost');
$body_vars = array('fd' => poll_prepare_edit_body_vars(), 'container_guid' => $guid);
$content = elgg_view_form("poll/edit", $form_vars, $body_vars);
}
$params = array('title' => $title, 'content' => $content, 'filter' => '');
$body = elgg_view_layout('content', $params);
// Display page
return elgg_view_page($title, $body);
}
示例6: sched_conf_get_page_content_edit
function sched_conf_get_page_content_edit($page_type, $guid)
{
$vars = array();
$vars['id'] = 'sched-conf-edit';
$vars['name'] = 'sched_conf_edit';
// just in case a feature adds an image upload
$vars['enctype'] = 'multipart/form-data';
$body_vars = array();
if ($page_type == 'edit') {
$title = elgg_echo('sched_conf:edit_conf_title');
$conf = get_entity((int) $guid);
if (elgg_instanceof($conf, 'object', 'conference') && $conf->canEdit()) {
$body_vars['conference'] = $conf;
$body_vars['form_data'] = sched_conf_prepare_edit_form_vars($conf);
$conf_container = get_entity($conf->container_guid);
if (elgg_instanceof($conf_container, 'group')) {
elgg_push_breadcrumb(elgg_echo('event_calendar:group_breadcrumb'), 'event_calendar/group/' . $conf->container_guid);
} else {
elgg_push_breadcrumb(elgg_echo('event_calendar:show_events_title'), 'event_calendar/list');
}
elgg_push_breadcrumb(elgg_echo('sched_conf:edit_conf_title'));
$content = elgg_view_form('sched_conf/edit', $vars, $body_vars);
} else {
$content = elgg_echo('sched_conf:error_edit');
}
} else {
$title = elgg_echo('sched_conf:add_conf_title');
if ($guid) {
// add to group
$group = get_entity($guid);
if (elgg_instanceof($group, 'group')) {
$body_vars['group_guid'] = $guid;
elgg_push_breadcrumb(elgg_echo('event_calendar:group_breadcrumb'), 'event_calendar/group/' . $guid);
elgg_push_breadcrumb(elgg_echo('sched_conf:add_conf_title'));
$body_vars['form_data'] = event_calendar_prepare_edit_form_vars();
$content = elgg_view_form('sched_conf/edit', $vars, $body_vars);
} else {
$content = elgg_echo('sched_conf:no_group');
}
} else {
elgg_push_breadcrumb(elgg_echo('event_calendar:show_events_title'), 'event_calendar/list');
elgg_push_breadcrumb(elgg_echo('sched_conf:add_conf_title'));
$body_vars['form_data'] = sched_conf_prepare_edit_form_vars();
$content = elgg_view_form('sched_conf/edit', $vars, $body_vars);
}
}
$params = array('title' => $title, 'content' => $content, 'filter' => '');
$body = elgg_view_layout("content", $params);
return elgg_view_page($title, $body);
}
示例7: reportedcontent_page_handler
/**
* Reported content page handler
*
* Serves the add report page
*
* @param array $page Array of page routing elements
* @return bool
*/
function reportedcontent_page_handler($page)
{
// only logged in users can report things
elgg_gatekeeper();
if (elgg_extract(0, $page) === 'add' && elgg_is_xhr()) {
echo elgg_view('resources/reportedcontent/add_form');
return true;
}
$title = elgg_echo('reportedcontent:this');
$content = elgg_view_form('reportedcontent/add');
$sidebar = elgg_echo('reportedcontent:instructions');
$params = array('title' => $title, 'content' => $content, 'sidebar' => $sidebar);
$body = elgg_view_layout('one_sidebar', $params);
echo elgg_view_page($title, $body);
return true;
}
示例8: poll_get_page_edit
function poll_get_page_edit($page_type, $guid = 0)
{
gatekeeper();
$form_vars = array('id' => 'poll-edit-form');
// Get the post, if it exists
if ($page_type == 'edit') {
$poll = get_entity($guid);
if (!$poll instanceof Poll) {
register_error(elgg_echo('poll:not_found'));
forward(REFERER);
}
if (!$poll->canEdit()) {
register_error(elgg_echo('poll:permission_error'));
forward(REFERER);
}
$container = $poll->getContainerEntity();
elgg_set_page_owner_guid($container->guid);
$title = elgg_echo('poll:editpost', array($poll->title));
$body_vars = array('fd' => poll_prepare_edit_body_vars($poll), 'entity' => $poll);
if ($container instanceof ElggGroup) {
elgg_push_breadcrumb($container->name, 'poll/group/' . $container->guid);
} else {
elgg_push_breadcrumb($container->name, 'poll/owner/' . $container->username);
}
elgg_push_breadcrumb(elgg_echo("poll:edit"));
} else {
if ($guid) {
$container = get_entity($guid);
elgg_push_breadcrumb($container->name, 'poll/group/' . $container->guid);
} else {
$container = elgg_get_logged_in_user_entity();
elgg_push_breadcrumb($container->name, 'poll/owner/' . $container->username);
}
elgg_set_page_owner_guid($container->guid);
elgg_push_breadcrumb(elgg_echo('poll:add'));
$title = elgg_echo('poll:addpost');
$body_vars = array('fd' => poll_prepare_edit_body_vars(), 'container_guid' => $guid);
}
$content = elgg_view_form("poll/edit", $form_vars, $body_vars);
$params = array('title' => $title, 'content' => $content, 'filter' => '');
$body = elgg_view_layout('content', $params);
// Display page
return elgg_view_page($title, $body);
}
示例9: discussion_handle_edit_page
/**
* Edit or add a discussion topic
*
* @param string $type 'add' or 'edit'
* @param int $guid GUID of group or topic
*/
function discussion_handle_edit_page($type, $guid)
{
elgg_gatekeeper();
if ($type == 'add') {
$group = get_entity($guid);
if (!elgg_instanceof($group, 'group')) {
register_error(elgg_echo('group:notfound'));
forward();
}
// make sure user has permissions to add a topic to container
if (!$group->canWriteToContainer(0, 'object', 'groupforumtopic')) {
register_error(elgg_echo('groups:permissions:error'));
forward($group->getURL());
}
$title = elgg_echo('groups:addtopic');
elgg_push_breadcrumb($group->name, "discussion/owner/{$group->guid}");
elgg_push_breadcrumb($title);
$body_vars = discussion_prepare_form_vars();
$content = elgg_view_form('discussion/save', array(), $body_vars);
} else {
$topic = get_entity($guid);
if (!elgg_instanceof($topic, 'object', 'groupforumtopic') || !$topic->canEdit()) {
register_error(elgg_echo('discussion:topic:notfound'));
forward();
}
$group = $topic->getContainerEntity();
if (!elgg_instanceof($group, 'group')) {
register_error(elgg_echo('group:notfound'));
forward();
}
$title = elgg_echo('groups:edittopic');
elgg_push_breadcrumb($group->name, "discussion/owner/{$group->guid}");
elgg_push_breadcrumb($topic->title, $topic->getURL());
elgg_push_breadcrumb($title);
$body_vars = discussion_prepare_form_vars($topic);
$content = elgg_view_form('discussion/save', array(), $body_vars);
}
$params = array('content' => $content, 'title' => $title, 'sidebar' => elgg_view('discussion/sidebar/edit'), 'filter' => '');
$body = elgg_view_layout('content', $params);
echo elgg_view_page($title, $body);
}
示例10: elgg_stars_menu_setup
/**
* Add starrating menu items to rateable entities
*
* @param string $hook Equals 'register'
* @param string $type Equals 'menu:entity' or 'menu:title'
* @param array $return Current menu items
* @param array $params Additional params
* @return array Update menu items
*/
function elgg_stars_menu_setup($hook, $type, $return, $params)
{
if (!(bool) elgg_get_plugin_setting('extend_menu', 'elgg_stars')) {
return $return;
}
$entity = elgg_extract('entity', $params, false);
if (!elgg_instanceof($entity)) {
return $return;
}
$type_subtype_pairs = elgg_stars_get_rateable_type_subtype_pairs();
$type = $entity->getType();
$subtype = $entity->getSubtype();
if (!array_key_exists($type, $type_subtype_pairs)) {
return $return;
}
if ($subtype && array_search($subtype, $type_subtype_pairs[$type]) === false) {
return $return;
}
$starrating = array('name' => 'stars', 'priority' => 10, 'text' => elgg_view_form('stars/rate', array(), $params), 'href' => false, 'encode_text' => false, 'section' => 'rating');
$return[] = ElggMenuItem::factory($starrating);
return $return;
}
示例11: friend_collection_message_router
/**
* add in our own page in the friends/collections URI
*
* @param type $hook
* @param type $type
* @param type $return
* @param type $params
* @return boolean
*/
function friend_collection_message_router($hook, $type, $return, $params)
{
if (!($return['segments'][0] == 'collections' && $return['segments'][1] == 'message')) {
return $return;
}
$id = $return['segments'][2];
$collection = get_access_collection($id);
$owner = get_user($collection->owner_guid);
$can_message = elgg_trigger_plugin_hook('can_message', 'collection', array('collection_id' => $id), true);
if (!$collection || !$owner || !$owner->canEdit() || !$can_message) {
return $return;
}
$step = get_input('step', 1);
// if we don't havea subject/message we will force step 1
$subject = get_input('subject');
$message = get_input('message');
if (!$subject || !$message) {
$step = 1;
}
$title = elgg_echo('friend_collection_message:title', array($collection->name));
$collections_link = elgg_normalize_url('collections/' . $owner->username);
elgg_push_breadcrumb(elgg_echo('friends:collections'), $collections_link);
elgg_push_breadcrumb($title);
switch ($step) {
case 2:
$action = 'action/friend_collection_message/send';
$content = elgg_view_form('friend_collection_message/send', array('action' => $action), array('collection' => $collection));
break;
default:
$action = elgg_http_remove_url_query_element(current_page_url(), 'step');
$action = elgg_http_add_url_query_elements($action, array('step' => 2));
$content = elgg_view_form('friend_collection_message/compose', array('action' => $action), array('collection' => $collection));
break;
}
$layout = elgg_view_layout('content', array('title' => $title, 'content' => $content, 'filter' => false));
echo elgg_view_page($title, $layout);
return false;
}
示例12: group_requests_page_handler
/**
* Serve pages related to group requests
*
* @param array $page The URL segments
*/
function group_requests_page_handler($page)
{
if (!isset($page[0])) {
$page[0] = 'add';
}
$params = array('filter' => false);
switch ($page[0]) {
case 'all':
admin_gatekeeper();
$requests = elgg_list_entities(array('type' => 'object', 'subtype' => \Groups\Requests\Request::SUBTYPE, 'no_results' => elgg_echo('group_requests:none')));
$params['title'] = elgg_echo('group_requests:requests');
$params['content'] = $requests;
break;
case 'add':
default:
gatekeeper();
$params['title'] = elgg_echo('group_requests:request');
$params['content'] = elgg_view_form('groups/request', array(), array('user_guid' => elgg_get_logged_in_user_guid()));
break;
}
$body = elgg_view_layout('content', $params);
echo elgg_view_page($title, $body);
}
示例13: elgg_get_page_owner_entity
<?php
/**
* This view prepends the content layout to check if we need to add a wire add form to the group acivity listing
*/
if (!elgg_is_logged_in() || !elgg_in_context("groups")) {
return;
}
$group = elgg_get_page_owner_entity();
if (!$group instanceof ElggGroup) {
return;
}
if ($group->thewire_enable == "no") {
return;
}
if (!$group->canEdit() && !$group->isMember()) {
return;
}
$page = current_page_url();
$page = str_ireplace(elgg_get_site_url(), "", $page);
// check if we're on the activity page
if (strpos($page, "groups/activity/" . $group->getGUID()) === 0) {
// check the plugin setting
if (elgg_get_plugin_setting("extend_activity", "thewire_tools") == "yes") {
echo elgg_view_form("thewire/add");
}
}
示例14: get_input
<?php
$guid = (int) get_input('guid');
$entity = get_entity($guid);
if (empty($entity) || !elgg_instanceof($entity, 'object', Wizard::SUBTYPE)) {
register_error(elgg_echo('wizard:action:error:entity'));
forward(REFERER);
}
$title = elgg_echo('wizard:edit:title', array($entity->title));
$form = elgg_view_form('wizard/edit', array('action' => 'action/wizard/edit'), array('entity' => $entity));
echo elgg_view_module('inline', $title, $form);
示例15: elgg_view_form
<?php
$form_helper = new \Tour\Page\Form();
$form_vars = $form_helper->prepare();
echo elgg_view_form('tour_page/save', array(), $form_vars);