<?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>
 ********************************************************************************/
 $auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
{
	$loginUserId = $auth->getStorage()->read()->id;
	$loginuserGroup = $auth->getStorage()->read()->group_id;
	$loginuserRole = $auth->getStorage()->read()->emprole;
}
if (count($this->messages)) 
 {
 ?>
	<div id="dispmsgepsettings" class="settingssuccess">
 <?php 
	foreach ($this->messages as $message)
	{
		if(!empty($message))
		{
			$flag = array_keys($message);
			echo "<div id='messageData' class='ml-alert-1-$flag[0]'><div style='display:block;'><span class='style-1-icon $flag[0]'></span>";
			echo $message[$flag[0]];
			echo "</div></div>";
		}
	} 
?>   
	</div>	
<?php 
} 
?>
<?php echo sapp_Helper::popup_helper('allexitproc');?>
<span id="error_message"></span>

<?php 
if($this->call != 'ajaxcall'){
if($loginuserRole == SUPERADMINROLE || $loginuserGroup == HR_GROUP || $loginuserGroup == MANAGEMENT_GROUP)
{
?>
<div class="count_new_dis_par"  title="Overall Status Count">
<div  class="count_new_dis" id="all_rec" onClick="displayallexitdata('<?php echo sapp_Global::_encrypt(1);?>','allexitproc');"><span>All</span><br><label><?php echo $this->allcount;?></label></div>
<div  class="count_new_dis" id="pending_rec" onClick="displayallexitdata('<?php echo sapp_Global::_encrypt(4);?>','allexitproc');"><span>Pending</span><br><label><?php echo $this->pendingexitcount;?></label></div>
<div  class="count_new_dis" id="approved_rec" onClick="displayallexitdata('<?php echo sapp_Global::_encrypt(2);?>','allexitproc');"><span>Approved</span><br><label><?php echo $this->approvedcount;?></label></div>
<div  class="count_new_dis" id="rejected_rec" onClick="displayallexitdata('<?php echo sapp_Global::_encrypt(3);?>','allexitproc');"><span>Rejected</span><br><label><?php echo $this->rejectedexitcount;?></label></div>
</div>
<?php 
}
}
?>

<?php

if($this->call == 'ajaxcall'){
	$div = ''; $endDiv = ''; 
} else { 
	$div = '<div id="grid_'.$this->dataArray[0]['objectname'].'" class="all-grid-control">'; $endDiv = '</div>';
}
	echo $div.'<div id="msg" style="display:none;font-style: oblique; font-weight: bold; color: green;""></div>'.$this->grid($this->dataArray[0]).$endDiv;
?>
<script type='text/javascript'>
$(document).ready(function(){
<?php if (count($this->messages)) {?>
      setTimeout(function(){
			$('#dispmsgepsettings').fadeOut('slow');
		},3000);
<?php } 
?>
});
<?php 
if($this->status == sapp_Global::_encrypt(1)){ ?>

        $('#all_rec').addClass('count_new_dis_active');
   
<?php }?>
<?php if($this->status == sapp_Global::_encrypt(2)){ ?>

        $('#approved_rec').addClass('count_new_dis_active');
   
<?php }?>
<?php if($this->status == sapp_Global::_encrypt(3)){ ?>

        $('#rejected_rec').addClass('count_new_dis_active');
   
<?php }?>
<?php if($this->status == sapp_Global::_encrypt(4)){ ?>

        $('#pending_rec').addClass('count_new_dis_active');
   
<?php }?>
function displayallexitdata(id,controllername)
{
	if(id)
	{
	 window.location.href = base_url+'/exit/'+controllername+'/index/con/'+id;
	}
}

</script>