<?php 
/********************************************************************************* 
 *  This file is part of Sentrifugo.
 *  Copyright (C) 2014 Sapplica
 *   
 *  Sentrifugo is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Sentrifugo is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Sentrifugo.  If not, see <http://www.gnu.org/licenses/>.
 *
 *  Sentrifugo Support <support@sentrifugo.com>
 ********************************************************************************/
?>

<?php 
if($this->nodata != '')
{
?>
<div class="ml-alert-1-info m1-info-set-2">
    <div class="style-1-icon info"></div>
       No data found.
</div>
<?php 
}
else 
{
$group_arr = $this->group_arr;
$data = $this->data;
?>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
        
   function getaccordion_content(role_id,group_id,pri_val)
   {
        $.post(base_url+"/roles/getgroupmenu/format/html",{role_id:role_id,group_id:group_id,pri_val:pri_val,disabled:"disabled"},function(data){
            $('#idaccordion_content').html(data);
        },'html');
   }
      
    var pri_val = $('#id').val();    
    getaccordion_content('<?php echo isset($data['id'])?$data['id']:"";?>','<?php echo isset($data['group_id'])?$data['group_id']:"";?>',pri_val);

});//end of ready function

</script>

<div id="error_message" style="display:none;"></div>

    <input type="hidden" name="hidgroup_value" id="idhidgroup_value" value="<?php echo isset($data['group_id'])?$data['group_id']:"1";?>" />
    <?php echo $this->form->id;  ?>

<div class="poc-ui-data-control">
<div class="left-block-ui-data">
    <div class="agency-ui">
            <ul class="group_disp_ul">
    <?php 
        
        $data_group_id = isset($data['group_id'])?$data['group_id']:"1";
        $i = 1;
        foreach($group_arr as $group_id => $group_arr)
        {
            if($data_group_id == $group_id)
                $group_class = "group_selected_cls";
            else 
                $group_class = "";
            
    ?>      <li li-order ='<?php echo $i;?>' id="idgroup<?php echo $group_id;?>" rcount="<?php echo $group_arr['cnt'];?>" group_id="<?php echo $group_id;?>" role_id ="<?php echo ($group_id == 1)?"1":"";?>" class="<?php echo $group_class;?>"><?php echo $group_arr['group_name'];?> (<?php echo $group_arr['cnt'];?>)</li>
    <?php 
            $i++;
        }
        ?>
            </ul>
    </div>
</div> 

<div class="right-block-data <?php echo ($data_group_id == 1)?"right-over-border":"";?>">  
	<?php
	$msgtitle = $this->controllername.'_delete';
	sapp_Helper::editdeleteForView(ROLES,$this->controllername,$this->id,$msgtitle);	
	?> 
  <?php 
sapp_Helper::viewHeader();
sapp_Helper::viewBody('alt','Role Name',(!empty($this->data['rolename']))?$this->data['rolename']:"...",'Role Type',(!empty($this->data['roletype']))?$this->data['roletype']:"...");
sapp_Helper::viewBody('nor','Role Description',(!empty($this->data['roledescription']))?$this->data['roledescription']:"...",'','');
sapp_Helper::viewFooter();
?>
    
<div class="form-body-header">Privileges</div>
	<div id="idaccordion_content"></div>
   
</div>   
</div>
	<!--<div class="new-form-ui-submit">
		<input type="submit" onclick="changeeditscreen('<?php //echo $this->controllername;?>',<?php //echo $this->id;?>);" value="Edit" />
		<button onclick="window.location.href='<?php //echo BASE_URL; ?>roles';" type="button" id="Cancel" name="Cancel">Cancel</button>
		</div>-->
    <?php 
}
?>