Ejemplo n.º 1
0
/**
 * add添加页面的view
 */
function add_view($user = array())
{
    $forms = array();
    $name_value = form_set_defaultvalue($user, 'name');
    $name_attr = array('class' => 'span4', 'name' => 'name');
    $name = form_input($name_attr);
    $name = form_format_widget('用户', $name, true);
    $pwd_attr = array('class' => 'span4', 'name' => 'pwd', 'id' => 'pwd');
    $pwd = form_password($pwd_attr);
    $pwd = form_format_widget('密码', $pwd, true, '不能输入纯数字');
    $repwd_attr = array('class' => 'span4', 'name' => 'repwd', 'data-confirm-to' => 'pwd', 'data-confirm-to-message' => '密码确认不正确');
    $repwd = form_password($repwd_attr);
    $repwd = form_format_widget('确认密码', $repwd);
    /*
     * 自定义按钮
     */
    $custom_btn = matrix_custom_btn('取消', array('data-prompt' => '您确定取消吗?', 'data-ajax' => 'ajax/operate.php'));
    $custom_btn = form_format_widget('', $custom_btn);
    $field_china = form_format_field_widget('国家', '中国');
    /*
     * radio与checkbox
     */
    $checkboxs[] = matrix_checkbox_inline(array('name' => 'join[]'), 1, '软妹子');
    $checkboxs[] = matrix_checkbox_inline(array('name' => 'join[]'), 2, '红宝石', true);
    $checkboxs[] = matrix_checkbox_inline(array('name' => 'join[]'), 3, '做一个春梦');
    $checkboxs = form_implode($checkboxs);
    $checkboxs = form_format_input_widget('搭配', $checkboxs);
    /*
     * 上传插件
     */
    $cover = uploadify(array('id' => 'cover'));
    $cover = form_format_widget('封面', $cover);
    /*
     * 弹出层
     */
    $category_attrs = array('id' => 'selectCategory', 'data-href' => base_url('user/layer?math=Math.random()'), 'data-title' => '选择品类', 'data-height' => '400', 'data-scrolling' => 'true');
    $category = matrix_btn('选择品类', $category_attrs, 'warning');
    $category = form_format_widget('类别', $category);
    $widget1 = array($pwd, $repwd, $custom_btn, $field_china, $checkboxs, $cover, $category);
    //控件数组
    $forms[] = form_detail_container($widget1, '主要内容');
    /*
     * 富文本编辑器
     */
    $ueditor = ueditor(array('id' => 'txtContent', 'name' => 'txtContent', 'style' => 'height:250px;width:100%'));
    $ueditor = form_format_widget('编辑器', $ueditor);
    $widget2 = array($ueditor);
    $forms[] = form_detail_container($widget2, '编辑器');
    $forms[] = form_detail_actions();
    //提交按钮
    return form_implode($forms);
}
Ejemplo n.º 2
0
/**
 * 自定义按钮,详情页面会有按钮做ajax操作
 * @param string $content
 * @param array $attrs
 * @param string $btn_css 样式选择
 * @param string $other_css 其他样式
 */
function matrix_custom_btn($content, $attrs = array(), $btn_css = '', $other_css = '')
{
    $attrs['data-type'] = 'custom';
    return matrix_btn($content, $attrs, $btn_css, $other_css);
}