我已经创建了一个关系请求页面,现在我遇到的问题是当我关系处于活动状态时,它会继续显示在视图中。我只希望显示字段active = false的请求。
这是我的请求控制器,它因阵列而崩溃,我该如何解决这个问题呢?
public function request(){
$this->set('title_for_layout', 'Relationships');
$this->set('stylesheet_used', 'homestyle');
$this->set('image_used', 'eBOXLogoHome.jpg');
$this->layout='home_layout';
$userid = $this->Auth->user('username');
$this->set('Relationships', $this->Relationship->find('all', array('conditions' => array('Relationship.partytwo' => $userid)) array('conditions'=>array('Relationship.active'=false))));
}
giggles,这是我的观点
<?php foreach($Relationships as $relationship):?>
<tr>
<td align='center'><?php echo $relationship['Relationship']['partyone']; ?></td>
<td align='center'><?php echo $relationship['Relationship']['partytwo']; ?></td>
<td> </td>
<td><?php echo $this->Html->link($relationship['Relationship']['partyone'], array('action'=>'approve', $relationship['Relationship']['id'])); ;?>
</td>
</tr>
<?php endforeach; ?>
</table>
答案 0 :(得分:0)
尝试使用set语句:
$this->set('Relationships', $this->Relationship->find('all',
array('conditions' => array(
'Relationship.partytwo' => $userid,
'Relationship.active' => false)
)
));