AJAX pagination working on Enquiry table on user views

This commit is contained in:
Karl Cordes 2011-03-17 11:01:15 +11:00
parent 1f33242874
commit 7bd1abe2c7
3 changed files with 50 additions and 42 deletions

View file

@ -1,14 +1,23 @@
<?php echo $javascript->link('jquery.jeditable.mini'); ?> <?php echo $javascript->link('jquery.jeditable.mini'); ?>
<?=$javascript->link('ajax_pagination'); ?>
<?php echo $paginator->options(array('url'=>$this->passedArgs)); ?> <?php echo $paginator->options(array('url'=>$this->passedArgs)); ?>
<?php <?php
echo $paginator->counter(array( echo $paginator->counter(array(
'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true) 'format' => __('Page %page% of %pages%, showing %current% Enquiries out of %count% total, starting on record %start%, ending on %end%', true)
)); ));
?> ?>
<div class="paging">
<?php echo $paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>
| <?php echo $paginator->numbers();?>
<?php echo $paginator->next(__('next', true).' >>', array(), null, array('class'=>'disabled'));?>
</div>
<table cellpadding="0" cellspacing="0" class="mer"> <table cellpadding="0" cellspacing="0" class="mer">
<tr> <tr>
<th><?php echo $paginator->sort('user_id');?></th> <th><?php echo $paginator->sort('user_id');?></th>

View file

@ -3,51 +3,51 @@
<span id="userID" style="display: none;"><?=$user['User']['id']?></span> <span id="userID" style="display: none;"><?=$user['User']['id']?></span>
<div class="users view"> <div class="users view">
<h2><?php __('User: '.$user['User']['username'] );?></h2> <h2><?php __('User: '.$user['User']['username'] );?></h2>
<dl><?php $i = 0; $class = ' class="altrow"';?> <dl><?php $i = 0; $class = ' class="altrow"';?>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Username'); ?></dt> <dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Username'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>> <dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $user['User']['username']; ?> <?php echo $user['User']['username']; ?>
&nbsp; &nbsp;
</dd> </dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('First Name'); ?></dt> <dt<?php if ($i % 2 == 0) echo $class;?>><?php __('First Name'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>> <dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $user['User']['first_name']; ?> <?php echo $user['User']['first_name']; ?>
&nbsp; &nbsp;
</dd> </dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Last Name'); ?></dt> <dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Last Name'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>> <dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $user['User']['last_name']; ?> <?php echo $user['User']['last_name']; ?>
&nbsp; &nbsp;
</dd> </dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Email'); ?></dt> <dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Email'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>> <dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $html->link($user['User']['email'], 'mailto:'.$user['User']['email']); ?> <?php echo $html->link($user['User']['email'], 'mailto:'.$user['User']['email']); ?>
&nbsp; &nbsp;
</dd> </dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Job Title'); ?></dt> <dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Job Title'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>> <dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $user['User']['job_title']; ?> <?php echo $user['User']['job_title']; ?>
&nbsp; &nbsp;
</dd> </dd>
</dl> </dl>
</div> </div>
<div class="related"> <div class="related">
<h3><?php __('Enquiries Assigned to this User');?></h3> <h3><?php __('Enquiries Assigned to this User');?></h3>
<button id="show" class="showHide">Show</button> <button id="show" class="showHide">Show</button>
<button id="hide" class="showHide">Hide</button> <button id="hide" class="showHide">Hide</button>
<div id="enquiryTable"> <div id="ajaxLoad" style="display:none;"><?php echo $html->image('ajax-loader.gif'); ?></div>
<div id="ajaxLoad" style="display:none;"><?php echo $html->image('ajax-loader.gif'); ?></div>
</div>
<div id="enquiryTable">
<? /* If there are enquiries for this user, render the enquiries table passing the $enquiries array */ ?> <? /* If there are enquiries for this user, render the enquiries table passing the $enquiries array */ ?>
<?php if (!empty($user['Enquiry'])) { <?php if (!empty($user['Enquiry'])) {
//echo $this->element('enquiry_table', $user['Enquiry']); //echo $this->element('enquiry_table', $user['Enquiry']);
} }
else { else {
echo "No Enquiries for this User"; echo "No Enquiries for this User";
} }
?> ?>
</div>
</div> </div>

View file

@ -4,7 +4,6 @@ $(function() {
$('#enquiryTable').hide(); $('#enquiryTable').hide();
$("#ajaxLoad").hide(); $("#ajaxLoad").hide();
$("#ajaxLoad").bind("ajaxSend", function() { $("#ajaxLoad").bind("ajaxSend", function() {
$(this).show(); $(this).show();
}).bind("ajaxComplete", function() { }).bind("ajaxComplete", function() {