コード例 #1
0
ファイル: index.php プロジェクト: horrabin/opendb
 if (is_exists_item_type($v_s_item_type)) {
     // now we need to transfer in
     if ($value == 'exclude') {
         $site_item_attribute_type_rs = array();
         // so this is the list of attributes currently attached to the s_item_type
         $results2 = fetch_site_item_attribute_type_rs($HTTP_VARS['site_type'], $v_s_item_type);
         if ($results2) {
             while ($attribute_type_r = db_fetch_assoc($results2)) {
                 $site_item_attribute_type_rs[] = $attribute_type_r;
             }
             db_free_result($results2);
         }
         $delete = TRUE;
         reset($site_item_attribute_type_rs);
         while (list(, $site_item_attribute_type_r) = each($site_item_attribute_type_rs)) {
             if (!is_s_item_attribute_type_deletable($v_s_item_type, $site_item_attribute_type_r['s_attribute_type'], $site_item_attribute_type_r['order_no'])) {
                 $errors[] = array('error' => 'Dependent Item Attribute records exist', 'detail' => 's_item_type=' . $v_s_item_type . ', s_attribute_type=' . $site_item_attribute_type_r['s_attribute_type'] . ', order_no=' . $site_item_attribute_type_r['order_no']);
                 $delete = FALSE;
             }
         }
         if ($delete) {
             reset($site_item_attribute_type_rs);
             while (list(, $site_item_attribute_type_r) = each($site_item_attribute_type_rs)) {
                 if (!delete_s_item_attribute_type($v_s_item_type, $site_item_attribute_type_r['s_attribute_type'], $site_item_attribute_type_r['order_no'])) {
                     $errors[] = array('error' => 'System Item Attribute Type (s_item_type=' . $v_s_item_type . ', s_attribute_type=' . $site_item_attribute_type_r['s_attribute_type'] . ', order_no=' . $site_item_attribute_type_r['order_no'] . ') not deleted', 'detail' => db_error());
                 }
             }
         }
     } else {
         if ($value == 'include') {
             for ($i = 0; $i < count($site_attribute_type_r); $i++) {
コード例 #2
0
ファイル: index.php プロジェクト: horrabin/opendb
function display_s_item_attribute_type_row($s_item_type, $s_item_attribute_type_r, $row, $exists_error_ind = FALSE, $s_attribute_type_list_rs)
{
    global $PHP_SELF;
    global $ADMIN_TYPE;
    echo "<tr>";
    // Indicates this record is in error, and we need to make this clear.
    if ($exists_error_ind) {
        $class = "error";
    } else {
        $class = "data";
    }
    // s_attribute_type
    if (is_not_empty_array($s_item_attribute_type_r) && $exists_error_ind == FALSE) {
        // order_no
        echo "<td class=\"{$class}\">";
        if (!is_s_item_attribute_type_deletable($s_item_type, $s_item_attribute_type_r['s_attribute_type'], $s_item_attribute_type_r['order_no'])) {
            echo get_input_field("order_no[{$row}]", NULL, "Order No.", "readonly", "N", $s_item_attribute_type_r['order_no'], FALSE);
        } else {
            echo get_input_field("order_no[{$row}]", NULL, "Order No.", "number(3)", "N", $s_item_attribute_type_r['order_no'], FALSE);
        }
        echo "<input type=\"hidden\" name=\"old_order_no[{$row}]\" value=\"" . $s_item_attribute_type_r['order_no'] . "\"></td>";
        // See if a s_field_type defined for this attribute type
        $attribute_type_r = fetch_s_attribute_type_r($s_item_attribute_type_r['s_attribute_type']);
        if (strlen($attribute_type_r['s_field_type']) > 0) {
            $value = $s_item_attribute_type_r['s_attribute_type'] . " [" . $attribute_type_r['s_field_type'] . "]";
        } else {
            $value = $s_item_attribute_type_r['s_attribute_type'];
        }
        echo "<input type=\"hidden\" name=\"s_attribute_type[{$row}]\" value=\"" . $s_item_attribute_type_r['s_attribute_type'] . "\">" . "<input type=\"hidden\" name=\"exists_ind[{$row}]\" value=\"Y\">";
        echo "<td class=\"{$class}\">" . $value . "</td>";
        echo "<td class=\"{$class}\"><a href=\"#\" onmouseover=\"return show_sat_tooltip('" . $s_item_attribute_type_r['s_attribute_type'] . "', arrayOfSystemAttributeTypeTooptips);\" onmouseout=\"return hide_tooltip();\">(?)</a></td>";
    } else {
        // order_no
        echo "<td class=\"{$class}\">" . ($exists_error_ind ? theme_image("rs.gif", "Duplicate Attribute Type & Order No") : "") . get_input_field("order_no[{$row}]", NULL, NULL, "number(3)", "N", $s_item_attribute_type_r['order_no'], FALSE) . "</td>";
        echo "<td class=\"{$class}\">" . "<select name=\"s_attribute_type[{$row}]\">" . "\n<option value=\"\">";
        reset($s_attribute_type_list_rs);
        while (list(, $attribute_type_r) = each($s_attribute_type_list_rs)) {
            if (is_not_empty_array($s_item_attribute_type_r) && $s_item_attribute_type_r['s_attribute_type'] == $attribute_type_r['s_attribute_type']) {
                echo "\n<option value=\"" . $attribute_type_r['s_attribute_type'] . "\" SELECTED>" . $attribute_type_r['s_attribute_type'];
            } else {
                echo "\n<option value=\"" . $attribute_type_r['s_attribute_type'] . "\">" . $attribute_type_r['s_attribute_type'];
            }
            if (strlen($attribute_type_r['s_field_type']) > 0) {
                echo " [" . $attribute_type_r['s_field_type'] . "]";
            }
        }
        echo "\n</select></td>";
        echo "<td class=\"{$class}\"><a href=\"#\" onmouseover=\"return show_sat_select_tooltip(document.forms['s_item_attribute_type']['s_attribute_type[{$row}]'], arrayOfSystemAttributeTypeTooptips);\" onmouseout=\"return hide_tooltip();\">(?)</a></td>";
    }
    echo "<td class=\"{$class}\">" . get_input_field("prompt[{$row}]", NULL, NULL, "text(15,30)", "N", $s_item_attribute_type_r['prompt'], FALSE) . "</td>";
    if (!is_array($s_item_attribute_type_r) || $attribute_type_r['s_field_type'] != 'STATUSTYPE' && $attribute_type_r['s_field_type'] != 'STATUSCMNT' && $attribute_type_r['s_field_type'] != 'DURATION' && $attribute_type_r['s_field_type'] != 'TITLE' && $attribute_type_r['s_field_type'] != 'ITEM_ID' && $attribute_type_r['s_field_type'] != 'UPDATE_ON') {
        echo "<td class=\"{$class}\">";
        echo get_input_field("instance_attribute_ind[{$row}]", NULL, NULL, "simple_checkbox(" . (strtoupper($s_item_attribute_type_r['instance_attribute_ind']) == "Y" ? "CHECKED" : "") . ")", "N", "Y", FALSE);
        echo "</td>";
        echo "<td class=\"{$class}\">";
        echo get_input_field("compulsory_ind[{$row}]", NULL, NULL, "simple_checkbox(" . (strtoupper($s_item_attribute_type_r['compulsory_ind']) == "Y" ? "CHECKED" : "") . ")", "N", "Y", FALSE);
        echo "</td>";
    } else {
        // title is not supported at instance level
        if ($attribute_type_r['s_field_type'] == 'TITLE') {
            echo "<td class=\"{$class}\">N</td>";
        } else {
            echo "<td class=\"{$class}\">Y</td>";
        }
        echo "<td class=\"{$class}\">Y</td>";
    }
    echo "\n<td class=\"{$class}\">";
    echo get_input_field("rss_ind[{$row}]", NULL, NULL, "simple_checkbox(" . (strtoupper($s_item_attribute_type_r['rss_ind']) == "Y" ? "CHECKED" : "") . ")", "N", "Y", FALSE) . "&nbsp;Rss Feed<br />";
    echo get_input_field("printable_ind[{$row}]", NULL, NULL, "simple_checkbox(" . (strtoupper($s_item_attribute_type_r['printable_ind']) == "Y" ? "CHECKED" : "") . ")", "N", "Y", FALSE) . "&nbsp;Printable";
    echo "</td>";
    echo "\n<td class=\"{$class}\">";
    if (is_not_empty_array($s_item_attribute_type_r)) {
        echo "<a href=\"{$PHP_SELF}?type={$ADMIN_TYPE}&op=delete&s_item_type=" . $s_item_type . "&s_attribute_type=" . $s_item_attribute_type_r['s_attribute_type'] . "&order_no=" . $s_item_attribute_type_r['order_no'] . "\">Delete</a>";
    }
    echo "</td>";
    echo "</tr>";
}