projects
/
timetracker.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Further refactoring of the FormElement class.
[timetracker.git]
/
WEB-INF
/
lib
/
form
/
Combobox.class.php
diff --git
a/WEB-INF/lib/form/Combobox.class.php
b/WEB-INF/lib/form/Combobox.class.php
index
7783793
..
314f4b7
100644
(file)
--- a/
WEB-INF/lib/form/Combobox.class.php
+++ b/
WEB-INF/lib/form/Combobox.class.php
@@
-44,12
+44,12
@@
class Combobox extends FormElement {
var $mCompareOn = "key"; // or "value"
var $mDataDeep = 1;
var $mDataKeys = array();
var $mCompareOn = "key"; // or "value"
var $mDataDeep = 1;
var $mDataKeys = array();
- var $c
ClassName = "Combobox"
;
+ var $c
lass = 'Combobox'
;
- function
Combobox
($name,$value="")
+ function
__construct
($name,$value="")
{
{
- $this->
mName
= $name;
- $this->
mValue
= $value;
+ $this->
name
= $name;
+ $this->
value
= $value;
}
function setMultiple($value) { $this->mMultiple = $value; }
}
function setMultiple($value) { $this->mMultiple = $value; }
@@
-65,34
+65,33
@@
class Combobox extends FormElement {
function getDataKeys() { return $this->mDataKeys; }
function getDataKeys() { return $this->mDataKeys; }
- function toStringControl() {
- if (!$this->isRenderable()) return "";
-
- if ($this->mId=="") $this->mId = $this->mName;
+ function toStringControl() {
+
+ if ($this->id=="") $this->id = $this->name;
$html = "\n\t<select";
$html = "\n\t<select";
- $html .= " name=\"$this->
mName\" id=\"$this->mI
d\"";
+ $html .= " name=\"$this->
name\" id=\"$this->i
d\"";
- if ($this->
mS
ize!="")
- $html .= " size=\"$this->
mS
ize\"";
+ if ($this->
s
ize!="")
+ $html .= " size=\"$this->
s
ize\"";
if ($this->mMultiple)
$html .= " multiple";
if ($this->mMultiple)
$html .= " multiple";
-
- if ($this->mTabindex!="")
- $html .= " tabindex=\"$this->mTabindex\"";
-
- if ($this->mOnChange!="")
- $html .= " onchange=\"$this->mOnChange\"";
+
+ if ($this->on_change!="")
+ $html .= " onchange=\"$this->on_change\"";
- if ($this->mStyle!="")
- $html .= " style=\"$this->mStyle\"";
+ if ($this->style!="")
+ $html .= " style=\"$this->style\"";
+
+ if (!$this->isEnabled())
+ $html .= " disabled";
$html .= ">\n";
if (is_array($this->mOptionsEmpty) && (count($this->mOptionsEmpty) > 0))
foreach ($this->mOptionsEmpty as $key=>$value) {
$html .= "<option value=\"".$key."\"";
$html .= ">\n";
if (is_array($this->mOptionsEmpty) && (count($this->mOptionsEmpty) > 0))
foreach ($this->mOptionsEmpty as $key=>$value) {
$html .= "<option value=\"".$key."\"";
- if (($this->
mValue == $value) && ($this->mV
alue != '')) $html .= " selected";
+ if (($this->
value == $value) && ($this->v
alue != '')) $html .= " selected";
$html .= ">".$value."</option>\n";
}
if (is_array($this->mOptions) && (count($this->mOptions) > 0))
$html .= ">".$value."</option>\n";
}
if (is_array($this->mOptions) && (count($this->mOptions) > 0))
@@
-103,7
+102,7
@@
class Combobox extends FormElement {
$value = $value[$this->mDataKeys[1]];
}
$html .= "<option value=\"".$key."\"";
$value = $value[$this->mDataKeys[1]];
}
$html .= "<option value=\"".$key."\"";
- if (($this->
mValue == $key) && ($this->mV
alue != '')) $html .= " selected";
+ if (($this->
value == $key) && ($this->v
alue != '')) $html .= " selected";
$html .= ">".htmlspecialchars($value)."</option>\n";
}
$html .= ">".htmlspecialchars($value)."</option>\n";
}
@@
-112,3
+111,4
@@
class Combobox extends FormElement {
return $html;
}
}
return $html;
}
}
+?>
\ No newline at end of file