From: hickert Date: Fri, 25 Jan 2008 08:32:33 +0000 (+0000) Subject: Updated queue plugin. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e414cf736f8031d472cfb243ced748b64a9b15e4;p=gosa.git Updated queue plugin. -Fixed sorting git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8600 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/plugins/addons/gotomasses/class_gotomasses.inc b/gosa-core/plugins/addons/gotomasses/class_gotomasses.inc index 67898bb9b..cb1da6db9 100644 --- a/gosa-core/plugins/addons/gotomasses/class_gotomasses.inc +++ b/gosa-core/plugins/addons/gotomasses/class_gotomasses.inc @@ -256,38 +256,38 @@ class gotomasses extends plugin */ function get_queued_entries() { - $start = $this->range * $this->start; - $stop = $start + $this->range; - $entries = $this->o_queue->get_queued_entries($start,$stop); + $map = array( + "QueuePosition" => "id", + "Action" => "status", + "TaskID" => "headertag", + "TargetName" => "macaddress", + "Schedule" => "timestamp"); + + if(!isset($map[$this->sort_by])){ + $sort = "id DESC"; + }else{ + $sort = $map[$this->sort_by]; + if($this->sort_dir == "up"){ + $sort.= " ASC"; + }else{ + $sort.= " DESC"; + } + } + + $start = $this->start; + $stop = $this->range; + $entries = $this->o_queue->get_queued_entries($start,$stop,$sort); if(!is_array($entries) || !isset($entries['XML']) || !is_array($entries['XML'])){ msg_dialog::display(_("Error"), sprintf(_("Cannot load queue entries: %s"), "

".$this->o_queue->get_error()), ERROR_DIALOG); return(array()); } - $tasks = array(); $ret = array(); foreach($entries['XML'] as $entry){ $task = $entry['ID']; $ret[]= $entry; } - $map = array("QueuePosition" => "ID", - "Action" => "STATUS", - "TaskID" => "HEADERTAG", - "TargetName" => "MACADDRESS", - "Schedule" => "TIMESTAMP"); - $sort_tmp = array(); - foreach($ret as $entry_id => $entry){ - $sort_tmp[$entry_id] = $entry[$map[$this->sort_by]]; - } - natcasesort($sort_tmp); - $return = array(); - foreach($sort_tmp as $entry_id => $value){ - $return[] = $ret[$entry_id]; - } - if($this->sort_dir != "up"){ - $return = array_reverse($return); - } - return($return); + return($ret); } @@ -313,7 +313,7 @@ class gotomasses extends plugin } if(isset($_GET['start'])){ $start = $_GET['start']; - if(is_numeric($start) && $start > 0){ + if(is_numeric($start) || $start == 0){ $this->start = $start; } }