<?php
include_once('c_poll_theme_card.php');
class c_page_cab_poll_theme_card_db extends c_page_cab_poll_theme_card
{
    public $h1='Опрос - карточка раздела - Исходные данные';
    var $use_textarea_autosize=1;

    function block_main()
    {
        $this->page_title();
        $this->panel_event();
    }

    function panel_event()
    {
        ?><strong>view_poll_themes</strong><br><?
        print_2x_arr([$this->rec_section]) ;

        ?><strong>poll_tree</strong><br><?
        $recs=execSQL('select * from poll_tree where pkey='.$this->rec_section['pkey']) ;
        print_2x_arr($recs);

        ?><strong>poll_themes</strong><br><?
        $recs=execSQL('select * from poll_themes where pkey='.$this->rec_section['pkey']) ;
        print_2x_arr($recs);


        ?><button class="v1" cmd="check_structure">Проверить структуру разделов</button><?
        ?><button class="v1" cmd="check_viewer">Пересоздать вьювер раздела</button><?
        $recs=execSQL('select * from poll_themes where pkey='.$this->rec_section['pkey']) ;
        print_2x_arr($recs);

        // информация по фильтрам персонала
        PERSONALS_FILTER()->show_personal_filter_db_info($this->rec_section['_reffer']) ;

        execSQL('select * from poll_tree order by pkey',2) ;
    }

    function CMD_check_structure()
    {   echo 'Проверяем структуру позразделов<br>' ;
        //TREE('poll_themes')->update_levels_parents('',['ext_table'=>'poll_questions']);
        TREE('poll_tree')->update_levels_parents();
        echo 'Проверка структуру выполнена<br>' ;
    }
    
    function CMD_check_viewer()
    {
        PERSONALS_FILTER()->update_viewer_personals('view_personals_poll_section_'.$this->rec_section['pkey']);  
	}

    function get_page_obj_by_url($url)
    { echo '$url='.$url.'<br>' ;
      $options=cab_page_prepare($url) ;
      if ($options['class_file'] and $options['class_name'] and $options['ext'])
      {
          include_once(_DIR_EXT.'/'.$options['ext'].'/'.$options['class_file']) ;
          $page=new $options['class_name'] ;
          damp_array($page);
      }
      //damp_array($options);


    }


}

?>
