summaryrefslogtreecommitdiffstats
path: root/application/views/scripts/event/index.phtml
blob: 90e1ef0b1d0dc0ff71b7763dd0aca59718389c61 (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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
<head>
    <title>Pool Control</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</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();});
var lastview;

	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 checkEventTypes() {
			
	}

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

			
               
				events: "/event/listevents",
				
				dayClick: function(date, allDay, jsEvent, view) {
					
					self.location="/event/add/";
				},
				
			    eventClick: function(calEvent) {
				    
			        alert('Event: ' + calEvent.title +
			      	  	  '\nStart: ' + calEvent.start +
			        	  '\nEnd: ' + calEvent.end +
			        	  '\nNote: ' + calEvent.note +
			        	  '\nCategory: ' + calEvent.category +
			        	  '\nParticipants ' + calEvent.participants);
			    },

			    eventRender: function(event, element) {
				    },

				viewDisplay: function(view) {
                    
			    	if (view.name == 'agendaWeek') 
                    {
                    }
			    	if (view.name == 'agendaDay') 
                    {
		            }
			    }
				      
			}); 
		$('.fc-header-center').append('<span class="fc-button fc-state-default fc-corner-right fc-state-active"><span class="fc-button-inner"><span id="lecture" class="fc-button-content">Lecture</span><span class="fc-button-effect"><span></span></span></span></span>');
		$('.fc-header-center').append('<span class="fc-button fc-state-default fc-corner-right fc-state-active"><span class="fc-button-inner"><span id="maintenance" class="fc-button-content">Maintenance</span><span class="fc-button-effect"><span></span></span></span></span>');
		$('.fc-header-center').append('<span class="fc-button fc-state-default fc-corner-right fc-state-active"><span class="fc-button-inner"><span id="boot" class="fc-button-content">Boot</span><span class="fc-button-effect"><span></span></span></span></span>');
		$('.fc-header-center').append('<span class="fc-button fc-state-default fc-corner-right fc-state-active"><span class="fc-button-inner"><span id="shutdown" class="fc-button-content">Shutdown</span><span class="fc-button-effect"><span></span></span></span></span>');
        $("#lecture").click(function() {alert('test');})
	}	
</script>
<br />
<br />
<div class='listelement'>
<?php
if(count($this->eventlist)>0) {
?>

<?php
	foreach ($this->poollist as $pool):?>
		<div id='pool<?php echo $pool->getID(); ?>' style='display:none;' >
		<h2><?php echo $pool->getTitle(); ?></h2>
		<?php if(!isset($this->eventlist[$pool->getID()])) {
		 	echo "This Pool hasn't events yet";
		} else { ?>
			<?php $poolEvents = $this->eventlist[$pool->getID()]; ?>
			<?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 />