Mercurial > hg > fapweb
changeset 690:bad79296eb34
Cleanups, rename variables.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 09 Nov 2014 21:17:40 +0200 |
parents | a934b2de8ef1 |
children | c9d16e2c9725 |
files | admajax.php msite.inc.php |
diffstat | 2 files changed, 27 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/admajax.php Sun Nov 09 20:47:09 2014 +0200 +++ b/admajax.php Sun Nov 09 21:17:40 2014 +0200 @@ -140,11 +140,13 @@ } -function stPrintEntryItemData($entry, $ctype, $prefix, $tr, $edit) +function stPrintEntryItemData($item, $row, $tr, $prefix, $ctype, $edit) { - $eid = $entry["id"]; + global $entryFlagsList; + + $eid = $item["id"]; if ($ctype === FALSE) - $ctype = stFetchSQLColumn("SELECT ctype FROM compos WHERE id=".$entry["compo_id"]); + $ctype = stFetchSQLColumn("SELECT ctype FROM compos WHERE id=".$item["compo_id"]); if ($tr) { @@ -154,24 +156,29 @@ } echo - " <td>".($entry["show_id"] > 0 ? $entry["show_id"] : "-")."</td>\n". - " ".stGetTDFormTextInput($edit, 20, SET_LEN_ENTRY_NAME, "name", $eid, $prefix, $entry["name"])."\n". - " ".stGetTDFormTextInput($edit, 15, SET_LEN_ENTRY_AUTHOR, "author", $eid, $prefix, $entry["author"])."\n". - " ".stGetTDFormTextInput($edit, 20, SET_LEN_ENTRY_FILENAME, "filename", $eid, $prefix, $entry["filename"])."\n". + " <td>".($item["show_id"] > 0 ? $item["show_id"] : "-")."</td>\n". + " ".stGetTDFormTextInput($edit, 20, SET_LEN_ENTRY_NAME, "name", $eid, $prefix, $item["name"])."\n". + " ".stGetTDFormTextInput($edit, 15, SET_LEN_ENTRY_AUTHOR, "author", $eid, $prefix, $item["author"])."\n"; + + echo + " ".stGetTDFormTextInput($edit, 20, SET_LEN_ENTRY_FILENAME, "filename", $eid, $prefix, $item["filename"])."\n"; + + echo " <td>". - stGetFormTextArea(2, 30, "info", $eid, $prefix, $entry["info"])."<br />". - stGetFormTextArea(2, 30, "notes", $eid, $prefix, $entry["notes"])."<br />". + stGetFormTextArea(2, 30, "info", $eid, $prefix, $item["info"])."<br />". + stGetFormTextArea(2, 30, "notes", $eid, $prefix, $item["notes"])."<br />". // XXX TODO flags? "</td>\n". + " <td>". "</td>\n"; if ($edit) { echo " <td>". - stGetFormButtonInput("delete", $eid, $prefix, "Del", "deleteEntry(".$entry["compo_id"].",".$eid.")"). - stGetFormTextInput(3, 3, "compo_id", $eid, $prefix, $entry["compo_id"]). - stGetFormButtonInput("update", $eid, $prefix, "Upd", "updateEntry(".$entry["compo_id"].",".$eid.")"). + stGetFormButtonInput("delete", $eid, $prefix, "Del", "deleteEntry(".$item["compo_id"].",".$eid.")"). + stGetFormTextInput(3, 3, "compo_id", $eid, $prefix, $item["compo_id"]). + stGetFormButtonInput("update", $eid, $prefix, "Upd", "updateEntry(".$item["compo_id"].",".$eid.")"). "</td>\n"; } @@ -1364,8 +1371,9 @@ " </tr>\n". " <tr><td colspan=\"6\"><hr /></td></tr>\n"; + $row = 0; foreach (stExecSQL("SELECT * FROM entries WHERE compo_id=".$id." ORDER BY id ASC") as $entry) - stPrintEntryItemData($entry, $compo["ctype"], "en", TRUE, FALSE); + stPrintEntryItemData($entry, $row++, TRUE, "en", $compo["ctype"], FALSE); echo "</table>\n"; @@ -1375,7 +1383,7 @@ case "entry": $res = stFetchSQL(stPrepareSQL("SELECT * FROM entries WHERE id=%D", "id")); if ($res !== FALSE) - stPrintEntryItemData($res, FALSE, "en", FALSE, stGetRequestItem("edit", FALSE)); + stPrintEntryItemData($res, -1, FALSE, "en", FALSE, stGetRequestItem("edit", FALSE)); else stError("No such entry ID!"); break;
--- a/msite.inc.php Sun Nov 09 20:47:09 2014 +0200 +++ b/msite.inc.php Sun Nov 09 21:17:40 2014 +0200 @@ -50,6 +50,11 @@ define("EFLAG_DISQUALIFIED", 1); // Entry is disqualified define("EFLAG_PROBLEMS", 2); // Has some problems +$entryFlagsList = array( + EFLAG_DISQUALIFIED => array("Disqualified", "img/disqualified.png"), + EFLAG_PROBLEMS => array("Has problems", "img/problems.png"), +); + // // Competition types