summaryrefslogtreecommitdiffstats
path: root/application/views/scripts/event/index.phtml
blob: 33a93e980354d90b05e91e66519ef2b1fa36c574 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<head>
    <title>Pool Control</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel='stylesheet' type='text/css' href='/media/css/fullcalendar.css' />	
</head>
<h1>Pool Control</h1>	
      	
<?php echo $this->formButton('addEvent', 'Add Event', array(
							'onclick' => 'self.location="/event/add/"',
							'class' => 'addbutton'))
?>

<form name="PoolSelectForm">
	<select name="PoolSelectbox" onChange="deselectAll();selectPool();">
		<option> Please choose a Pool </option>
<?php if(count($this->poollist)>0){
	foreach($this->poollist as $pool => $p){
		 echo "<option value='" . $p->getID() . "'>" . $p->getTitle() . "</option>";
	}
} else echo '<option> No Pools </option>';?>
	</select>
</form>

<div id='calendar' style='margin:3em 0;font-size:13px'></div>

<script type="text/javascript">

$(document).ready(function() {iniCalendar();});

	function showCalendar() {
		$("#calendar").show();
	}

	function hideCalendar() {
		$("#calendar").hide();
	}
		
	function selectPool() {
		selectForm = document.PoolSelectForm;
		selectBox = selectForm.PoolSelectbox;
		selectedValue = selectBox.options.selectedIndex;
		selectedOption = selectBox.options[selectedValue];
		poolID = selectedOption.value;
		setVisible('pool' + poolID);
	}
	function deselectAll() {
		selectForm = document.PoolSelectForm;
		selectBox = selectForm.PoolSelectbox;
		selectOptions = selectBox.options;
		for(i = 0; i < selectOptions.length; i++) {
			selectOption = selectOptions[i];
			poolID = selectOption.value;
			if(poolID != 'Choose a Pool') {
				setInvisible('pool' + poolID);
			}
		}
	}

	function iniCalendar() {
		
		var calendar = $('#calendar').fullCalendar({
				header: {
					left: 'title',
					center: 'prev,next today',
					right: 'month,agendaWeek,agendaDay'
				},
				editable: true,
//				disableDragging: false,
//				droppable: true,
				selectable: true,
				selectHelper: true,

				events: "calendarEvents.php",
				
				dayClick: function(date, allDay, jsEvent, view) {
					self.location="/event/add/";
				},
				
			    eventClick: function(event, element) {
					var title = prompt('New Title:');
			        event.title = title;

			        $('#calendar').fullCalendar('updateEvent', event);

			    }
			});	
	}	
</script>
<br />
<br />
<div class='listelement'>
<?php
if(count($this->eventlist)>0) {
?>

<?php
	foreach ($this->poollist as $pool):
		$poolEvents = $this->eventlist[$pool->getID()]; ?>
	<div id='pool<?php echo $pool->getID(); ?>' style='display:none;' >
		<h2><?php echo $pool->getTitle(); ?></h2>	
		<?php if(count($poolEvents)==0) {
		 	echo "This Pool hasn't events yet";
		} else { ?>
			<?php foreach ($poolEvents as $event): ?>
		<div class='element'>
			<div class='content'>
				<div class='actions'>				
					<a href="<?php echo $this->url(
						array(
							'controller' => 'event',
							'action'     => 'edit',
							'eventID'   =>  $event['eventID']
						),
						'default',
						true);?>"><img src='/media/img/edit.png' alt='Edit Group' /></a>
					<a href="<?php echo $this->url(
						array(
							'controller' => 'event',
							'action'     => 'delete',
							'eventID'   =>  $event['eventID']
						),
						'default',
						true);?>"><img src='/media/img/delete.png' alt='Delete Group' /></a>									
				</div>
				<div class='title'><?php echo $event['title']; ?></div>
				<?php if($event['category']) {
					?>
				<div class='subtitle'><?php echo $event['category']; ?></div>
				<?php
				} else {
					?>
				<div class='subtitle'>&nbsp;</div>
				<?php
				}
				?>
				<div class='details'><label>Start Time:</label>
					<div class='item'><?php echo date ('d F Y - H:i', strtotime($event['start'])); ?>&nbsp;</div>
				</div>
				<div class='details'><label>End Time:</label>
					<div class='item'><?php echo date ('d F Y - H:i', strtotime($event['end'])); ?>&nbsp;</div>
				</div>
				<div class='details'><label>Participants:</label>
					<div class='item'><?php echo $event['participants']; ?>&nbsp;</div>
				</div>
				<div class='details'><label>Membership:</label>
					<div class='item'><?php echo $event['pbs_person_name']; ?>&nbsp;</div>
				</div>
				<div class='details'><label>BootOs:</label>
					<div class='item'><?php echo $event['pbs_bootos_title']; ?>&nbsp;</div>
				</div>
				<div class='details'><label>Repeat:</label>
					<div class='item'><?php if($event['repeat']) echo 'yes'; else echo 'no'; ?>&nbsp;</div>
				</div>
				<div class='details'><label>Immediate:</label>
					<div class='item'><?php if($event['immediate']) echo 'yes'; else echo 'no'; ?>&nbsp;</div>
				</div>
				<div class='details'><label>Note:</label>
					<div class='item'><?php echo $event['note']; ?>&nbsp;</div>
				</div>
			</div>
		</div>
		<div class='clear'></div>
			<?php endforeach ?>
		<?php } ?>
	</div>
	<?php endforeach ?>
<?php } ?>
</div>
<br />
<br />