PHP部分:
function praise_detail($main_id){
$joins = array(array(
‘table’ => ‘comment_praises’,
‘alias’ => ‘CommentPraise’,
‘type’ => ‘INNER’,
‘conditions’ => array(‘CommentPraise.comment_task_id = CommentTask.id’)
));
$fields = array(‘CommentPraise.*’,’CommentTask.*’);
$this->paginate = array(‘fields’=>$fields,’conditions’=>array(‘CommentPraise.main_task_id’=>$main_id),’joins’=>$joins,’order’=>’CommentPraise.id ‘,’limit’=>50);
// var_dump(‘praise_detail’);var_dump($this->paginate());
$this->set(‘tasks’, $this->paginate());
}
praise_detail.ctp
<div class=”user index”>
<h2><?php __(‘子任务列表’);?>-<?php echo $main_info[‘CommentTask’][‘name’];?></h2>
<table cellpadding=”0″ cellspacing=”0″ style=”/*table-layout:fixed;word-wap:break-word*/”>
<tr>
<th><?php echo $this->Paginator->sort(‘id’);?></th>
<th><?php echo $this->Paginator->sort(‘main_task_id’);?></th>
<th><?php echo $this->Paginator->sort(‘bid’);?></th>
<th><?php echo $this->Paginator->sort(‘uid’);?></th>
<th><?php echo $this->Paginator->sort(‘content_id’);?></th>
<th><?php echo $this->Paginator->sort(‘status’);?></th>
<th><?php echo $this->Paginator->sort(‘praise_time’);?></th>
<th><?php echo $this->Paginator->sort(‘created’);?></th>
<th><?php echo $this->Paginator->sort(‘comment_url’);?></th>
<th class=”actions”>操作</th>
</tr>
<?php
$i = 0;
foreach ($tasks as $task):
$class = null;
if ($i++ % 2 == 0) {
$class = ‘ class=”altrow”‘;
}
?>
<tr<?php echo $class;?>>
<td><?php echo $task[‘CommentPraise’][‘id’] ?> </td>
<td><?php echo $task[‘CommentPraise’][‘main_task_id’]; ?> </td>
<td><?php echo $task[‘CommentTask’][‘bid’]; ?> </td>
<td><?php echo $task[‘CommentTask’][‘uid’]; ?> </td>
<td><?php echo $task[‘CommentTask’][‘content_id’]; ?> </td>
<td><?php
if($task[‘CommentPraise’][‘status’]==0) {
echo ‘未处理’;
}else if($task[‘CommentPraise’][‘status’]==1) {
echo ‘成功’;
}else{
echo ‘失败’;
} ?> </td>
<td><?php echo $task[‘CommentPraise’][‘praise_time’]?> </td>
<td><?php echo $task[‘CommentPraise’][‘created’]; ?> </td>
<td><?php echo $task[‘CommentTask’][‘comment_url’]; ?> </td>
<td class=”actions”>
<?php
if($task[‘CommentPraise’][‘status’] != 1)
{
// echo $this->Html->link(__(‘Delete’, true), array(‘action’ => ‘delete’, $task[‘CommentTask’][‘id’]), null, sprintf(__(‘Are you sure you want to delete # %s?’, true), $task[‘CommentTask’][‘id’]));
}
?>
</td>
</tr>
<?php endforeach; ?>
</table>
<p>
<?php
echo $this->Paginator->counter(array(
‘format’ => __(‘Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%’, true)
));
?> </p>
<div class=”paging”>
<?php echo $this->Paginator->prev(‘<< ‘ . __(‘previous’, true), array(), null, array(‘class’=>’disabled’));?>
| <?php echo $this->Paginator->numbers();?>
|
<?php echo $this->Paginator->next(__(‘next’, true) . ‘ >>’, array(), null, array(‘class’ => ‘disabled’));?>
<?php __(‘Page To’);?>: <input type=’text’ id=’page’ class=’jump’ onkeypress=’enter_jump(“/brush/comment_tasks/praise_detail/”)’ /><?php __(‘Page’);?> <input type=’submit’ value='<?php __(“Jump”);?>’ onclick=’jump_to_page(“/brush/comment_tasks/praise_detail/”);’ />
</div>
</div>
<?php echo $this->Html->script(‘jump’);
require_once(‘webroot/php/action/comment_task.php’);?>