<?php
class myBlock extends control
{
    public function printParamsBlock($blockID)
    {
        $block = $this->block->getByID($blockID);
        if(empty($block)) return false;

        $this->app->loadLang('im');

        $html = '<div><table class="table table-form table-borderless"><tr><td><table>';

        $key = zget($this->config->xuanxuan, 'key', '');
        $html .= '<tr><td><strong>'.$this->lang->im->key.'</strong></td><td class="code">'.(strlen($key) > 8 ? (substr($key, 0, 4).'...'.substr($key, -4)) : $key).'</td></tr>';
        $html .= '<tr><td><strong>'.$this->lang->im->xxdServer.'</strong></td><td>'.$this->loadModel('im')->getServer().'</td></tr>';
        $html .= '<tr><td><strong>'.$this->lang->im->pollingInterval.'</strong></td><td class="code">'.zget($this->config->xuanxuan, 'pollingInterval', 60).'</td></tr>';
        $html .= '<tr><td><strong>'.$this->lang->im->xxd->ip.'</strong></td><td class="code">'.zget($this->config->xuanxuan, 'ip', '0.0.0.0').'</td></tr>';
        $html .= '<tr><td><strong>'.$this->lang->im->xxd->uploadFileSize.'</strong></td><td>'.$this->lang->im->xxd->max.zget($this->config->xuanxuan, 'uploadFileSize', 20).'M'.'</td></tr>';

        $html .= '</table></td><td><table>';

        $html .= '<tr><td><strong>'.$this->lang->im->xxd->chatPort.'</strong></td><td class="code">'.zget($this->config->xuanxuan, 'chatPort', 11444).'</td></tr>';
        $html .= '<tr><td><strong>'.$this->lang->im->xxd->commonPort.'</strong></td><td class="code">'.zget($this->config->xuanxuan, 'commonPort', 11444).'</td></tr>';

        $https = zget($this->config->xuanxuan, 'https', 'off');
        $html .= '<tr><td><strong>'.$this->lang->im->xxd->https.'</strong></td><td>'.zget($this->lang->im->httpsOptions, $https).'</td></tr>';

        $debug = zget($this->config->xuanxuan, 'debug', 0);
        $html .= '<tr><td><strong>'.$this->lang->im->debug.'</strong></td><td>'.zget($this->lang->im->debugStatus, $debug).'</td></tr>';

        $html .= '<tr><td>'.html::a(helper::createLink('setting', 'downloadXXD', 'type=config'), $this->lang->im->downloadConf, "class='btn btn-primary download' target='hiddenwin'").'</td>';
        $html .= '<td>'.html::a(helper::createLink('setting', 'xuanxuan', 'type=edit'), $this->lang->im->changeSetting, "class='btn'").'</td></tr>';

        $html .= '</table></td></tr></table></div>';

        die($html);
    }
}
