projects
/
timetracker.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
A bit of cleanup in localization files.
[timetracker.git]
/
WEB-INF
/
lib
/
form
/
CheckboxGroup.class.php
diff --git
a/WEB-INF/lib/form/CheckboxGroup.class.php
b/WEB-INF/lib/form/CheckboxGroup.class.php
index
759a076
..
0bb3ac4
100644
(file)
--- a/
WEB-INF/lib/form/CheckboxGroup.class.php
+++ b/
WEB-INF/lib/form/CheckboxGroup.class.php
@@
-33,17
+33,15
@@
class CheckboxGroup extends FormElement {
var $mOptions = array();
var $mLayout = "V";
var $mGroupIn = 1;
var $mOptions = array();
var $mLayout = "V";
var $mGroupIn = 1;
- var $cClassName = "CheckboxGroup";
var $mDataKeys = array();
var $mDataDeep = 1;
var $lSelAll = "All";
var $lSelNone = "None";
var $mDataKeys = array();
var $mDataDeep = 1;
var $lSelAll = "All";
var $lSelNone = "None";
- function __construct($name,$value="")
- {
- $this->name = $name;
- $this->mValue = $value;
- }
+ function __construct($name) {
+ $this->class = 'CheckboxGroup';
+ $this->name = $name;
+ }
function setChecked($value) { $this->mChecked = $value; }
function isChecked() { return $this->mChecked; }
function setChecked($value) { $this->mChecked = $value; }
function isChecked() { return $this->mChecked; }
@@
-60,15
+58,13
@@
class CheckboxGroup extends FormElement {
function setGroupIn($value) { $this->mGroupIn = $value; if ($this->mGroupIn<1) $this->mGroupIn = 1;}
function getGroupIn() { return $this->mGroupIn; }
function setGroupIn($value) { $this->mGroupIn = $value; if ($this->mGroupIn<1) $this->mGroupIn = 1;}
function getGroupIn() { return $this->mGroupIn; }
- function setLocalization($i18n) {
- FormElement::setLocalization($i18n);
+ function localize($i18n) {
$this->lSelAll = $i18n->getKey('label.select_all');
$this->lSelNone = $i18n->getKey('label.select_none');
}
$this->lSelAll = $i18n->getKey('label.select_all');
$this->lSelNone = $i18n->getKey('label.select_none');
}
- function toStringControl() {
- if (!$this->isRenderable()) return "";
-
+ function getHtml() {
+
if ($this->id=="") $this->id = $this->name;
$renderArray = array();
if ($this->id=="") $this->id = $this->name;
$renderArray = array();
@@
-87,9
+83,9
@@
class CheckboxGroup extends FormElement {
$optval = $optval[$this->mDataKeys[1]];
}
$html = "<input type=\"checkbox\" name=\"$this->name[]\" id=\"$this->id"."_".$i."\"";
$optval = $optval[$this->mDataKeys[1]];
}
$html = "<input type=\"checkbox\" name=\"$this->name[]\" id=\"$this->id"."_".$i."\"";
- if (is_array($this->
mV
alue)) {
- foreach ($this->
mValue as $value
) {
- if (($
value == $optkey) && ($value
!= null))
+ if (is_array($this->
v
alue)) {
+ foreach ($this->
value as $element
) {
+ if (($
element == $optkey) && ($element
!= null))
$html .= " checked=\"true\"";
}
}
$html .= " checked=\"true\"";
}
}
@@
-115,9
+111,9
@@
class CheckboxGroup extends FormElement {
$optval = $optval[$this->mDataKeys[1]];
}
$html = "<input type=\"checkbox\" name=\"$this->name[]\" id=\"$this->id"."_".$i."\"";
$optval = $optval[$this->mDataKeys[1]];
}
$html = "<input type=\"checkbox\" name=\"$this->name[]\" id=\"$this->id"."_".$i."\"";
- if (is_array($this->
mV
alue)) {
- foreach ($this->
mValue as $value
) {
- if (($
value == $optkey) && ($value
!= null))
+ if (is_array($this->
v
alue)) {
+ foreach ($this->
value as $element
) {
+ if (($
element == $optkey) && ($element
!= null))
$html .= " checked=\"true\"";
}
}
$html .= " checked=\"true\"";
}
}
@@
-132,8
+128,8
@@
class CheckboxGroup extends FormElement {
}
}
- $html = "\n\t<table style=\"".$this->
mS
tyle."\"><tr><td align=\"center\" bgcolor=\"eeeeee\">\n";
- $html .= '<a href="#" onclick="setAll'.$this->
getName().'(true);return false;">'.$this->lSelAll.'</a> / <a href="#" onclick="setAll'.$this->getName()
.'(false);return false;">'.$this->lSelNone.'</a>';
+ $html = "\n\t<table style=\"".$this->
s
tyle."\"><tr><td align=\"center\" bgcolor=\"eeeeee\">\n";
+ $html .= '<a href="#" onclick="setAll'.$this->
name.'(true);return false;">'.$this->lSelAll.'</a> / <a href="#" onclick="setAll'.$this->name
.'(false);return false;">'.$this->lSelNone.'</a>';
$html .= "</td></tr>\n";
$html .= "<tr><td>";
$html .= "\n\t<table width=\"100%\">\n";
$html .= "</td></tr>\n";
$html .= "<tr><td>";
$html .= "\n\t<table width=\"100%\">\n";
@@
-148,10
+144,10
@@
class CheckboxGroup extends FormElement {
$html .= "</td></tr></table>\n";
$str = "<script>\n";
$html .= "</td></tr></table>\n";
$str = "<script>\n";
- $str .= "function setAll".$this->
getName()
."(value) {\n";
+ $str .= "function setAll".$this->
name
."(value) {\n";
$str .= "\tvar formInputs = document.getElementsByTagName(\"input\");\n";
$str .= "\tfor (var i = 0; i < formInputs.length; i++) {\n";
$str .= "\tvar formInputs = document.getElementsByTagName(\"input\");\n";
$str .= "\tfor (var i = 0; i < formInputs.length; i++) {\n";
- $str .= "\t\tif ((formInputs.item(i).type=='checkbox') && (formInputs.item(i).name=='".$this->
getName()
."[]')) {\n";
+ $str .= "\t\tif ((formInputs.item(i).type=='checkbox') && (formInputs.item(i).name=='".$this->
name
."[]')) {\n";
$str .= "\t\tformInputs.item(i).checked=value;\n";
$str .= "\t}\n}\n";
$str .= "}\n";
$str .= "\t\tformInputs.item(i).checked=value;\n";
$str .= "\t}\n}\n";
$str .= "}\n";