summaryrefslogtreecommitdiff
path: root/functions.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2009-12-24 15:36:02 +0300
committerAndrew Dolgov <[email protected]>2009-12-24 15:36:02 +0300
commit7f969260c1845d76b223197fd4392dd1576d548e (patch)
tree29b10fed579ce6594927ecfebccd4d25a16c5ee2 /functions.php
parentfe430670ab156355869125fefe3b3e7a0cf2cf9e (diff)
add toggle_collapse_cat()
Diffstat (limited to 'functions.php')
-rw-r--r--functions.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/functions.php b/functions.php
index d7ef40cf6..378242cb2 100644
--- a/functions.php
+++ b/functions.php
@@ -6266,4 +6266,34 @@
return $str;
}
+
+ function toggle_collapse_cat($link, $cat_id) {
+ if ($cat_id > 0) {
+ db_query($link, "UPDATE ttrss_feed_categories SET
+ collapsed = NOT collapsed WHERE id = '$cat_id' AND owner_uid = " .
+ $_SESSION["uid"]);
+ } else {
+ $pref_name = '';
+
+ switch ($cat_id) {
+ case -1:
+ $pref_name = '_COLLAPSED_SPECIAL';
+ break;
+ case -2:
+ $pref_name = '_COLLAPSED_LABELS';
+ break;
+ case 0:
+ $pref_name = '_COLLAPSED_UNCAT';
+ break;
+ }
+
+ if ($pref_name) {
+ if (get_pref($link, $pref_name)) {
+ set_pref($link, $pref_name, 'false');
+ } else {
+ set_pref($link, $pref_name, 'true');
+ }
+ }
+ }
+ }
?>