/** * display the field for filters * * @param string $field_id the id of the field used for id/name * @param mixed $value (optional) the value to put in the field * retrieved from $_POST if not given * @param string $label (optional) the label to use if not given the * value will be retrieved from custom field * $id_field * @param string $field_prefix (optional) the prefix to give to * the field id/name * @param string $other_after optional html code added after the input element * @param string $other_before optional html code added before the label element * @param mixed $field_special (optional) not used * * @return string of field xhtml code * * @access public */ function play_filter($id_field, $value = FALSE, $label = FALSE, $field_prefix = FALSE, $other_after = '', $other_before = '', $field_special = FALSE) { require_once _base_ . '/lib/lib.form.php'; $lang =& DoceboLanguage::createInstance('field'); if ($value === FALSE) { echo "Trallallero: " . Field::getFieldValue_Filter($_POST, $id_field, $field_prefix, 'false'); if (Field::getFieldValue_Filter($_POST, $id_field, $field_prefix, 'false') == 'false') { $value = 'false'; } else { $value = 'true'; } } if ($label === FALSE) { $re_field = sql_query("\r\n\t\t\tSELECT translation\r\n\t\t\tFROM " . Field::_getMainTable() . "\r\n\t\t\tWHERE id_common = '" . (int) $id_field . "' AND type_field = '" . Field_Upload::getFieldType() . "'"); list($label) = sql_fetch_row($re_field); } return Form::getRadioSet($label, Field::getFieldId_Filter($id_field, $field_prefix), Field::getFieldName_Filter($id_field, $field_prefix), array($lang->def('_YES') => 'true', $lang->def('_NO') => 'false'), $value, $other_after, $other_before); }
/** * display the field for filters * * @param string $field_id the id of the field used for id/name * @param mixed $value (optional) the value to put in the field * retrieved from $_POST if not given * @param string $label (optional) the label to use if not given the * value will be retrieved from custom field * $id_field * @param string $field_prefix (optional) the prefix to give to * the field id/name * @param string $other_after optional html code added after the input element * @param string $other_before optional html code added before the label element * @param mixed $field_special (optional) not used * * @return string of field xhtml code * * @access public */ function play_filter($id_field, $value = FALSE, $label = FALSE, $field_prefix = FALSE, $other_after = '', $other_before = '', $field_special = FALSE) { require_once _base_ . '/lib/lib.form.php'; if ($value === FALSE) { $value = Field::getFieldValue_Filter($_POST, $id_field, $field_prefix, ''); } if ($label === FALSE) { $re_field = sql_query("\r\n\t\t\tSELECT translation\r\n\t\t\tFROM " . Field::_getMainTable() . "\r\n\t\t\tWHERE id_common = '" . (int) $id_field . "' AND type_field = '" . Field_Freetext::getFieldType() . "'"); list($label) = sql_fetch_row($re_field); } return Form::getTextfield($label, Field::getFieldId_Filter($id_field, $field_prefix), Field::getFieldName_Filter($id_field, $field_prefix), 255, $value, $label, $other_after, $other_before); /* in filter all in one line return Form::getSimpleTextarea($label, Field::getFieldId_Filter($id_field, $field_prefix), Field::getFieldName_Filter($id_field, $field_prefix), $value );*/ }
/** * display the field for filters * * @param string $field_id the id of the field used for id/name * @param mixed $value (optional) the value to put in the field * retrieved from $_POST if not given * @param string $label (optional) the label to use if not given the * value will be retrieved from custom field * $id_field * @param string $field_prefix (optional) the prefix to give to * the field id/name * @param string $other_after optional html code added after the input element * @param string $other_before optional html code added before the label element * @param mixed $field_special (optional) if is an array the elements are * the options of dropdown, if is numeric is trated * as a field id and used to retrieve options * if not given the elements will be retrieved from * custom field $id_field * * @return string of field xhtml code * * @access public */ function play_filter($id_field, $value = FALSE, $label = FALSE, $field_prefix = FALSE, $other_after = '', $other_before = '', $field_special = FALSE) { require_once _base_ . '/lib/lib.form.php'; if ($value === FALSE) { $value = Field::getFieldValue_Filter($_POST, $id_field, $field_prefix, '0'); } $option = array(); $option[0] = Lang::t('_DROPDOWN_NOVALUE', 'field'); if (is_array($field_special)) { foreach ($field_special as $key_opt => $label_opt) { $option[$key_opt] = $label_opt; } } else { $re_field_element = sql_query("\r\n\t\t\tSELECT id_common_son, translation\r\n\t\t\tFROM " . Field_Dropdown::_getElementTable() . "\r\n\t\t\tWHERE idField = '" . (int) ($field_special !== FALSE ? $field_special : $id_field) . "'\r\n\t\t\t\tAND lang_code = '" . getLanguage() . "'\r\n\t\t\tORDER BY sequence"); while (list($id_common_son, $element) = sql_fetch_row($re_field_element)) { $option[$id_common_son] = $element; } } if ($label === FALSE) { $re_field = sql_query("\r\n\t\t\tSELECT translation\r\n\t\t\tFROM " . Field::_getMainTable() . "\r\n\t\t\tWHERE id_common = '" . (int) $id_field . "'\r\n\t\t\t\tAND type_field = '" . Field_Dropdown::getFieldType() . "'"); list($label) = sql_fetch_row($re_field); } return Form::getDropdown($label, Field::getFieldId_Filter($id_field, $field_prefix), Field::getFieldName_Filter($id_field, $field_prefix), $option, $value, $other_after, $other_before); }