Пример #1
0
function mysql_where_str($constraints)
{
    $cons_strs = array();
    foreach ($constraints as $key => $value) {
        #array_push($attributes, $key);
        $constraint = "";
        $attribute_type = get_attribute_type($key);
        if ($key == "name" || $key == "text") {
            $constraint = "{$key} LIKE \"%{$value}%\"";
        } elseif ($attribute_type == "int") {
            $constraint = "{$key}={$value}";
        } else {
            $constraint = "{$key}=\"{$value}\"";
        }
        array_push($cons_strs, $constraint);
    }
    return get_sql_array_str($cons_strs, " AND ");
}
					<div class="form-item cf">
						<label class="item-label">字段标题<span class="check-tips">(请输入字段标题,用于表单显示)</span></label>
						<div class="controls">
							<input type="text" class="text input-large" name="title" value="<?php 
echo $info["title"];
?>
">
						</div>
					</div>
					<div class="form-item cf">
						<label class="item-label">字段类型<span class="check-tips">(用于表单中的展示方式)</span></label>
						<div class="controls">
							<select name="type" id="data-type">
								<option value="">----请选择----</option>
								<?php 
$_result = get_attribute_type();
if (is_array($_result)) {
    $i = 0;
    $__LIST__ = $_result;
    if (count($__LIST__) == 0) {
        echo "";
    } else {
        foreach ($__LIST__ as $key => $type) {
            $mod = $i % 2;
            ++$i;
            ?>
<option value="<?php 
            echo $key;
            ?>
" rule="<?php 
            echo $type[1];
 ><?php 
                echo $type[0];
                ?>
</option><?php 
            }
        }
    } else {
        echo "";
    }
    ?>
                                            </select>
                                            <?php 
} else {
    ?>
                                                <input type="text" name="type" value="<?php 
    echo get_attribute_type($info['type']);
    ?>
" disabled><?php 
}
?>

                                        </div>
                                    </div>
                                   <div class="control-group">
                                        <label class="control-label">文本宽度</label>
                                        <div class="controls">
                                        <input type="text" name="text_size" value="<?php 
echo $info["text_size"];
?>
">  
                                         <span class="help-block">(编辑区域的宽度已1至12数字)</span>
			<td><?php 
                echo $vo["name"];
                ?>
</td>
			<td><a data-id="<?php 
                echo $vo["id"];
                ?>
" href="<?php 
                echo U('Attribute/edit?id=' . $vo['id']);
                ?>
"><?php 
                echo $vo["title"];
                ?>
</a></td>
			<td><span><?php 
                echo get_attribute_type($vo['type']);
                ?>
</span></td>
			<td><a href="<?php 
                echo U('Attribute/edit?id=' . $vo['id']);
                ?>
">编辑</a>
				<a class="confirm ajax-get" href="<?php 
                echo U('Attribute/remove?id=' . $vo['id']);
                ?>
">删除</a>
                </td>
		</tr><?php 
            }
        }
    } else {