<?php namespace Phpcmf\Controllers\Admin;

class Home extends \Phpcmf\Common
{
    // 示例
	public function code() {

        // 将变量传入模板
        \Phpcmf\Service::V()->assign([

        ]);
        // 选择输出模板 后台位于 ./Views/code.html 此文件需要手动创建
        \Phpcmf\Service::V()->display('code.html');
    }

    // 配置
    public function config() {
        
        if(IS_AJAX_POST) {
            // 保存配置
            if(\Phpcmf\Service::M('wheeditor', 'wheeditor')->save_data($this->request->getPost())) {
                return $this->_msg(1, '保存成功');
            }else{
                return $this->_msg(1, '保存失败');
            }
        }


        // 将变量传入模板
        \Phpcmf\Service::V()->assign([
            'cdn' => \Phpcmf\Service::M('wheeditor', 'wheeditor')->get_cdn(),
            'info' => \Phpcmf\Service::M('wheeditor', 'wheeditor')->get_info(),
            'toolbar' => \Phpcmf\Service::M('wheeditor', 'wheeditor')->get_toolbar(),
        ]);
        
        \Phpcmf\Service::V()->display('config.html');
    }

}
