changeset 374:9c4accca7bf8

Add some helper functions.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 03 Dec 2013 15:52:08 +0200
parents ff8462a80cf2
children 028daa721ee2
files admajax.php
diffstat 1 files changed, 29 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/admajax.php	Tue Dec 03 15:50:07 2013 +0200
+++ b/admajax.php	Tue Dec 03 15:52:08 2013 +0200
@@ -198,7 +198,36 @@
 }
 
 
+function stGetOptionList($id, $sql, $iname, $active, $onChange = "")
 {
+  $str =
+    "<select class=\"selectBox\" id=\"".$id."\" size=\"10\"".
+    ($onChange != "" ? " onChange=\"".$onChange."\"" : "").">\n";
+
+  if (($res = stExecSQL($sql)) !== false)
+  {
+    foreach ($res as $item)
+    {
+      $str .= "<option value=\"".$item["id"]."\"".
+        ($active == $item["id"] ? " selected=\"selected\"" : "").
+        ">".chentities($item[$iname])."</option>\n";
+    }
+  }
+
+  return $str."</select>\n";
+}
+
+
+function stGetShowModeButton($mode, $name, $cmode)
+{
+  return stGetFormRadioButtonInput(
+    "showMode", "", "", $mode,
+    $cmode == $mode,
+    $name,
+    "onClick=\"setDisplayVar('showMode',".$mode.")\"");
+}
+
+
 function stRandomizeCompoShowOrder($compo_id, $patch)
 {
   $entries = stExecSQL("SELECT id,show_id FROM entries WHERE compo_id=".$compo_id);