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
/**
 * 详情页面,checkbox与radio一行显示
 * @param string $label 左边的提示语
 * @param string $widget 标签内容
 * @param string $prompt 提示信息
 * @return string
 */
function form_format_input_widget($label, $widget, $prompt = '')
{
    return form_format_widget($label, $widget, false, $prompt, 2);
}
Ejemplo n.º 3
0
/**
 * moduleadd页面的view代码
 */
function moduleadd_view($module, $files, $id)
{
    $key_value = form_set_defaultvalue($module, 'module_key');
    if ($id > 0) {
        //修改的时候是不需要下拉框的
        $key = form_format_field_widget('选择模块', $key_value);
    } else {
        $key_attrs = array('name' => 'key', 'class' => 'span2', 'data-value-not-equals' => '', 'data-value-not-equals-message' => '请选择模块');
        $key = matrix_select_attrs($files, $key_attrs, $key_value);
        $key = form_format_widget('选择模块', $key, true);
    }
    $name_value = form_set_defaultvalue($module, 'module_name');
    $name_attr = array('name' => 'name', 'class' => 'span4', 'data-required' => 'true', 'data-required-message' => '请输入模块名');
    $name = form_input($name_attr, $name_value);
    $name = form_format_widget('模块名称', $name, true);
    $sort_value = form_set_defaultvalue($module, 'sort');
    $sort_attr = array('name' => 'sort', 'class' => 'span2', 'data-digits' => 'true', 'data-digits-message' => '请输入正确的排序数字');
    $sort = form_input($sort_attr, $sort_value);
    $sort = form_format_widget('排序', $sort);
    $action_value = form_set_defaultvalue($module, 'action');
    $action_attr = array('name' => 'action', 'class' => 'span2');
    $action = form_input($action_attr, $action_value);
    $action = form_format_widget('默认功能', $action);
    $icon_value = form_set_defaultvalue($module, 'icon');
    $icon_attr = array('name' => 'icon', 'class' => 'span2');
    $icon = form_input($icon_attr, $icon_value);
    $icon_a_attr = array('target' => '_blank', 'href' => 'http://matrix.pwstrick.com/buttons.html');
    $icon_prompt = '显示在左边菜单栏中的小icon,' . form_a($icon_a_attr, '查询icon名') . ',将“icon-”前缀去掉就是名字';
    $icon = form_format_widget('默认icon', $icon, false, $icon_prompt);
    //form内容拼接
    $forms = array();
    $widget = array($key, $name, $sort, $action, $icon);
    //控件数组
    $forms[] = form_detail_container($widget);
    $forms[] = form_detail_actions();
    return form_implode($forms);
}