Advertisement
Guest User

mrdevin

a guest
Feb 18th, 2010
964
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 16.63 KB | None | 0 0
  1. //users/view.ctp (this has the first form
  2.  
  3. <div class="users view">
  4.  
  5. <h2><?php echo __('Profile for:') .' '. $user['User']['first_name'] .' '. $user['User']['last_name'];?></h2>
  6.  
  7.   <h3>Passport Photos</h3>
  8.   <?php echo $html->image("placeholder.png", array("alt" => "ProfileImage")); ?>
  9.  
  10.   <h3><?php echo __('Account Info') ?></h3>
  11.    
  12.     <label for="email"><?php __('Email'); ?>:</label>
  13.     <div id="email"><?php if(!empty($user['User']['email'])){echo $user['User']['email'];}else{echo 'click to add';} ?></div>
  14.    
  15.     <label for="password"><?php echo __('Password'); ?>:</label>
  16.    
  17.     <?php if($activeUser['User']['id'] == $user['User']['id']){?>
  18.       <div id="password">
  19.       <?php echo '<a href="#passwordChange" title="Click to change Password"/>'. __("Click to change Password",true).'</a>';?>
  20.       </div><!-- END password section -->
  21.       <div id="passwordChange">
  22.         <?php echo $form->create('User', array( 'action' =>'updatePass' ));?>
  23.           <fieldset>
  24.             <legend><?php __('Change Password');?></legend>
  25.             <?php
  26.               $options = array('type'=>'password', 'div' => array('class' => 'required'));
  27.               echo $form->input(__('old_password', true), $options);
  28.              
  29.               $options = array('div' => array('class' => 'required'), 'error' => array('confirmPassword' => __('Passwords do not match please try again',true), 'noempty' => __('Please provide a password',true)));
  30.               echo $form->input(__('password', true), $options);
  31.              
  32.               $options = array('type'=>'password', 'div' => array('class' => 'required'));
  33.               echo $form->input(__('confirmation_password', true), $options);
  34.              
  35.               echo $form->hidden('User.id', array('value' => $user['User']['id']));
  36.             ?>
  37.           </fieldset>
  38.         <?php echo $ajax->submit(__('Change Password', true), array('url' => array('controller' => 'users', 'action' => 'updatePass'),
  39.                    'update' => 'storage',
  40.                    'complete' => '$("#UserUpdatePassForm input[type=password]").val(""); '));
  41.                    
  42.         $form->end();?>
  43.                     <a href="#">Cancel</a>
  44.       </div>
  45.     <?php }else{?>
  46.       <div id="password">
  47.         &#149;&#149;&#149;&#149;&#149;&#149;&#149;&#149;&#149;&#149;
  48.       </div><!-- END password section -->
  49.     <?php }?>
  50.    
  51.    
  52.     <?php if( $activeUser['Group']['name'] != 'customer' && $activeUser['Group']['name'] != 'partner' ) { ?>
  53.       <label for="last_login"><?php __('Last Login'); ?>:</label>
  54.       <div id="last_login"><?php echo $time->timeAgoInWords($user['User']['last_login']); ?></div>
  55.       <!-- END last login -->
  56.     <?php } ?>
  57.        
  58.   <h3><?php echo __('Student Info') ?></h3>
  59.     <label for="first_name"><?php __('First Name'); ?>:</label>
  60.     <div id="first_name"><?php if(!empty($user['User']['first_name'])){echo $user['User']['first_name'];}else{echo 'click to add';} ?></div>
  61.    
  62.     <label for="middle_name"><?php __('Middle Name'); ?>:</label>
  63.     <div id="middle_name"><?php if(!empty($user['User']['middle_name'])){echo $user['User']['middle_name'];}else{echo 'click to add';} ?></div>
  64.    
  65.     <label for="last_name"><?php __('Last Name'); ?>:</label>
  66.     <div id="last_name"><?php if(!empty($user['User']['last_name'])){echo $user['User']['last_name'];}else{echo 'click to add';} ?></div>
  67.    
  68.     <label for="nickname"><?php __('Nickname'); ?>:</label>
  69.     <div id="nickname"><?php if(!empty($user['User']['nickname'])){echo $user['User']['nickname'];}else{echo 'click to add';} ?></div>
  70.  
  71.     <label for="gender"><?php __('Gender'); ?>:</label>
  72.     <div id="gender"><?php
  73.     if(!empty($user['User']['gender'])){
  74.       if($user['User']['gender'] == '1'){
  75.         __('Male');
  76.       } else {
  77.         __('Female');
  78.       }
  79.     }else{
  80.       echo 'click to add';
  81.     } ?></div>
  82.    
  83.     <label for="birthdate"><?php __('Birthdate'); ?>:</label>
  84.     <div id="birthdate"><?php echo $time->timeAgoInWords($user['User']['birthdate']); ?></div>
  85.    
  86.   <h3><?php echo __('Nationality & Residence') ?></h3>
  87.     <label for="birth_city"><?php __('Birth City'); ?>:</label>
  88.     <div id="birth_city"><?php if(!empty($user['User']['birth_city'])){echo $user['User']['birth_city'];}else{echo 'click to add';} ?></div>
  89.    
  90.     <label for="birth_country"><?php __('Birth Country'); ?>:</label>
  91.     <div id="birth_country"><?php if(!empty($user['User']['birth_country'])){echo $user['User']['birth_country'];}else{echo 'click to add';} ?></div>
  92.    
  93.     <label for="citizenship"><?php __('citizenship'); ?>:</label>
  94.     <div id="citizenship"><?php if(!empty($user['User']['citizenship'])){echo $user['User']['citizenship'];}else{echo 'click to add';} ?></div>
  95.    
  96.     <label for="residence"><?php __('residence'); ?>:</label>
  97.     <div id="residence"><?php if(!empty($user['User']['residence'])){echo $user['User']['residence'];}else{echo 'click to add';} ?></div>
  98.    
  99.   <h3><?php echo __('Address & Phone') ?></h3>
  100.     <label for="street_1"><?php __('Street Address'); ?>:</label>
  101.     <div id="street_1"><?php if(!empty($user['Address']['street_1'])){echo $user['Address']['street_1'];}else{echo 'click to add';} ?></div>
  102.  
  103.     <label for="street_2"><?php __('Street Address line 2'); ?>:</label>
  104.     <div id="street_2"><?php if(!empty($user['Address']['street_2'])){echo $user['Address']['street_2'];}else{echo 'click to add';} ?></div>
  105.  
  106.     <label for="city"><?php __('City'); ?>:</label>
  107.     <div id="city"><?php if(!empty($user['Address']['city'])){echo $user['Address']['city'];}else{echo 'click to add';} ?></div>
  108.    
  109.     <label for="state"><?php __('State/Province'); ?>:</label>
  110.     <div id="state"><?php if(!empty($user['Address']['state'])){echo $user['Address']['state'];}else{echo 'click to add';} ?></div>
  111.    
  112.     <label for="zip"><?php __('Zip'); ?>:</label>
  113.     <div id="zip"><?php if(!empty($user['Address']['zip'])){echo $user['Address']['zip'];}else{echo 'click to add';} ?></div>
  114.    
  115.     <label for="country"><?php __('Country'); ?>:</label>
  116.     <div id="country"><?php if(!empty($user['Address']['country'])){echo $user['Address']['country'];}else{echo 'click to add';} ?></div>
  117.    
  118.     <label for="home_phone"><?php __('Home Phone Number'); ?>:</label>
  119.     <div id="home_phone"><?php if(!empty($user['User']['home_phone'])){echo $user['User']['home_phone'];}else{echo 'click to add';} ?></div>
  120.    
  121.     <label for="nearest_airport"><?php __('Nearest Airport'); ?>:</label>
  122.     <div id="nearest_airport"><?php if(!empty($user['User']['nearest_airport'])){echo $user['User']['nearest_airport'];}else{echo 'click to add';} ?></div>
  123.    
  124.     <?php if( $activeUser['Group']['name'] != 'customer' && $activeUser['Group']['name'] != 'partner' ) { ?>
  125.     <h3><?php __('Group'); ?>:</h3>
  126.       <div id="group_id"><?php echo $user['Group']['name'];?></div>
  127.     <?php } ?>
  128. </div>
  129.  
  130. <?php
  131.   $applications['Application'] = $user['Application'];
  132.   echo $this->element('my_apps' , array('applications' => $applications, 'formms' => $formms));  
  133.  
  134. if($user['User']['id'] == $activeUser['User']['id']){
  135.   echo $ajax->editor('email', '/updateItem/'.$user['User']['id'].'/email', array(
  136.           'indicator' => 'Saving...',
  137.           'cancel' => __('cancel', true),
  138.           'submit' => __('save', true),
  139.           "onblur" => 'cancel',
  140.           'tooltip' => __('Click to edit...', true),
  141.   ));
  142.   echo $ajax->editor('first_name', '/updateItem/'.$user['User']['id'].'/first_name', array(
  143.           'indicator' => 'Saving...',
  144.           'cancel' => __('cancel', true),
  145.           'submit' => __('save', true),
  146.           "onblur" => 'cancel',
  147.           'tooltip' => __('Click to edit...', true),
  148.   ));
  149.   echo $ajax->editor('middle_name', '/updateItem/'.$user['User']['id'].'/middle_name', array(
  150.           'indicator' => 'Saving...',
  151.           'cancel' => __('cancel', true),
  152.           'submit' => __('save', true),
  153.           "onblur" => 'cancel',
  154.           'tooltip' => __('Click to edit...', true),
  155.   ));
  156.   echo $ajax->editor('last_name', '/updateItem/'.$user['User']['id'].'/last_name', array(
  157.           'indicator' => 'Saving...',
  158.           'cancel' => __('cancel', true),
  159.           'submit' => __('save', true),
  160.           "onblur" => 'cancel',
  161.           'tooltip' => __('Click to edit...', true),
  162.   ));
  163.   echo $ajax->editor('nickname', '/updateItem/'.$user['User']['id'].'/nickname', array(
  164.           'indicator' => 'Saving...',
  165.           'cancel' => __('cancel', true),
  166.           'submit' => __('save', true),
  167.           "onblur" => 'cancel',
  168.           'tooltip' => __('Click to edit...', true),
  169.   ));
  170.   echo $ajax->editor('gender', '/updateItem/'.$user['User']['id'].'/gender', array(
  171.           'indicator' => 'Saving...',
  172.           'data' => "{'0':'".__('Select One',true)."','1':'".__('Male',true)."','2':'".__('Female',true)."'}",
  173.           'type' => 'select',
  174.           'cancel' => __('cancel', true),
  175.           'submit' => __('save', true),
  176.           "onblur" => 'cancel',
  177.           'tooltip' => __('Click to edit...', true),
  178.   ));
  179.   echo $ajax->editor('birth_city', '/updateItem/'.$user['User']['id'].'/birth_city', array(
  180.           'indicator' => 'Saving...',
  181.           'cancel' => __('cancel', true),
  182.           'submit' => __('save', true),
  183.           "onblur" => 'cancel',
  184.           'tooltip' => __('Click to edit...', true),
  185.   ));
  186.   echo $ajax->editor('birth_country', '/updateItem/'.$user['User']['id'].'/birth_country', array(
  187.           'indicator' => 'Saving...',
  188.           'data' => $countries->asJson(),
  189.           'type' => 'select',
  190.           'cancel' => __('cancel', true),
  191.           'submit' => __('save', true),
  192.           "onblur" => 'cancel',
  193.           'tooltip' => __('Click to edit...', true),
  194.   ));
  195.   echo $ajax->editor('citizenship', '/updateItem/'.$user['User']['id'].'/citizenship', array(
  196.           'indicator' => 'Saving...',
  197.           'data' => $countries->asJson(),
  198.           'type' => 'select',
  199.           'cancel' => __('cancel', true),
  200.           'submit' => __('save', true),
  201.           "onblur" => 'cancel',
  202.           'tooltip' => __('Click to edit...', true),
  203.   ));
  204.   echo $ajax->editor('residence', '/updateItem/'.$user['User']['id'].'/residence', array(
  205.           'indicator' => 'Saving...',
  206.           'data' => $countries->asJson(),
  207.           'type' => 'select',
  208.           'cancel' => __('cancel', true),
  209.           'submit' => __('save', true),
  210.           "onblur" => 'cancel',
  211.           'tooltip' => __('Click to edit...', true),
  212.   ));
  213.   echo $ajax->editor('street_1', '/userAddress/'.$user['User']['id'].'/street_1', array(
  214.           'indicator' => 'Saving...',
  215.           'cancel' => __('cancel', true),
  216.           'submit' => __('save', true),
  217.           "onblur" => 'cancel',
  218.           'tooltip' => __('Click to edit...', true),
  219.   ));
  220.   echo $ajax->editor('street_2', '/userAddress/'.$user['User']['id'].'/street_2', array(
  221.           'indicator' => 'Saving...',
  222.           'cancel' => __('cancel', true),
  223.           'submit' => __('save', true),
  224.           "onblur" => 'cancel',
  225.           'tooltip' => __('Click to edit...', true),
  226.   ));
  227.   echo $ajax->editor('city', '/userAddress/'.$user['User']['id'].'/city', array(
  228.           'indicator' => 'Saving...',
  229.           'cancel' => __('cancel', true),
  230.           'submit' => __('save', true),
  231.           "onblur" => 'cancel',
  232.           'tooltip' => __('Click to edit...', true),
  233.   ));
  234.   echo $ajax->editor('state', '/userAddress/'.$user['User']['id'].'/state', array(
  235.           'indicator' => 'Saving...',
  236.           'cancel' => __('cancel', true),
  237.           'submit' => __('save', true),
  238.           "onblur" => 'cancel',
  239.           'tooltip' => __('Click to edit...', true),
  240.   ));
  241.   echo $ajax->editor('country', '/userAddress/'.$user['User']['id'].'/country', array(
  242.           'indicator' => 'Saving...',
  243.           'data' => $countries->asJson(),
  244.           'type' => 'select',
  245.           'cancel' => __('cancel', true),
  246.           'submit' => __('save', true),
  247.           "onblur" => 'cancel',
  248.           'tooltip' => __('Click to edit...', true),
  249.   ));
  250.   echo $ajax->editor('zip', '/userAddress/'.$user['User']['id'].'/zip', array(
  251.           'indicator' => 'Saving...',
  252.           'cancel' => __('cancel', true),
  253.           'submit' => __('save', true),
  254.           "onblur" => 'cancel',
  255.           'tooltip' => __('Click to edit...', true),
  256.   ));
  257.   echo $ajax->editor('home_phone', '/updateItem/'.$user['User']['id'].'/home_phone', array(
  258.           'indicator' => 'Saving...',
  259.           'cancel' => __('cancel', true),
  260.           'submit' => __('save', true),
  261.           "onblur" => 'cancel',
  262.           'tooltip' => __('Click to edit...', true),
  263.   ));
  264.   echo $ajax->editor('nearest_airport', '/updateItem/'.$user['User']['id'].'/nearest_airport', array(
  265.           'indicator' => 'Saving...',
  266.           'cancel' => __('cancel', true),
  267.           'submit' => __('save', true),
  268.           "onblur" => 'cancel',
  269.           'tooltip' => __('Click to edit...', true),
  270.   ));
  271.   echo $ajax->editor('group_id', '/updateItem/'.$user['User']['id'].'/group_id', array(
  272.           'indicator' => 'Saving...',
  273.           'data' => "{'1':'super-admin','2':'admin','3':'partner','4':'advisor','5':'operator','6':'customer'}",
  274.           'type' => 'select',
  275.           'cancel' => __('cancel', true),
  276.           'submit' => __('save', true),
  277.           "onblur" => 'cancel',
  278.           'tooltip' => __('Click to edit...', true),
  279.   ));
  280. }
  281. ?>
  282.  
  283.  
  284. // elements/my_apps.ctp (this contains the second form
  285. <div class="applications index">
  286. <h2><?php __('Applications');?></h2>
  287.  
  288.  
  289.  
  290. <?php echo $form->create('Applications', array( 'url' => array('controller' => 'applications', 'action' => 'assign',  'id' => null))); ?>
  291.           <fieldset>
  292.             <legend><?php __('Assign Application to User');?></legend>
  293.             <?php
  294.               $options = array('--' => __('Select One',true), 'test' => 'test', 'test2' => 'test2');
  295.               foreach($formms as $formm){
  296.                 $options[$formm['Form']['id']] = $formm['Form']['name'];
  297.               }
  298.  
  299.               echo $form->label('Application.form_id', __('Form Name',true).":");
  300.               echo $form->select('Application.form_id', $options, $selected = '--');
  301.              
  302.               echo $form->hidden('Application.user_id', array('value' => $user['User']['id']));
  303.             ?>
  304.           </fieldset>
  305. <?php echo $form->submit(__('Assign', true));
  306.       echo $form->end();?>
  307. <!--
  308. ###this is what i have tried printing out but still the "form" tags are removed by the time it is rendered
  309.  
  310. <form action="/high-school-app/applications/assign" method="post" id="ApplicationAssignForm">
  311. <fieldset>
  312.   <legend>Assign Application to User</legend>
  313.   <label for="AppplicationFormId">Form Name:</label>
  314.   <select id="AppplicationFormId" name="data[Application][form_id]">
  315.     <option value=""></option>
  316.     <option selected="selected" value="--">Select One</option>
  317.     <option value="test">test</option>
  318.     <option value="test2">test2</option>
  319.   </select>
  320.   <input type="hidden" id="AppplicationUserId" value="" name="data[Application][user_id]">
  321. </fieldset>
  322. <div class="submit">
  323.   <input type="submit" value="Assign">
  324. </div>
  325.  
  326. </form>
  327. -->
  328. <?php
  329.  
  330.  
  331.   if(empty($applications['Application'])){?>
  332.  
  333.     <span class="centered"><?php __('Currently you have no Applications. Once one is assigned to you it will appear here. If this is not what you expected please call +49 30 84 39 39 0 or send us an');
  334.       echo $html->link(__('e-mail',true), 'mailto:info@ayusa.de');
  335.   ?></span>
  336.  
  337.   <?php } else {?>
  338.     <table cellpadding="0" cellspacing="0">
  339.     <tr>
  340.       <th><?php __('Application Name');?></th>
  341.       <th><?php __('Started');?></th>
  342.       <th><?php __('Complete');?></th>
  343.       <th class="actions"><?php __('Actions');?></th>
  344.     </tr>
  345.     <?php
  346.     $i = 0;
  347.     foreach ($applications as $application):
  348.       $class = null;
  349.       if ($i++ % 2 == 0) {
  350.         $class = ' class="altrow"';
  351.       }
  352.    
  353.     ?>
  354.       <tr<?php echo $class;?>>
  355.    
  356.         <td>
  357.           <?php echo $application['Form']['FormName'][0]['name']; ?>
  358.         </td>
  359.         <td>
  360.           <?php echo $time->timeAgoInWords($application['Application']['created']); ?>
  361.         </td>
  362.         <td>
  363.           %%%%
  364.         </td>
  365.        
  366.         <td class="actions">
  367.           <?php echo $html->link(__('View', true), array('action' => 'view', $application['Application']['id'])); ?>
  368.    
  369.           <?php echo $html->link(__('Delete', true), array('action' => 'delete', $application['Application']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $application['Application']['id'])); ?>
  370.         </td>
  371.       </tr>
  372.     <?php endforeach; ?>
  373.     </table>
  374.   <?php }?>
  375. </div>
  376.  
  377.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement