C:\xampp\htdocs\kptv2\admin\php\inc\select.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php

class Select
{
    var 
$content;
    var 
$selectedName;
    var 
$selectedValue;
    var 
$name;
    var 
$useNameAsValues;
    var 
$functArray;

    function 
Select($name$id "") {
        
$this->name $name;
        
$this->useNameAsValues false;
        if(
$id == "")
            
$this->id $name;
        else
            
$this->id $id;
        
$functArray = array();
    }

    function 
AttachArray($arr) {
        
$this->content $arr;
    }

    function 
AddOnFunction($name$functName) {
        
$str $name " = " "\"" $functName ";\"";
        
$this->functArray[] = $str;
    }

    function 
Generate() {
        
$ret "<SELECT NAME = \"" $this->name "\" id = \"" $this->id "\"";
        if(
count($this->functArray) > 0) {
            foreach(
$this->functArray as $funct)
                
$ret.=" " $funct;
        }
        
$ret.=">";
        
$keys array_keys($this->content);
        foreach(
$keys as $key) {
            if(
$this->useNameAsValues == false) {
                
$ret.="<OPTION value = \"" $key "\"";
                if(
$this->selectedValue == $key)
                    
$ret.=" SELECTED";
            }
            else {
                
$ret.="<OPTION value = \"" $this->content[$key] . "\"";
                if(
$this->selectedName == $this->content[$key]) {
                    
$ret.=" SELECTED";
                }
            }
            
$ret.=" >" $this->content[$key] . "</OPTION>";
        }
        
$ret.="</SELECT>";
        return 
$ret;
    }
}
?>
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586