/** * 字段相关属性参数 * * @param array $value 值 * @return string */ public function option($option) { $linkage = isset($option['linkage']) ? $option['linkage'] : ''; $str = '<select name="data[setting][option][linkage]">'; $data = $this->ci->db->get($this->ci->db->dbprefix('linkage'))->result_array(); if ($data) { foreach ($data as $t) { $str .= '<option value="' . $t['code'] . '" ' . ($linkage == $t['code'] ? 'selected' : '') . '> ' . dr_lang2name($t['langname']) . ' </option>'; } } $str .= '</select>'; return '<tr> <th><font color="red">*</font> ' . lang('m-183') . ':</th> <td>' . $str . ' </td> </tr> <tr> <th>' . lang('m-087') . ':</th> <td> <input id="field_default_value" type="text" class="input-text" size="20" value="' . $option['value'] . '" name="data[setting][option][value]"> ' . $this->member_field_select() . ' <div class="onShow">' . lang('m-086') . '</div> </td> </tr> '; }
/** * 字段相关属性参数 * * @param array $value 值 * @param array $field 字段集合 * @return string */ public function option($option, $field = NULL) { $option['value'] = isset($option['value']) ? $option['value'] : ''; $group = array(); foreach ($field as $t) { if ($t['fieldtype'] == 'Group') { $t['setting'] = dr_string2array($t['setting']); if (preg_match_all('/\\{(.+)\\}/U', $t['setting']['option']['value'], $value)) { foreach ($value[1] as $v) { $group[] = $v; } } } } $_field = '<option value=""> -- </option>'; foreach ($field as $t) { if ($t['fieldtype'] != 'Group' && !@in_array($t['fieldname'], $group)) { $_field .= '<option value="' . $t['fieldname'] . '">' . dr_lang2name($t['langname']) . '</option>'; } } return ' <tr> <th>' . lang('m-106') . ':</th> <td> <select name="xx" id="fxx">' . $_field . '</select><div class="onShow">' . lang('m-108') . '</div> </td> </tr> <tr> <th>' . lang('m-109') . ':</th> <td> <textarea name="data[setting][option][value]" id="fvalue" style="width:520px;height:50px;" class="text">' . $option['value'] . '</textarea> <br><div class="onShow">' . lang('m-110') . '</div> </td> </tr> <script type="text/javascript"> $(function() { $("#fxx").change(function(){ var value = $(this).val(); var fvalue = $("#fvalue").val(); var text = $("#fxx").find("option:selected").text(); $("#fxx option[value=\'"+value+"\']").remove(); $("#fvalue").val(fvalue+" "+text+": {"+value+"}"); }); }); </script> '; }