<?php

    global $tpl;


    if( core::$i->id )
    {
        $query = db::$i->q("
            SELECT * 
            FROM `wagi` 
            WHERE 
                `user`='".( user::$i->id )."' 
                AND 
                `proces_id`='".( core::$i->id )."' 
            ORDER BY RAND()
        " , true );
        
        $Kryteria = new stdClass;
        
        if( $Kryteria->Count = db::$i->rows )
        {
            
            while( $item = db::$i->f( $query ) )
            {
                list( $item['nazwa'] , $item['image'] ) = db::$i->row("SELECT `nazwa`,`image` FROM `kryteria` WHERE `id`='".( $item['kryterium_id'] )."'");
                $Kryteria->Items[] = core::object( $item );
            }
        }
        
        $tpl->assign(array(
            'Kryteria' => $Kryteria,
            'id' => core::$i->id
        ));

        module::$i->on();
    } 
    else 
    {
        core::page404();
    }

?>