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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
|
<h1>Pools</h1>
<?php if($this->notification != ''){echo $this->notification;} ?>
<?php echo $this->searchform; ?>
<?php echo $this->formButton('createconfig', 'Create Pool', array(
'onclick' => 'self.location="/user/pool/createpool/page/'.$this->page.'"',
'class' => 'addbutton'))?>
<?php if ($this->pools): ?>
<table >
<tr>
<!--<th>ID <span class='code'>poolID</span></th>-->
<th>Title <span class='code'>title</span></th>
<th>Description <span class='code'>description</span></th>
<th>Location <span class='code'>location</span></th>
<th colspan=3>Actions</th>
</tr>
<?php foreach ($this->pools as $pool): ?>
<tr class=entry>
<!--<td><?php echo $this->escape($pool->getID()) ?></td>-->
<td><?php echo $this->escape($pool->getTitle()) ?></td>
<td><?php echo $this->escape($pool->getDescription()) ?></td>
<td><?php echo $this->escape($pool->getLocation()) ?></td>
<td class='action'><a href="<?php echo $this->url(
array(
'module' => 'user',
'controller' => 'pool',
'action' => 'editpool',
'poolID' => $pool->getID(),
'page' => $this->page
),
'default',
true) ?>"><img src='/media/img/edit.png' alt='Edit Pool'/></a></td>
<td class='action'><a href="<?php echo $this->url(
array(
'module' => 'user',
'controller' => 'pool',
'action' => 'deletepool',
'poolID' => $pool->getID(),
'page' => $this->page
),
'default',
true) ?>"><img src='/media/img/delete.png' alt='Delete Pool'/></a></td>
<td class='action'><a href="<?php echo $this->url(
array(
'module' => 'user',
'controller' => 'pool',
'action' => 'linkclient',
'poolID' => $pool->getID(),
'page' => $this->page
),
'default',
true) ?>"><img src='/media/img/add.png' alt='Link Client'/></a></td>
</tr>
<?php
$poolentriesMapper = new Application_Model_PoolEntriesMapper();
$clients = $poolentriesMapper->findBy(array('poolID' => $pool->getID()),true);
?>
<?php if (count($clients)>0): ?>
<tr class=detail>
<td class=arrowtop>↳</td>
<td colspan=6>
<table>
<tr>
<!-- <th>ClientID</th> -->
<th>Mac</th>
<th>Hardwarehash</th>
<th>Actions</th>
</tr>
<?php
foreach ($clients as $client): ?>
<tr>
<!-- <td><?php echo $client['clientID'];?></td> -->
<?php
$cli = new Application_Model_Client();
$clientMapper = new Application_Model_ClientMapper();
$clientMapper->find($client['clientID'],$cli);
?>
<td><?php echo ($cli->macAdress); ?></td>
<td><?php echo ($cli->hardwarehash); ?></td>
<td class='action'><a href="<?php echo $this->url(
array(
'module' => 'user',
'controller' => 'pool',
'action' => 'unlinkclient',
'poolentriesID' => $client['poolentriesID'],
'page' => $this->page
),
'default',
true) ?>"><img src='/media/img/delete.png' alt='Unlink Client'/></a></td>
</tr>
<?php endforeach ?>
</table>
</td>
</tr>
<?php endif;?>
<?php endforeach ?>
</table>
<?php echo $this->pagination; ?>
<?php if (isset($this->freeclients) && count($this->freeclients)>0): ?>
<h2 style='margin-top:20px;'>Free clients</h2>
<p style="text-align:right;">
<span style="font-weight:bold;">Search:</span> <input type="text" id="txtSearch" name="txtSearch" maxlength="50" />
<img id="imgSearch" src="/media/img/delete.png" alt="Cancel Search" title="Cancel Search" style="width:150px;width:14px;height:14px;" />
</p>
<div style="height: 200px; overflow: scroll; overflow-x: hidden; ">
<table id='tblSearch'>
<tr>
<th>ClientID</th>
<th>MacAdress</th>
<th>Hardwarehash</th>
<th>Actions</th>
</tr>
<?php
foreach ($this->freeclients as $client): ?>
<tr>
<td><?php echo $client['clientID']; ?></td>
<td><?php echo $client['macadress']; ?></td>
<td><?php echo $client['hardwarehash']; ?></td>
<td><select onChange="location.href=this.options[this.selectedIndex].value">
<option></option>
<?php foreach ($this->pools as $pool): ?>
<option value="<?php echo $this->url(
array(
'module' => 'user',
'controller' => 'pool',
'action' => 'linkclient',
'clientID' => $client['clientID'],
'poolID' => $pool->getID(),
'page' => $this->page
),
'default',
true) ?>"><?php echo $pool->getTitle(); ?></option>
<?php //<img src='/media/img/add.png' alt='Link to Pool'/></a></td> ?>
<?php endforeach ?>
</select>
</td>
</tr>
<?php endforeach ?>
</table>
</div>
<script>
jQuery.expr[":"].containsNoCase = function(el, i, m) {
var search = m[3];
if (!search) return false;
return eval("/" + search + "/i").test($(el).text());
};
jQuery(document).ready(function() {
// used for the first example in the blog post
jQuery('li:contains(\'DotNetNuke\')').css('color', '#0000ff').css('font-weight', 'bold');
// hide the cancel search image
jQuery('#imgSearch').hide();
// reset the search when the cancel image is clicked
jQuery('#imgSearch').click(function() {
resetSearch();
});
// cancel the search if the user presses the ESC key
jQuery('#txtSearch').keyup(function(event) {
if (event.keyCode == 27) {
resetSearch();
}
});
// execute the search
jQuery('#txtSearch').keyup(function() {
// only search when there are 3 or more characters in the textbox
if (jQuery('#txtSearch').val().length > 2) {
// hide all rows
jQuery('#tblSearch tr').hide();
// show the header row
jQuery('#tblSearch tr:first').show();
// show the matching rows (using the containsNoCase from Rick Strahl)
jQuery('#tblSearch tr td:containsNoCase(\'' + jQuery('#txtSearch').val() + '\')').parent().show();
// show the cancel search image
jQuery('#imgSearch').show();
}
else if (jQuery('#txtSearch').val().length == 0) {
// if the user removed all of the text, reset the search
resetSearch();
}
// if there were no matching rows, tell the user
if (jQuery('#tblSearch tr:visible').length == 1) {
// remove the norecords row if it already exists
jQuery('.norecords').remove();
// add the norecords row
jQuery('#tblSearch').append('<tr class="norecords"><td colspan="5" class="Normal">No records were found</td></tr>');
}
});
});
function resetSearch() {
// clear the textbox
jQuery('#txtSearch').val('');
// show all table rows
jQuery('#tblSearch tr').show();
// remove any no records rows
jQuery('.norecords').remove();
// remove the cancel search image
jQuery('#imgSearch').hide();
// make sure we re-focus on the textbox for usability
jQuery('#txtSearch').focus();
}
</script>
<?php endif;?>
<?php else: ?>
<p>There are no pools to display.</p>
<?php endif;?>
|