diff options
author | Andrew Dolgov <[email protected]> | 2006-05-20 10:41:47 +0100 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2006-05-20 10:41:47 +0100 |
commit | 673d54caa558f33950e8534be5a9906f6345acb1 (patch) | |
tree | 6daa69ebf0d5bc2bf3457fdcec339bc5017737b7 /functions.php | |
parent | 1503d39768b66371df56d3e8a22c132edbd872ab (diff) |
various interface improvements/fixes
Diffstat (limited to 'functions.php')
-rw-r--r-- | functions.php | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/functions.php b/functions.php index 06b142d73..343315eb1 100644 --- a/functions.php +++ b/functions.php @@ -665,6 +665,20 @@ print "</select>"; } + function print_select_hash($id, $values, $default, $attributes = "") { + print "<select id='$id' $attributes>"; + foreach (array_keys($values) as $v) { + if ($v == $default) + $sel = "selected"; + else + $sel = ""; + + print "<option $sel value=\"$v\">".$values[$v]."</option>"; + } + + print "</select>"; + } + function get_filter_name($title, $content, $link, $filters) { if ($filters["title"]) { @@ -1565,4 +1579,61 @@ } } + function print_feed_select($link, $id, $default_id = "", + $attributes = "", $include_all_feeds = true) { + + print "<select id=\"$id\" $attributes>"; + if ($include_all_feeds) { + print "<option id=\"0\">All feeds</option>"; + } + + $result = db_query($link, "SELECT id,title FROM ttrss_feeds + WHERE owner_uid = ".$_SESSION["uid"]." ORDER BY title"); + + if (db_num_rows($result) > 0 && $include_all_feeds) { + print "<option disabled>--------</option>"; + } + + while ($line = db_fetch_assoc($result)) { + if ($line["id"] == $default_id) { + $is_selected = "selected"; + } else { + $is_selected = ""; + } + printf("<option $is_selected id='%d'>%s</option>", + $line["id"], db_unescape_string($line["title"])); + } + + print "</select>"; + } + + function print_feed_cat_select($link, $id, $default_id = "", + $attributes = "", $include_all_cats = true) { + + print "<select id=\"$id\" $attributes>"; + + if ($include_all_cats) { + print "<option id=\"0\">Uncategorized</option>"; + } + + $result = db_query($link, "SELECT id,title FROM ttrss_feed_categories + WHERE owner_uid = ".$_SESSION["uid"]." ORDER BY title"); + + if (db_num_rows($result) > 0 && $include_all_cats) { + print "<option disabled>--------</option>"; + } + + while ($line = db_fetch_assoc($result)) { + if ($line["id"] == $default_id) { + $is_selected = "selected"; + } else { + $is_selected = ""; + } + printf("<option $is_selected id='%d'>%s</option>", + $line["id"], $line["title"]); + } + + print "</select>"; + } + ?> |