Code

Applied in_array strict patches from trunk
[gosa.git] / gosa-core / include / class_sortableListing.inc
index b134ab1dc06df26e048c867c9568cffa8130b69d..df89b48217e8e38d4b139b03233c2458e9789490 100644 (file)
@@ -54,6 +54,7 @@ class sortableListing {
     private $acl= "";
     private $modified= false;
 
+       
     public function sortableListing($data= array(), $displayData= null, $reorderable= false)
     {
         global $config;
@@ -69,7 +70,7 @@ class sortableListing {
 
         // Generate instance wide unique ID
         $id = "";
-        while($id == "" || in_array($id, $usedIds)){
+        while($id == "" || in_array_strict($id, $usedIds)){
 
             // Wait 1 msec to ensure that we definately get a new id
             if($id != "") usleep(1);
@@ -100,6 +101,17 @@ class sortableListing {
         $this->sortColumn = $id;
     }
 
+       /*
+       * 
+       * Examples
+       * DatenARray ($data)
+       * @param: array( arbitrary object, arbitrary object)
+       * Datenarray will be manipulated by add, del and sort operations. According to this it will be returned from this widget.
+       * The index of a data entry must correspond to the entry of the "display array" following.
+       * DisplayArray ($displyData)
+       * @param: array("eins" array( "data"=> array("Uno", "2", "x" ) , "zwei" array( "data"=> array("Due", "3", "y" ))) ;
+       * label pointing on a list of columns that will be shown in the list.
+       */
     public function setListData($data, $displayData= null)
     {
         // Save data to display
@@ -113,13 +125,13 @@ class sortableListing {
         $this->setDisplayData($displayData);
     }
 
-
+       //setting flat data 
     private function setData($data)
     {
         $this->data= $data;
     }
 
-
+       // collecting the display data -
     private function setDisplayData($data)
     {
         if (!is_array($data)) {
@@ -226,7 +238,7 @@ class sortableListing {
         } else {
             $edit_image= $this->editable?image('images/lists/edit.png', "%ID", _("Edit this entry")):"";
         }
-        if (strpos($this->acl, 'd') === false) {
+        if (strpos($this->acl, 'w') === false) {
             $delete_image= $this->deleteable?image('images/lists/trash-grey.png'):"";
         } else {
             $delete_image= $this->deleteable?image('images/lists/trash.png', "%ID", _("Delete this entry")):"";
@@ -546,7 +558,7 @@ class sortableListing {
     {
         // Only add if not already there
         if (!$key) {
-            if (in_array($entry, $this->data)) {
+            if (in_array_strict($entry, $this->data)) {
                 return;
             }
         } else {