/** * Get the actual value * * @param null|string $key Null to get both values or string to get only one * @param string $mode How get the value in case of retriving only one value * @return mixed */ public function getValue($key = null, $mode = 'raw') { if (!is_null($key)) { $ret = $this->cfg->getInArray('rangeValue', $key); } else { $ret = $this->rangeValue; } return utils::htmlDeOut($ret); }
public function getValue($key = null, $mode = 'raw') { if (!is_null($key)) { if ($mode == 'input') { $ret = $this->set[$key] ? $this->dates[$key]->format('date', 'short2') : null; } else { $ret = $this->cfg->getInArray('rangeValue', $key); } } else { $ret = $this->rangeValue; } return utils::htmlDeOut($ret); }
/** * Get the actual value * * @param bool $outside Indicate if it's coming from outside (ie if it should be htmlDeOut) * @return mixed */ public function getValue($outside = true) { $val = parent::getValue(); if (!is_null($this->cfg->valueNone) && $val == $this->cfg->valueNone) { return null; } if ($this->cfg->needOut) { if ($outside) { $val = utils::htmlDeOut($val, true); } else { $val = utils::htmlOut($val, true); } } return $val; }
/** * Parse values send through POST data and eventually add the new ones * * @param array $values Valeus to parse * @return array Values to use */ protected function addNew(array $values) { $new = isset($values['new']) && is_array($values['new']) ? array_filter($values['new']) : null; unset($values['new']); if ($this->cfg->allowAdd && count($new) && is_array($new)) { $dbList = $this->cfg->dbList; if (is_array($dbList) && $dbList['table']) { $tbl = db::get('table', $dbList['table']); $list = utils::htmlDeOut($this->cfg->list); $i18n = isset($dbList['i18nFields']) && $dbList['i18nFields']; if (!$i18n) { $field = substr($dbList['fields'], strlen($dbList['ident']) + 1); } foreach ($new as $v) { $exists = array_search($v, $list); if ($exists === false) { $row = $tbl->getRow(); if ($i18n) { $i18nRow = $row->getI18nRow(); $i18nRow->set($dbList['i18nFields'], $v); } else { $row->set($field, $v); } $id = $row->save(); $values[] = $id; $list[$id] = $v; } else { $values[] = $exists; } } $this->cfg->list = utils::htmlOut($list); if (is_array($this->cfg->list)) { $this->addRule('in', array_keys($this->cfg->list)); } } } return $values; }
/** * Get the actual value * * @return mixed */ public function getValue() { return utils::htmlDeOut($this->cfg->value); }