Ejemplo n.º 1
0
 protected function doSorting(&$children)
 {
     $orderMethod = Input::get('order', 'name');
     $orderDir = Input::get('dir', 'asc');
     if (!Sorting::validOrderMethod($orderMethod)) {
         $orderMethod = 'name';
     }
     if (!Sorting::validOrderDirection($orderDir)) {
         $orderDir = 'asc';
     }
     // if the values are default then skip sorting as the paths already in order
     if ($orderMethod !== 'name' || $orderDir !== 'asc') {
         Sorting::sort($children, $orderMethod, $orderDir);
     }
     $invOrderDir = $orderDir === 'asc' ? 'desc' : 'asc';
     $params = array('orderMethod' => $orderMethod, 'orderDir' => $orderDir, 'invOrderDir' => $invOrderDir);
     return $params;
 }