aboutsummaryrefslogtreecommitdiff
path: root/mod/file/search.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-03-03 17:53:05 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-03-03 17:53:05 +0000
commit4766f36a4d74924f21ff329c4318ce4e069ffa04 (patch)
tree969b84632f2a8b0db79788a8a6db8e41d63e5cb4 /mod/file/search.php
parent57a217fd6b708844407486046a1faa23b46cac08 (diff)
downloadelgg-4766f36a4d74924f21ff329c4318ce4e069ffa04.tar.gz
elgg-4766f36a4d74924f21ff329c4318ce4e069ffa04.tar.bz2
Pulled in the interface changes.
git-svn-id: http://code.elgg.org/elgg/trunk@5257 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/file/search.php')
-rw-r--r--mod/file/search.php88
1 files changed, 88 insertions, 0 deletions
diff --git a/mod/file/search.php b/mod/file/search.php
new file mode 100644
index 000000000..ed8846514
--- /dev/null
+++ b/mod/file/search.php
@@ -0,0 +1,88 @@
+<?php
+
+ /**
+ * Elgg file search
+ *
+ * @package ElggFile
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+
+ */
+
+ // Load Elgg engine
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+
+ // Get input
+ $md_type = 'simpletype';
+ $tag = get_input('tag');
+ $search_viewtype = get_input('search_viewtype');
+
+ $friends = (int) get_input('friends_guid',0);
+ if ($friends) {
+ if ($owner_guid = get_user_friends($user_guid, "", 999999, 0)) {
+ foreach($owner_guid as $key => $friend)
+ $owner_guid[$key] = (int) $friend->getGUID();
+ } else {
+ $owner_guid = array();
+ }
+ } else {
+ $owner_guid = get_input('owner_guid',0);
+ if (substr_count($owner_guid,',')) {
+ $owner_guid = explode(",",$owner_guid);
+ }
+ }
+ $page_owner = get_input('page_owner',0);
+ if ($page_owner) {
+ set_page_owner($page_owner);
+ } else {
+ if ($friends) {
+ set_page_owner($friends);
+ } else {
+ if ($owner_guid > 0 && !is_array($owner_guid))
+ set_page_owner($owner_guid);
+ }
+ }
+
+ if (is_callable('group_gatekeeper')) group_gatekeeper();
+
+ if (empty($tag)) {
+ $title = elgg_echo('file:type:all');
+ $area2 = elgg_view_title(elgg_echo('file:type:all'));
+ } else {
+ $title = sprintf(elgg_echo('searchtitle'),$tag);
+ if (is_array($owner_guid)) {
+ $area2 = elgg_view_title(elgg_echo("file:friends:type:" . $tag));
+ } else if (page_owner() && page_owner() != $_SESSION['guid']) {
+ $area2 = elgg_view_title(sprintf(elgg_echo("file:user:type:" . $tag),page_owner_entity()->name));
+ } else{
+ $area2 = elgg_view_title(elgg_echo("file:type:" . $tag));
+ }
+ }
+ if ($friends) {
+ $area1 = get_filetype_cloud($friends,true);
+ } else if ($owner_guid) {
+ $area1 = get_filetype_cloud($owner_guid);
+ } else {
+ $area1 = get_filetype_cloud();
+ }
+
+ // Set context
+ set_context('search');
+
+ $limit = 10;
+ if ($search_viewtype == "gallery") $limit = 12;
+ if (!empty($tag)) {
+ $area2 .= list_entities_from_metadata($md_type, $tag, 'object', 'file', $owner_guid, $limit);
+ } else {
+ $area2 .= elgg_list_entities(array('types' => 'object', 'subtypes' => 'file', 'owner_guid' => $owner_guid, 'limit' => $limit));
+ }
+
+ set_context("file");
+
+ $body = elgg_view_layout('two_column_left_sidebar',$area1, $area2);
+
+ page_draw($title, $body);
+
+?> \ No newline at end of file