Code Duplication    Length = 13-13 lines in 2 locations

core/functions/tv.php 2 locations

@@ 696-708 (lines=13) @@
693
                    $field_html .= ' <a onclick="document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].value=\'\';document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].onblur(); return true;" onmouseover="window.status=\'clear the date\'; return true;" onmouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><i class="' . $_style["actions_calendar_delete"] . '"></i></a>';
694
695
                    break;
696
                case "dropdown": // handler for select boxes
697
                    $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" size="1" onchange="documentDirty=true;">';
698
                    $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform',
699
                        $tvsArray));
700
                    foreach($index_list as $item => $itemvalue) {
701
                        list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue);
702
                        if (strlen($itemvalue) == 0) {
703
                            $itemvalue = $item;
704
                        }
705
                        $field_html .= '<option value="' . $modx->getPhpCompat()->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->getPhpCompat()->htmlspecialchars($item) . '</option>';
706
                    }
707
                    $field_html .= "</select>";
708
                    break;
709
                case "listbox": // handler for select boxes
710
                    $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" onchange="documentDirty=true;" size="8">';
711
                    $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform',
@@ 709-721 (lines=13) @@
706
                    }
707
                    $field_html .= "</select>";
708
                    break;
709
                case "listbox": // handler for select boxes
710
                    $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" onchange="documentDirty=true;" size="8">';
711
                    $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform',
712
                        $tvsArray));
713
                    foreach($index_list as $item => $itemvalue) {
714
                        list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue);
715
                        if (strlen($itemvalue) == 0) {
716
                            $itemvalue = $item;
717
                        }
718
                        $field_html .= '<option value="' . $modx->getPhpCompat()->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->getPhpCompat()->htmlspecialchars($item) . '</option>';
719
                    }
720
                    $field_html .= "</select>";
721
                    break;
722
                case "listbox-multiple": // handler for select boxes where you can choose multiple items
723
                    $field_value = explode("||", $field_value);
724
                    $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '[]" multiple="multiple" onchange="documentDirty=true;" size="8">';