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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
<?php
/* OOHForms: checkbox
*
* Copyright (c) 1998 by Jay Bloodworth
*
* $Id: of_checkbox.inc,v 1.4 1999/09/11 14:23:54 kk Exp $
*/
class of_checkbox extends of_element {
var $checked;
// Constructor
function of_checkbox($a) {
$this->setup_element($a);
}
function self_get($val, $which, &$count) {
$str = "";
if ($this->multiple) {
$n = $this->name . "[]";
$str .= "<input type='checkbox' name='$n' value='$val'";
if (is_array($this->value)) {
reset($this->value);
while (list($k,$v) = each($this->value)) {
if ($v==$val) {
$str .= " checked";
break;
}
}
}
} else {
$str .= "<input type='checkbox' name='$this->name'";
$str .= " value='$this->value'";
if ($this->checked)
$str .= " checked";
}
if ($this->extrahtml)
$str .= " $this->extrahtml";
$str .= ">\n";
$count = 1;
return $str;
}
function self_get_frozen($val, $which, &$count) {
$str = "";
$x = 0;
$t="";
if ($this->multiple) {
$n = $this->name . "[]";
if (is_array($this->value)) {
reset($this->value);
while (list($k,$v) = each($this->value)) {
if ($v==$val) {
$x = 1;
$str .= "<input type='hidden' name='$this->name' value='$v'>\n";
$t =" bgcolor=#333333";
break;
}
}
}
} else {
if ($this->checked) {
$x = 1;
$t = " bgcolor=#333333";
$str .= "<input type='hidden' name='$this->name'";
$str .= " value='$this->value'>";
}
}
$str .= "<table$t border=1><tr><td> </td></tr></table>\n";
$count = $x;
return $str;
}
function self_load_defaults($val) {
if ($this->multiple)
$this->value = $val;
elseif (isset($val) && (!$this->value || $val==$this->value))
$this->checked=1;
else
$this->checked=0;
}
} // end CHECKBOX
?>
|