Pman/Images.php
[Pman.Base] / Pman / Roo.php
index a20a1a3..46bcb61 100644 (file)
@@ -73,7 +73,7 @@ class Pman_Roo extends Pman
     function get($tab)
     {
          //  $this->jerr("Not authenticated", array('authFailure' => true));
-       echo '<PRE>';print_R($_GET);  DB_DataObject::debuglevel(1);
+       //echo '<PRE>';print_R($_GET);  DB_DataObject::debuglevel(1);
         
         $this->init(); // from pnan.
         
@@ -157,15 +157,14 @@ class Pman_Roo extends Pman
         $this->loadMap($x, $_columns, empty($_REQUEST['_distinct']) ? false:  $_REQUEST['_distinct']);
         
         $this->setFilters($x,$_REQUEST);
-        
-         echo "GOT THIS FAR?";
-        
+      
+         //print_r($x);
         // build join if req.
-         
+          //DB_DataObject::debugLevel(1);
         $total = $x->count($this->countWhat);
         // sorting..
-      //   DB_DataObject::debugLevel(1);
-        
+      //   
+        //var_dump($total);exit;
         $this->applySort($x);
         
         
@@ -260,12 +259,13 @@ class Pman_Roo extends Pman
      * @arg   DB_DataObject $x
      * 
      */
-    function applySort($x)
+    function applySort($x, $sort = '', $dir ='')
     {
         
        // Db_DataObject::debugLevel(1);
-        $sort = empty($_REQUEST['sort']) ? '' : $_REQUEST['sort'];
-        $dir = (empty($_REQUEST['dir']) || strtoupper($_REQUEST['dir']) == 'ASC' ? 'ASC' : 'DESC');
+        $sort = empty($_REQUEST['sort']) ? $sort : $_REQUEST['sort'];
+        $dir = empty($_REQUEST['dir']) ? $dir : $_REQUEST['dir'];
+        $dir = $dir == 'ASC' ? 'ASC' : 'DESC';
         
         
         
@@ -749,7 +749,7 @@ class Pman_Roo extends Pman
         //DB_DataObject::debugLevel(1);
         // we do select as after everything else as we need to plop distinct at the beginning??
         /// well I assume..
-       // echo '<PRE>';print_r($selectAs );exit;
+       // echo '<PRE>';print_r($this->colsJname);exit;
         foreach($selectAs as $ar) {
             $do->selectAs($ar[0], $ar[1], $ar[2]);
         }
@@ -841,9 +841,9 @@ class Pman_Roo extends Pman
                     
                     
                     $x->whereAddIn(
-                        isset($this->colsJoinName[$key]) ? 
-                            $this->colsJoinName[$key] :
-                            $x->tableName(). '.'.$key,
+                        isset($this->colsJname[$key]) ? 
+                            $this->colsJname[$key] :
+                            ($x->tableName(). '.'.$key),
                         $ar, $quote ? 'string' : 'int');
                 }
                 
@@ -857,8 +857,8 @@ class Pman_Roo extends Pman
                 $key  = substr($key, 1) ;
                 
                 $x->whereAdd(   (
-                        isset($this->colsJoinName[$key]) ? 
-                            $this->colsJoinName[$key] :
+                        isset($this->colsJname[$key]) ? 
+                            $this->colsJname[$key] :
                             $x->tableName(). '.'.$key ) . ' != ' .
                     (is_numeric($val) ? $val : "'".  $x->escape($val) . "'")
                 );