Code

Updated client dns handling
[gosa.git] / include / class_divSelectBox.inc
1 <?php
3 class divSelectBox {
5         var $a_entries;
6         var $summary;
7         var $cols;
9         // Members for page managment
10   var $height=200;
12         // Added php 4 constructor
13         function divSelectBox(){
14                 $this->s_summary                = "";
15                 $this->a_entries                = array();
16                 $this->cols                     = 0;
17         }
19   function setHeight($h){
20     $this->height=$h;
21   }
23         function AddEntry($a_entriedata) {
24                 $this->a_entries[] = $a_entriedata;
25         }
27   function DrawList(){
28     $s_return  = "";
29     $s_return .= "<div style=\"height:2px; overflow:hidden;background:#888888;width:100%;margin-right:0px;\"></div>\n";
30     $s_return .= "<div style=\"padding-right:1px;padding-bottom:2px;height:".$this->height.";width:100%\">\n";
31     $s_return .= "<div style=\"overflow: auto;width:100%;height:".($this->height)."px;\">\n";
32     $s_return .= "<table ".
33                     "summary='".$this->s_summary."' ".
34                     "width='100%' ".
35                     "cellspacing='0' ".
36                     "style='overflow:scroll; ".
37                     "height:".($this->height-2)."px;".
38                     "padding-right:1px; ".
39                     "padding-bottom:2px; ".
40                     "border-left:solid 2px; ".
41                     "border-top:solid 0px; ".
42                     "border-color:#888888; ".
43                     "'>\n";
44     $s_return.=$this->_generatePage();
45     $s_return.= "</table></div></div>";
46     return ($s_return);
47   }
48         
49         function _numentries(){
50                 $cnt = count($this->a_entries);
51                 return $cnt;
52         }
53         
54         function SetSummary($msg){
55                 $this->s_summary = $msg;
56         }
58         function _generatePage(){
59                 
60                 $s_value        = "";
61                 $s_key          = "";
62                 $s_return       = "";
63                 $i_alternate=0;
64     $str = "";
65         
66     /* If divlist is empty, append a single white entry */
67     if(count($this->a_entries)==0){
68       $str.="<tr class='rowxp1'
69                 ><td class='list1nohighlight' style='height:100%; border-right:0px;'>&nbsp;</td></tr>";
70       return($str);
71     }
73     $i = $this->_numEntries();
74     foreach($this->a_entries as $s_key => $s_value){
75       $i--;
77       if($i_alternate!=0){ 
78         $i_alternate=0; 
79       } else {
80         $i_alternate=1;
81       }
83       $s_return .= "\n<tr class='rowxp".($i_alternate)."'>";
85       $cnt = 0;                                         
86     
87       foreach($s_value as $s_key2 => $s_value2 ){                               
88         $this->cols = count($s_value) ;                                         
89         $cnt++;                                 
91         if(!isset($s_value2['class'])){
92           $class = "list".$i_alternate; 
93         } else {
94           $class = $s_value2['class'];
95         }
97         if(!isset($s_value2['attach'])){
98           $style = "";
99         } else {
100           $style = " ".$s_value2['attach']." "  ;
101         }
103         $s_return .= "\n<td ".$style." class='".$class."'>";
104         $s_return .= $s_value2['string'];
105         $s_return .= "</td>";
106       }
107       $s_return.="\n</tr>";
108     }
109     $s_return.="\n<tr>";
110     for($i = 0 ; $i < ($this->cols) ; $i ++){
111       if($i >= ($this->cols-1)){
112         $s_return .= "<td class='list1nohighlight' style='height:100%;border:0px;'><div style='font-size:1px;'>&nbsp;</div></td>";
113       }else{
114         $s_return .= "<td class='list1nohighlight' style='height:100%;'><div style='font-size:1px;'>&nbsp;</div></td>";
115       }
116       
117     }
118     $s_return.="</tr>";
119     return $s_return;
120   }
122 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
123 ?>