Adding base36 id to children listing...
authorHarvie <tomas@mudrunka.cz>
Mon, 29 Nov 2010 03:03:51 +0000 (04:03 +0100)
committerHarvie <tomas@mudrunka.cz>
Mon, 29 Nov 2010 03:03:51 +0000 (04:03 +0100)
wwwroot/inc/base36.inc [new file with mode: 0644]
wwwroot/inc/nodes.inc
wwwroot/inc/smarty/node_methodz/function.get_children.php

diff --git a/wwwroot/inc/base36.inc b/wwwroot/inc/base36.inc
new file mode 100644 (file)
index 0000000..257d42c
--- /dev/null
@@ -0,0 +1,6 @@
+<?php
+
+function addBase36id($node) {
+  $node['node_kid']=base_convert($node['node_id'],10,36);
+  return $node;
+}
index 47bba1bfa0765f8f033407542e639f8778eef314..46cbeaa2683f09d79fd272373e92506dd58929ad 100644 (file)
@@ -13,9 +13,9 @@
      }
    }
 
-class nodes {
-
+require_once(INCLUDE_DIR.'base36.inc');
 
+class nodes {
 
 function addNode($params) {
         global $db,$node,$error,$error_messages;
@@ -194,8 +194,7 @@ where $table_name.node_id='$node_handle'";
                         return false;
                 }
                 else {
-                        $node=$result->getRecord();
-                        $node['node_kid']=base_convert($node['node_id'],10,36);
+                        $node=addBase36id($result->getRecord());
                         $node['node_vector']=trim($node['node_vector'],"z");
                         $ancestors=str_split($node['node_vector'],VECTOR_CHARS);
                         foreach ($ancestors as $ancestor) {
@@ -234,7 +233,7 @@ where $table_name.node_id='$node_handle'";
                 $result=$db->query($q);
 
                 while ($result->next()){
-                        $record[]=$result->getRecord();
+                        $record[]=addBase36id($result->getRecord());
                 }
                 return $record;
 
@@ -253,7 +252,7 @@ node_parent='$node_handle' order by node_created $orderby LIMIT $offset,$limit";
                 $result=$db->query($q);
 
                 while ($result->next()) {
-                        $array[]=$result->getRecord();
+                        $array[]=addBase36id($result->getRecord());
                 }
 
                 return $array;
@@ -270,7 +269,7 @@ node_parent='$node_handle' order by node_created $orderby LIMIT $offset,$limit";
                 $result=$db->query($q);
 
                 while ($result->next()) {
-                        $children_array[]=$result->getRecord();
+                        $children_array[]=addBase36id($result->getRecord());
                 }
 
                 return $children_array;
index 75726787151f69654c96f906967b9421f16e7a69..9852318792199b815c677013f25ecb0247835c36 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+require_once(INCLUDE_DIR.'base36.inc');
+
         function smarty_function_get_children($params,&$smarty) {
 
                 global $db,$node;
@@ -36,7 +38,7 @@ rch'])."%' ";
                 $set=$db->query($q);
 
                 while ($set->next()) {
-                        $get_children_array[]=$set->getRecord();
+                        $get_children_array[]=addBase36id($set->getRecord());
                 }
 
                 $smarty->assign('get_children',$get_children_array);
This page took 0.115619 seconds and 4 git commands to generate.