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); }
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/"); } } }
/** * 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'))); } }
/** * 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); }
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; } }
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; }
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'); } }
/** * 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); }
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')); } } }
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; }
/** * 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); }
/** * 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; }
/** * 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; }
/** * 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()); }
/** * 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; }
/** * Prepare the map creation form variables * * @param type $drawmap * @return type */ function sharemaps_prepare_form_vars_drawmap($drawmap = null) { // input names => defaults $values = array('title' => '', 'description' => '', 'access_id' => ACCESS_DEFAULT, 'tags' => '', 'container_guid' => elgg_get_page_owner_guid(), 'guid' => null, 'dm_markers' => '', 'entity' => $drawmap); if ($drawmap) { foreach (array_keys($values) as $field) { if (isset($drawmap->{$field})) { $values[$field] = $drawmap->{$field}; } } } if (elgg_is_sticky_form('drawmap')) { $sticky_values = elgg_get_sticky_values('drawmap'); foreach ($sticky_values as $key => $value) { $values[$key] = $value; } } elgg_clear_sticky_form('drawmap'); return $values; }
/** * Prepare discussion topic form variables * * @param ElggObject $topic Topic object if editing * @return array */ function discussion_prepare_form_vars($topic = NULL) { // input names => defaults $values = array('title' => '', 'description' => '', 'status' => '', 'access_id' => ACCESS_DEFAULT, 'tags' => '', 'container_guid' => elgg_get_page_owner_guid(), 'guid' => null, 'topic' => $topic); if ($topic) { foreach (array_keys($values) as $field) { if (isset($topic->{$field})) { $values[$field] = $topic->{$field}; } } } if (elgg_is_sticky_form('topic')) { $sticky_values = elgg_get_sticky_values('topic'); foreach ($sticky_values as $key => $value) { $values[$key] = $value; } } elgg_clear_sticky_form('topic'); return $values; }
/** * Add amapnews form parameters * * @param type $entity_unit * @return type */ function amapnews_prepare_form_vars($entity_unit = null) { // input names => defaults $values = array('title' => '', 'description' => '', 'excerpt' => '', 'featured' => '', 'photo' => '', 'tags' => '', 'connected_guid' => null, 'access_id' => ACCESS_DEFAULT, 'container_guid' => elgg_get_page_owner_guid(), 'entity' => $entity_unit, 'guid' => null, 'comments_on' => NULL); if ($entity_unit) { foreach (array_keys($values) as $field) { if (isset($entity_unit->{$field})) { $values[$field] = $entity_unit->{$field}; } } } if (elgg_is_sticky_form('amapnews')) { $sticky_values = elgg_get_sticky_values('amapnews'); foreach ($sticky_values as $key => $value) { $values[$key] = $value; } } elgg_clear_sticky_form('amapnews'); return $values; }
/** * Prepare the add/edit form variables * * @param ElggObject $task * @return array */ function tasks_prepare_form_vars($task = null, $parent_guid = 0) { // input names => defaults $values = array('title' => '', 'description' => '', 'start_date' => '', 'end_date' => '', 'task_type' => '', 'status' => '', 'assigned_to' => '', 'percent_done' => '', 'work_remaining' => '', 'access_id' => ACCESS_DEFAULT, 'write_access_id' => ACCESS_DEFAULT, 'tags' => '', 'container_guid' => elgg_get_page_owner_guid(), 'guid' => null, 'entity' => $task, 'parent_guid' => $parent_guid); if ($task) { foreach (array_keys($values) as $field) { if (isset($task->{$field})) { $values[$field] = $task->{$field}; } } } if (elgg_is_sticky_form('task')) { $sticky_values = elgg_get_sticky_values('task'); foreach ($sticky_values as $key => $value) { $values[$key] = $value; } } elgg_clear_sticky_form('task'); return $values; }
/** * Prepare the add/edit form variables * * @param ElggObject $video A video object. * @return array */ function videos_prepare_form_vars($video = null) { // input names => defaults $values = array('title' => get_input('title', ''), 'video_url' => get_input('video_url', ''), 'description' => '', 'access_id' => ACCESS_DEFAULT, 'tags' => '', 'container_guid' => elgg_get_page_owner_guid(), 'guid' => null, 'entity' => $video); if ($video) { foreach (array_keys($values) as $field) { if (isset($video->{$field})) { $values[$field] = $video->{$field}; } } } if (elgg_is_sticky_form('videos')) { $sticky_values = elgg_get_sticky_values('videos'); foreach ($sticky_values as $key => $value) { $values[$key] = $value; } } elgg_clear_sticky_form('videos'); return $values; }
/** * Prepare the add/edit form variables * * @param ElggObject $page * @return array */ function pages_prepare_form_vars($page = null, $parent_guid = 0) { // input names => defaults $values = array('title' => '', 'description' => '', 'access_id' => ACCESS_DEFAULT, 'write_access_id' => ACCESS_DEFAULT, 'tags' => '', 'container_guid' => elgg_get_page_owner_guid(), 'guid' => null, 'entity' => $page, 'parent_guid' => $parent_guid); if ($page) { foreach (array_keys($values) as $field) { if (isset($page->{$field})) { $values[$field] = $page->{$field}; } } } if (elgg_is_sticky_form('page')) { $sticky_values = elgg_get_sticky_values('page'); foreach ($sticky_values as $key => $value) { $values[$key] = $value; } } elgg_clear_sticky_form('page'); return $values; }
function vouchers_prepare_form_vars($voucher = null) { // input names => defaults $values = array('title' => '', 'code' => '', 'code_type' => '', 'code_end' => '', 'description' => '', 'amount' => '', 'amount_type' => '', 'access_id' => ACCESS_DEFAULT, 'tags' => '', 'container_guid' => elgg_get_page_owner_guid(), 'entity' => $voucher, 'valid_from' => '', 'valid_until' => '', 'price' => 0, 'points' => 0, 'howmany' => '', 'currency' => '', 'weburl' => '', 'vimage' => '', 'qrcode' => '', 'zone' => '', 'terms' => '', 'excerpt' => '', 'guid' => null, 'comments_on' => NULL); if ($voucher) { foreach (array_keys($values) as $field) { if (isset($voucher->{$field})) { $values[$field] = $voucher->{$field}; } } } if (elgg_is_sticky_form('vouchers')) { $sticky_values = elgg_get_sticky_values('vouchers'); foreach ($sticky_values as $key => $value) { $values[$key] = $value; } } elgg_clear_sticky_form('vouchers'); return $values; }
/** * Prepare the add/edit form variables * * @param ElggObject $page * @return array */ function markdown_wiki_prepare_form_vars($markdown_wiki = null, $container_guid = 0) { // input names => defaults $values = array('title' => '', 'description' => $_SESSION['convert_markdown_wiki'], 'summary' => '', 'access_id' => ACCESS_PUBLIC, 'write_access_id' => ACCESS_LOGGED_IN, 'tags' => '', 'container_guid' => $container_guid ? $container_guid : elgg_get_page_owner_guid(), 'guid' => null, 'entity' => $markdown_wiki); if ($markdown_wiki) { foreach (array_keys($values) as $field) { if (isset($markdown_wiki->{$field})) { $values[$field] = $markdown_wiki->{$field}; } } } if (elgg_is_sticky_form('markdown_wiki')) { $sticky_values = elgg_get_sticky_values('markdown_wiki'); foreach ($sticky_values as $key => $value) { $values[$key] = $value; } } elgg_clear_sticky_form('markdown_wiki'); unset($_SESSION['convert_markdown_wiki']); return $values; }
/** * Pull together market variables for the save/edit form * * @param Market $post * @return array */ function market_prepare_form_vars($post = NULL) { $values = array('title' => NULL, 'description' => NULL, 'price' => NULL, 'access_id' => ACCESS_DEFAULT, 'marketcategory' => NULL, 'market_type' => NULL, 'location' => NULL, 'custom' => NULL, 'tags' => NULL, 'container_guid' => elgg_get_page_owner_guid(), 'guid' => NULL); if ($post) { foreach (array_keys($values) as $field) { if (isset($post->{$field})) { $values[$field] = $post->{$field}; } } } if (elgg_is_sticky_form('market')) { $sticky_values = elgg_get_sticky_values('market'); foreach ($sticky_values as $key => $value) { $values[$key] = $value; } } elgg_clear_sticky_form('market'); if (!$post) { return $values; } return $values; }
/** * Prepare the add/edit form variables * * @param ElggObject $project * @return array */ function projects_prepare_form_vars($project = null, $parent_guid = 0) { // input names => defaults $values = array('title' => '', 'description' => '', 'project_type' => '', 'cost' => '', 'organization' => '', 'funding' => '', 'status' => '', 'start_date' => '', 'end_date' => '', 'assigned_to[]' => '', 'access_id' => ACCESS_DEFAULT, 'write_access_id' => ACCESS_DEFAULT, 'tags' => '', 'upload' => '', 'container_guid' => elgg_get_page_owner_guid(), 'guid' => null, 'entity' => $project, 'parent_guid' => $parent_guid); if ($project) { foreach (array_keys($values) as $field) { if (isset($project->{$field})) { $values[$field] = $project->{$field}; } } $opis = elgg_get_entities_from_relationship(array("relationship" => "opi", "relationship_guid" => $project->guid, "inverse_relationship" => true)); $values['opis'] = $opis; } if (elgg_is_sticky_form('project')) { $sticky_values = elgg_get_sticky_values('project'); foreach ($sticky_values as $key => $value) { $values[$key] = $value; } } elgg_clear_sticky_form('project'); return $values; }
/** * Prepare wall river summary * @return string */ function formatSummary() { $subject = $this->getOwnerEntity(); $wall_owner = $this->getContainerEntity(); if ($wall_owner->guid == $subject->guid || $wall_owner->guid == elgg_get_page_owner_guid()) { $owned = true; } if (elgg_instanceof($wall_owner, 'group')) { $group_wall = true; } $summary[] = elgg_view('output/url', array('text' => $subject->name, 'href' => $subject->getURL(), 'class' => 'elgg-river-subject')); if ($this->address) { $summary[] = elgg_echo('wall:new:address'); } else { $files = elgg_get_entities_from_relationship(array('relationship' => 'attached', 'relationship_guid' => $this->guid, 'inverse_relationship' => true, 'count' => true)); if ($files) { $images = elgg_get_entities_from_relationship(array('types' => 'object', 'subtypes' => 'file', 'metadata_name_value_pairs' => array('name' => 'simpletype', 'value' => 'image'), 'relationship' => 'attached', 'relationship_guid' => $this->guid, 'inverse_relationship' => true, 'count' => true)); if ($files == $images) { $summary[] = elgg_echo('wall:new:images', array($images)); } else { if (!$images) { $summary[] = elgg_echo('wall:new:items', array($files)); } else { $summary[] = elgg_echo('wall:new:attachments', array($images, $files - $images)); } } } else { if (!$owned && !$group_wall) { $summary[] = elgg_echo('wall:new:status'); } } } if (!$owned && !$group_wall) { $wall_owner_link = elgg_view('output/url', array('text' => $wall_owner->name, 'href' => $wall_owner->getURL(), 'class' => 'elgg-river-object')); $summary[] = elgg_echo('wall:owner:suffix', array($wall_owner_link)); } return implode(' ', $summary); }
/** * Updates fixed widgets on profile and dashboard * * @param string $hook_name name of the hook * @param string $entity_type type of the hook * @param unknown $return_value return value * @param unknown $params hook parameters * * @return void */ public static function checkFixedWidgets($hook_name, $entity_type, $return_value, $params) { $context = elgg_get_context(); if (!in_array($context, ['profile', 'dashboard'])) { // only check things if you are viewing a profile or dashboard page return; } $page_owner_guid = elgg_get_page_owner_guid(); if (empty($page_owner_guid)) { return; } $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); } }
/** * Prepare the add/edit form variables * * @param ElggObject $page * @param int $parent_guid * @param ElggAnnotation $revision * @return array */ function pages_prepare_form_vars($page = null, $parent_guid = 0, $revision = null) { // input names => defaults $values = array('title' => '', 'description' => '', 'access_id' => ACCESS_DEFAULT, 'write_access_id' => ACCESS_DEFAULT, 'tags' => '', 'container_guid' => elgg_get_page_owner_guid(), 'guid' => null, 'entity' => $page, 'parent_guid' => $parent_guid); if ($page) { foreach (array_keys($values) as $field) { if (isset($page->{$field})) { $values[$field] = $page->{$field}; } } } if (elgg_is_sticky_form('page')) { $sticky_values = elgg_get_sticky_values('page'); foreach ($sticky_values as $key => $value) { $values[$key] = $value; } } elgg_clear_sticky_form('page'); // load the revision annotation if requested if ($revision instanceof ElggAnnotation && $revision->entity_guid == $page->getGUID()) { $values['description'] = $revision->value; } return $values; }
/** * Prepare the add/edit form variables * * @param ElggObject $task * @return array */ function task_prepare_form_vars($task = null, $list_guid = 0) { // input names => defaults $values = array('title' => get_input('title', ''), 'description' => '', 'priority' => '', 'access_id' => ACCESS_DEFAULT, 'write_access_id' => ACCESS_DEFAULT, 'tags' => '', 'container_guid' => elgg_get_page_owner_guid(), 'guid' => null, 'entity' => $task, 'list_guid' => $list_guid, 'referer_guid' => get_input('referer_guid', '')); if ($task) { foreach (array_keys($values) as $field) { if (isset($task->{$field})) { $values[$field] = $task->{$field}; } } } if (elgg_is_sticky_form('task')) { $sticky_values = elgg_get_sticky_values('task'); foreach ($sticky_values as $key => $value) { $values[$key] = $value; } } elgg_clear_sticky_form('task'); if ($referer = get_input('referer')) { $link = elgg_view('output/url', array('href' => $referer, 'text' => elgg_echo('tasks:this:moreinfo:here'))); $values['description'] .= "<p>" . elgg_echo('tasks:this:moreinfo', array($link)) . "</p>"; } return $values; }
<?php /** * Activity widget content view */ $num = (int) $vars['entity']->num_display; $options = array('limit' => $num, 'pagination' => false); if (elgg_in_context('dashboard')) { if ($vars['entity']->content_type == 'friends') { $options['relationship_guid'] = elgg_get_page_owner_guid(); $options['relationship'] = 'friend'; } } else { $options['subject_guid'] = elgg_get_page_owner_guid(); } $content = elgg_list_river($options); if (!$content) { $content = elgg_echo('river:none'); } echo $content;