policybot/application/helpers/custom_helper.php
2021-11-30 16:26:55 +05:30

67 lines
1.8 KiB
PHP

<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
/**
* CodeIgniter
*
* An open source application development framework for PHP 5.1.6 or newer
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
* @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
* @license https://codeigniter.com/user_guide/license.html
* @link https://codeigniter.com
* @since Version 1.0
* @filesource
*/
// ------------------------------------------------------------------------
/**
* CodeIgniter Path Helpers
*
* @package CodeIgniter
* @subpackage Helpers
* @category Helpers
* @author ExpressionEngine Dev Team
* @link https://codeigniter.com/user_guide/helpers/xml_helper.html
*/
// ------------------------------------------------------------------------
//Set Default Time Zone as India
//date_default_timezone_set('NZ');
//check page access - STARTS
if (!function_exists('checkpageaccess')) {
function checkpageaccess($role,$userid,$module,$submodule,$page) {
$CI = & get_instance();
$page_access_module=$CI->commonsql_model->page_access_check($role,$userid,$module,$submodule,$page);
//echo $CI->db->last_query();
if($page_access_module->num_rows()>0){
return TRUE;
}else{
return FALSE;
}
}
}
function times_counter($time){
$seconds = 0;
foreach($time as $t)
{
$new=$t.":00";
$timeArr = array_reverse(explode(":", $new));
foreach ($timeArr as $key => $value)
{
if ($key > 2) break;
$seconds += pow(60, $key) * $value;
}
}
$hours = floor($seconds / 3600);
$mins = floor(($seconds - ($hours*3600)) / 60);
//$secs = floor($seconds % 60);
echo $hours.':'.$mins;
}