Beispiel #1
0
 foreach ($allow_admin_view_fields as $value) {
     $showtype = 'p';
     if ($value == 'message') {
         $showtype = 'p_pre';
     }
     $editvalue[$value] = !empty($update[$value]) ? $update[$value] : $editvalue[$value];
     showsetting($mname . '_' . $value, $value, $editvalue[$value], $showtype);
 }
 if ($mname == "album") {
     $photosview = "<a target=\"_blank\" href=\"{$_SERVER[SCRIPT_NAME]}?&action=list&m=photo&shopid={$editvalue['shopid']}&albumid={$editvalue['itemid']}&filtersubmit=GO\">" . lang('verify_photosview') . '</a>';
     showsetting($mname . '_photosview', 'photosview', $photosview, "p_pre");
 }
 if (!empty($editvalue['attr_ids'])) {
     echo '<tr><td colspan="2" class="td27">' . lang('item_attribute') . '</td></tr>';
     require_once B_ROOT . '/batch.attribute.php';
     $attributes = getattribute($editvalue['attr_catid']);
     foreach ($editvalue['attr_ids'] as $key => $value) {
         echo '<tr class="noborder"><td class="vtop rowform">' . $attributes[$key]['attr_name'] . ': ' . ($attributes[$key]['attr_type'] == 0 ? $attributes[$key]['attr_values'][$value]['attr_text'] : $value) . '</td><td class="vtop rowform"></td></tr>';
     }
 } elseif (!empty($attributes)) {
     echo '<tr><td colspan="2" class="td27">' . lang('item_attribute') . '</td></tr>';
     foreach ($attributes as $key => $value) {
         echo '<tr class="noborder"><td class="vtop rowform">' . $attributes[$key]['attr_name'] . ': ' . ($attributes[$key]['attr_id'] == 0 ? $attributes[$key]['attr_values'][$value]['attr_text'] : $value) . '</td><td class="vtop rowform"></td></tr>';
     }
 }
 if (!empty($editvalue['relatedidstr']) || !empty($relatedarr)) {
     print_r($editvalue['relatedidstr']);
     if (!empty($editvalue['relatedidstr'])) {
         foreach ($editvalue['relatedidstr'] as $related) {
             $related = explode('@', $related);
             $relatedtype = trim($related[0]);
function getitemattributes($type_id, $itemid)
{
    global $_G, $_SGLOBAL, $lang, $_BCACHE, $_SBLOCK;
    $type_id = intval($type_id);
    $itemid = intval($itemid);
    if ($itemid) {
        $query = DB::query("SELECT * FROM " . tname("itemattribute") . " WHERE itemid = '{$itemid}' AND catid = '{$type_id}'");
        $itemattr = DB::fetch($query);
    }
    $attributes = getattribute($type_id);
    if (count($attributes) < 1) {
        return false;
    }
    if (!empty($itemattr)) {
        foreach ($attributes as $attr_id => $attribute) {
            if ($attribute['attr_type'] == 1) {
                $attr_id_s[] = $attr_id;
            }
        }
        if (!empty($attr_id_s)) {
            $query = DB::query("SELECT * FROM " . tname("attrvalue_text") . " WHERE attr_id in ('" . implode("', '", $attr_id_s) . "') AND item_id = '{$itemid}'", DB_FETCHMODE_ASSOC);
            while ($row = DB::fetch($query)) {
                $itemattr['attr_id_' . $attributes[$row['attr_id']]['attr_row']] = $row['attr_text'];
            }
        }
    }
    //print_r($itemattr);
    $itemattributestr = '';
    foreach ($attributes as $attr_id => $attr) {
        if ($attr['attr_type'] == 0) {
            $valuesops = '';
            foreach ($attr['attr_values'] as $key => $value) {
                $valuesops .= '<option value="' . $value['attr_valueid'] . '"' . ($itemattr['attr_id_' . $attr['attr_row']] && $itemattr['attr_id_' . $attr['attr_row']] == $value['attr_valueid'] ? ' selected="selected"' : '') . '>' . $value['attr_text'] . '</option>';
                if ($itemattr['attr_id_' . $attr['attr_row']] && $itemattr['attr_id_' . $attr['attr_row']] == $value['attr_valueid']) {
                    $itemattrvalue = $value['attr_text'];
                }
            }
            $attrsettings .= '<tr><td class="td27" width="80px">' . $attr['attr_name'] . $lang['colon'] . '</td><td class="td27"><select name="attr_ids[' . $attr_id . ']">' . $valuesops . '</select>' . '</td></tr>';
            $itemattributestr .= $attr['attr_name'] . $lang['colon'] . $itemattrvalue . "    ";
        } else {
            $valuesops = '<input type="text" name="attr_ids[' . $attr_id . ']" ' . ($itemattr['attr_id_' . $attr['attr_row']] ? 'value="' . $itemattr['attr_id_' . $attr['attr_row']] . '" ' : '') . '/>';
            $attrsettings .= '<tr><td class="td27" width="80px">' . $attr['attr_name'] . $lang['colon'] . '</td><td class="td27">' . $valuesops . '</td></tr>';
            $itemattrvalue = $itemattr['attr_id_' . $attr['attr_row']];
            $itemattributestr .= $attr['attr_name'] . $lang['colon'] . $itemattrvalue . "    ";
        }
    }
    return $itemattributestr;
}