| 1 | <?php |
|---|
| 2 | #debug( $this->data ); |
|---|
| 3 | if ($this->data['User']['id'] != $this->Session->read('Auth.User.id')): #security check |
|---|
| 4 | echo $this->__getSupport(); |
|---|
| 5 | endif; |
|---|
| 6 | |
|---|
| 7 | echo $this->Html->para(null, $this->Html->image('avatars/'.$this->data['User']['avatar'], array('alt'=>$this->data['User']['username'], 'title'=>$this->data['User']['username']))); |
|---|
| 8 | |
|---|
| 9 | echo $this->Form->create('User', array('onsubmit'=>'return chkForm()')); |
|---|
| 10 | echo $this->Form->hidden('User.id'); |
|---|
| 11 | echo $this->Form->hidden('Profile.id'); |
|---|
| 12 | echo $this->Form->hidden('User.email'); |
|---|
| 13 | echo $this->Form->hidden('Profile.modified', array('value'=>'now()')); |
|---|
| 14 | echo '<fieldset>'; |
|---|
| 15 | echo '<legend>'.$this->Session->read('Auth.User.username') .'\'s '.__('profile', True).'</legend>'; |
|---|
| 16 | echo $this->Html->div(Null, '<b>'.$this->data['User']['email'].'</b>'); |
|---|
| 17 | echo $this->Form->input('User.name', array('size' => 35, 'maxlength'=>50)); |
|---|
| 18 | |
|---|
| 19 | $langs = array('en'=>'English', 'es'=>'Español'); |
|---|
| 20 | echo $this->Form->input('User.lang', array('type'=>'select', 'options'=>$langs, 'label'=> __('Language',True))); |
|---|
| 21 | |
|---|
| 22 | echo $this->Form->input('Profile.cv', array('type'=>'textarea','cols' => 70, 'rows' => 7, 'label'=> __('profile',True))); |
|---|
| 23 | echo $this->Form->input('Profile.phone', array('size' => 35, 'maxlength'=>50, 'label'=>__('Phone', True))); |
|---|
| 24 | echo $this->Form->input('Profile.cellphone', array('size' => 35, 'maxlength'=>50, 'label'=>__('Cell Phone', True))); |
|---|
| 25 | echo $this->Form->input('Profile.matricula', array('size'=>20,'maxlength'=>20,'title'=>__('If you are student, write your matricula number', True))); |
|---|
| 26 | |
|---|
| 27 | if ( $this->Session->read('Auth.User.group_id') < 3): # admin and teachers |
|---|
| 28 | echo $this->Form->input('Profile.quote', array('size' => 70, 'maxlength' => 150, 'label'=>__('Quote', True))); |
|---|
| 29 | echo $this->Form->input('Profile.name_blog', array('size' => 45, 'maxlength' => 150, 'label'=>__('eduBlog name', True))); |
|---|
| 30 | echo $this->Form->input('Profile.tags', array('size' => 45, 'maxlength' => 150, 'label'=>'Tags')); |
|---|
| 31 | $styles = array('mexico'=>'México', 'basic'=>'Basic'); |
|---|
| 32 | echo $this->Form->input('Profile.layout', array('type'=>'select', 'options'=>$styles, 'label'=>__('Layout',True))); |
|---|
| 33 | endif; |
|---|
| 34 | |
|---|
| 35 | echo $this->Form->input('Profile.newsletter', array('type'=>'checkbox', 'label'=> __('Subscribe to newsletter', True))); |
|---|
| 36 | echo $this->Form->input('User.helps', array('type'=>'checkbox', 'label'=> __('Enable help messages', True))); |
|---|
| 37 | |
|---|
| 38 | echo $this->Html->div(Null, $this->Form->input('User.pwd', array('size'=>9, 'maxlength'=>9, 'value'=>'', |
|---|
| 39 | 'label'=>__('Password', True))) . ' '.__('Left empty if you do not want to change', True), array('style'=>'clear:both;margin:25px 0 16px 0;')); |
|---|
| 40 | echo '</fieldset>'; |
|---|
| 41 | echo $this->Form->end(__('Save', True)); |
|---|
| 42 | |
|---|
| 43 | echo $this->Html->div('spaced'); |
|---|
| 44 | echo $this->Form->create('User', array('enctype'=>'multipart/form-data', 'action'=>'avatar')); |
|---|
| 45 | echo $this->Form->hidden('User.id'); |
|---|
| 46 | ?> |
|---|
| 47 | <fieldset> |
|---|
| 48 | <legend><?php __('Upload new avatar'); ?></legend> |
|---|
| 49 | <?php |
|---|
| 50 | echo $this->Html->div(null, __('An image 50 x 50 pixels', True)); |
|---|
| 51 | echo $this->Form->input('User.file', array('type'=>'file')); |
|---|
| 52 | echo '</fieldset>'; |
|---|
| 53 | echo $this->Form->end(__('Upload', True)); |
|---|
| 54 | echo '</div>'; |
|---|
| 55 | |
|---|
| 56 | # JS |
|---|
| 57 | echo $this->Html->scriptStart(); |
|---|
| 58 | ?> |
|---|
| 59 | function chkForm() |
|---|
| 60 | { |
|---|
| 61 | var name = document.getElementById("UserName"); |
|---|
| 62 | var passwd = document.getElementById("UserPwd"); |
|---|
| 63 | |
|---|
| 64 | if (name.value.length < 6) |
|---|
| 65 | { |
|---|
| 66 | alert('<?php __('The name must be at least six characters');?>'); |
|---|
| 67 | name.focus(); |
|---|
| 68 | return false; |
|---|
| 69 | } |
|---|
| 70 | |
|---|
| 71 | if (passwd.value.length > 0 && passwd.value.length < 6) |
|---|
| 72 | { |
|---|
| 73 | alert('<?php __('The password must be at least five characters');?>'); |
|---|
| 74 | passwd.focus(); |
|---|
| 75 | return false; |
|---|
| 76 | } |
|---|
| 77 | |
|---|
| 78 | return true; |
|---|
| 79 | } |
|---|
| 80 | <?php echo $this->Html->scriptEnd(); ?> |
|---|