summary refs log tree commit diff stats
path: root/admin/polls.php
diff options
context:
space:
mode:
authorStarla Insigna <hatkirby@fourisland.com>2009-08-13 17:46:09 -0400
committerStarla Insigna <hatkirby@fourisland.com>2009-08-13 17:46:09 -0400
commitb5736e3ad3830fa732dcbd1a518ec3dd6ea7b98a (patch)
tree0449277e94a42aa155995a90fd8a89cb3309e7ab /admin/polls.php
parent6a1d5b60e6ec541a36727b84b71168f62221f7d7 (diff)
downloadfourisland-b5736e3ad3830fa732dcbd1a518ec3dd6ea7b98a.tar.gz
fourisland-b5736e3ad3830fa732dcbd1a518ec3dd6ea7b98a.tar.bz2
fourisland-b5736e3ad3830fa732dcbd1a518ec3dd6ea7b98a.zip
Rewrote Admin panel
The following database changes must be made:

* A TEXT column called "text" must be added to the end of "polloftheweek"
* The transferPollRss.php script must be run
* The "pollrss" table must be dropped

Closes #113
Diffstat (limited to 'admin/polls.php')
-rw-r--r--admin/polls.php98
1 files changed, 98 insertions, 0 deletions
diff --git a/admin/polls.php b/admin/polls.php new file mode 100644 index 0000000..8e1465c --- /dev/null +++ b/admin/polls.php
@@ -0,0 +1,98 @@
1<?php
2/*
3 444444444
4 4::::::::4
5 4:::::::::4
6 4::::44::::4
7 4::::4 4::::4 Four Island
8 4::::4 4::::4
9 4::::4 4::::4 Written and maintained by Starla Insigna
104::::444444::::444
114::::::::::::::::4 admin/polls.php
124444444444:::::444
13 4::::4 Please do not use, reproduce or steal the
14 4::::4 contents of this file without explicit
15 4::::4 permission from Hatkirby.
16 44::::::44
17 4::::::::4
18 4444444444
19*/
20
21if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);}
22
23require('headerproc.php');
24require_once('Pager.php');
25
26$category = 'polls';
27$pageaid = 'polls';
28
29if (isset($_GET['action']))
30{
31 if ($_GET['action'] == 'delete')
32 {
33 if (is_numeric($_POST['id']))
34 {
35 $delpoll = "DELETE FROM polloftheweek WHERE id = " . $_POST['id'];
36 $delpoll2 = mysql_query($delpoll);
37
38 $flashmsg = 'The selected poll has been deleted.';
39 }
40 } else if ($_GET['action'] == 'deletes')
41 {
42 $ids = explode(',', $_POST['ids']);
43
44 if (is_array($ids) && !empty($ids))
45 {
46 foreach ($ids as $id)
47 {
48 $delpoll = "DELETE FROM polloftheweek WHERE id = " . $id;
49 $delpoll2 = mysql_query($delpoll);
50 }
51
52 $flashmsg = 'The selected polls have been deleted.';
53 }
54 }
55}
56
57$template = new FITemplate('admin/polls');
58
59$getposts = "SELECT * FROM polloftheweek ORDER BY id DESC";
60$getposts2 = mysql_query($getposts);
61$i=0;
62while ($getposts3[$i] = mysql_fetch_array($getposts2))
63{
64 $i++;
65}
66
67if ($i != 0)
68{
69 $template->adds_block('AVAIL',array('exi'=>1));
70} else {
71 $template->adds_block('NOTAVAIL',array('exi'=>1));
72}
73
74$pager = &Pager::factory(array( 'mode' => 'Sliding',
75 'perPage' => 20,
76 'delta' => 2,
77 'itemData' => $getposts3));
78
79$j=0;
80
81foreach ($pager->getPageData() as $post)
82{
83 if (!empty($post))
84 {
85 $template->adds_block('POST', array( 'TITLE' => $post['question'],
86 'ID' => $post['id'],
87 'ODD' => ($j % 2 ? '' : ' class="odd"')));
88 }
89
90 $j++;
91}
92
93$template->add('PAGEID', $pager->getCurrentPageID());
94$template->add('PAGINATION', $pager->links);
95
96$template->display();
97
98?>