Author: sevein
Date: Wed Aug  8 18:11:40 2012
New Revision: 12056

Log:
Postpone array_reverse until the last element is removed with array_pop

Modified:
   trunk/apps/qubit/modules/informationobject/actions/treeViewAction.class.php
   
trunk/apps/qubit/modules/informationobject/actions/treeViewComponent.class.php

Modified: 
trunk/apps/qubit/modules/informationobject/actions/treeViewAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/actions/treeViewAction.class.php 
Wed Aug  8 18:08:13 2012        (r12055)
+++ trunk/apps/qubit/modules/informationobject/actions/treeViewAction.class.php 
Wed Aug  8 18:11:40 2012        (r12056)
@@ -39,7 +39,7 @@
     {
       case 'prevSiblings':
 
-        $this->items = 
array_reverse($this->resource->getTreeViewSiblings(array('limit' => 
$numberOfPreviousOrNextSiblings + 1, 'position' => 'previous')));
+        $this->items = $this->resource->getTreeViewSiblings(array('limit' => 
$numberOfPreviousOrNextSiblings + 1, 'position' => 'previous'));
 
         $this->hasPrevSiblings = count($this->items) > 
$numberOfPreviousOrNextSiblings;
         if ($this->hasPrevSiblings)
@@ -47,6 +47,9 @@
           array_pop($this->items);
         }
 
+        // Reverse array
+        $this->prevSiblings = array_reverse($this->prevSiblings);
+
         break;
 
       case 'nextSiblings':

Modified: 
trunk/apps/qubit/modules/informationobject/actions/treeViewComponent.class.php
==============================================================================
--- 
trunk/apps/qubit/modules/informationobject/actions/treeViewComponent.class.php  
    Wed Aug  8 18:08:13 2012        (r12055)
+++ 
trunk/apps/qubit/modules/informationobject/actions/treeViewComponent.class.php  
    Wed Aug  8 18:11:40 2012        (r12056)
@@ -37,13 +37,16 @@
 
     // Previous siblings
     // Get an extra sibling just to know if the + button is necessary
-    $this->prevSiblings = 
array_reverse($this->resource->getTreeViewSiblings(array('limit' => 
$numberOfPreviousOrNextSiblings + 1, 'position' => 'previous')));
+    $this->prevSiblings = $this->resource->getTreeViewSiblings(array('limit' 
=> $numberOfPreviousOrNextSiblings + 1, 'position' => 'previous'));
     $this->hasPrevSiblings = count($this->prevSiblings) > 
$numberOfPreviousOrNextSiblings;
     if ($this->hasPrevSiblings)
     {
       array_pop($this->prevSiblings);
     }
 
+    // Reverse array
+    $this->prevSiblings = array_reverse($this->prevSiblings);
+
     // Next siblings, same logic than above with the + button
     $this->nextSiblings = $this->resource->getTreeViewSiblings(array('limit' 
=> 5, 'position' => 'next'));
     $this->hasNextSiblings = count($this->nextSiblings) > 
$numberOfPreviousOrNextSiblings;

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/qubit-commits?hl=en.

Reply via email to