<?php
$add = [];
$module_more = $module = $cname = [];
$cname[] = '更新模块域名目录';
if (dr_is_app('module')) {
    $add['module1'] = ['手动重建内容搜索索引', 'update_search_index'];
    $cname[] = '更新模块域名目录';
    $module = \Phpcmf\Service::L('cache')->get('module-'.SITE_ID.'-content');
    if ($module) {
        $module = dr_array_sort($module, 'share', 'asc');
        $limit = 10;
        if (is_array($module) && dr_count($module) > $limit) {
            $module_more = array_slice($module, $limit);
            $module = array_slice($module, 0, $limit);
        }
    }
}
if (dr_is_app('sites')) {
    $cname[] = '更新子站目录';
}
if (dr_is_app('client')) {
    $cname[] = '更新终端目录';
}
if ($cname) {
    $add['module2'] = [implode('、', $cname), 'update_site_config'];
}
?>
{loop $add $id $t}
<tr>
    <td>
        <span class="badge badge-success"> {$key} </span>
    </td>
    <td>
        {dr_lang($t[0])}
    </td>
    <td style="overflow:auto">
        <label>
            <a href="javascript:my_update_cache('{$id}', '{$t[1]}');" class="btn red btn-xs"><i class="fa fa-refresh"></i> {dr_lang('立即执行')} </a>
        </label>
        <label id="dr_{$id}_result" >

        </label>
    </td>
</tr>
{php $key=$key+1;}
{/loop}
<tr>
    <td>
        <span class="badge badge-success">{$key++}</span>
    </td>
    <td>
        {dr_lang('新增或变更栏目后，需要更新栏目缓存数据')}
    </td>
    <td style="overflow:auto">
        <label>
            <a href="javascript:dr_iframe_show('{dr_lang('更新共享栏目')}', '{dr_url('module/api/update_category_repair')}&all=1&mid=share', '500px', '300px');" class="btn blue btn-xs"><i class="fa fa-cog"></i> {dr_lang('共享栏目')} </a>
        </label>
        {loop $module $c}
        {if !$c.share}
        <label>
            <a href="javascript:dr_iframe_show('{dr_lang($c.name)}', '{dr_url('module/api/update_category_repair')}&all=1&mid={$c.dirname}', '500px', '300px');" class="btn blue btn-xs"><i class="{dr_icon($c.icon)}"></i> {dr_lang($c.name)} </a>
        </label>
        {/if}
        {/loop}
        {if $module_more}
        <div class="btn-group" style="margin-top:0; margin-left: 10px">
            <button type="button" class="btn btn-xs btn-default ">{dr_lang('更多')}</button>
            <button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
                <i class="fa fa-angle-down"></i>
            </button>
            <ul class="dropdown-menu" role="menu">
                {loop $module_more $c}
                {if !$c.share}
                <li>
                    <a href="javascript:dr_iframe_show('{dr_lang($c.name)}', '{dr_url('module/api/update_category_repair')}&all=1&mid={$c.dirname}', '500px', '300px');"><i class="{dr_icon($c.icon)}"></i> {dr_lang($c.name)} </a>
                </li>
                {/if}
                {/loop}
            </ul>
        </div>
        {/if}
    </td>
</tr>
<tr>
    <td>
        <span class="badge badge-success">{$key++}</span>
    </td>
    <td>
        {dr_lang('内容地址与设置地址不同步时，更新内容URL地址')}
    </td>
    <td style="overflow:auto">
        {loop $module $c}
        <label>
            <a href="javascript:dr_iframe_show('{dr_lang($c.name)}', '{dr_url('api/update_url')}&mid={$c.dirname}', '500px', '300px');" class="btn blue btn-xs"><i class="{dr_icon($c.icon)}"></i> {dr_lang($c.name)} </a>
        </label>
        {/loop}
        {if $module_more}
        <div class="btn-group" style="margin-top:0; margin-left: 10px">
            <button type="button" class="btn btn-xs btn-default ">{dr_lang('更多')}</button>
            <button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
                <i class="fa fa-angle-down"></i>
            </button>
            <ul class="dropdown-menu" role="menu">
                {loop $module_more $c}
                <li>
                    <a href="javascript:dr_iframe_show('{dr_lang($c.name)}', '{dr_url('api/update_url')}&mid={$c.dirname}', '500px', '300px');"><i class="{dr_icon($c.icon)}"></i> {dr_lang($c.name)} </a>
                </li>
                {/loop}
            </ul>
        </div>
        {/if}
    </td>
</tr>