[SUCS Devel] site r626 - in branches/sucs-site: components templates
imranh at sucs.org
imranh at sucs.org
Wed Dec 31 17:18:04 GMT 2014
Author: imranh
Date: 2014-12-31 17:18:02 +0000 (Wed, 31 Dec 2014)
New Revision: 626
Modified:
branches/sucs-site/components/events.php
branches/sucs-site/templates/event.tpl
branches/sucs-site/templates/event_edit.tpl
branches/sucs-site/templates/events.tpl
Log:
Working on some events stuff. Very rough stuff work
Modified: branches/sucs-site/components/events.php
===================================================================
--- branches/sucs-site/components/events.php 2014-12-29 22:52:54 UTC (rev 625)
+++ branches/sucs-site/components/events.php 2014-12-31 17:18:02 UTC (rev 626)
@@ -1,12 +1,12 @@
<?php
-/*
+/*
* Main events page, including admin functions
*/
-$permission = "bananas";
+$permission = "sucsstaff";
$eventtable = "events";
-$eventcategories = array("Talks","Gaming","Social","Misc");
+$eventcategories = array("Technical","Talks","Gaming","Social","Misc");
$smarty->assign("event_categories", $eventcategories);
@@ -25,7 +25,7 @@
}
if (isset($session->groups[$permission])) {
- $smarty->assign("editable", true);
+ $smarty->assign("editable", true);
$action = @$_REQUEST['action'];
// process form actions with side-effects first
@@ -43,6 +43,7 @@
$datetime .= " ".$_REQUEST['Time_Hour'];
$datetime .= ":".$_REQUEST['Time_Minute'];
+
$record['whn'] = $datetime;
$record['category'] = $_REQUEST['category'];
$id = @$_REQUEST['id'];
@@ -52,11 +53,11 @@
$DB->AutoExecute($eventtable, $record, 'UPDATE', "id=".$id);
} else {
$DB->AutoExecute($eventtable, $record, 'INSERT');
- }
+ }
unset($action);
break;
- }
+ }
}
if (isset($session->groups[$permission]) && isset($action)) {
@@ -64,10 +65,10 @@
case "create":
$event = array("id" => "*");
$body = $smarty->fetch("event_edit.tpl");
- break;
+ break;
case "edit":
if (isset($eventcat) && isset($eventid)) {
- $event = $DB->GetRow("SELECT * FROM $eventtable WHERE id=?", array($eventid));
+ $event = $DB->GetRow("SELECT * FROM $eventtable WHERE id=?", array($eventid));
//make tastier breadcrumbs
$pathlist[$events_index + 1] = $event['name'];
@@ -78,7 +79,7 @@
break;
}
} else {
- // not logged in, or no special action required
+ // not logged in, or no special action required
if (isset($eventcat) && isset($eventid)) {
$event = $DB->GetRow("SELECT * FROM $eventtable WHERE id=?", array($eventid));
@@ -88,7 +89,7 @@
$smarty->assign("event", $event);
$body = $smarty->fetch("event.tpl");
} else {
- $events = $DB->GetAll("SELECT *,date_part('epoch', whn) as whn_timestamp
+ $events = $DB->GetAll("SELECT *,date_part('epoch', whn) as whn_timestamp
FROM $eventtable WHERE date_trunc('day', whn) >= date_trunc('day',NOW()) ORDER BY whn ASC");
$oldevents = $DB->GetAll("SELECT *,date_part('epoch', whn) as whn_timestamp
FROM $eventtable WHERE date_trunc('day', whn) < date_trunc('day', NOW()) ORDER BY whn DESC LIMIT 3");
@@ -96,11 +97,11 @@
$smarty->assign("oldevents", $oldevents);
$body = $smarty->fetch("events.tpl");
}
-}
+}
$smarty->assign("body", $body);
$smarty->assign("title", "Events");
-$smarty->assign("secondary", file_get_contents("../static/fragments/Events-secondary.txt"));
+//$smarty->assign("secondary", file_get_contents("../static/fragments/Events.txt"));
?>
Modified: branches/sucs-site/templates/event.tpl
===================================================================
--- branches/sucs-site/templates/event.tpl 2014-12-29 22:52:54 UTC (rev 625)
+++ branches/sucs-site/templates/event.tpl 2014-12-31 17:18:02 UTC (rev 626)
@@ -1,4 +1,26 @@
-<h1>{$event.name}</h1>
+{if $editable}
+ <div style="float: right">
+ <a href="{$baseurl}/Community/Events/{$event.category}_{$event.id}?action=edit">(Edit)</a>
+ </div>
+{/if}
+
+<div>
+ <h2 style="text-align:left;display:inline">What?</h2>
+ <h1 style="text-align:right;display:inline">{$event.name}</h1>
+</div>
+<br>
+<div>
+ <h2 style="text-align:left;display:inline">Where?</h2>
+ <h1 style="text-align:right;display:inline">{$event.location}</h1>
+</div>
+<br>
+<div>
+ <h2 style="text-align:left;display:inline">When?</h2>
+ <h1 style="text-align:right;display:inline">{$event.whn|date_format:"l \t\h\e jS \o\f F Y \a\t h:i:s A"}{if $event.show_time},{$event.whn_timestamp|date_format:"%H:%M"}{/if}</h1>
+</div>
+
+<h1>Why?</h1>
+
+<p1>
{$event.description}
-{$event.location}
-{$event.whn}
+</p1>
\ No newline at end of file
Modified: branches/sucs-site/templates/event_edit.tpl
===================================================================
--- branches/sucs-site/templates/event_edit.tpl 2014-12-29 22:52:54 UTC (rev 625)
+++ branches/sucs-site/templates/event_edit.tpl 2014-12-31 17:18:02 UTC (rev 626)
@@ -6,8 +6,8 @@
<span class="textinput"><input type="text" name="name" {if $event.name}value="{$event.name}"{/if} /></span>
</div>
<div class="row">
- <label>Date</label>
- <span class="textinput">{html_select_date}</span>
+ <label>Date</label>
+ <span class="textinput">{html_select_date end_year='+2' }</span>
</div>
<div class="row">
<label>Time</label>
@@ -33,4 +33,4 @@
<input type="submit" value="Save" />
</div>
-</form>
+</form>
\ No newline at end of file
Modified: branches/sucs-site/templates/events.tpl
===================================================================
--- branches/sucs-site/templates/events.tpl 2014-12-29 22:52:54 UTC (rev 625)
+++ branches/sucs-site/templates/events.tpl 2014-12-31 17:18:02 UTC (rev 626)
@@ -1,22 +1,34 @@
+{include file="../static/fragments/Events.txt"}
+ <div class="box">
+ <div class="boxhead">
+ <h3>Got an idea?</h3>
+ </div>
+ <div class="boxcontent">
+ <p>Got an idea for a event you'd like to see hosted? Email {mailto address="exec at sucs.org" encode='javascript'}</p>
+ </div>
+ <div class="hollowfoot"><div><div></div></div></div>
+ </div>
+
{if $editable}
<a href="?action=create">Add Event</a>
{/if}
+
<div class="box">
<div class="boxhead"><h2>Upcoming Events</h2></div>
<div class="boxcontent">
{if $events|@count < 1}
<p>No events :(</p>
-<p>Pester <tt>exec AT sucs.org</tt> to organise some!</p>
+<p>Pester {mailto address="exec at sucs.org" encode='javascript'} to organise some!</p>
+
{else}
{foreach from=$events item=event}
-<h3>{$event.name}
-{if $editable}<a href="{$baseurl}/Community/Events/{$event.category}_{$event.id}?action=edit">(Edit)</a>{/if}
-</h3>
-<div>{$event.whn_timestamp|date:"l, jS F"}{if $event.show_time},{$event.whn_timestamp|date_format:"%H:%M"}{/if}</div>
-<div>at {$event.location}</div>
-<p>
-{$event.description}
-</p>
+<h2>
+ <a href="{$baseurl}/Community/Events/{$event.category}_{$event.id}">{$event.name}</a>
+</h2>
+<div><b>{$event.whn_timestamp|date_format:"l, jS F Y"}{if $event.show_time},{$event.whn_timestamp|date_format:"%H:%M"}{/if}</b></div>
+<div>at <b>{$event.location}</b></div>
+<div><p>{$event.description}</p></div>
+
{/foreach}
{/if}
</div>
@@ -28,5 +40,5 @@
<h2>Recent Events</h2>
<p><small>You missed them. Too bad!</small></p>
{foreach from=$oldevents item=event}
-<h4>{$event.name} - <small>{$event.whn_timestamp|date_format:"%A, %e %B"}</small></h4>
+<h4><a href="{$baseurl}/Community/Events/{$event.category}_{$event.id}">{$event.name}</a> - <small>{$event.whn_timestamp|date_format:"%A, %e %B"}</small></h4>
{/foreach}
More information about the Devel
mailing list