18 if (!$this->cfg->uniqValue)
19 $this->cfg->name.=
'[]';
21 $dbList = $this->cfg->dbList;
22 if (is_array($dbList) && $dbList[
'table']) {
23 $list = $this->cfg->list;
27 $group = $this->cfg->group;
33 $values = $db->select(array_merge($dbList, array(
'result'=>PDO::FETCH_ASSOC)));
36 foreach($values as $v) {
37 $key = array_shift($v);
38 if ($dbList[
'nbFieldGr'] > 0) {
40 $tmp2 = implode($dbList[
'sepGr'], $arr[0]);
49 $list[$key] = implode($dbList[
'sep'], $v);
54 }
else if ($this->cfg->needOut)
57 if (is_array($this->cfg->list))
58 $this->
addRule(
'in', array_keys($this->cfg->list));
68 $val = parent::getValue();
69 if (!is_null($this->cfg->valueNone) && $val == $this->cfg->valueNone)
71 if ($this->cfg->needOut) {
80 public function setValue($value, $refill =
false) {
81 if (is_array($value) && $this->cfg->uniqValue) {
82 parent::setValue(array_shift($value));
84 parent::setValue($value);
88 public function to($type) {
89 if ($this->cfg->mode ==
'view') {
90 if ($this->cfg->uniqValue)
91 return $this->cfg->getInArray(
'list', $this->
getValue(
false));
94 if (is_array($this->cfg->list)) {
95 foreach($this->cfg->list as $k=>$v) {
105 return implode(
', ', $tmp);
109 $prm = $this->cfg->get($type);
110 $inline = $this->cfg->inline ?
'Inline' : null;
114 unset($tmp[
'plus'], $tmp[
'global'], $tmp[
'globalInline'], $tmp[
'value'], $tmp[
'selected'], $tmp[
'disabled'], $tmp[
'group'], $tmp[
'name'], $tmp[
'des']);
116 foreach($tmp as $k=>$v)
117 $prm[
'plus'].= $k.
'="'.$v.
'" ';
121 $descriptions = $this->cfg->descriptions;
122 if ($this->cfg->outDescriptions)
124 if (is_array($this->cfg->list)) {
125 foreach($this->cfg->list as $k=>$v) {
126 if (is_array($this->cfg->group) && array_key_exists($k, $this->cfg->group) && $tmpGr != $k) {
129 array(
'[label]',
'[group]'),
130 array($this->cfg->group[$k], $tmpVal),
134 $plus = $this->
isInValue($k) ? $prm[
'selected'] : null;
135 $plus.= $this->
isDisabled($k) ? $prm[
'disabled'] : null;
137 $tmpVal.= $this->
updateLine($type, $k, str_replace(
138 array(
'[plus]',
'[value]',
'[label]',
'[des]'),
139 array($plus, $k, $v, isset($descriptions[$k]) ? $descriptions[$k] : null),
140 isset($prm[
'value'.$inline]) ? $prm[
'value'.$inline] : $prm[
'value']));
144 if (!empty($tmpGr)) {
146 array(
'[label]',
'[group]'),
147 array($this->cfg->group[$k], $tmpVal),
152 $this->
id = (!$this->cfg->uniqValue)? substr($this->cfg->name, 0, -2) : $this->cfg->name;
154 array(
'[values]',
'[plus]',
'[name]',
'[id]'),
155 array($ret, $prm[
'plus'], $this->cfg->name, $this->id),
156 $prm[
'global'.$inline]);
172 return $this->
to(
'html');
176 return $this->
to(
'xul');
186 if (is_array($this->cfg->value))
187 return (in_array($val, $this->cfg->value));
189 return ($val == $this->cfg->value);
199 return in_array($val, $this->cfg->disabled);
static htmlOut($val, $key=false)
static htmlDeOut($val, $key=false)
static cutArray(array $arr, $nb, $presKey=true)
static getInstance($cfg=null)