本文整理汇总了PHP中elgg_get_page_owner_guid函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_get_page_owner_guid函数的具体用法?PHP elgg_get_page_owner_guid怎么用?PHP elgg_get_page_owner_guid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_get_page_owner_guid函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hflts_page_handler
function hflts_page_handler($page)
{
if (elgg_extract(0, $page) === 'collective') {
$content = elgg_view('hflts/collective', array('nAlternativas' => $page[1], 'nCriterios' => $page[2], 'nExpertos' => $page[3], 'G' => $page[4], 'import_file' => $page[5], 'weight_file' => $page[6]));
$params = array('title' => 'DM con datos de samples/set_' . $page[5] . '.csv (' . $page[6] . ')', 'content' => $content, 'filter' => '');
$body = elgg_view_layout('content', $params);
echo elgg_view_page('hflts', $body);
return true;
}
set_input('username', $page[0]);
//necesario
$user = elgg_get_page_owner_entity();
// ej strem
$guid = elgg_get_page_owner_guid();
// id de strem
//aqui es donde tengo que filtrar por guid como en https://elgg.org/discussion/view/2268999/doubt-in-elgg-get-entities-from-metadata
$valorations = elgg_get_entities_from_metadata(['type' => 'object', 'subtype' => 'evaluation_content', 'metadata_name_value_pairs' => array('name' => 'user_guid', 'value' => $guid), 'limit' => $vars['entity']->num_display, 'pagination' => false, 'order_by_metadata' => ['name' => 'state', 'direction' => 'ASC', 'as' => 'text']]);
if (!$valorations) {
$valorations = '<p class="mtm">' . elgg_echo('evaluationcontent:none') . '</p>';
}
$content = elgg_view('hflts/driver', array('valorations' => $valorations));
$params = array('title' => 'Valoraciones de ' . $user->name, 'content' => $content, 'filter' => '');
$body = elgg_view_layout('content', $params);
echo elgg_view_page('hflts', $body);
}
示例2: widget_manager_pagesetup
function widget_manager_pagesetup()
{
$context = elgg_get_context();
if (elgg_is_admin_logged_in() && $context == "admin") {
// move defaultwidgets menu item
elgg_unregister_menu_item("page", "appearance:default_widgets");
elgg_register_menu_item('page', array('name' => "appearance:default_widgets", 'href' => "admin/appearance/default_widgets", 'text' => elgg_echo("admin:appearance:default_widgets"), 'context' => 'admin', 'parent_name' => "widgets", 'section' => "configure"));
// add own menu items
elgg_register_admin_menu_item('configure', 'manage', 'widgets');
if (elgg_get_plugin_setting("custom_index", "widget_manager") == "1|0") {
// a special link to manage homepages that are only available if logged out
elgg_register_menu_item('page', array('name' => "admin:widgets:manage:index", 'href' => elgg_get_site_url() . "?override=true", 'text' => elgg_echo("admin:widgets:manage:index"), 'context' => 'admin', 'parent_name' => "widgets", 'section' => "configure"));
}
}
// update fixed widgets if needed
if (in_array($context, array("profile", "dashboard")) && ($page_owner_guid = elgg_get_page_owner_guid())) {
// only check things if you are viewing a profile or dashboard page
$fixed_ts = elgg_get_plugin_setting($context . "_fixed_ts", "widget_manager");
if (empty($fixed_ts)) {
// there should always be a fixed ts, so fix it now. This situation only occurs after activating widget_manager the first time.
$fixed_ts = time();
elgg_set_plugin_setting($context . "_fixed_ts", $fixed_ts, "widget_manager");
}
// get the ts of the profile/dashboard you are viewing
$user_fixed_ts = elgg_get_plugin_user_setting($context . "_fixed_ts", $page_owner_guid, "widget_manager");
if ($user_fixed_ts < $fixed_ts) {
widget_manager_update_fixed_widgets($context, $page_owner_guid);
}
}
if (widget_manager_multi_dashboard_enabled()) {
if (get_input("internal_dashboard") == "yes") {
elgg_set_view_location("page/default", dirname(__FILE__) . "/views_alt/");
}
}
}
示例3: add_submenus
/**
* Sets up submenus. Triggered on pagesetup.
*
*/
function add_submenus()
{
$plugins_base = elgg_get_site_url() . "plugins";
if (elgg_get_context() == 'admin') {
elgg_register_admin_menu_item('administer', 'statistics', 'community_plugins');
elgg_register_admin_menu_item('administer', 'utilities', 'community_plugins');
elgg_register_admin_menu_item('configure', 'community_plugins', 'settings');
return;
}
if (elgg_get_context() != "plugins") {
return;
}
$page_owner = elgg_get_page_owner_entity();
if (elgg_is_logged_in() && elgg_get_page_owner_guid() == elgg_get_logged_in_user_guid()) {
elgg_register_menu_item('page', array('href' => "{$plugins_base}/developer/{$page_owner->username}", 'name' => 'plugins:yours', 'text' => elgg_echo("plugins:yours", array(elgg_echo('plugins:types:')))));
} else {
if (elgg_get_page_owner_guid()) {
$title = elgg_echo("plugins:user", array($page_owner->name, elgg_echo('plugins:types:')));
elgg_register_menu_item('page', array('href' => "{$plugins_base}/developer/{$page_owner->username}", 'name' => 'plugins:user', 'text' => $title));
}
}
elgg_register_menu_item('page', array('href' => '/plugins', 'name' => 'plugins:all', 'text' => elgg_echo('plugins:all')));
// add upload link when viewing own plugin page
if (elgg_get_logged_in_user_guid() == elgg_get_page_owner_guid()) {
elgg_register_menu_item('page', array('href' => "{$plugins_base}/new/project/{$page_owner->username}", 'name' => 'plugins:upload', 'text' => elgg_echo('plugins:upload')));
}
}
示例4: file_tools_get_folders
/**
* Get the folders in a container
*
* @param int $container_guid the container to check
*
* @return bool|ElggObject[]
*/
function file_tools_get_folders($container_guid = 0)
{
$container_guid = (int) $container_guid;
if (empty($container_guid)) {
$container_guid = elgg_get_page_owner_guid();
}
if (empty($container_guid)) {
return false;
}
$folders = elgg_get_entities(['type' => 'object', 'subtype' => FILE_TOOLS_SUBTYPE, 'container_guid' => $container_guid, 'limit' => false]);
if (empty($folders)) {
return false;
}
$parents = array();
/* @var $folder ElggObject */
foreach ($folders as $folder) {
$parent_guid = (int) $folder->parent_guid;
if (!empty($parent_guid)) {
$temp = get_entity($parent_guid);
if (!elgg_instanceof($temp, 'object', FILE_TOOLS_SUBTYPE)) {
$parent_guid = 0;
}
}
if (!array_key_exists($parent_guid, $parents)) {
$parents[$parent_guid] = [];
}
$parents[$parent_guid][] = $folder;
}
return file_tools_sort_folders($parents, 0);
}
示例5: current_dokuwiki_entity
function current_dokuwiki_entity($create = true)
{
$page_owner = elgg_get_page_owner_guid();
$user = elgg_get_logged_in_user_entity();
//error_log($page_owner->guid);
//error_log($user->guid);
if (!$page_owner) {
$page_owner = 0;
}
$entities = elgg_get_entities(array('types' => 'object', 'subtypes' => 'dokuwiki', 'limit' => 1, 'owner_guid' => $page_owner));
if ($entities) {
$doku = $entities[0];
return $doku;
} elseif ($user && $create) {
elgg_set_ignore_access(true);
$newdoku = new ElggObject();
$newdoku->access_id = ACCESS_PUBLIC;
$newdoku->owner_guid = $page_owner;
$newdoku->subtype = 'dokuwiki';
$newdoku->container_guid = $page_owner;
$newdoku->save();
$acl = array();
$acl[] = "# acl.auth.php";
$acl[] = '# <?php exit()?\\>';
$acl[] = "* @ALL 0";
$acl[] = "* @user 1";
$acl[] = "* @member 8";
$acl[] = "* @admin 16";
$acl[] = "* @root 255";
$newdoku->wiki_acl = implode("\n", $acl) . "\n";
elgg_set_ignore_access(false);
return $newdoku;
}
}
示例6: hj_forums_get_forums
function hj_forums_get_forums($container_guid = 0)
{
$result = false;
if (empty($container_guid)) {
$container_guid = elgg_get_page_owner_guid();
}
$flag = false;
while ($flag != true) {
$container_entity = get_entity($container_guid);
if (!elgg_instanceof($container_entity, 'group')) {
$container_guid = $container_entity->container_guid;
} else {
$flag = true;
}
}
if (!empty($container_guid)) {
$options = array("type" => "object", "subtype" => "hjforum", "container_guid" => $container_guid, "limit" => false, "order_by" => "e.last_action DESC");
$options["joins"][] = "JOIN " . elgg_get_config("dbprefix") . "objects_entity oe ON oe.guid = e.guid";
if ($forums = elgg_get_entities($options)) {
$parents = array();
foreach ($forums as $forum) {
$options = array("type" => "object", "subtype" => "hjforum", "container_guid" => $forum->guid, 'limit' => false, "order_by" => "e.last_action DESC");
$subForums = elgg_get_entities($options);
foreach ($subForums as $subForum) {
$subForum->parent_guid = $forum->guid;
array_push($forums, $subForum);
$options = array("type" => "object", "subtype" => "hjforum", "container_guid" => $subForum->guid, 'limit' => false, "order_by" => "e.last_action DESC");
$subSubForums = elgg_get_entities($options);
foreach ($subSubForums as $subSubForum) {
$subSubForum->parent_guid = $subForum->guid;
array_push($forums, $subSubForum);
}
}
}
foreach ($forums as $forum) {
$parent_guid = (int) $forum->parent_guid;
if (!empty($parent_guid)) {
if ($temp = get_entity($parent_guid)) {
if ($temp->getSubtype() != "hjforum") {
$parent_guid = 0;
}
} else {
$parent_guid = 0;
}
} else {
$parent_guid = 0;
}
if (!array_key_exists($parent_guid, $parents)) {
$parents[$parent_guid] = array();
}
$parents[$parent_guid][] = $forum;
}
$result = hj_forums_sort_forums($parents, 0);
}
}
return $result;
}
示例7: customstyle_pagesetup
function customstyle_pagesetup()
{
if (!elgg_get_page_owner_guid() && elgg_is_logged_in()) {
elgg_set_page_owner_guid($_SESSION['user']->getGUID());
}
if ($_SERVER['PHP_SELF'] != "/index.php" && elgg_get_page_owner_guid() != 0) {
elgg_extend_view('page/elements/foot', 'customstyle/metatags');
}
}
示例8: groups_handle_mine_page
/**
* List groups the user is memober of
*/
function groups_handle_mine_page()
{
$page_owner = elgg_get_page_owner_entity();
$title = elgg_echo('groups:yours');
elgg_push_breadcrumb($title);
$content = elgg_list_entities_from_relationship_count(array('type' => 'group', 'relationship' => 'member', 'relationship_guid' => elgg_get_page_owner_guid(), 'inverse_relationship' => false, 'full_view' => false));
$params = array('content' => $content, 'title' => $title, 'filter' => '');
$body = elgg_view_layout('content', $params);
echo elgg_view_page($title, $body);
}
示例9: sched_conf_pagesetup
function sched_conf_pagesetup()
{
// a bit of a kludge to check if we are on a listing page
$url = current_page_url();
if (strpos($url, 'event_calendar/list') !== FALSE) {
elgg_register_menu_item('title', array('name' => 'add_conference', 'href' => 'sched_conf/add/', 'text' => elgg_echo('sched_conf:add_conf_title'), 'class' => 'elgg-button elgg-button-action'));
} else {
if (strpos($url, 'event_calendar/group') !== FALSE) {
$group_guid = elgg_get_page_owner_guid();
elgg_register_menu_item('title', array('name' => 'add_conference', 'href' => "sched_conf/add/" . $group_guid, 'text' => elgg_echo('sched_conf:add_conf_title'), 'class' => 'elgg-button elgg-button-action'));
}
}
}
示例10: custom_friends_page_handler
function custom_friends_page_handler($page_elements, $handler)
{
elgg_set_context('friends');
if (isset($page_elements[0]) && ($user = get_user_by_username($page_elements[0]))) {
elgg_set_page_owner_guid($user->getGUID());
}
if (elgg_get_logged_in_user_guid() == elgg_get_page_owner_guid()) {
collections_submenu_items();
}
if (!isset($handler[0])) {
$handler[0] = 'friends';
}
require_once dirname(__FILE__) . "/pages/friends/index.php";
return true;
}
示例11: groups_handle_mine_page
/**
* List groups the user is memober of
*/
function groups_handle_mine_page()
{
$page_owner = elgg_get_page_owner_entity();
if ($page_owner->guid == elgg_get_logged_in_user_guid()) {
$title = elgg_echo('groups:yours');
} else {
$title = elgg_echo('groups:user', array($page_owner->name));
}
elgg_push_breadcrumb($title);
elgg_register_title_button();
$dbprefix = elgg_get_config('dbprefix');
$content = elgg_list_entities_from_relationship(array('type' => 'group', 'relationship' => 'member', 'relationship_guid' => elgg_get_page_owner_guid(), 'inverse_relationship' => false, 'full_view' => false, 'joins' => array("JOIN {$dbprefix}groups_entity ge ON e.guid = ge.guid"), 'order_by' => 'ge.name ASC', 'no_results' => elgg_echo('groups:none')));
$params = array('content' => $content, 'title' => $title, 'filter' => '');
$body = elgg_view_layout('content', $params);
echo elgg_view_page($title, $body);
}
示例12: file_type_cloud_get_url
/**
* Type cloud
*/
function file_type_cloud_get_url($type, $friends)
{
$url = elgg_get_site_url() . 'file/search?subtype=file';
if ($type->tag != "all") {
$url .= "&md_type=simpletype&tag=" . urlencode($type->tag);
}
if ($friends) {
$url .= "&friends={$friends}";
}
if ($type->tag == "image") {
$url .= "&listtype=gallery";
}
if (elgg_get_page_owner_guid()) {
$url .= "&page_owner=" . elgg_get_page_owner_guid();
}
return $url;
}
示例13: golfscore_prepare_form_vars
/**
* Prepare the add/edit form variables
*
* @param ElggObject $golfscore golfscore object.
* @return array
*/
function golfscore_prepare_form_vars($golfscore = null)
{
$values = array('title' => get_input('title', ''), 'address' => get_input('address', ''), 'description' => '', 'access_id' => ACCESS_DEFAULT, 'tags' => '', 'shares' => array(), 'container_guid' => elgg_get_page_owner_guid(), 'guid' => null, 'entity' => $golfscore);
if ($golfscore) {
foreach (array_keys($values) as $field) {
if (isset($golfscore->{$field})) {
$values[$field] = $golfscore->{$field};
}
}
}
if (elgg_is_sticky_form('golfscore')) {
$sticky_values = elgg_get_sticky_values('golfscore');
foreach ($sticky_values as $key => $value) {
$values[$key] = $value;
}
}
elgg_clear_sticky_form('golfscore');
return $values;
}
示例14: testSetAndUnsetPageOwner
/**
* It should be possible to set and unset a page owner even if that results in no page owner at all.
*/
public function testSetAndUnsetPageOwner()
{
/**
* How to test:
* 1. Set page owner
* 2. Unset page owner
* 3. Assert that fetching page owner results in the expected page owner
*/
// check if setting to false returns 0
elgg_set_page_owner_guid(1);
$this->assertEquals(1, elgg_get_page_owner_guid());
elgg_set_page_owner_guid(false);
$this->assertEquals(0, elgg_get_page_owner_guid());
// check if setting to null returns 0
elgg_set_page_owner_guid(1);
$this->assertEquals(1, elgg_get_page_owner_guid());
elgg_set_page_owner_guid(null);
$this->assertEquals(0, elgg_get_page_owner_guid());
}
示例15: answers_prepare_form_vars
/**
* Prepare the add/edit form variables
*
* @param ElggObject $question A question object.
* @return array
*/
function answers_prepare_form_vars($question = null)
{
$values = array('title' => get_input('search', ''), 'description' => '', 'access_id' => ACCESS_DEFAULT, 'tags' => '', 'container_guid' => elgg_get_page_owner_guid(), 'guid' => null, 'entity' => $question);
if ($question) {
foreach (array_keys($values) as $field) {
if (isset($question->{$field})) {
$values[$field] = $question->{$field};
}
}
}
if (elgg_is_sticky_form('question')) {
$sticky_values = elgg_get_sticky_values('question');
foreach ($sticky_values as $key => $value) {
$values[$key] = $value;
}
}
elgg_clear_sticky_form('question');
return $values;
}