<? 
$title = 'Form Class Generator';
$this->headTitle($title, 'SET');
?>
<header class="page-header">
<h2 class="">Form Class Source Code</h2>
</header>

<div class="btn-toolbar">
    <div class="btn-group">
        <span class="btn code-format" onclick="formatCode()"><i class="icon-ok"></i></span>
    </div>
</div>

<?if($this->elementsCode):?>
<textarea id="form-code" class="span10 editor-code" rows="20" data-ui='{"mode":"javascript", "lineNumbers":true, "fontsize":"12px"}'><?=$this->widget('Scaffold', 'widgets/formclass', $this->vars())?></textarea>
<?else:?>
<textarea id="form-code" class="span10 editor-code" rows="20" data-ui='{"mode":"javascript", "lineNumbers":true, "fontsize":"12px"}'>
<?=$this->widget('Scaffold', 'widgets/formphp', $this->vars())?>
<?=$this->widget('Scaffold', 'widgets/formhtml', $this->vars())?>
</textarea>
<?endif;?>
<script>
    function formatCode(){
            var editor = $("#form-code").data("eva-ui-obj");
            eva.loader(eva.s('/lib/js/codemirror/lib/util/formatting.js'), function(){
                    CodeMirror.commands["selectAll"](editor);
                    editor.autoFormatRange(editor.getCursor(true), editor.getCursor(false));
            });
    }
</script>
