<?php
function canILogin($id_emp, $TrunkDate, $endDate) { //použité
	$CI =& get_instance();	
	$CI->load->model('model_employee');
	return $CI -> model_employee-> canILogin($id_emp, $TrunkDate, $endDate);
} 

function hasFreeSlots($id_inv){ //použité
	$CI =& get_instance();	
	$CI->load->model('model_employee');
	$empOnInv = $CI -> model_employee-> getCountEmployeesOnInventory($id_inv);
	$maxEmpOnInv = $CI -> model_employee-> getMaxEmployeesOnInventory($id_inv);
	if($empOnInv==$maxEmpOnInv){
		return FALSE;
	} else {
		return TRUE;
	}
}

function numberOfFreeSlots($id_inv){ //použité
	$CI =& get_instance();	
	$CI->load->model('model_employee'); 
	$empOnInv = $CI -> model_employee-> getCountEmployeesOnInventory($id_inv);
	$maxEmpOnInv = $CI -> model_employee-> getMaxEmployeesOnInventory($id_inv);
	return $maxEmpOnInv-$empOnInv;	
}

function amILoggedThere($id_inv, $id_emp){ //použité
	$CI =& get_instance();	
	$CI->load->model('model_employee');
	return $CI -> model_employee-> amILoggedThere($id_inv, $id_emp);	
}

function showInventory($id_emp, $id_inv, $trunkDate, $endDate){ //použité
	if ((hasFreeSlots($id_inv)==TRUE) AND (canILogin($id_emp,$trunkDate,$endDate)==TRUE) AND (amILoggedThere($id_inv, $id_emp)==FALSE)){
		return TRUE;	
	} else {
		return FALSE;
	}		
}

function haveICompletedProfile($id_emp){
	$CI =& get_instance();	
	$CI->load->model('model_employee');
	return $CI -> model_employee-> haveICompletedProfile($id_emp);	
}

function getCountMyInventories($id_emp,$date){
	$CI =& get_instance();	
	$CI->load->model('model_employee');
	return $CI -> model_employee-> getCountMyInventories($id_emp,$date);
}

function getCountMyInventoriesDriver($id_emp,$date){
	$CI =& get_instance();	
	$CI->load->model('model_employee');
	return $CI -> model_employee-> getCountMyInventoriesDriver($id_emp,$date);	
}