public function handle_user_input(&$user_input, &$plugin_cookies)
 {
     hd_print(__METHOD__);
     hd_print(__METHOD__ . ":" . print_r($user_input, true));
     if ($user_input->control_id == 'pop_up') {
         $media_url = MediaURL::decode($user_input->selected_media_url);
         $key = (string) $media_url->category_id;
         // hd_print("key = $key");
         if ($key) {
             $url = EmplexerConfig::getInstance()->getPlexBaseUrl($plugin_cookies, $this) . '/library/sections/' . $key;
             /*$popUp = new EmplexerPopUp(4);
             		$action = $popUp->showPopUpMenu($url);*/
             $doc = HD::http_get_document(EmplexerConfig::getInstance()->getPlexBaseUrl($plugin_cookies, $this) . '/library/sections/' . $key);
             $pop_up_items = array();
             $xml = simplexml_load_string($doc);
             $defaultFilter = 'all';
             if ($media_url->type == 'show') {
                 $defaultFilter = isset($plugin_cookies->defaultShowFilter) ? $plugin_cookies->defaultShowFilter : 'all';
             }
             if ($media_url->type == 'movie') {
                 $defaultFilter = isset($plugin_cookies->defaultMovieFilter) ? $plugin_cookies->defaultMovieFilter : 'all';
             }
             foreach ($xml->Directory as $c) {
                 $key = (string) $c->attributes()->key;
                 $prompt = (string) $c->attributes()->prompt;
                 $is_secondary = (string) $c->attributes()->secondary;
                 if ($key != $defaultFilter && $key != 'folder' && !$prompt) {
                     // if ($key != 'all' ){
                     $pop_up_items[] = array(GuiMenuItemDef::caption => (string) $c->attributes()->title, GuiMenuItemDef::action => ActionFactory::open_folder($this->get_right_media_url_for_pop_up($media_url, $key, $is_secondary != null), $key));
                 }
             }
             hd_print(__METHOD__ . ' pop_up_items:' . print_r($pop_up_items, true));
             $action = ActionFactory::show_popup_menu($pop_up_items);
             // hd_print(__METHOD__ . ': ' . print_r($action, true));
             return $action;
         } else {
             return null;
         }
     }
     if ($user_input->control_id == 'savePref') {
         hd_print(__METHOD__ . ':' . print_r($user_input, true));
         hd_print(__METHOD__ . ':' . print_r($plugin_cookies, true));
         EmplexerSetupScreen::savePreferences($user_input, $plugin_cookies);
     }
 }
 public function handle_user_input(&$user_input, &$plugin_cookies)
 {
     hd_print(__METHOD__ . ':' . print_r($user_input, true));
     if ($user_input->selected_control_id == 'configureNfs') {
         $saveAdvanceNfsConfig = UserInputHandlerRegistry::create_action($this, 'saveAdvanceNfsConfig');
         return ActionFactory::show_nfs_advanced_configuration_modal('Nfs advanced configuration', &$plugin_cookies, $saveAdvanceNfsConfig);
     } else {
         if ($user_input->selected_control_id == 'configureSMB') {
             $saveAdvanceSmbConfig = UserInputHandlerRegistry::create_action($this, 'saveAdvanceSmbConfig');
             return ActionFactory::show_smb_advanced_configuration_modal('SMB advanced configuration', &$plugin_cookies, $saveAdvanceSmbConfig);
         } else {
             if ($user_input->selected_control_id == 'btnDefaultFilter') {
                 $saveDefaultFilters = UserInputHandlerRegistry::create_action($this, 'saveDefaultFilters');
                 return ActionFactory::show_default_filter_selecor_modal('Default filters configuration', &$plugin_cookies, $saveDefaultFilters);
             } else {
                 if ($user_input->selected_control_id == 'btnSalvar') {
                     return EmplexerSetupScreen::savePreferences($user_input, $plugin_cookies, ActionFactory::reset_controls($this->do_get_control_defs($plugin_cookies)));
                 } else {
                     if ($user_input->selected_control_id == 'connectionMethod') {
                         if ($user_input->connectionMethod == NFS_CONNECTION_TYPE) {
                             $saveAdvanceNfsConfig = UserInputHandlerRegistry::create_action($this, 'saveAdvanceNfsConfig');
                             return ActionFactory::show_nfs_advanced_configuration_modal('Nfs advanced configuration', &$plugin_cookies, $saveAdvanceNfsConfig);
                         } else {
                             if ($user_input->connectionMethod == SMB_CONNECTION_TYPE) {
                                 $saveAdvanceSmbConfig = UserInputHandlerRegistry::create_action($this, 'saveAdvanceSmbConfig');
                                 return ActionFactory::show_smb_advanced_configuration_modal('SMB advanced configuration', &$plugin_cookies, $saveAdvanceSmbConfig);
                             } else {
                                 EmplexerSetupScreen::savePreferences($user_input, $plugin_cookies);
                                 return ActionFactory::reset_controls($this->do_get_control_defs($plugin_cookies));
                             }
                         }
                     } else {
                         if ($user_input->selected_control_id == 'saveDefaultFilters') {
                             EmplexerSetupScreen::savePreferences($user_input, $plugin_cookies);
                             return ActionFactory::reset_controls($this->do_get_control_defs($plugin_cookies));
                         } else {
                             if ($user_input->selected_control_id == 'saveAdvanceNfs') {
                                 EmplexerSetupScreen::savePreferences($user_input, $plugin_cookies);
                                 return ActionFactory::reset_controls($this->do_get_control_defs($plugin_cookies));
                             } else {
                                 if ($user_input->selected_control_id == 'saveAdvanceSmb') {
                                     EmplexerSetupScreen::savePreferences($user_input, $plugin_cookies);
                                     return ActionFactory::reset_controls($this->do_get_control_defs($plugin_cookies));
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }