function get_attribute_type_rs($attribute_type_rs) { global $_attribute_type_list_rs; if (!is_array($_attribute_type_list_rs)) { $results = fetch_item_type_s_attribute_type_rs(); if ($results) { while ($attribute_type_r = db_fetch_assoc($results)) { $_attribute_type_list_rs[] = array('value' => $attribute_type_r['s_attribute_type'], 'display' => $attribute_type_r['description']); } db_free_result($results); } } reset($_attribute_type_list_rs); while (list(, $_attribute_type_list_r) = each($_attribute_type_list_rs)) { $attribute_type_rs[] = $_attribute_type_list_r; } return $attribute_type_rs; }
function display_site_plugin_s_attribute_type_map_row($record_r, $row) { global $PHP_SELF; global $ADMIN_TYPE; if (is_not_empty_array($record_r)) { echo "<input type=\"hidden\" name=\"exists_ind[{$row}]\" value=\"Y\">"; echo "<input type=\"hidden\" name=\"sequence_number[{$row}]\" value=\"" . $record_r['sequence_number'] . "\">"; echo "<td class=\"data\">" . get_input_field("variable[{$row}]", NULL, "Variable", "readonly", "Y", $record_r['variable'], FALSE) . "</td>"; } else { echo "<input type=\"hidden\" name=\"exists_ind[{$row}]\" value=\"N\">"; echo "<td class=\"data\">" . get_input_field("variable[{$row}]", NULL, "Variable", "text(10,20)", "Y", NULL, FALSE) . "</td>"; } $item_type_groups[] = '*'; $results = fetch_item_type_group_rs(); if ($results) { while ($item_type_group_r = db_fetch_assoc($results)) { $item_type_groups[] = $item_type_group_r['s_item_type_group']; } db_free_result($results); } // this is to avoid confusion if system data is defined for non-existent s_item_type_groups if (!in_array($record_r['s_item_type_group'], $item_type_groups)) { $item_type_groups[] = $record_r['s_item_type_group']; } echo "\n<td class=\"data\">" . custom_select("s_item_type_group[{$row}]", $item_type_groups, "%value%", 1, $record_r['s_item_type_group'], 'value', NULL, NULL, "if(this.options[this.options.selectedIndex].value != '*'){this.form['s_item_type[{$row}]'].options[0].selected=true;}") . "</td>"; $item_types[] = '*'; $results = fetch_item_type_rs(); if ($results) { while ($item_type_r = db_fetch_assoc($results)) { $item_types[] = $item_type_r['s_item_type']; } db_free_result($results); } // this is to avoid confusion if system data is defined for non-existent s_item_types if (!in_array($record_r['s_item_type'], $item_types)) { $item_types[] = $record_r['s_item_type']; } echo "\n<td class=\"data\">" . custom_select("s_item_type[{$row}]", $item_types, "%value%", 1, $record_r['s_item_type'], 'value', NULL, NULL, "if(this.options[this.options.selectedIndex].value != '*'){this.form['s_item_type_group[{$row}]'].options[0].selected=true;}") . "</td>"; $attribute_types[] = ''; $results = fetch_item_type_s_attribute_type_rs(); if ($results) { while ($attribute_type_r = db_fetch_assoc($results)) { $attribute_types[] = $attribute_type_r['s_attribute_type']; } db_free_result($results); } // this is to avoid confusion if system data is defined for non-existent s_attribute_types if (!in_array($record_r['s_attribute_type'], $attribute_types)) { $attribute_types[] = $record_r['s_attribute_type']; } echo "\n<td class=\"data\">" . custom_select("s_attribute_type[{$row}]", $attribute_types, "%value%", 1, $record_r['s_attribute_type']) . "</td>"; if (is_array($record_r) && is_lookup_attribute_type($record_r['s_attribute_type'])) { echo "<td class=\"data\"><input type=\"checkbox\" class=\"checkbox\" name=\"lookup_attribute_val_restrict_ind[{$row}]\" value=\"Y\"" . (strtoupper($record_r['lookup_attribute_val_restrict_ind']) == 'Y' ? 'CHECKED' : '') . ">"; } else { echo "\n<td class=\"data\"> </td>"; } echo "\n<td class=\"data\">"; if (is_not_empty_array($record_r)) { echo "<a href=\"{$PHP_SELF}?type={$ADMIN_TYPE}&op=delete_site_plugin_s_attribute_type_map&site_type=" . $record_r['site_type'] . "&sequence_number=" . $record_r['sequence_number'] . "\">Delete</a>"; } else { echo " "; } echo "\n</td>"; }
if (strlen($item_type_r['image']) > 0) { $src = theme_image_src($item_type_r['image']); if ($src !== FALSE && strlen($src) > 0) { echo "<img src=\"{$src}\"> "; } } echo $item_type_r['s_item_type'] . " System Attributes</h3>"; if (is_not_empty_array($errors)) { echo format_error_block($errors); } echo "\n<form name=\"s_item_attribute_type\" action=\"{$PHP_SELF}\" method=\"POST\">"; echo "\n<input type=\"hidden\" name=\"op\" value=\"update\">" . "\n<input type=\"hidden\" name=\"type\" value=\"" . $HTTP_VARS['type'] . "\">" . "\n<input type=\"hidden\" name=\"s_item_type\" value=\"" . $HTTP_VARS['s_item_type'] . "\">"; echo "<table>"; echo "<tr class=\"navbar\">" . "<th>Order<br />No.</th>" . "<th colspan=2>Attribute Type [Field Type]</th>" . "<th>Prompt</th>" . "<th>Instance Ind.</th>" . "<th>Compulsory</th>" . "<th>Indicators</th>" . "<th></th>" . "</tr>"; $column_count = 8; $sat_results = fetch_item_type_s_attribute_type_rs(); while ($attribute_type_r = db_fetch_assoc($sat_results)) { $s_attribute_type_list_rs[] = $attribute_type_r; } db_free_result($sat_results); echo get_s_attribute_type_tooltip_array($s_attribute_type_list_rs); $results = fetch_s_item_attribute_type_rs($HTTP_VARS['s_item_type']); if ($results) { // value, display, img, checked_ind, order_no $row = 0; while ($item_attribute_type_r = db_fetch_assoc($results)) { display_s_item_attribute_type_row($HTTP_VARS['s_item_type'], $item_attribute_type_r, $row, FALSE, $s_attribute_type_list_rs); $row++; } db_free_result($results); }