示例#1
0
 public static function show_default_filter_selecor_modal($modalTitle, &$plugin_cookies, $post_action = null)
 {
     $defs = array();
     $movieFilters = array("all" => "All", "unwatched" => "Unwatched", "newest" => "Recently Released", "recentlyAdded" => "Recently Added", "recentlyViewed" => "Recently Viewed", "onDeck" => "On Deck", "collection" => "By Collection", "genre" => "By Genre", "year" => "By Year", "decade" => "By Decade", "director" => "By Director", "actor" => "By Starring Actor", "country" => "By Country", "contentRating" => "By Content Rating", "rating" => "By Rating", "resolution" => "By Resolution", "firstCharacter" => "By First Letter", "folder" => "By Folder");
     $showFilters = array("all" => "All", "unwatched" => "Unwatched", "newest" => "Recently Aired", "recentlyAdded" => "Recently Added", "recentlyViewed" => "Recently Viewed Episodes", "recentlyViewedShows" => "Recently Viewed Shows", "onDeck" => "On Deck", "collection" => "By Collection", "firstCharacter" => "By First Letter", "genre" => "By Genre", "year" => "By Year", "contentRating" => "By Content Rating", "folder" => "By Folder");
     $artistFilters = array("all" => "All Artists", "albums" => "By Album", "genre" => "By Genre", "decade" => "By Decade", "year" => "By Year", "collection" => "By Collection", "recentlyAdded" => "Recently Added", "folder" => "By Folder");
     ControlFactory::add_combobox($defs, null, null, $name = 'defaultMovieFilter', $title = 'Default movie filter', $initial_value = isset($plugin_cookies->defaultMovieFilter) ? $plugin_cookies->defaultMovieFilter : 'all', $value_caption_pairs = $movieFilters, $width = 600, $need_confirm = false, $need_apply = false);
     ControlFactory::add_combobox($defs, null, null, $name = 'defaultShowFilter', $title = 'Default show filter', $initial_value = isset($plugin_cookies->defaultShowFilter) ? $plugin_cookies->defaultShowFilter : 'all', $value_caption_pairs = $showFilters, $width = 600, $need_confirm = false, $need_apply = false);
     ControlFactory::add_combobox($defs, null, null, $name = 'defaultArtistFilter', $title = 'Default music filter', $initial_value = isset($plugin_cookies->defaultArtistFilter) ? $plugin_cookies->defaultArtistFilter : 'all', $value_caption_pairs = $artistFilters, $width = 600, $need_confirm = false, $need_apply = false);
     ControlFactory::add_custom_close_dialog_and_apply_buffon($defs, 'saveDefaultFilters', 'save', 200, $post_action);
     return ActionFactory::show_dialog($modalTitle, $defs);
 }
 protected function add_combobox(&$defs, $name, $title, $initial_value, $value_caption_pairs, $width, $need_confirm = false, $need_apply = false)
 {
     ControlFactory::add_combobox($defs, $this, null, $name, $title, $initial_value, $value_caption_pairs, $width, $need_confirm, $need_apply);
 }
 public function showPrefScreen($key, &$plugin_cookies)
 {
     hd_print(__METHOD__);
     $url = $this->base_url . $key;
     $xml = HD::getAndParseXmlFromUrl($url);
     $identifier = (string) $xml->attributes()->identifier;
     $defs = array();
     foreach ($xml as $setting) {
         $secture = (bool) $setting->attributes()->secture;
         $default = (string) $setting->attributes()->default;
         $value = (string) $setting->attributes()->value;
         $label = (string) $setting->attributes()->label;
         $values = (string) $setting->attributes()->values;
         $type = (string) $setting->attributes()->type;
         $option = (string) $setting->attributes()->option;
         $id = (string) $setting->attributes()->id;
         if ($type == "text") {
             ControlFactory::add_text_field($defs, null, null, $name = $id, $title = $label, $initial_value = $value, $numeric = false, $password = $option == 'hidden', $has_osk = false, $always_active = 0, $width = 500);
         }
         if ($type == "bool") {
             ControlFactory::add_combobox($defs, null, null, $name = $id, $title = $label, $initial_value = $value == "true" ? 0 : 1, $value_caption_pairs = array('true', 'false'), $width = 500, $need_confirm = false, $need_apply = false);
         }
         if ($type == 'enum') {
             $values = explode('|', $values);
             ControlFactory::add_combobox($defs, null, null, $name = $id, $title = $label, $initial_value = $value, $value_caption_pairs = $values, $width = 500, $need_confirm = false, $need_apply = false);
         }
     }
     $params['identifier'] = $identifier;
     $savePrefsAction = UserInputHandlerRegistry::create_action($this, 'savePrefs', $params);
     ControlFactory::add_custom_close_dialog_and_apply_buffon($defs, 'btnSavePrefs', 'save', 200, $savePrefsAction);
     $a = ActionFactory::show_dialog('Prefs', $defs);
     // hd_print(__METHOD__ . ':' . print_r($a, true));
     return $a;
 }