PageRenderTime 60ms CodeModel.GetById 43ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 0ms

/halogy/application/modules/users/views/edit.php

https://bitbucket.org/haloweb/halogy-1.0/
PHP | 338 lines | 264 code | 74 blank | 0 comment | 23 complexity | 850d32ec33c7986788fb7530dbf5d5bf MD5 | raw file
  1<script type="text/javascript">
  2function hideAddress(){
  3	if (
  4		$('input#billingAddress1').val() == $('input#address1').val() &&
  5		$('input#billingAddress2').val() == $('input#address2').val() &&
  6		$('input#billingAddress3').val() == $('input#address3').val() &&
  7		$('input#billingCity').val() == $('input#city').val() &&
  8		$('select#billingState').val() == $('select#state').val() &&
  9		$('input#billingPostcode').val() == $('input#postcode').val() &&
 10		$('select#billingCountry').val() == $('select#country').val()									
 11	){
 12		$('div#billing').hide();
 13		$('input#sameAddress').attr('checked', true);
 14	}
 15}
 16$(function(){
 17	$('a.showtab').click(function(event){
 18		event.preventDefault();
 19		var div = $(this).attr('href'); 
 20		$('div.tab').hide();
 21		$(div).show();
 22	});
 23	$('ul.innernav a').click(function(event){
 24		event.preventDefault();
 25		$(this).parent().siblings('li').removeClass('selected'); 
 26		$(this).parent().addClass('selected');
 27	});
 28	$('div.tab:not(#tab1)').hide();	
 29	$('input#sameAddress').click(function(){
 30		$('div#billing').toggle(200);
 31		$('input#billingAddress1').val($('input#address1').val());
 32		$('input#billingAddress2').val($('input#address2').val());
 33		$('input#billingAddress3').val($('input#address3').val());
 34		$('input#billingCity').val($('input#city').val());
 35		$('select#billingState').val($('select#state').val());
 36		$('input#billingPostcode').val($('input#postcode').val());
 37		$('select#billingCountry').val($('select#country').val());
 38	});
 39	hideAddress();
 40});
 41</script>
 42
 43<form method="post" action="<?php echo $this->uri->uri_string(); ?>" class="default">
 44
 45	<h1 class="headingleft">Edit User <small>(<a href="/admin/users">Back to Users</a>)</small></h1>
 46
 47	<div class="headingright">
 48		<input type="submit" value="Save Changes" class="button" />
 49	</div>
 50	
 51	<div class="clear"></div>
 52	
 53	<?php if ($errors = validation_errors()): ?>
 54		<div class="error">
 55			<?php echo $errors; ?>
 56		</div>
 57	<?php endif; ?>
 58	<?php if (isset($message)): ?>
 59		<div class="message clear">
 60			<?php echo $message; ?>
 61		</div>
 62	<?php endif; ?>
 63
 64<ul class="innernav clear">
 65	<li class="selected"><a href="#tab1" class="showtab">Details</a></li>
 66	<?php if (@in_array('shop', $this->permission->sitePermissions) || @in_array('community', $this->permission->sitePermissions)): ?>	
 67		<li><a href="#tab2" class="showtab">Address</a></li>
 68		<?php if (@in_array('community', $this->permission->sitePermissions)): ?>
 69			<li><a href="#tab3" class="showtab">Community</a></li>
 70			<li><a href="#tab4" class="showtab">Company</a></li>
 71		<?php endif; ?>
 72	<?php endif; ?>
 73</ul>
 74
 75<br class="clear" />
 76
 77<div id="tab1" class="tab">
 78
 79	<h2>User Details</h2>
 80
 81	<label for="username">Username:</label>
 82	<?php echo @form_input('username', set_value('username', $data['username']), 'id="username" class="formelement"'); ?>
 83	<br class="clear" />
 84
 85	<label for="password">Password:</label>
 86	<?php echo @form_password('password','', 'id="password" class="formelement"'); ?>
 87	<br class="clear" />
 88
 89<?php if (@in_array('users_groups', $this->permission->permissions)): ?>
 90	<label for="permissions">Group:</label>
 91	<?php 
 92		$values = array(
 93			0 => 'None'
 94		);
 95
 96		if ($this->session->userdata('groupID') == '-1')
 97		{
 98			$values[-1] = 'Superuser';
 99		}
100		
101		$values[$this->site->config['groupID']] = 'Administrator';
102		if ($groups)
103		{
104			foreach($groups as $group)
105			{
106				$values[$group['groupID']] = $group['groupName'];
107			}
108		}
109		echo @form_dropdown('groupID',$values,set_value('groupIDs', $data['groupID']), 'id="groupIDs" class="formelement"'); 
110	?>
111	<span class="tip">To edit permissions click on `User Groups` in the Users tab.</span>
112	<br class="clear" />
113<?php endif; ?>
114
115	<label for="email">Email:</label>
116	<?php echo @form_input('email',set_value('email', $data['email']), 'id="email" class="formelement"'); ?>
117	<br class="clear" />	
118
119	<label for="firstName">First Name:</label>
120	<?php echo @form_input('firstName',set_value('firstName', $data['firstName']), 'id="firstName" class="formelement"'); ?>
121	<br class="clear" />
122
123	<label for="lastName">Last Name:</label>
124	<?php echo @form_input('lastName',set_value('lastName', $data['lastName']), 'id="lastName" class="formelement"'); ?>
125	<br class="clear" />
126
127	<label for="displayName">Display Name:</label>
128	<?php echo @form_input('displayName', set_value('displayName', $data['displayName']), 'id="displayName" class="formelement" maxlength="15"'); ?>
129	<span class="tip">For use in the forums (optional).</span></span><br class="clear" />
130	
131<?php if (@in_array('shop', $this->permission->sitePermissions)): ?>
132
133	<label for="subscribed">Subscribed?</label>
134	<?php 
135		$values = array(
136			0 => 'No',
137			1 => 'Yes',
138		);
139		echo @form_dropdown('subscribed',$values,set_value('subscribed', $data['subscribed']), 'id="subscribed" class="formelement"'); 
140	?>
141	<br class="clear" />
142	
143	<label for="plan">Plan:</label>
144	<?php echo @form_input('plan',set_value('plan', $data['plan']), 'id="plan" class="formelement"'); ?>
145	<br class="clear" />
146
147<?php endif; ?>
148
149	<label for="active">Active?</label>
150	<?php 
151		$values = array(
152			1 => 'Yes',
153			0 => 'No'			
154		);
155		echo @form_dropdown('active',$values,set_value('active', $data['active']), 'id="active" class="formelement"'); 
156	?>
157	<br class="clear" />
158
159
160<?php if (@in_array('emailer', $this->permission->sitePermissions)): ?>	
161
162	<br />
163
164	<h2>Email Newsletter</h2>
165	
166	<label for="subscription">Subscription</label>
167	<?php 
168		$values = array(
169			'Y' => 'All (Fully subscribed)',
170			'E' => 'Email only',
171			'P' => 'Post only',
172			'N' => 'None (Un-subscribed)',
173		);
174		echo @form_dropdown('subscription',$values,set_value('subscription', $data['subscription']), 'id="subscription" class="formelement"'); 
175	?>
176	<br class="clear" />
177
178	<label for="bounced">Bounced email:</label>
179	<?php 
180		$values = array(
181			0 => 'No',
182			1 => 'Yes (email has bounced)',
183		);
184		echo @form_dropdown('bounced',$values,set_value('bounced', $data['bounced']), 'id="bounced" class="formelement"'); 
185	?>
186	<br class="clear" />
187<?php endif; ?>
188
189<br />
190
191</div>
192
193<div id="tab2" class="tab">
194
195<?php if (@in_array('shop', $this->permission->sitePermissions) || @in_array('community', $this->permission->sitePermissions)): ?>	
196	<h2>Delivery Address</h2>
197
198	<label for="address1">Address 1:</label>
199	<?php echo @form_input('address1',set_value('address1', $data['address1']), 'id="address1" class="formelement"'); ?>
200	<br class="clear" />
201
202	<label for="address2">Address 2:</label>
203	<?php echo @form_input('address2',set_value('address2', $data['address2']), 'id="address2" class="formelement"'); ?>
204	<br class="clear" />
205
206	<label for="address3">Address 3:</label>
207	<?php echo @form_input('address3',set_value('address3', $data['address3']), 'id="address3" class="formelement"'); ?>
208	<br class="clear" />
209
210	<label for="city">City:</label>
211	<?php echo @form_input('city',set_value('city', $data['city']), 'id="city" class="formelement"'); ?>
212	<br class="clear" />
213
214	<label for="state">State:</label>
215	<?php echo display_states('state', $data['state'], 'id="state" class="formelement"'); ?>
216	<br class="clear" />
217
218	<label for="postcode">Post /ZIP Code:</label>
219	<?php echo @form_input('postcode',set_value('postcode', $data['postcode']), 'id="postcode" class="formelement"'); ?>
220	<br class="clear" />
221
222	<label for="country">Country:</label>
223	<?php echo display_countries('country', $data['country'], 'id="country" class="formelement"'); ?>
224	<br class="clear" />
225
226	<label for="phone">Phone:</label>
227	<?php echo @form_input('phone',set_value('phone', $data['phone']), 'id="phone" class="formelement"'); ?>
228	<br class="clear" /><br />
229
230	<h2>Billing Address</h2>
231
232	<p><input type="checkbox" name="sameAddress" value="1" class="checkbox" id="sameAddress" />
233	The billing address is the same as my delivery address.</p>
234
235	<div id="billing">
236
237		<label for="billingAddress1">Address 1:</label>
238		<?php echo @form_input('billingAddress1',set_value('billingAddress1', $data['billingAddress1']), 'id="billingAddress1" class="formelement"'); ?>
239		<br class="clear" />
240	
241		<label for="billingAddress2">Address 2:</label>
242		<?php echo @form_input('billingAddress2',set_value('billingAddress2', $data['billingAddress2']), 'id="billingAddress2" class="formelement"'); ?>
243		<br class="clear" />
244	
245		<label for="billingAddress3">Address 3:</label>
246		<?php echo @form_input('billingAddress3',set_value('billingAddress3', $data['billingAddress3']), 'id="billingAddress3" class="formelement"'); ?>
247		<br class="clear" />
248	
249		<label for="billingCity">City:</label>
250		<?php echo @form_input('billingCity',set_value('billingCity', $data['billingCity']), 'id="billingCity" class="formelement"'); ?>
251		<br class="clear" />
252
253		<label for="billingState">State:</label>
254		<?php echo display_states('billingState', $data['billingState'], 'id="billingState" class="formelement"'); ?>
255		<br class="clear" />
256	
257		<label for="billingPostcode">Post /ZIP Code:</label>
258		<?php echo @form_input('billingPostcode',set_value('billingPostcode', $data['billingPostcode']), 'id="billingPostcode" class="formelement"'); ?>
259		<br class="clear" />
260	
261		<label for="billingCountry">Country:</label>
262		<?php echo display_countries('billingCountry', $data['billingCountry'], 'id="billingCountry" class="formelement"'); ?>
263		<br class="clear" />
264
265	</div>
266	<br />
267		
268<?php endif; ?>
269
270</div>
271
272<div id="tab3" class="tab">
273
274<?php if (@in_array('community', $this->permission->permissions)): ?>
275
276	<h2>Community</h2>
277
278	<label for="signature">Signature:</label>
279	<?php echo @form_textarea('signature',set_value('signature', $data['signature']), 'id="signature" class="formelement small"'); ?>
280	<br class="clear" />
281
282	<label for="bio">Bio:</label>
283	<?php echo @form_textarea('bio',set_value('bio', $data['bio']), 'id="bio" class="formelement small"'); ?>
284	<br class="clear" />
285
286	<label for="notifications">Notifications:</label>
287	<?php
288		$values = array(
289			0 => 'No',
290			1 => 'Yes',
291		);
292		echo @form_dropdown('notifications', $values, set_value('notifications', $data['notifications']), 'id="notifications" class="formelement"'); 
293	?>
294	<br class="clear" />
295
296	<label for="privacy">Privacy:</label>
297	<?php
298		$values = array(
299			'V' => 'Everyone can see my profile',
300			'H' => 'Hide my profile and feed'
301		);
302		echo @form_dropdown('privacy', $values, set_value('privacy', $data['privacy']), 'id="privacy" class="formelement"'); 
303	?>
304	<br class="clear" />
305
306	<label for="kudos">Kudos:</label>
307	<?php echo @form_input('kudos',set_value('kudos', $data['kudos']), 'id="kudos" class="formelement"'); ?>
308	<br class="clear" /><br />	
309
310<?php endif; ?>
311
312</div>
313
314<?php if (@in_array('community', $this->permission->sitePermissions)): ?>	
315
316<div id="tab4" class="tab">
317
318	<h2>Company</h2>
319
320	<label for="companyName">Company Name:</label>
321	<?php echo @form_input('companyName',set_value('companyName', $data['companyName']), 'id="companyName" class="formelement"'); ?>
322	<br class="clear" />
323
324	<label for="companyDescription">Company Description:</label>
325	<?php echo @form_textarea('companyDescription',set_value('companyDescription', $data['companyDescription']), 'id="companyDescription" class="formelement small"'); ?>
326	<br class="clear" />
327
328	<label for="companyWebsite">Company Website:</label>
329	<?php echo @form_input('companyWebsite',set_value('companyWebsite', $data['companyWebsite']), 'id="companyWebsite" class="formelement"'); ?>
330	<br class="clear" />
331	
332</div>
333
334<?php endif; ?>
335
336<p class="clear" style="text-align: right;"><a href="#" class="button grey" id="totop">Back to top</a></p>
337	
338</form>