<?php
include_once(_DIR_TO_CLASS.'/c_page.php') ;
class c_page_cab_account_select_group extends c_page
{
 public $h1='Выбор группы ЭСМО при авторизации фельдшера' ;

 function check_access()  { return(1) ; }

 function body()
 {
     $this->body_autorize() ;
 }

 function panel_autorize()  {$this->panel_form_autorize() ;}

  function panel_form_autorize($options=array())
  {   $arr_groups=execSQL_row('select pkey,obj_name from obj_site_account where clss in (206) and parent!=0 order by clss,obj_name') ;
      $options_list=ACCOUNTS()->get_arr_groups_select_options(array('root_id'=>$_SESSION['autorize_process']['account_group_id'])) ;
      //damp_array($_COOKIE,1,-1);
      //damp_array($_SESSION['autorize_process'],1,-1) ;
      LOG_JSON('account_autorize')->reg('panel_form_autorize','Показана панель выбора группы') ;
      LOG_JSON('account_autorize')->flush('auth_'.$_COOKIE[session_name()].'_'.date('d_m_Y_h_i')) ;
      $form=new i_form() ;
      //$form->form_open();
      ?><form id="sky-form" class="sky-form" style="min-width:600px;">
        <header><img src="<?echo _LOGO_CAB?>"></header><?
      ?><fieldset><?
      $form->row_open();
      if ($_SESSION['autorize_process']['account_id']) $form->filter_section_select('group_id_to_auth',$this->h1,0,$options_list,array('nospace_element'=>1,'cur_value'=>$_COOKIE['def_group'])) ;
                   else {?><div class="alert">Не передан ID сотрудника, выбор группы невозможен</div><?}
      $form->row_close() ;
      ?></fieldset><?
      ?><footer><button class="button v2" cmd="AD/cancel_check_sertificate">Отмена</button><?
           if ($_SESSION['autorize_process']['account_id'] and $_SESSION['autorize_process']['from_AD']){?><button class="button v2" cmd="account/fixed_selected_group">Войти в выбранной группе</button><?}
                        if ($_SESSION['autorize_process']['account_id'] and !$_SESSION['autorize_process']['from_AD']){?><button class="button v2" cmd="account/account_login">Войти в выбранной группе</button><?}
      ?></footer><?
      //$form->form_close();
      ?></form><?


  }

 function block_main() {}

 
}
?>