I am trying to create a registry information system that will record different households of an area. My tables are tbl_household, tbl_person (the member of the household), tbl_officer (the local officer of the area this will manage the data and a member of tbl_person), tbl_voter (the voters among the person in the table person). So the system should record the household with members from the tbl_person and person can be a officer or a voter or both.
I already create the CRUD functionality using GII but i don’t know how to establish the relation between two tables. When I select the specified household ID I want it to display a button that will redirect to the list of person who have the same household ID in short its family members cause. I tried to create a button this way
<?php
/* @var $this HouseholdController */
/* @var $model Household */
$this->breadcrumbs=array(
'Households'=>array('index'),
$model->household_id,
);
$this->menu=array(
array('label'=>'List Household', 'url'=>array('index')),
array('label'=>'Add Household', 'url'=>array('create')),
array('label'=>'Update Household', 'url'=>array('update', 'id'=>$model->household_id)),
array('label'=>'Delete Household', 'url'=>'#', 'linkOptions'=>array('submit'=>array('delete','id'=>$model->household_id),'confirm'=>'Are you sure you want to delete this item?')),
array('label'=>'Manage Household', 'url'=>array('admin')),
//this is the code I added that will display the list of persons
array('lable'=>'View Family Member', 'url'=>array('/person/view')),
array('lable'=>'Manage Family Member', 'url'=>array('/person/admin')),
);
?>
<h1>View Household ID: <?php echo $model->household_id; ?></h1>
<?php $this->widget('zii.widgets.CDetailView', array(
'data'=>$model,
'attributes'=>array(
'household_id',
'family_name',
'family_size',
'income_source',
'purok',
'house_num',
'block_num',
),
)); ?>
I know this is wrong cause this will only redirect the user to the person view page. I want to display the sorted by household ID in the person table with the same ID in the household table. I want to know if i can add some ‘visible’=>only the household ID = $this household ID. Is there anyway you can help me with this?