<?php
include_once(_DIR_TO_CLASS.'/c_page.php') ;
class c_page_cab_print_order extends c_page
{
    public $rec_doc ;
	public $h1='Список нарядов для печати' ;

    function second_menu_config() {
        $this->second_menu['/cab/print_order/']=array('title'=>'Печать нарядов') ;
    }

    function block_main() {
        $this->page_title('Печать нарядов') ;
        $this->print_order_types();
    }


    function print_order_types() {
        $exist_types = execSQL('select * from '.PRINT_ORDER()->type_table);

        ?>
        <div>
            <button class="button v2" cmd="print_order/add_order_type">Добавить</button>
        </div>
        <div id="panel_filter">
            <form class="sky-form">
                <table class="basic auto fz_small">
                    <tr>
                        <th rowspan="2">ID тип печати</th>
                        <th rowspan="2">Наименование</th>
                        <th colspan="3">Настройки</th>
                        <th rowspan="2"></th>
                    </tr>
                    <tr>
                        <th>Печатать штамп</th>
                        <th>URL для печати</th>
                        <th>Общий URL</th>
                    </tr>
                    <?
                    foreach ($exist_types as $exist_type) {
                        $ext_data=unserialize($exist_type['ext_info']);
                        ?>
                        <tr>
                            <td><?echo $exist_type['type']?></td>
                            <td><?echo $exist_type['obj_name']?></td>
                            <td><img src="/images/status_<?echo $ext_data['enable_stamp']?>.png"></td>
                            <td><?if ($ext_data['enable_stamp']) echo PRINT_ORDER()->print_order_setting['type_of_get_PDF']['values'][$ext_data['type_of_get_PDF']]?></td>
                            <td>
                                <?
                                if ($ext_data['enable_stamp'] and $ext_data['type_of_get_PDF']=='common') {
                                    if ($ext_data['common_URL']) echo $ext_data['common_URL']; else echo 'Не указан';
                                }
                                ?>
                            </td>
                            <td>
                                <a href="/cab/print_order/order/<?echo $exist_type['pkey']?>/" title="Редактировать" ><img src="/images/view-details-32.png" width="32"></a>
                                <a href="" class="v2" type_order_key="<?echo $exist_type['pkey']?>" title="Удалить" cmd="print_order/print_order_delete"><img src="/images/delete-2-24.png" width="32"></a>
                            </td>
                        </tr>
                        <?
                    }
                    ?>
                </table>
            </form>
        </div>
        <?
    }

}
?>