当前位置: 首页>>代码示例>>PHP>>正文


PHP can_write_to_container函数代码示例

本文整理汇总了PHP中can_write_to_container函数的典型用法代码示例。如果您正苦于以下问题:PHP can_write_to_container函数的具体用法?PHP can_write_to_container怎么用?PHP can_write_to_container使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了can_write_to_container函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: bookmarks_pagesetup

function bookmarks_pagesetup()
{
    global $CONFIG;
    // Set up menu for logged in users
    //add submenu options
    if (get_context() == "bookmarks") {
        if (isloggedin()) {
            add_submenu_item(elgg_echo('bookmarks:inbox'), $CONFIG->wwwroot . "pg/bookmarks/" . $_SESSION['user']->username . "/inbox");
            if (page_owner()) {
                $page_owner = page_owner_entity();
                add_submenu_item(sprintf(elgg_echo('bookmarks:read'), $page_owner->name), $CONFIG->wwwroot . "pg/bookmarks/" . $page_owner->username . "/items");
            }
            if (!$page_owner instanceof ElggGroup) {
                add_submenu_item(elgg_echo('bookmarks:friends'), $CONFIG->wwwroot . "pg/bookmarks/" . $_SESSION['user']->username . "/friends");
            }
        }
        //if(!$page_owner instanceof ElggGroup)
        //	add_submenu_item(elgg_echo('bookmarks:everyone'),$CONFIG->wwwroot."mod/bookmarks/everyone.php");
        // Bookmarklet
        if (isloggedin() && page_owner() && can_write_to_container(0, page_owner())) {
            $page_owner = page_owner_entity();
            $bmtext = elgg_echo('bookmarks:bookmarklet');
            if ($page_owner instanceof ElggGroup) {
                $bmtext = elgg_echo('bookmarks:bookmarklet:group');
            }
            add_submenu_item($bmtext, $CONFIG->wwwroot . "pg/bookmarks/{$page_owner->username}/bookmarklet");
        }
    }
    $page_owner = page_owner_entity();
    if ($page_owner instanceof ElggGroup && get_context() == 'groups') {
        if ($page_owner->bookmarks_enable != "no") {
            add_submenu_item(sprintf(elgg_echo("bookmarks:group"), $page_owner->name), $CONFIG->wwwroot . "pg/bookmarks/" . $page_owner->username . '/items');
        }
    }
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:35,代码来源:start.php

示例2: blog_pagesetup

function blog_pagesetup()
{
    global $CONFIG;
    //add submenu options
    if (get_context() == "blog") {
        $page_owner = page_owner_entity();
        if ((page_owner() == $_SESSION['guid'] || !page_owner()) && isloggedin()) {
            add_submenu_item(elgg_echo('blog:your'), $CONFIG->wwwroot . "pg/blog/" . $_SESSION['user']->username);
            add_submenu_item(elgg_echo('blog:friends'), $CONFIG->wwwroot . "pg/blog/" . $_SESSION['user']->username . "/friends/");
            add_submenu_item(elgg_echo('blog:everyone'), $CONFIG->wwwroot . "mod/blog/everyone.php");
        } else {
            if (page_owner()) {
                add_submenu_item(sprintf(elgg_echo('blog:user'), $page_owner->name), $CONFIG->wwwroot . "pg/blog/" . $page_owner->username);
                if ($page_owner instanceof ElggUser) {
                    // Sorry groups, this isn't for you.
                    add_submenu_item(sprintf(elgg_echo('blog:user:friends'), $page_owner->name), $CONFIG->wwwroot . "pg/blog/" . $page_owner->username . "/friends/");
                }
                add_submenu_item(elgg_echo('blog:everyone'), $CONFIG->wwwroot . "mod/blog/everyone.php");
            } else {
                add_submenu_item(elgg_echo('blog:everyone'), $CONFIG->wwwroot . "mod/blog/everyone.php");
            }
        }
        if (can_write_to_container(0, page_owner()) && isloggedin()) {
            add_submenu_item(elgg_echo('blog:addpost'), $CONFIG->wwwroot . "pg/blog/{$page_owner->username}/new/");
        }
        if (!defined('everyoneblog') && page_owner()) {
            if ($dates = get_entity_dates('object', 'blog', page_owner())) {
                foreach ($dates as $date) {
                    $timestamplow = mktime(0, 0, 0, substr($date, 4, 2), 1, substr($date, 0, 4));
                    $timestamphigh = mktime(0, 0, 0, (int) substr($date, 4, 2) + 1, 1, substr($date, 0, 4));
                    if (!isset($page_owner)) {
                        $page_owner = page_owner_entity();
                    }
                    $link = $CONFIG->wwwroot . 'pg/blog/' . $page_owner->username . '/archive/' . $timestamplow . '/' . $timestamphigh;
                    add_submenu_item(sprintf(elgg_echo('date:month:' . substr($date, 4, 2)), substr($date, 0, 4)), $link, 'filter');
                }
            }
        }
    }
    // Group submenu
    $page_owner = page_owner_entity();
    if ($page_owner instanceof ElggGroup && get_context() == 'groups') {
        if ($page_owner->blog_enable != "no") {
            add_submenu_item(sprintf(elgg_echo("blog:group"), $page_owner->name), $CONFIG->wwwroot . "pg/blog/" . $page_owner->username);
        }
    }
}
开发者ID:ashwiniravi,项目名称:Elgg-Social-Network-Single-Sign-on-and-Web-Statistics,代码行数:47,代码来源:start.php

示例3: group_menus_izap_contest

function group_menus_izap_contest()
{
    global $CONFIG;
    $pageowner = elgg_get_page_owner_entity();
    // if the page owner is group and context is group
    if ($pageowner instanceof ElggGroup && (get_context() == 'groups' || get_context() == GLOBAL_IZAP_CONTEST_QUIZ_PAGEHANDLER || get_context() == GLOBAL_IZAP_CONTEST_CHALLENGE_PAGEHANDLER) && ($pageowner->izapchallenge_enable == 'yes' || empty($pageowner->izapchallenge_enable))) {
        if (can_write_to_container(elgg_get_logged_in_user_guid(), $pageowner->guid)) {
            //elgg_register_menu_item('page', new ElggMenuItem('izap-contest:challenge:group:add',
            //                elgg_echo('izap-contest:challenge:group:add'),
            //                izapbase::setHref(array(
            //                    'context' => GLOBAL_IZAP_CONTEST_CHALLENGE_PAGEHANDLER,
            //                    'action' => 'add',
            //                    'page_owner' => false,
            //                    'vars' => array($pageowner->username
            //                    )
            //                        )
            //                )
            //        )
            //);
        }
        elgg_register_menu_item('page', new ElggMenuItem('izap-contest:challenge:group:list', elgg_echo('izap-contest:challenge:group:list'), IzapBase::setHref(array('context' => GLOBAL_IZAP_CONTEST_CHALLENGE_PAGEHANDLER, 'action' => 'list', 'page_owner' => false, 'vars' => array($pageowner->guid, $pageowner->username)))));
    }
}
开发者ID:socialweb,项目名称:PiGo,代码行数:23,代码来源:start.php

示例4: elgg_extract

$list_completed = (bool) elgg_extract('list_completed', $vars, true);
// only applies to full view
if (empty($entity) || !elgg_instanceof($entity, 'object', TodoList::SUBTYPE)) {
    return;
}
if (!$full) {
    echo '<div class="todos-list-item">';
    echo '<h3>' . elgg_view('output/url', array('text' => $entity->title, 'href' => $entity->getURL(), 'is_trusted' => true)) . '</h3>';
    echo elgg_view_menu('todolist', array('entity' => $entity, 'class' => 'elgg-menu-hz elgg-menu-todos', 'sort_by' => 'register'));
    echo '</div>';
}
$options = array('type' => 'object', 'subtype' => TodoItem::SUBTYPE, 'limit' => false, 'full_view' => false, 'pagination' => false, 'item_class' => 'todos-list-item', 'list_class' => 'todos-list todos-list-todoitem elgg-todo-' . $entity->guid, 'container_guid' => $entity->getGUID());
if (!$show_completed) {
    $options['order_by_metadata'] = array('name' => 'order', 'as' => 'integer');
}
if (can_write_to_container(null, $entity->getContainerGUID())) {
    $options['list_class'] .= ' todos-sortable';
}
$active_todos = elgg_list_entities_from_metadata($options);
echo $active_todos;
if ($entity->canWriteToContainer(0, 'object', TodoItem::SUBTYPE)) {
    elgg_load_js("lightbox");
    elgg_load_css("lightbox");
    elgg_load_js('elgg.userpicker');
    elgg_load_js('jquery.ui.autocomplete.html');
    if (empty($active_todos) && !$full) {
        // add an empty place to drop todos from other lists
        echo "<ul class='elgg-list todos-list todos-list-todoitem todos-sortable elgg-todo-{$entity->guid}'></ul>";
    }
    echo '<div>';
    echo elgg_view('output/url', array('text' => elgg_echo('todos:todoitem:add'), 'class' => 'elgg-lightbox mll', 'href' => 'ajax/view/todos/todoitem/form?container_guid=' . $entity->getGUID()));
开发者ID:coldtrick,项目名称:todos,代码行数:31,代码来源:todolist.php

示例5: elgg_make_sticky_form

elgg_make_sticky_form('answer');
$guid = (int) get_input('guid');
$answer = new ElggAnswer($guid);
$adding = !$answer->guid;
$editing = !$adding;
if ($editing && !$answer->canEdit()) {
    register_error(elgg_echo('InvalidParameterException:NoEntityFound'));
    forward(REFERER);
}
$container_guid = (int) get_input('container_guid');
$description = get_input('description');
if (empty($container_guid) || empty($description)) {
    register_error(elgg_echo('questions:action:answer:save:error:body', [$container_guid, $description]));
    forward(REFERER);
}
if ($adding && !can_write_to_container(0, $container_guid, 'object', 'answer')) {
    register_error(elgg_echo('questions:action:answer:save:error:container'));
    forward(REFERER);
}
$question = get_entity($container_guid);
if (empty($question) || !$question instanceof ElggQuestion) {
    register_error(elgg_echo('ClassException:ClassnameNotClass', [$container_guid, elgg_echo('item:object:question')]));
    forward(REFERER);
}
if ($question->getStatus() != 'open') {
    elgg_clear_sticky_form('answer');
    register_error(elgg_echo('questions:action:answer:save:error:question_closed'));
    forward(REFERER);
}
$answer->description = $description;
$answer->access_id = $question->access_id;
开发者ID:lorea,项目名称:Hydra-dev,代码行数:31,代码来源:save.php

示例6: elgg_push_context

<?php

/**
 * Shows the overview page of the FFD Cafe
 *
 * @package theme_ffd
 */
elgg_push_context("cafe");
if (elgg_is_logged_in() && can_write_to_container()) {
    $add = elgg_view_form('theme_ffd/cafe', array('name' => 'cafe', 'action' => 'action/cafe/save'), array('collapsable' => true));
} else {
    $add = "";
}
$options = array('type' => 'object', 'subtype' => 'cafe', 'order_by' => 'last_action DESC', 'full_view' => false);
$owner = get_input('owner');
if ($owner) {
    $owner = get_user_by_username($owner);
}
if ($owner) {
    $options['owner_guid'] = $owner->guid;
    $filter_context = 'mine';
} else {
    $filter_context = 'all';
}
$purpose = get_input('purpose');
if (in_array($purpose, array('search', 'share', 'experience'))) {
    $options['metadata_name_value_pairs'] = array(array('name' => 'purpose', 'value' => $purpose));
    $getter = 'elgg_get_entities_from_metadata';
} else {
    $getter = 'elgg_get_entities';
}
开发者ID:pleio,项目名称:pinboard,代码行数:31,代码来源:overview.php

示例7: file_submenus

/**
 * Sets up submenus for the file system.  Triggered on pagesetup.
 *
 */
function file_submenus()
{
    global $CONFIG;
    $page_owner = page_owner_entity();
    // Group submenu option
    if ($page_owner instanceof ElggGroup && get_context() == "groups") {
        if ($page_owner->files_enable != "no") {
            add_submenu_item(sprintf(elgg_echo("file:group"), $page_owner->name), $CONFIG->wwwroot . "pg/file/" . $page_owner->username);
        }
    }
    // General submenu options
    if (get_context() == "file") {
        if ((page_owner() == $_SESSION['guid'] || !page_owner()) && isloggedin()) {
            add_submenu_item(sprintf(elgg_echo("file:yours"), $page_owner->name), $CONFIG->wwwroot . "pg/file/" . $page_owner->username);
            add_submenu_item(sprintf(elgg_echo('file:yours:friends'), $page_owner->name), $CONFIG->wwwroot . "pg/file/" . $page_owner->username . "/friends/");
        } else {
            if (page_owner()) {
                add_submenu_item(sprintf(elgg_echo("file:user"), $page_owner->name), $CONFIG->wwwroot . "pg/file/" . $page_owner->username);
                if ($page_owner instanceof ElggUser) {
                    // This one's for users, not groups
                    add_submenu_item(sprintf(elgg_echo('file:friends'), $page_owner->name), $CONFIG->wwwroot . "pg/file/" . $page_owner->username . "/friends/");
                }
            }
        }
        add_submenu_item(elgg_echo('file:all'), $CONFIG->wwwroot . "mod/file/world.php");
        if (can_write_to_container($_SESSION['guid'], page_owner())) {
            add_submenu_item(elgg_echo('file:upload'), $CONFIG->wwwroot . "pg/file/" . $page_owner->username . "/new/");
        }
    }
}
开发者ID:eokyere,项目名称:elgg,代码行数:34,代码来源:start.php

示例8: elgg_get_page_owner_entity

<?php

$page_owner = elgg_get_page_owner_entity();
if (empty($page_owner)) {
    forward(REFERER);
}
if ($page_owner instanceof ElggGroup) {
    poll_container_gatekeeper($page_owner);
    elgg_group_gatekeeper();
}
// breadcrumb
elgg_push_breadcrumb($page_owner->name);
if (poll_is_enabled_for_container($page_owner)) {
    // check if add button is allowed
    if (can_write_to_container(0, $page_owner->getGUID(), 'object', Poll::SUBTYPE)) {
        elgg_register_title_button();
    }
}
// build page elements
$title = elgg_echo('poll:owner:title', [$page_owner->name]);
$options = ['type' => 'object', 'subtype' => Poll::SUBTYPE, 'no_results' => elgg_echo('poll:none')];
if ($page_owner instanceof ElggUser) {
    $options['owner_guid'] = $page_owner->getGUID();
    $options['preload_containers'] = true;
} elseif ($page_owner instanceof ElggGroup) {
    $options['container_guid'] = $page_owner->getGUID();
    $options['preload_owners'] = true;
}
$contents = elgg_list_entities($options);
// build page
$page_data = elgg_view_layout('content', ['title' => $title, 'content' => $contents, 'filter' => $page_owner instanceof ElggGroup ? '' : null, 'filter_context' => $page_owner->getGUID === elgg_get_logged_in_user_guid() ? 'mine' : '']);
开发者ID:coldtrick,项目名称:poll,代码行数:31,代码来源:owner.php

示例9: canWriteToContainer

 /**
  * Can a user add an entity to this container
  *
  * @param int    $user_guid The GUID of the user creating the entity (0 for logged in user).
  * @param string $type      The type of entity we're looking to write
  * @param string $subtype   The subtype of the entity we're looking to write
  *
  * @return bool
  * @see elgg_set_ignore_access()
  */
 public function canWriteToContainer($user_guid = 0, $type = 'all', $subtype = 'all')
 {
     return can_write_to_container($user_guid, $this->guid, $type, $subtype);
 }
开发者ID:nirajkaushal,项目名称:Elgg,代码行数:14,代码来源:ElggEntity.php

示例10: pages_container_permission_check

/**
 * Extend container permissions checking to extend can_write_to_container for write users.
 *
 * @param string $hook
 * @param string $entity_type
 * @param bool   $returnvalue
 * @param array  $params
 *
 * @return bool
 */
function pages_container_permission_check($hook, $entity_type, $returnvalue, $params)
{
    if (elgg_get_context() != "pages") {
        return null;
    }
    if (elgg_get_page_owner_guid() && can_write_to_container(elgg_get_logged_in_user_guid(), elgg_get_page_owner_guid())) {
        return true;
    }
    if ($page_guid = get_input('page_guid', 0)) {
        $entity = get_entity($page_guid);
    } elseif ($parent_guid = get_input('parent_guid', 0)) {
        $entity = get_entity($parent_guid);
    }
    if (isset($entity) && pages_is_page($entity)) {
        if (can_write_to_container(elgg_get_logged_in_user_guid(), $entity->container_guid) || in_array($entity->write_access_id, get_access_list())) {
            return true;
        }
    }
}
开发者ID:ramkameswaran,项目名称:gcconnex,代码行数:29,代码来源:start.php

示例11: register_error

}
$adding = !$question->guid;
$editing = !$adding;
$moving = false;
if ($editing && !$question->canEdit()) {
    register_error(elgg_echo('InvalidParameterException:NoEntityFound'));
    forward(REFERER);
}
$container_guid = (int) get_input('container_guid');
if (empty($container_guid)) {
    $container_guid = (int) $question->owner_guid;
}
if ($editing && $container_guid != $question->getContainerGUID()) {
    $moving = true;
}
if ($adding && !can_write_to_container(0, $container_guid, 'object', 'question')) {
    register_error(elgg_echo('questions:action:question:save:error:container'));
    forward(REFERER);
}
if (questions_limited_to_groups() && $container_guid == $question->owner_guid) {
    register_error(elgg_echo('questions:action:question:save:error:limited_to_groups'));
    forward(REFERER);
}
$title = get_input('title');
$description = get_input('description');
$tags = string_to_tag_array(get_input('tags', ''));
$access_id = (int) get_input('access_id');
if (empty($container_guid) || empty($title) || empty($description)) {
    register_error(elgg_echo('questions:action:question:save:error:body', array($container_guid, $title, $description)));
    forward(REFERER);
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:31,代码来源:save.php

示例12: elgg_trigger_plugin_hook

     break;
 case 'summary':
     echo '<div class="summary">';
     echo elgg_trigger_plugin_hook('markdown_wiki_edit', 'summary', $vars['guid'], '');
     echo '<label>' . elgg_echo("markdown_wiki:{$name}") . '</label>';
     echo elgg_view("input/{$type}", array('name' => $name, 'value' => $vars[$name]));
     echo elgg_view("input/checkbox", array('name' => 'minorchange'));
     echo elgg_echo('markdown_wiki:minorchange');
     echo '</div>';
     break;
 case 'tags':
     break;
 case 'write_access_id':
     if ($user) {
         $entity = get_entity($vars['guid']);
         if (!$vars['guid'] && can_write_to_container($user, $vars['container_guid'], 'object', 'markdown_wiki') || $entity && $entity->canEdit($user_guid)) {
             $list = get_write_access_array();
             $list[0] = elgg_echo('markdown_wiki:access:private');
             unset($list[2]);
             // no public.
             echo '<div>';
             echo '<label>' . elgg_echo("markdown_wiki:{$name}") . '</label><br/>';
             echo elgg_view("input/{$type}", array('name' => $name, 'value' => $vars[$name], 'options_values' => $list));
             echo '</div>';
         }
     }
     break;
 case 'title':
     echo elgg_view("input/{$type}", array('name' => $name, 'value' => $vars[$name]));
     break;
 case 'guid':
开发者ID:akudan,项目名称:elgg-markdown_wiki,代码行数:31,代码来源:edit.php

示例13: ElggQuestion

$question = new ElggQuestion($guid);
$adding = !$question->guid;
$editing = !$adding;
$moving = false;
if ($editing && !$question->canEdit()) {
    register_error(elgg_echo("InvalidParameterException:NoEntityFound"));
    forward(REFERER);
}
$container_guid = (int) get_input("container_guid");
if (empty($container_guid)) {
    $container_guid = (int) $question->owner_guid;
}
if ($editing && $container_guid != $question->getContainerGUID()) {
    $moving = true;
}
if ($adding && !can_write_to_container(0, $container_guid, "object", "question")) {
    register_error(elgg_echo("questions:action:question:save:error:container"));
    forward(REFERER);
}
if (questions_limited_to_groups() && $container_guid == $question->owner_guid) {
    register_error(elgg_echo("questions:action:question:save:error:limited_to_groups"));
    forward(REFERER);
}
$title = get_input("title");
$description = get_input("description");
$tags = string_to_tag_array(get_input("tags", ""));
$access_id = (int) get_input("access_id");
if (empty($container_guid) || empty($title) || empty($description)) {
    register_error(elgg_echo("questions:action:question:save:error:body", array($container_guid, $title, $description)));
    forward(REFERER);
}
开发者ID:Pleio,项目名称:questions,代码行数:31,代码来源:save.php

示例14: ElggObject

    // Otherwise, save the question
} else {
    $question = new ElggObject();
    $question->subtype = "question";
    //$question->access_id = $access;
    $question->access_id = ACCESS_PUBLIC;
    $question->title = $title;
    $question->description = $body;
    // check if user can add question to group
    if ($container_guid && $container_guid != $_SESSION['guid']) {
        $question->container_guid = $container_guid;
        $group = get_entity($container_guid);
        if (!$group instanceof ElggGroup) {
            forward();
        }
        if (!can_write_to_container($_SESSION['guid'], $container_guid)) {
            forward();
        }
        if ($group->content_access == ACCESS_PRIVATE) {
            $question->access_id = $group->group_acl;
        }
    }
    if (!$question->save()) {
        register_error(elgg_echo("answers:question:saveerror"));
        forward("mod/answers/add.php");
    }
    if (is_array($tagarray)) {
        $question->tags = $tagarray;
    }
    // Success message
    system_message(elgg_echo("answers:question:posted"));
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:31,代码来源:addquestion.php

示例15: publication_pagesetup

function publication_pagesetup()
{
    global $CONFIG;
    //add submenu options
    if (get_context() == "publications") {
        $page_owner = page_owner_entity();
        if ((page_owner() == $_SESSION['guid'] || !page_owner()) && isloggedin()) {
            add_submenu_item(elgg_echo('publication:everyone'), $CONFIG->wwwroot . "mod/publications/everyone.php");
        } else {
            if (page_owner()) {
                add_submenu_item(sprintf(elgg_echo('publication:user'), $page_owner->name), $CONFIG->wwwroot . "pg/publications/" . $page_owner->username);
                if ($page_owner instanceof ElggUser) {
                    if (get_loggedin_user() == $page_owner) {
                        add_submenu_item(sprintf(elgg_echo('publication:user:friends'), $page_owner->name), $CONFIG->wwwroot . "pg/publications/" . $page_owner->username . "/friends/");
                    }
                }
                add_submenu_item(elgg_echo('publication:everyone'), $CONFIG->wwwroot . "mod/publications/everyone.php");
            } else {
                add_submenu_item(elgg_echo('publication:everyone'), $CONFIG->wwwroot . "mod/publications/everyone.php");
            }
        }
        if (can_write_to_container(0, page_owner()) && isloggedin()) {
            add_submenu_item(elgg_echo('publication:add'), $CONFIG->wwwroot . "pg/publications/{$page_owner->username}/new/");
        }
    }
    // Group submenu
    $page_owner = page_owner_entity();
    if ($page_owner instanceof ElggGroup && get_context() == 'groups') {
        if ($page_owner->publication_enable != "no") {
            add_submenu_item(sprintf(elgg_echo("publication:group"), $page_owner->name), $CONFIG->wwwroot . "pg/publications/" . $page_owner->username);
        }
    }
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:33,代码来源:start.php


注:本文中的can_write_to_container函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。