From 2bd7ef20eca36015bd404a94c328c15bc3dd23df Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 22 Aug 2009 19:56:20 +0000 Subject: finished moving lists to pages/lists/ --- friendmostviewed.php | 59 ---------------------------- mostviewedimages.php | 41 ------------------- mostviewedimageslastmonth.php | 50 ----------------------- mostviewedimagesthismonth.php | 50 ----------------------- mostviewedimagesthisyear.php | 50 ----------------------- mostviewedimagestoday.php | 50 ----------------------- pages/lists/friendmostviewed.php | 59 ++++++++++++++++++++++++++++ pages/lists/highestrated.php | 2 +- pages/lists/highestvotecount.php | 2 +- pages/lists/mostcommentedimages.php | 2 +- pages/lists/mostcommentedimagesthismonth.php | 2 +- pages/lists/mostcommentedimagestoday.php | 2 +- pages/lists/mostviewedimages.php | 41 +++++++++++++++++++ pages/lists/mostviewedimageslastmonth.php | 50 +++++++++++++++++++++++ pages/lists/mostviewedimagesthismonth.php | 50 +++++++++++++++++++++++ pages/lists/mostviewedimagesthisyear.php | 50 +++++++++++++++++++++++ pages/lists/mostviewedimagestoday.php | 50 +++++++++++++++++++++++ pages/lists/recentlycommented.php | 2 +- pages/lists/recentlyviewed.php | 45 +++++++++++++++++++++ pages/lists/recentvotes.php | 2 +- pages/lists/yourmostviewed.php | 42 ++++++++++++++++++++ recentlyviewed.php | 45 --------------------- start.php | 18 ++++----- yourmostviewed.php | 41 ------------------- 24 files changed, 403 insertions(+), 402 deletions(-) delete mode 100644 friendmostviewed.php delete mode 100644 mostviewedimages.php delete mode 100644 mostviewedimageslastmonth.php delete mode 100644 mostviewedimagesthismonth.php delete mode 100644 mostviewedimagesthisyear.php delete mode 100644 mostviewedimagestoday.php create mode 100644 pages/lists/friendmostviewed.php create mode 100644 pages/lists/mostviewedimages.php create mode 100644 pages/lists/mostviewedimageslastmonth.php create mode 100644 pages/lists/mostviewedimagesthismonth.php create mode 100644 pages/lists/mostviewedimagesthisyear.php create mode 100644 pages/lists/mostviewedimagestoday.php create mode 100644 pages/lists/recentlyviewed.php create mode 100644 pages/lists/yourmostviewed.php delete mode 100644 recentlyviewed.php delete mode 100644 yourmostviewed.php diff --git a/friendmostviewed.php b/friendmostviewed.php deleted file mode 100644 index 5c4ec91f4..000000000 --- a/friendmostviewed.php +++ /dev/null @@ -1,59 +0,0 @@ -username); - } - }*/ - - if (is_null(page_owner_entity()->name) || page_owner_entity()->name == '') { - $friendname = get_input('username'); - } else { - $friendname = page_owner_entity()->name; - }; - - //there has to be a better way to do this - if(!$friendname) { - $page = get_input("page"); - list($pagename, $friendname) = split("/", $page); - } - $user = get_user_by_username($friendname); - global $CONFIG; - $prefix = $CONFIG->dbprefix; - $max = 24; - - $sql = "SELECT ent.guid, count( * ) AS views - FROM " . $prefix . "entities ent - INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id - AND sub.subtype = 'image' - INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid - INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id - AND ms.string = 'tp_view' - WHERE ent.owner_guid = " . $user->guid . " - GROUP BY ent.guid - ORDER BY views DESC - LIMIT $max"; - - $result = get_data($sql); - - $entities = array(); - foreach($result as $entity) { - $entities[] = get_entity($entity->guid); - } - - $title = sprintf(elgg_echo("tidypics:friendmostviewed"), $friendname); - $area2 = elgg_view_title($title); - $area2 .= elgg_view_entity_list($entities, $max, 0, $max); - $body = elgg_view_layout('two_column_left_sidebar', '', $area2); - page_draw($title, $body); - -?> \ No newline at end of file diff --git a/mostviewedimages.php b/mostviewedimages.php deleted file mode 100644 index 66266f5e7..000000000 --- a/mostviewedimages.php +++ /dev/null @@ -1,41 +0,0 @@ -dbprefix; - $max = 24; - - //this works but is wildly inefficient - //$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000); - - $sql = "SELECT ent.guid, count( * ) AS views - FROM " . $prefix . "entities ent - INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id - AND sub.subtype = 'image' - INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid AND ann1.owner_guid != ent.owner_guid - INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id - AND ms.string = 'tp_view' - GROUP BY ent.guid - ORDER BY views DESC - LIMIT $max"; - - $result = get_data($sql); - - $entities = array(); - foreach($result as $entity) { - $entities[] = get_entity($entity->guid); - } - $title = elgg_echo("tidypics:mostviewed"); - $area2 = elgg_view_title($title); - $area2 .= elgg_view_entity_list($entities, $max, 0, $max); - $body = elgg_view_layout('two_column_left_sidebar', '', $area2); - page_draw($title, $body); -?> \ No newline at end of file diff --git a/mostviewedimageslastmonth.php b/mostviewedimageslastmonth.php deleted file mode 100644 index c57a74233..000000000 --- a/mostviewedimageslastmonth.php +++ /dev/null @@ -1,50 +0,0 @@ -dbprefix; - $max = 24; - - - //find timestamps for first and last days of last month - $time_info = new stdClass(); - $time_info->start = strtotime("-1 months", mktime(0,0,0, date("m"), 1, date("Y"))); - $time_info->end = mktime(0,0,0,date("m"), 0, date("Y")); - - //this works but is wildly inefficient - //$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000); - - $sql = "SELECT ent.guid, count( * ) AS views - FROM " . $prefix . "entities ent - INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id - AND sub.subtype = 'image' - INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid AND ann1.owner_guid != ent.owner_guid - INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id - AND ms.string = 'tp_view' - WHERE ann1.time_created BETWEEN $time_info->start AND $time_info->end - GROUP BY ent.guid - ORDER BY views DESC - LIMIT $max"; - - $result = get_data($sql); - - $entities = array(); - foreach($result as $entity) { - $entities[] = get_entity($entity->guid); - } - - tidypics_mostviewed_submenus(); - $title = elgg_echo("tidypics:mostviewedlastmonth"); - $area2 = elgg_view_title($title); - $area2 .= elgg_view_entity_list($entities, $max, 0, $max); - $body = elgg_view_layout('two_column_left_sidebar', '', $area2); - page_draw($title, $body); -?> \ No newline at end of file diff --git a/mostviewedimagesthismonth.php b/mostviewedimagesthismonth.php deleted file mode 100644 index e950f0f20..000000000 --- a/mostviewedimagesthismonth.php +++ /dev/null @@ -1,50 +0,0 @@ -dbprefix; - $max = 24; - - - //find timestamps for first and last days of this month - $time_info = new stdClass(); - $time_info->start = mktime(0,0,0, date("m"), 1, date("Y")); - $time_info->end = mktime(); - - //this works but is wildly inefficient - //$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000); - - $sql = "SELECT ent.guid, count( * ) AS views - FROM " . $prefix . "entities ent - INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id - AND sub.subtype = 'image' - INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid AND ann1.owner_guid != ent.owner_guid - INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id - AND ms.string = 'tp_view' - WHERE ann1.time_created BETWEEN $time_info->start AND $time_info->end - GROUP BY ent.guid - ORDER BY views DESC - LIMIT $max"; - - $result = get_data($sql); - - $entities = array(); - foreach($result as $entity) { - $entities[] = get_entity($entity->guid); - } - - tidypics_mostviewed_submenus(); - $title = elgg_echo("tidypics:mostviewedthismonth"); - $area2 = elgg_view_title($title); - $area2 .= elgg_view_entity_list($entities, $max, 0, $max); - $body = elgg_view_layout('two_column_left_sidebar', '', $area2); - page_draw($title, $body); -?> \ No newline at end of file diff --git a/mostviewedimagesthisyear.php b/mostviewedimagesthisyear.php deleted file mode 100644 index 807260769..000000000 --- a/mostviewedimagesthisyear.php +++ /dev/null @@ -1,50 +0,0 @@ -dbprefix; - $max = 24; - - - //find timestamps for first day of the year and current date - $time_info = new stdClass(); - $time_info->start = mktime(0,0,0, 1, 1, date("Y")); - $time_info->end = mktime(); - - //this works but is wildly inefficient - //$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000); - - $sql = "SELECT ent.guid, count( * ) AS views - FROM " . $prefix . "entities ent - INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id - AND sub.subtype = 'image' - INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid AND ann1.owner_guid != ent.owner_guid - INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id - AND ms.string = 'tp_view' - WHERE ann1.time_created BETWEEN $time_info->start AND $time_info->end - GROUP BY ent.guid - ORDER BY views DESC - LIMIT $max"; - - $result = get_data($sql); - - $entities = array(); - foreach($result as $entity) { - $entities[] = get_entity($entity->guid); - } - - tidypics_mostviewed_submenus(); - $title = elgg_echo("tidypics:mostviewedthisyear"); - $area2 = elgg_view_title($title); - $area2 .= elgg_view_entity_list($entities, $max, 0, $max); - $body = elgg_view_layout('two_column_left_sidebar', '', $area2); - page_draw($title, $body); -?> \ No newline at end of file diff --git a/mostviewedimagestoday.php b/mostviewedimagestoday.php deleted file mode 100644 index b971771ba..000000000 --- a/mostviewedimagestoday.php +++ /dev/null @@ -1,50 +0,0 @@ -dbprefix; - $max = 24; - - - //find timestamps for today - $time_info = new stdClass(); - $time_info->start = mktime(0,0,0, date("m"), date("d"), date("Y")); - $time_info->end = mktime(); - - //this works but is wildly inefficient - //$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000); - - $sql = "SELECT ent.guid, count( * ) AS views - FROM " . $prefix . "entities ent - INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id - AND sub.subtype = 'image' - INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid AND ann1.owner_guid != ent.owner_guid - INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id - AND ms.string = 'tp_view' - WHERE ann1.time_created BETWEEN $time_info->start AND $time_info->end - GROUP BY ent.guid - ORDER BY views DESC - LIMIT $max"; - - $result = get_data($sql); - - $entities = array(); - foreach($result as $entity) { - $entities[] = get_entity($entity->guid); - } - - tidypics_mostviewed_submenus(); - $title = elgg_echo("tidypics:mostviewedtoday"); - $area2 = elgg_view_title($title); - $area2 .= elgg_view_entity_list($entities, $max, 0, $max); - $body = elgg_view_layout('two_column_left_sidebar', '', $area2); - page_draw($title, $body); -?> \ No newline at end of file diff --git a/pages/lists/friendmostviewed.php b/pages/lists/friendmostviewed.php new file mode 100644 index 000000000..793304edc --- /dev/null +++ b/pages/lists/friendmostviewed.php @@ -0,0 +1,59 @@ +username); + } + }*/ + + if (is_null(page_owner_entity()->name) || page_owner_entity()->name == '') { + $friendname = get_input('username'); + } else { + $friendname = page_owner_entity()->name; + }; + + //there has to be a better way to do this + if(!$friendname) { + $page = get_input("page"); + list($pagename, $friendname) = split("/", $page); + } + $user = get_user_by_username($friendname); + global $CONFIG; + $prefix = $CONFIG->dbprefix; + $max = 24; + + $sql = "SELECT ent.guid, count( * ) AS views + FROM " . $prefix . "entities ent + INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id + AND sub.subtype = 'image' + INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid + INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id + AND ms.string = 'tp_view' + WHERE ent.owner_guid = " . $user->guid . " + GROUP BY ent.guid + ORDER BY views DESC + LIMIT $max"; + + $result = get_data($sql); + + $entities = array(); + foreach($result as $entity) { + $entities[] = get_entity($entity->guid); + } + + $title = sprintf(elgg_echo("tidypics:friendmostviewed"), $friendname); + $area2 = elgg_view_title($title); + $area2 .= elgg_view_entity_list($entities, $max, 0, $max); + $body = elgg_view_layout('two_column_left_sidebar', '', $area2); + page_draw($title, $body); + +?> \ No newline at end of file diff --git a/pages/lists/highestrated.php b/pages/lists/highestrated.php index e9f0296e2..bacb7ba86 100644 --- a/pages/lists/highestrated.php +++ b/pages/lists/highestrated.php @@ -4,7 +4,7 @@ * */ - include_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php"; //if no friends were requested, see world pictures instead, or redirect to user's friends /* if (is_null(get_input('username')) || get_input('username')=='') { diff --git a/pages/lists/highestvotecount.php b/pages/lists/highestvotecount.php index 694afb32d..26b907144 100644 --- a/pages/lists/highestvotecount.php +++ b/pages/lists/highestvotecount.php @@ -7,7 +7,7 @@ */ // Load Elgg engine - include_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php"; global $CONFIG; $prefix = $CONFIG->dbprefix; diff --git a/pages/lists/mostcommentedimages.php b/pages/lists/mostcommentedimages.php index b3a36a9ac..e22d3863e 100644 --- a/pages/lists/mostcommentedimages.php +++ b/pages/lists/mostcommentedimages.php @@ -7,7 +7,7 @@ */ // Load Elgg engine - include_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php"; global $CONFIG; $prefix = $CONFIG->dbprefix; diff --git a/pages/lists/mostcommentedimagesthismonth.php b/pages/lists/mostcommentedimagesthismonth.php index c47cee2da..88b8371ee 100644 --- a/pages/lists/mostcommentedimagesthismonth.php +++ b/pages/lists/mostcommentedimagesthismonth.php @@ -7,7 +7,7 @@ */ // Load Elgg engine - include_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php"; global $CONFIG; $prefix = $CONFIG->dbprefix; diff --git a/pages/lists/mostcommentedimagestoday.php b/pages/lists/mostcommentedimagestoday.php index 066feb45e..d35ac468d 100644 --- a/pages/lists/mostcommentedimagestoday.php +++ b/pages/lists/mostcommentedimagestoday.php @@ -7,7 +7,7 @@ */ // Load Elgg engine - include_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php"; global $CONFIG; $prefix = $CONFIG->dbprefix; diff --git a/pages/lists/mostviewedimages.php b/pages/lists/mostviewedimages.php new file mode 100644 index 000000000..bd1b3ee92 --- /dev/null +++ b/pages/lists/mostviewedimages.php @@ -0,0 +1,41 @@ +dbprefix; + $max = 24; + + //this works but is wildly inefficient + //$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000); + + $sql = "SELECT ent.guid, count( * ) AS views + FROM " . $prefix . "entities ent + INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id + AND sub.subtype = 'image' + INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid AND ann1.owner_guid != ent.owner_guid + INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id + AND ms.string = 'tp_view' + GROUP BY ent.guid + ORDER BY views DESC + LIMIT $max"; + + $result = get_data($sql); + + $entities = array(); + foreach($result as $entity) { + $entities[] = get_entity($entity->guid); + } + $title = elgg_echo("tidypics:mostviewed"); + $area2 = elgg_view_title($title); + $area2 .= elgg_view_entity_list($entities, $max, 0, $max); + $body = elgg_view_layout('two_column_left_sidebar', '', $area2); + page_draw($title, $body); +?> \ No newline at end of file diff --git a/pages/lists/mostviewedimageslastmonth.php b/pages/lists/mostviewedimageslastmonth.php new file mode 100644 index 000000000..c5edec3d9 --- /dev/null +++ b/pages/lists/mostviewedimageslastmonth.php @@ -0,0 +1,50 @@ +dbprefix; + $max = 24; + + + //find timestamps for first and last days of last month + $time_info = new stdClass(); + $time_info->start = strtotime("-1 months", mktime(0,0,0, date("m"), 1, date("Y"))); + $time_info->end = mktime(0,0,0,date("m"), 0, date("Y")); + + //this works but is wildly inefficient + //$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000); + + $sql = "SELECT ent.guid, count( * ) AS views + FROM " . $prefix . "entities ent + INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id + AND sub.subtype = 'image' + INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid AND ann1.owner_guid != ent.owner_guid + INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id + AND ms.string = 'tp_view' + WHERE ann1.time_created BETWEEN $time_info->start AND $time_info->end + GROUP BY ent.guid + ORDER BY views DESC + LIMIT $max"; + + $result = get_data($sql); + + $entities = array(); + foreach($result as $entity) { + $entities[] = get_entity($entity->guid); + } + + tidypics_mostviewed_submenus(); + $title = elgg_echo("tidypics:mostviewedlastmonth"); + $area2 = elgg_view_title($title); + $area2 .= elgg_view_entity_list($entities, $max, 0, $max); + $body = elgg_view_layout('two_column_left_sidebar', '', $area2); + page_draw($title, $body); +?> \ No newline at end of file diff --git a/pages/lists/mostviewedimagesthismonth.php b/pages/lists/mostviewedimagesthismonth.php new file mode 100644 index 000000000..dfdb6136a --- /dev/null +++ b/pages/lists/mostviewedimagesthismonth.php @@ -0,0 +1,50 @@ +dbprefix; + $max = 24; + + + //find timestamps for first and last days of this month + $time_info = new stdClass(); + $time_info->start = mktime(0,0,0, date("m"), 1, date("Y")); + $time_info->end = mktime(); + + //this works but is wildly inefficient + //$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000); + + $sql = "SELECT ent.guid, count( * ) AS views + FROM " . $prefix . "entities ent + INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id + AND sub.subtype = 'image' + INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid AND ann1.owner_guid != ent.owner_guid + INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id + AND ms.string = 'tp_view' + WHERE ann1.time_created BETWEEN $time_info->start AND $time_info->end + GROUP BY ent.guid + ORDER BY views DESC + LIMIT $max"; + + $result = get_data($sql); + + $entities = array(); + foreach($result as $entity) { + $entities[] = get_entity($entity->guid); + } + + tidypics_mostviewed_submenus(); + $title = elgg_echo("tidypics:mostviewedthismonth"); + $area2 = elgg_view_title($title); + $area2 .= elgg_view_entity_list($entities, $max, 0, $max); + $body = elgg_view_layout('two_column_left_sidebar', '', $area2); + page_draw($title, $body); +?> \ No newline at end of file diff --git a/pages/lists/mostviewedimagesthisyear.php b/pages/lists/mostviewedimagesthisyear.php new file mode 100644 index 000000000..e6c8a53db --- /dev/null +++ b/pages/lists/mostviewedimagesthisyear.php @@ -0,0 +1,50 @@ +dbprefix; + $max = 24; + + + //find timestamps for first day of the year and current date + $time_info = new stdClass(); + $time_info->start = mktime(0,0,0, 1, 1, date("Y")); + $time_info->end = mktime(); + + //this works but is wildly inefficient + //$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000); + + $sql = "SELECT ent.guid, count( * ) AS views + FROM " . $prefix . "entities ent + INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id + AND sub.subtype = 'image' + INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid AND ann1.owner_guid != ent.owner_guid + INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id + AND ms.string = 'tp_view' + WHERE ann1.time_created BETWEEN $time_info->start AND $time_info->end + GROUP BY ent.guid + ORDER BY views DESC + LIMIT $max"; + + $result = get_data($sql); + + $entities = array(); + foreach($result as $entity) { + $entities[] = get_entity($entity->guid); + } + + tidypics_mostviewed_submenus(); + $title = elgg_echo("tidypics:mostviewedthisyear"); + $area2 = elgg_view_title($title); + $area2 .= elgg_view_entity_list($entities, $max, 0, $max); + $body = elgg_view_layout('two_column_left_sidebar', '', $area2); + page_draw($title, $body); +?> \ No newline at end of file diff --git a/pages/lists/mostviewedimagestoday.php b/pages/lists/mostviewedimagestoday.php new file mode 100644 index 000000000..9845506eb --- /dev/null +++ b/pages/lists/mostviewedimagestoday.php @@ -0,0 +1,50 @@ +dbprefix; + $max = 24; + + + //find timestamps for today + $time_info = new stdClass(); + $time_info->start = mktime(0,0,0, date("m"), date("d"), date("Y")); + $time_info->end = mktime(); + + //this works but is wildly inefficient + //$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000); + + $sql = "SELECT ent.guid, count( * ) AS views + FROM " . $prefix . "entities ent + INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id + AND sub.subtype = 'image' + INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid AND ann1.owner_guid != ent.owner_guid + INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id + AND ms.string = 'tp_view' + WHERE ann1.time_created BETWEEN $time_info->start AND $time_info->end + GROUP BY ent.guid + ORDER BY views DESC + LIMIT $max"; + + $result = get_data($sql); + + $entities = array(); + foreach($result as $entity) { + $entities[] = get_entity($entity->guid); + } + + tidypics_mostviewed_submenus(); + $title = elgg_echo("tidypics:mostviewedtoday"); + $area2 = elgg_view_title($title); + $area2 .= elgg_view_entity_list($entities, $max, 0, $max); + $body = elgg_view_layout('two_column_left_sidebar', '', $area2); + page_draw($title, $body); +?> \ No newline at end of file diff --git a/pages/lists/recentlycommented.php b/pages/lists/recentlycommented.php index bfb64981d..da0f2a12a 100644 --- a/pages/lists/recentlycommented.php +++ b/pages/lists/recentlycommented.php @@ -7,7 +7,7 @@ */ // Load Elgg engine - include_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php"; global $CONFIG; $prefix = $CONFIG->dbprefix; diff --git a/pages/lists/recentlyviewed.php b/pages/lists/recentlyviewed.php new file mode 100644 index 000000000..b8a5531b2 --- /dev/null +++ b/pages/lists/recentlyviewed.php @@ -0,0 +1,45 @@ +dbprefix; + $max_limit = 200; //get extra because you'll have multiple views per image in the result set + $max = 16; //controls how many actually show on screen + + //this works but is wildly inefficient + //$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000); + + $sql = "SELECT distinct ent.guid, ann1.time_created + FROM " . $prefix . "entities ent + INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id + AND sub.subtype = 'image' + INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid + INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id + AND ms.string = 'tp_view' + ORDER BY ann1.id DESC + LIMIT $max_limit"; + + $result = get_data($sql); + + $entities = array(); + foreach($result as $entity) { + if(!$entities[$entity->guid]) { + $entities[$entity->guid] = get_entity($entity->guid); + } + if(count($entities) >= $max) break; + } + + $title = elgg_echo("tidypics:recentlyviewed"); + $area2 = elgg_view_title($title); + $area2 .= elgg_view_entity_list($entities, $max, 0, $max); + $body = elgg_view_layout('two_column_left_sidebar', '', $area2); + page_draw($title, $body); +?> \ No newline at end of file diff --git a/pages/lists/recentvotes.php b/pages/lists/recentvotes.php index f9ddbdc38..3d8eac97e 100644 --- a/pages/lists/recentvotes.php +++ b/pages/lists/recentvotes.php @@ -7,7 +7,7 @@ */ // Load Elgg engine - include_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php"; global $CONFIG; $prefix = $CONFIG->dbprefix; diff --git a/pages/lists/yourmostviewed.php b/pages/lists/yourmostviewed.php new file mode 100644 index 000000000..6a2114d19 --- /dev/null +++ b/pages/lists/yourmostviewed.php @@ -0,0 +1,42 @@ +dbprefix; + $max = 24; + + $sql = "SELECT ent.guid, count( * ) AS views + FROM " . $prefix . "entities ent + INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id + AND sub.subtype = 'image' + INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid + INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id + AND ms.string = 'tp_view' + WHERE ent.owner_guid = " . $viewer->guid . " + GROUP BY ent.guid + ORDER BY views DESC + LIMIT $max"; + + $result = get_data($sql); + + $entities = array(); + foreach($result as $entity) { + $entities[] = get_entity($entity->guid); + } + + $title = elgg_echo("tidypics:yourmostviewed"); + $area2 = elgg_view_title($title); + $area2 .= elgg_view_entity_list($entities, $max, 0, $max); + $body = elgg_view_layout('two_column_left_sidebar', '', $area2); + page_draw($title, $body); +?> \ No newline at end of file diff --git a/recentlyviewed.php b/recentlyviewed.php deleted file mode 100644 index 4cf3737dd..000000000 --- a/recentlyviewed.php +++ /dev/null @@ -1,45 +0,0 @@ -dbprefix; - $max_limit = 200; //get extra because you'll have multiple views per image in the result set - $max = 16; //controls how many actually show on screen - - //this works but is wildly inefficient - //$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000); - - $sql = "SELECT distinct ent.guid, ann1.time_created - FROM " . $prefix . "entities ent - INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id - AND sub.subtype = 'image' - INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid - INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id - AND ms.string = 'tp_view' - ORDER BY ann1.id DESC - LIMIT $max_limit"; - - $result = get_data($sql); - - $entities = array(); - foreach($result as $entity) { - if(!$entities[$entity->guid]) { - $entities[$entity->guid] = get_entity($entity->guid); - } - if(count($entities) >= $max) break; - } - - $title = elgg_echo("tidypics:recentlyviewed"); - $area2 = elgg_view_title($title); - $area2 .= elgg_view_entity_list($entities, $max, 0, $max); - $body = elgg_view_layout('two_column_left_sidebar', '', $area2); - page_draw($title, $body); -?> \ No newline at end of file diff --git a/start.php b/start.php index 8f99a8212..53b2c17c4 100644 --- a/start.php +++ b/start.php @@ -192,14 +192,14 @@ global $CONFIG; add_submenu_item(elgg_echo('tidypics:mostvieweddashboard'), $CONFIG->url . "mod/tidypics/mostvieweddashboard.php"); - add_submenu_item(elgg_echo('tidypics:mostviewedthisyear'), $CONFIG->url . "mod/tidypics/mostviewedimagesthisyear.php"); - add_submenu_item(elgg_echo('tidypics:mostviewedthismonth'), $CONFIG->url . "mod/tidypics/mostviewedimagesthismonth.php"); - add_submenu_item(elgg_echo('tidypics:mostviewedlastmonth'), $CONFIG->url . "mod/tidypics/mostviewedimageslastmonth.php"); - add_submenu_item(elgg_echo('tidypics:mostviewedtoday'), $CONFIG->url . "mod/tidypics/mostviewedimagestoday.php"); + add_submenu_item(elgg_echo('tidypics:mostviewedthisyear'), $CONFIG->url . "mod/tidypics/pages/lists/mostviewedimagesthisyear.php"); + add_submenu_item(elgg_echo('tidypics:mostviewedthismonth'), $CONFIG->url . "mod/tidypics/pages/lists/mostviewedimagesthismonth.php"); + add_submenu_item(elgg_echo('tidypics:mostviewedlastmonth'), $CONFIG->url . "mod/tidypics/pages/lists/mostviewedimageslastmonth.php"); + add_submenu_item(elgg_echo('tidypics:mostviewedtoday'), $CONFIG->url . "mod/tidypics/pages/lists/mostviewedimagestoday.php"); add_submenu_item(elgg_echo('tidypics:mostcommented'), $CONFIG->url . "mod/tidypics/pages/lists/mostcommentedimages.php"); add_submenu_item(elgg_echo('tidypics:mostcommentedthismonth'), $CONFIG->url . "mod/tidypics/pages/lists/mostcommentedimagesthismonth.php"); add_submenu_item(elgg_echo('tidypics:mostcommentedtoday'), $CONFIG->url . "mod/tidypics/pages/lists/mostcommentedimagestoday.php"); - add_submenu_item(elgg_echo('tidypics:recentlycommented'), $CONFIG->wwwroot . 'mod/tidypics/pages/lists/recentlycommented'); + add_submenu_item(elgg_echo('tidypics:recentlycommented'), $CONFIG->wwwroot . 'pg/photos/recentlycommented'); } /** * Sets up tidypics admin menu. Triggered on pagesetup. @@ -282,7 +282,7 @@ case "mostviewed": if (isset($page[1])) set_input('guid',$page[1]); - include($CONFIG->pluginspath . "tidypics/mostviewedimages.php"); + include($CONFIG->pluginspath . "tidypics/pages/lists/mostviewedimages.php"); break; case "mostrecent": @@ -292,7 +292,7 @@ case "yourmostviewed": if (isset($page[1])) set_input('guid',$page[1]); - include($CONFIG->pluginspath . "tidypics/yourmostviewed.php"); + include($CONFIG->pluginspath . "tidypics/pages/lists/yourmostviewed.php"); break; case "yourmostrecent": @@ -302,7 +302,7 @@ case "friendmostviewed": if (isset($page[1])) set_input('guid',$page[1]); - include($CONFIG->pluginspath . "tidypics/friendmostviewed.php"); + include($CONFIG->pluginspath . "tidypics/pages/lists/friendmostviewed.php"); break; case "friendmostrecent": @@ -312,7 +312,7 @@ case "recentlyviewed": if (isset($page[1])) set_input('guid',$page[1]); - include($CONFIG->pluginspath . "tidypics/recentlyviewed.php"); + include($CONFIG->pluginspath . "tidypics/pages/lists/recentlyviewed.php"); break; case "recentlycommented": diff --git a/yourmostviewed.php b/yourmostviewed.php deleted file mode 100644 index ffcdb50ad..000000000 --- a/yourmostviewed.php +++ /dev/null @@ -1,41 +0,0 @@ -dbprefix; - $max = 24; - - $sql = "SELECT ent.guid, count( * ) AS views - FROM " . $prefix . "entities ent - INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id - AND sub.subtype = 'image' - INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid - INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id - AND ms.string = 'tp_view' - WHERE ent.owner_guid = " . $viewer->guid . " - GROUP BY ent.guid - ORDER BY views DESC - LIMIT $max"; - - $result = get_data($sql); - - $entities = array(); - foreach($result as $entity) { - $entities[] = get_entity($entity->guid); - } - - $title = elgg_echo("tidypics:yourmostviewed"); - $area2 = elgg_view_title($title); - $area2 .= elgg_view_entity_list($entities, $max, 0, $max); - $body = elgg_view_layout('two_column_left_sidebar', '', $area2); - page_draw($title, $body); -?> \ No newline at end of file -- cgit v1.2.3