changeset 37:238c73840b61

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 15 Feb 2013 20:58:47 +0200
parents ace577c92a32
children 2a2ec7112df1
files msite.inc.php
diffstat 1 files changed, 69 insertions(+), 66 deletions(-) [+]
line wrap: on
line diff
--- a/msite.inc.php	Wed Jan 02 05:52:57 2013 +0200
+++ b/msite.inc.php	Fri Feb 15 20:58:47 2013 +0200
@@ -209,44 +209,6 @@
 }
 
 
-function stPrintAttendee($item, $row, $edit, $eclass = "")
-{
-  $id = $item["id"];
-  $prefix = "at";
-  echo "  ".
-    "<tr class=\"".($row % 2 == 1 ? "rodd" : "reven").$eclass."\" id=\"attendee".$id."\">".
-    stGetTDEditTextItem(FALSE, 20, 40, "name", $id, $prefix, $item["name"]).
-    stGetTDEditTextItem(FALSE, 20, 40, "groups", $id, $prefix, $item["groups"]).
-    "<td class=\"regtime\">".date("d M Y / H:i", $item["regtime"])."</td>".
-    stGetTDEditTextItem($edit, 30, 64, "oneliner", $id, $prefix, $item["oneliner"], "autocomplete=\"off\"");
-
-  if ($edit)
-  {
-    echo
-      stGetTDEditTextItem($edit, 20, 40, "email", $id, $prefix, $item["email"], "autocomplete=\"off\"").
-      "<td>".
-      "<button class=\"button\" id=\"atupd".$id."\" type=\"button\" onclick=\"updateAttendee(".$id.")\">Update</button>".
-      "<button class=\"button\" id=\"atdel".$id."\" type=\"button\" onclick=\"deleteAttendee(".$id.")\">Delete</button>".
-      "</td>";
-  }
-
-  echo "</tr>\n";
-}
-
-
-function stPrintNewsItem($item, $edit = "")
-{
-  echo
-  "<div class=\"newsitem\" id=\"news".$item["id"]."\">\n".
-  "  <h2>".chentities($item["title"])."</h2>\n".
-  "  <div class=\"text\">".dhentities($item["text"])."</div>\n".
-  "  <div class=\"sig\">-- ".chentities($item["author"])."<br />".
-    date("d M Y / H:i", $item["utime"]).
-    $edit."</div>\n".
-  "</div>\n";
-}
-
-
 function stChkDataItem($name)
 {
   return !isset($_REQUEST[$name]) || strlen(trim($_REQUEST[$name])) < 1;
@@ -414,34 +376,6 @@
 }
 
 
-function stGetCompoList($fvisible, $fvoting = FALSE)
-{
-  global $compos;
-
-  // Get entries and competitions into an array structure
-  $sql = "SELECT * FROM compos";
-  if ($fvisible || $fvoting)
-  {
-    $sql .= " WHERE ".implode(" AND ", array($fvisible ? "visible<>0" : "", $fvoting ? "voting<>0" : ""));
-  }
-  foreach (stExecSQL($sql) as $compo)
-  {
-    $id = $compo["id"];
-
-    $compos[$compo["id"]] = array(
-      "name" => $compo["name"],
-      "entries" => array()
-    );
-
-    $sql = stPrepareSQL("SELECT * FROM entries WHERE compo_id=%d", $id);
-    foreach (stExecSQL($sql) as $entry)
-    {
-      $compos[$id]["entries"][$entry["id"]] = $entry;
-    }
-  }
-}
-
-
 //
 // CLI utility helper functions
 //
@@ -482,4 +416,73 @@
 }
 
 
+//
+// Site-specific common functions .. these should be elsewhere
+//
+function stPrintAttendee($item, $row, $edit, $eclass = "")
+{
+  $id = $item["id"];
+  $prefix = "at";
+  echo "  ".
+    "<tr class=\"".($row % 2 == 1 ? "rodd" : "reven").$eclass."\" id=\"attendee".$id."\">".
+    stGetTDEditTextItem(FALSE, 20, 40, "name", $id, $prefix, $item["name"]).
+    stGetTDEditTextItem(FALSE, 20, 40, "groups", $id, $prefix, $item["groups"]).
+    "<td class=\"regtime\">".date("d M Y / H:i", $item["regtime"])."</td>".
+    stGetTDEditTextItem($edit, 30, 64, "oneliner", $id, $prefix, $item["oneliner"], "autocomplete=\"off\"");
+
+  if ($edit)
+  {
+    echo
+      stGetTDEditTextItem($edit, 20, 40, "email", $id, $prefix, $item["email"], "autocomplete=\"off\"").
+      "<td>".
+      "<button class=\"button\" id=\"atupd".$id."\" type=\"button\" onclick=\"updateAttendee(".$id.")\">Update</button>".
+      "<button class=\"button\" id=\"atdel".$id."\" type=\"button\" onclick=\"deleteAttendee(".$id.")\">Delete</button>".
+      "</td>";
+  }
+
+  echo "</tr>\n";
+}
+
+
+function stPrintNewsItem($item, $edit = "")
+{
+  echo
+  "<div class=\"newsitem\" id=\"news".$item["id"]."\">\n".
+  "  <h2>".chentities($item["title"])."</h2>\n".
+  "  <div class=\"text\">".dhentities($item["text"])."</div>\n".
+  "  <div class=\"sig\">-- ".chentities($item["author"])."<br />".
+    date("d M Y / H:i", $item["utime"]).
+    $edit."</div>\n".
+  "</div>\n";
+}
+
+
+function stGetCompoList($fvisible, $fvoting = FALSE)
+{
+  global $compos;
+
+  // Get entries and competitions into an array structure
+  $sql = "SELECT * FROM compos";
+  if ($fvisible || $fvoting)
+  {
+    $sql .= " WHERE ".implode(" AND ", array($fvisible ? "visible<>0" : "", $fvoting ? "voting<>0" : ""));
+  }
+  foreach (stExecSQL($sql) as $compo)
+  {
+    $id = $compo["id"];
+
+    $compos[$compo["id"]] = array(
+      "name" => $compo["name"],
+      "entries" => array()
+    );
+
+    $sql = stPrepareSQL("SELECT * FROM entries WHERE compo_id=%d", $id);
+    foreach (stExecSQL($sql) as $entry)
+    {
+      $compos[$id]["entries"][$entry["id"]] = $entry;
+    }
+  }
+}
+
+
 ?>
\ No newline at end of file