From 368d735fbf606b8d593b2bc7b719af81963a9699 Mon Sep 17 00:00:00 2001 From: Harvie Date: Mon, 16 May 2011 04:14:55 +0200 Subject: [PATCH] function nodes::GetUserSubmissionsChildren() created, need to write some usefull SQL query --- wwwroot/backend/mysql/backend.inc | 19 ++++++++++++++++++- wwwroot/inc/result.inc | 2 +- ...function.get_user_submissions_children.php | 11 +++++------ 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/wwwroot/backend/mysql/backend.inc b/wwwroot/backend/mysql/backend.inc index daba57b..0dc22dc 100644 --- a/wwwroot/backend/mysql/backend.inc +++ b/wwwroot/backend/mysql/backend.inc @@ -261,7 +261,7 @@ function getChildrenNodes($orderby="desc",$offset=0,$limit=DEFAULT_LISTING_AMOUN $q="select users.*,nodes.* from nodes left join users on users.user_id=nodes.node_creator where node_parent='$node_handle' order by node_created $orderby LIMIT $offset,$limit"; - echo $q; + #echo $q; $result=$db->query($q); while ($result->next()) { @@ -273,6 +273,23 @@ node_parent='$node_handle' order by node_created $orderby LIMIT $offset,$limit"; } +function GetUserSubmissionsChildren($user_id,$limit=23,$offset=0,$orderby='') { + global $db; + + $q="select users.*,nodes.* from nodes +left join users on users.user_id=nodes.node_creator where +node_creator='$user_id' order by node_created $orderby LIMIT $offset,$limit"; + //$q="select * from nodes LIMIT 10,10"; + #echo $q; + $result=$db->query($q); + + while ($result->next()) { + $array[]=addBase36id($result->getRecord()); + } + + return $array; +} + function getThreadedChildrenNodes($orderby="desc",$offset=0,$limit=DEFAULT_LISTING_AMOUNT) { global $db, $error, $node; $node_handle=$node['node_id']; diff --git a/wwwroot/inc/result.inc b/wwwroot/inc/result.inc index ab421a6..e37c118 100644 --- a/wwwroot/inc/result.inc +++ b/wwwroot/inc/result.inc @@ -44,7 +44,7 @@ class result extends PDOStatement { } function getInt($column) { //DEPRECATED!!! Use $this->fetch(); instead!!! - $this->getString(); //Dynamic typing OMG... + $this->getString($column); //Dynamic typing OMG... } function getNumRows() { //DEPRECATED!!! Use $this->rowCount(); instead!!! diff --git a/wwwroot/inc/smarty/node_methodz/function.get_user_submissions_children.php b/wwwroot/inc/smarty/node_methodz/function.get_user_submissions_children.php index 8e32075..68d7482 100644 --- a/wwwroot/inc/smarty/node_methodz/function.get_user_submissions_children.php +++ b/wwwroot/inc/smarty/node_methodz/function.get_user_submissions_children.php @@ -4,11 +4,11 @@ function smarty_function_get_user_submissions_children($params, &$smarty) { - if (!isset($_SESSION['user_id') + if (isset($_SESSION['user_id'])) $user_id = $_SESSION['user_id']; else return -1; - +/* if (!isset($params['listing_amount'])) $listing_amount = DEFAULT_LISTING_AMMOUNT; else @@ -23,10 +23,9 @@ function smarty_function_get_user_submissions_children($params, &$smarty) { $order_by = $params['order_by']; else $order_by = 'node_id'; - - $replies=nodes::GetUserSubmissionsChildren($user_id,$listing_ammount,$offset,$order_by); - +*/ + $replies=nodes::GetUserSubmissionsChildren($user_id /*,$listing_ammount,$offset,$order_by*/ ); $smarty->assign('get_user_submissions_children', $replies); + } -?> -- 2.30.2