<?php

require_once 'lib/abstract_preloaded_regular_screen.php';

class I24hArchCatScreen extends AbstractPreloadedRegularScreen
{
    const ID = 'arch_cat_list';

    public function __construct($session, $amedia, $vod)
    {
        parent::__construct(
            self::ID,
            array
            (
                array
                (
                    PluginRegularFolderView::async_icon_loading => true,

                    PluginRegularFolderView::view_params => array
                    (
                        ViewParams::num_cols => 5,
                        ViewParams::num_rows => 1,
                        ViewParams::paint_details => false,
                        ViewParams::paint_sandwich => true,
                        ViewParams::sandwich_base => 'gui_skin://special_icons/sandwich_base.aai',
                        ViewParams::sandwich_mask => 'cut_icon://{name=sandwich_mask}',
                        ViewParams::sandwich_cover => 'cut_icon://{name=sandwich_cover}',
                        ViewParams::sandwich_width => 290,
                        ViewParams::sandwich_height => 160,
                        ViewParams::sandwich_icon_upscale_enabled => true,
                        ViewParams::sandwich_icon_keep_aspect_ratio => false,
                        ViewParams::background_path => I24HSettings::$BG_PIC,
                        ViewParams::background_width => 1920,
                        ViewParams::background_height => 1080,
                        ViewParams::background_order => 'before_all'

                    ),

                    PluginRegularFolderView::base_view_item_params => array
                    (
                        ViewItemParams::item_paint_icon => true,
                        ViewItemParams::item_layout => HALIGN_CENTER,
                        ViewItemParams::icon_valign => VALIGN_CENTER,
                        ViewItemParams::item_caption_font_size => FONT_SIZE_NORMAL,
                        ViewItemParams::item_caption_width => 1000,
                        ViewItemParams::icon_width => 290,
                        ViewItemParams::icon_height => 160,
                        ViewItemParams::item_paint_caption => false,
                        ViewItemParams::icon_path => 'plugin_file://icons/mov_unset.png',
                        ViewItemParams::item_detailed_icon_path => 'missing://',

                    ),

                    PluginRegularFolderView::not_loaded_view_item_params => array(),
                )
            ));
    }


    public function get_action_map(MediaURL $media_url, &$plugin_cookies)
    {
        return array(GUI_EVENT_KEY_ENTER => ActionFactory::open_folder());
    }

    public function get_all_folder_items(MediaURL $media_url, &$plugin_cookies)
    {
        $items = array();


        $items[] = array
        (
            PluginRegularFolderItem::media_url =>
                MediaURL::encode(
                    array (
                        'screen_id'   => I24hTopcatListScreen::ID,
                        'ganre_id'    => 1,
                    )),
            PluginRegularFolderItem::caption => 'Фильмы',
            PluginRegularFolderItem::view_item_params => array (
                ViewItemParams::icon_path => 'http://static.24h.tv/dune/main/ArchiveFilm.png'
            )
        );

        $items[] = array
        (
            PluginRegularFolderItem::media_url =>
                MediaURL::encode(
                    array (
                        'screen_id'   => I24hTopcatListScreen::ID,
                        'ganre_id'    => 2,
                    )),
            PluginRegularFolderItem::caption => 'Сериалы',
            PluginRegularFolderItem::view_item_params => array (
                ViewItemParams::icon_path => 'http://static.24h.tv/dune/main/ArchiveSerials.png'
            )
        );

        $items[] = array
        (
            PluginRegularFolderItem::media_url =>  MediaURL::encode(
                array (
                    'screen_id'   => I24hTopcatListScreen::ID,
                    'ganre_id'    => 3,
                )),
            PluginRegularFolderItem::caption => 'Детям',
            PluginRegularFolderItem::view_item_params => array (
                ViewItemParams::icon_path => 'http://static.24h.tv/dune/main/ArchiveBaby.png'
            )
        );

        $items[] = array
        (
            PluginRegularFolderItem::media_url =>
                MediaURL::encode(
                    array (
                        'screen_id'   => I24hTopcatListScreen::ID,
                        'ganre_id'    => 4,
                    )),
            PluginRegularFolderItem::caption => 'Передачи',
            PluginRegularFolderItem::view_item_params => array (
                ViewItemParams::icon_path => 'http://static.24h.tv/dune/main/ArchivePeredachi.png'
            )
        );

        $items[] = array
        (
            PluginRegularFolderItem::media_url =>
                MediaURL::encode(
                    array (
                        'screen_id'   => I24hTopcatListScreen::ID,
                        'ganre_id'    => 5,
                    )),
            PluginRegularFolderItem::caption => 'Спорт',
            PluginRegularFolderItem::view_item_params => array (
                ViewItemParams::icon_path => 'http://static.24h.tv/dune/main/ArchiveSport.png'
            )
        );

        return array_merge($items);
    }

}
