Mercurial > hg > mgallery
comparison mgallery.php @ 7:dec931d9e860
Implement configurable navigation controls.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 30 May 2015 12:08:39 +0300 |
parents | 1bf73b49fc91 |
children | 79987aa7ee9a |
comparison
equal
deleted
inserted
replaced
6:405a02586fc2 | 7:dec931d9e860 |
---|---|
76 | 76 |
77 return mgGetNaviControlImage($galIndex, $res, $class, $url); | 77 return mgGetNaviControlImage($galIndex, $res, $class, $url); |
78 } | 78 } |
79 | 79 |
80 | 80 |
81 function mgGetControl($str, $class, &$galIndex, $index, $delta, $naviFlags) | 81 function mgGetControlText($id, $active, $url, $naviFlags) |
82 { | |
83 if ($naviFlags & GNAV_TEXT) | |
84 { | |
85 $str = chentities(mgGetSetting("navi_ctrl_".$id)); | |
86 return | |
87 "<span class=\"naviControl ".$id."\">[". | |
88 ($active ? "<a href=\"".$url."\">".$str."</a>" : $str). | |
89 "]</span>"; | |
90 } | |
91 else | |
92 return ""; | |
93 } | |
94 | |
95 | |
96 function mgGetControl($id, &$galIndex, $index, $delta, $naviFlags) | |
82 { | 97 { |
83 $active = mgGetNaviActive($galIndex, $index, $delta, $res, $url, TRUE); | 98 $active = mgGetNaviActive($galIndex, $index, $delta, $res, $url, TRUE); |
84 if ($active && ($naviFlags & GNAV_IMG)) | 99 if ($active && ($naviFlags & GNAV_IMG)) |
85 $img = mgGetNaviControlImage($galIndex, $res, $class, $url); | 100 $img = mgGetNaviControlImage($galIndex, $res, $id, $url); |
86 else | 101 else |
87 $img = ""; | 102 $img = ""; |
88 | 103 |
89 if ($naviFlags & GNAV_TEXT) | 104 $text = mgGetControlText($id, $active, $url, $naviFlags); |
90 $str = "<span class=\"naviControl ".$class."\">[".($active ? "<a href=\"".$url."\">".$str."</a>" : $str)."]</span>"; | 105 |
106 if ($delta < 0) | |
107 return $img.$text; | |
91 else | 108 else |
92 $str = ""; | 109 return $text.$img; |
93 | |
94 if ($delta < 0) | |
95 return $img.$str; | |
96 else | |
97 return $str.$img; | |
98 } | 110 } |
99 | 111 |
100 | 112 |
101 function mgGetNaviControls(&$galIndex, $index, $naviFlags) | 113 function mgGetNaviControls(&$galIndex, $index, $naviFlags) |
102 { | 114 { |
103 global $galPath; | 115 global $galPath; |
104 | 116 |
105 return | 117 return |
106 "<div class=\"naviControls\">". | 118 "<div class=\"naviControls\">". |
107 mgGetControl("<<", "prev", $galIndex, $index, -1, $naviFlags). | 119 mgGetControl("prev", $galIndex, $index, -1, $naviFlags). |
108 "[<a href=\"".mgGetURL($galPath, FALSE)."\">^^</a>]". | 120 mgGetControlText("up", TRUE, mgGetURL($galPath, FALSE), $naviFlags). |
109 mgGetControl(">>", "next", $galIndex, $index, 1, $naviFlags). | 121 mgGetControl("next", $galIndex, $index, 1, $naviFlags). |
110 "</div>\n"; | 122 "</div>\n"; |
111 } | 123 } |
112 | 124 |
113 | 125 |
114 function mgPrintTable($class, &$galEntries, &$galIndex, $start, $limit) | 126 function mgPrintTable($class, &$galEntries, &$galIndex, $start, $limit) |