Esempio n. 1
0
     echo format_error_block($errors);
 }
 echo get_javascript('admin/select.js');
 echo "\n<form name=\"edit_site_plugin_item_types\" action=\"{$PHP_SELF}\" method=\"POST\">";
 echo "\n<input type=\"hidden\" name=\"op\" value=\"" . $HTTP_VARS['op'] . "\">";
 echo "\n<input type=\"hidden\" name=\"type\" value=\"" . $ADMIN_TYPE . "\">";
 echo "\n<input type=\"hidden\" name=\"site_type\" value=\"" . $HTTP_VARS['site_type'] . "\">";
 echo "<table>";
 $exists_item_type_rs = array();
 $not_exists_item_type_rs = array();
 $results = fetch_item_type_rs();
 if ($results) {
     while ($item_type_r = db_fetch_assoc($results)) {
         $exists = FALSE;
         for ($i = 0; $i < count($site_attribute_type_r); $i++) {
             if (is_exists_item_attribute_type($item_type_r['s_item_type'], $site_attribute_type_r[$i])) {
                 $exists = TRUE;
             }
         }
         if ($exists) {
             $exists_item_type_rs[] = $item_type_r;
         } else {
             $not_exists_item_type_rs[] = $item_type_r;
         }
     }
     db_free_result($results);
 }
 echo "<tr class=\"navbar\">\n\t\t\t<th>Exclude</th>\n\t\t\t<th></th>\n\t\t\t<th>Include</th>\n\t\t\t</tr>";
 echo "<tr><td><select name=\"from_item_types\" class=\"includeExcludeWidget\" size=\"15\" MULTIPLE>";
 for ($i = 0; $i < count($not_exists_item_type_rs); $i++) {
     echo "<option value=\"" . $not_exists_item_type_rs[$i]['s_item_type'] . "\">" . $not_exists_item_type_rs[$i]['s_item_type'] . " - " . $not_exists_item_type_rs[$i]['description'] . "\n";
Esempio n. 2
0
    }
    return $HTTP_VARS;
}
if ($HTTP_VARS['op'] == 'delete') {
    if (!is_exists_item_attribute_type(NULL, $HTTP_VARS['s_attribute_type'])) {
        if (!is_reserved_s_attribute_type($HTTP_VARS['s_attribute_type'])) {
            $s_field_type = fetch_attribute_type_s_field_type($HTTP_VARS['s_attribute_type']);
            if ($s_field_type == 'ADDRESS' && is_exists_addr_attribute_type_rltshp(NULL, $HTTP_VARS['s_attribute_type'])) {
                $errors[] = array('error' => 'Attribute type not deleted.', 'detail' => 'Attribute is linked to at least one system address type');
                $HTTP_VARS['op'] = '';
            } else {
                if ($s_field_type == 'RATING') {
                    $errors[] = array('error' => 'Attribute type not deleted.', 'detail' => 'Attribute is reserved for ratings');
                    $HTTP_VARS['op'] = '';
                } else {
                    if ($s_field_type != 'ADDRESS' && $s_field_type != 'RATING' && is_exists_item_attribute_type(NULL, $HTTP_VARS['s_attribute_type'])) {
                        $errors[] = array('error' => 'Attribute type not deleted.', 'detail' => 'Attribute is linked to at least one system item type');
                        $HTTP_VARS['op'] = '';
                    } else {
                        if ($HTTP_VARS['confirmed'] == 'true') {
                            if (delete_s_attribute_type($HTTP_VARS['s_attribute_type'])) {
                                $HTTP_VARS['op'] = NULL;
                            } else {
                                $errors[] = array('error' => 'Attribute type not deleted.', 'detail' => db_error());
                                $HTTP_VARS['op'] = '';
                            }
                        } else {
                            if ($HTTP_VARS['confirmed'] != 'false') {
                                echo "\n<h3>Delete Attribute type</h3>";
                                echo get_op_confirm_form($PHP_SELF, "Are you sure you want to delete attribute type '" . $HTTP_VARS['s_attribute_type'] . "'?", array('type' => $ADMIN_TYPE, 'op' => 'delete', 's_attribute_type' => $HTTP_VARS['s_attribute_type'], 'active_tab' => $HTTP_VARS['active_tab']));
                            } else {
Esempio n. 3
0
                 }
             } else {
                 //if(is_exists_item_attribute_type($HTTP_VARS['s_item_type'], $HTTP_VARS['s_attribute_type'][$i], $HTTP_VARS['old_order_no'][$i]))
                 $errors[] = array('error' => 'Item Attribute type (' . $HTTP_VARS['s_attribute_type'][$i] . '[' . $HTTP_VARS['old_order_no'][$i] . ']) not found', 'detail' => db_error());
             }
         }
         //if($HTTP_VARS['exists_ind'][$i] == 'Y')
     }
     //for($i=0; $i<count($HTTP_VARS['s_attribute_type']); $i++)
     // Now do the inserts.
     for ($i = 0; $i < count($HTTP_VARS['s_attribute_type']); $i++) {
         // Ignore elements that have no order_no or old_order_no specified.
         if ($HTTP_VARS['exists_ind'][$i] != 'Y') {
             if (strlen($HTTP_VARS['s_attribute_type'][$i]) > 0) {
                 if (is_numeric($HTTP_VARS['old_order_no'][$i]) || is_numeric($HTTP_VARS['order_no'][$i])) {
                     if (!is_exists_item_attribute_type($HTTP_VARS['s_item_type'], $HTTP_VARS['s_attribute_type'][$i], $HTTP_VARS['order_no'][$i])) {
                         if (!insert_s_item_attribute_type($HTTP_VARS['s_item_type'], $HTTP_VARS['s_attribute_type'][$i], $HTTP_VARS['order_no'][$i], $HTTP_VARS['prompt'][$i], $HTTP_VARS['instance_attribute_ind'][$i], $HTTP_VARS['compulsory_ind'][$i], $HTTP_VARS['rss_ind'][$i], $HTTP_VARS['printable_ind'][$i])) {
                             $errors[] = array('error' => 'Item Attribute type (' . $HTTP_VARS['s_attribute_type'][$i] . '[' . $HTTP_VARS['old_order_no'][$i] . ']) not inserted', 'detail' => db_error());
                         }
                     } else {
                         // Cache any records that could not be inserted.
                         $sait_already_exists[] = array('s_attribute_type' => $HTTP_VARS['s_attribute_type'][$i], 'order_no' => $HTTP_VARS['order_no'][$i], 'prompt' => $HTTP_VARS['prompt'][$i], 'instance_attribute_ind' => $HTTP_VARS['instance_attribute_ind'][$i], 'compulsory_ind' => $HTTP_VARS['compulsory_ind'][$i], 'rss_ind' => $HTTP_VARS['rss_ind'][$i], 'printable_ind' => $HTTP_VARS['printable_ind'][$i]);
                     }
                 } else {
                     $errors[] = array('error' => 'Item Attribute type (' . $HTTP_VARS['s_attribute_type'][$i] . ') not inserted', 'detail' => 'No order_no specified.');
                 }
             }
             //if(strlen($HTTP_VARS['s_attribute_type'][$i])>0)
         }
     }
 }