Rights Page 17 may

view
-----------------------
<div class="modal-header" id="ModelHeader" >
<h4 class="modal-title">
Rights Management
</h4>
</div>

<div class="modal-body">
<div class="row">
<?php
foreach($model as $row_C)
{
?>
<div class="col-lg-3">
<div class="form-group">

<table border="1" class="mytble" >

<tr>
<td colspan="2" class="tblnm" >
<?php
echo $row_C->model_name;
?>
</td>
</tr>

<?php
if(!$Permission)
{
foreach($Model_And_Rights as $row_D)
{
if($row_D->model_id==$row_C->model_id)
{
?>
<tr>
<td><?php echo $row_D->rights_name; ?></td>
<td><input  type="checkbox" name="vehicle" value="<?php echo $row_D->rights_name; ?>" ></td>
</tr>

<?php
}
}
}
?>


<?php
foreach($Permission as $row_A)
{
//foreach($model_group as $row_A)

if($row_A->model_id==$row_C->model_id)
{
?>
<tr>
<td><?php echo $row_A->rights_name; ?></td>
<td><input  type="checkbox" name="vehicle" value="<?php echo $row_A->model_id; ?>" checked></td>
</tr>

<?php
}
// else
// {
// }

}


?>

</table>

</div>
</div>

<?php
}
?>
</div>
</div>

<div class="modal-footer">
<input type="submit" name="bulk_rights_submit" id="bulk_rights_submit" value="Update" class="btn btn-primary"/>
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div>




<style>
.mytble
{
text-align: center;
width: 80%;
border: 3px solid #337ab7;
}
.tblnm
{
height: 33px;
background-color: #337ab7;
color: #fff;
}
#ModelHeader
{
color: #000;
background-color: #cbbb8d;
border-color: #cbbb8d;
}
</style>


controller
----------------
public function Mas_Custom_Rights()
{

$UserTypeId = $this->input->post('id');
       $data['Model_And_Rights']= $this->admin_model->mas_model_rights_group();
$data['model']= $this->admin_model->mas_model();
$data['Permission']= $this->admin_model->mas_permission($UserTypeId);
$this->load->view('admin/mas_rights' , $data );
}

---------------------------

model


function mas_model_rights_group()
{

$this->db->from('mas_model_rights_group');
$this->db->join('mas_model', 'mas_model_rights_group.model_id = mas_model.model_id');
$this->db->join('mas_rights', 'mas_model_rights_group.rights_id = mas_rights.rights_id');
// $this->db->where('user_type_id', $UserTypeId);
$query = $this->db->get();
return $query->result();
}



function mas_model()
{
$this->db->select('*');
$this->db->from('mas_model');
$query=$this->db->get();
return $query->result();
# return $result=$query->row();
}

function mas_permission($UserTypeId)
{

$this->db->from('mas_permission');
$this->db->join('mas_model', 'mas_permission.model_id = mas_model.model_id');
$this->db->join('mas_rights', 'mas_permission.rights_id = mas_rights.rights_id');
$this->db->where('user_type_id', $UserTypeId);
$query = $this->db->get();
return $query->result();
}

Comments