<?php
defined('BASEPATH') OR exit('No direct script access allowed');

if ( ! function_exists('active_link_controller'))
{
    function active_link_controller($controller)
    {
        $CI    =& get_instance();
        $class = $CI->router->fetch_class();

        return ($class == $controller) ? 'active' : NULL;
    }
}


if ( ! function_exists('active_link_function'))
{
    function active_link_function($controller)
    {
        $CI    =& get_instance();
        $class = $CI->router->fetch_method();

        return ($class == $controller) ? 'active' : NULL;
    }
}

if ( ! function_exists('menu_habilitado'))
{
    function menu_habilitado($valor)
    {
        if ($_SESSION['grupos'] != NULL) {
            foreach ($_SESSION['grupos'] as $value) {
                if ($valor == $value) {
                    return true;
                }
            }
        }else{
            return false;    
        }

        
    }
}


if ( ! function_exists('grupo_usuario'))
{
    function grupo_usuario($valor)
    {
        if ($_SESSION['user_groups'] != NULL) {
            foreach ($_SESSION['user_groups'] as $value) {
                if ($valor == $value) {
                    return true;
                }
            }
        }else{
            return false;    
        }

        
    }
}

if ( ! function_exists('no_grupo_usuario'))
{
    function no_grupo_usuario($valor)
    {
        if ($_SESSION['user_groups'] != NULL) {
            foreach ($_SESSION['user_groups'] as $value) {
                if ($valor != $value) {
                    return true;
                }
            }
        }else{
            return false;    
        }

        
    }
}