<?php
    
    global $tpl;  

    switch( core::$i->method )
    {
        case 'save':
        
            if( kryteria::add( $_REQUEST , false ) )
            {

                $tpl->assign(array(
                    'ProcesId' => $_REQUEST['proces_id']
                ));
                       
                js::$i->setJSON(array(   
                    'status' => true,
                    'html' => $tpl->fetch('ajax/' . core::$i->mode . '/' . core::$i->function . '_success.tpl' )
                ));
            } 
            else 
            {
                js::$i->setJSON(array(
                    'error' => statement::$i->LastHtml
                ));
            }
        

        break;
        
        default:
        
            $tpl->assign(array(
                'ProcesId' => $_REQUEST['ProcesId'],
                'temat_id' => $_REQUEST['temat_id'],
                'Typy' => typ_kryterium::getList(),
                'Images' => zdjecia::getGroupList(),
                'Lingwistyczne' => lin::getGroupList()
            ));
        
            js::$i->setJSON(array(   
                'status' => true,
                'html' => $tpl->fetch('ajax/' . core::$i->mode . '/' . core::$i->function . '.tpl' )
            ));
            
        break;
    }

?>