コード例 #1
0
ファイル: ThemeBuilder.php プロジェクト: hisune/tinymvc-demo
 public static function buildModSetting()
 {
     return ['id' => '', 'js' => 'function check(){
             var type = $(".mod-type").val();
             var config = $(".mod-config").val();
             var table = $(".mod-table").val();
             if(type != "" && config != "" && table != ""){
                 $.ajax({
                     url: "' . tiny\Url::get('themeBuilder/check') . '",
                     data: {type: type, config: config, table: table},
                     dataType: "json",
                     success: function(response){
                         if(response.ret == 1){
                             $(".mod-field").val(response.msg);
                         }else{
                             $(".mod-field").val("");
                             $("#db-field-result").html(response.msg);
                         }
                     }
                 });
             }
             if(type == "mysql"){
                 $(".mod-field").attr("readonly", true);
             }else{
                 $(".mod-field").removeAttr("readonly");
             }
         }', 'mod' => [['title' => '数据库类型', 'name' => 'type', 'attribute' => ['onchange' => 'check()'], 'type' => 'select', 'option' => self::getDbType()], ['title' => '数据库配置字段', 'name' => 'config', 'attribute' => ['onchange' => 'check()'], 'type' => 'input', 'default' => 'database', 'required' => true], ['title' => '表名', 'name' => 'table', 'type' => 'input', 'attribute' => ['onchange' => 'check()'], 'required' => true], ['title' => '增删改查', 'name' => 'method', 'type' => 'checkbox', 'default' => '["sel", "mod", "del"]', 'option' => self::getMethod()], ['title' => '字段名', 'name' => 'field', 'type' => 'textarea', 'attribute' => ['readonly' => 'true'], 'required' => true]]];
 }
コード例 #2
0
ファイル: index.php プロジェクト: hisune/tinymvc-demo
function getUrl($v)
{
    if (strpos($v['route'], 'http') === 0) {
        $url = 'href="' . $v['route'] . '"';
        if ($v['blank']) {
            $url .= ' target="_blank"';
        }
    } else {
        $url = $v['route'] ? 'data-url="' . \Tiny\Url::get($v['route']) . '"' : '';
    }
    $url .= ' data-name="' . $v['name'] . '"';
    return $url;
}
コード例 #3
0
ファイル: Admin.php プロジェクト: hisune/tinymvc-demo
 public static function listDataTablesShowRenderOperate($row)
 {
     return tiny\Html::tag('button', '', ['onclick' => 'loadContent("' . tiny\Url::get('admin/mod', ['id' => $row->id]) . '")', 'class' => 'glyphicon glyphicon-edit pointer']) . tiny\Html::tag('button', '', ['onclick' => 'deleteItem("' . tiny\Url::get('admin/delete', ['id' => $row->id]) . '", "' . $row->true_name . '")', 'class' => 'glyphicon glyphicon-remove pointer', 'style' => 'margin-left: 3px;']);
 }
コード例 #4
0
ファイル: index.php プロジェクト: hisune/tinymvc-demo
echo var_export(\Tiny\Config::$controller);
?>
</pre>
            <p>生成的文件所在位置:</p>
            <pre>controller: <?php 
echo $dir;
?>
 <br />helper: <?php 
echo str_replace('\\' . \Tiny\Config::$controller[0], '\\Helper', $dir);
?>
 <br />model: <?php 
echo str_replace('\\' . \Tiny\Config::$controller[0], '\\Molder', $dir);
?>
            </pre>
            <p>DB table自动查询结果:</p>
            <div id="db-field-result"></div>
        </div><!-- /.box-body -->
        <div class="box-footer">
            <strong>Copyright &copy; 2014-2015 <a href="http://hisune.com" target="_blank">Hisune</a>.</strong> All rights reserved.
            powered by <a href="https://github.com/hisune/tinymvc" target="_blank">Tiny MVC</a>
        </div>
    </div>
</div>
<script>
    $.get('<?php 
echo \Tiny\Url::get('themeBuilder/build');
?>
', function(ret){
        $('#theme').html(ret);
    });
</script>