{include file="./index_top.tpl"}
<div align=center>
    <div align=center style="width:900px;">
        <br>
        {$lang.Cron_settings}
        <br><br>
        <a href="edit_cron.php" {if !$sel}class='selected_href'{/if}>{$lang.Tasks_list}</a><span class="help_bt" h_id="cron_Tasks_list"></span> /
        <a href="edit_cron.php?sel=archive" {if $sel=='archive'}class='selected_href'{/if}>{$lang.Archive}</a><span class="help_bt" h_id="cron_Archive"></span> /
        <a href="edit_cron.php?sel=monitor" {if $sel=='monitor'}class='selected_href'{/if}>{$lang.Monitor}</a><span class="help_bt" h_id="cron_Monitor"></span><br><br>
        {if $all_threads}
            {foreach from=$all_threads item=one_thread key=thread_name}
                <div style="margin:0 auto;">
                    <div style="float:left; margin-right: 5px;">
                        <TABLE border=0 cellpadding=3 style="float:left; border: solid 1px #336699;">
                            <TR>
                                <TH colspan=4 align=center>{$thread_name}</TH>
                            </TR>
                            <TR>
                                <Td></Td>
                                <Td align="center">{$lang.Description}</Td>
                                <Td align="center">{$lang.Period}</Td>
                                <Td align="center">{$lang.Plain_time}</Td>
                                <Td align="center">{$lang.Status}</Td>
                            </TR>
                            {foreach from=$one_thread item=one_task}
                                <TR>
                                    <Td>{$one_task.queue_id}</Td>
                                    <Td align="center"><a
                                                href="edit_cron.php?cron_id={$one_task.id}">{$one_task.description}</a>
                                    </Td>
                                    <Td>
                                        {if $one_task.period eq "* * * * *"}{$lang.Every_minute}
                                        {elseif $one_task.period eq "1-59/5 * * * *"}{$lang.Every_5_minute}
                                        {elseif $one_task.period eq "1,15,30,45 * * * *"}{$lang.Every_15_minute}
                                        {elseif $one_task.period eq "1 * * * *"}{$lang.Every_hour}
                                        {elseif $one_task.period eq "1 3 * * *"}{$lang.Every_day_3_oclock}
                                        {elseif $one_task.period eq "1 12 * * *"}{$lang.Every_day_12_oclock}
                                        {elseif $one_task.period eq "1 23 * * *"}{$lang.Every_day_23_oclock}
                                        {else}
                                            {$one_task.period}
                                        {/if}
                                    </Td>
                                    <Td align="center">{$one_task.plain_time}</Td>
                                    <Td>{if $one_task.run_status}{$lang.Running}{else}{$lang.Waiting}{/if}</Td>
                                </TR>
                            {/foreach}
                        </TABLE>
                    </div>
                </div>
            {/foreach}
        {else}
            <p>
                {$lang.no_cron_tasks}
            </p>
        {/if}
    </div>
</div>
<div style="clear:both"></div>
<br>
<div align=center>
    <form action="edit_cron.php?sel=monitor" method="post"
          onsubmit="var form = this; return jconfirm('{$lang.reset_cron_confirm}', function () { form.submit(); });">
        <input class="btn btn-default btn-sm" type=submit value="{$lang.reset_cron_tasks}"><span class="help_bt" h_id="reset_cron_tasks"></span>
        <input type=hidden name='reset_tasks' value="1">
        <input type=hidden value="{$csrf}" name="csrf">
    </form>
</div>
<br>