Welcome Guest, Not a member yet? Register   Sign In
Code Iginter Core subclassing
#5

[eluser]reaktivo[/eluser]
[quote author="blasto333" date="1224572853"]What I did is create a base controller that all Admin controllers extend, so that functionality is taken care of.

Secure_Area
Code:
<?php
class Secure_Area extends Controller
{
    /*
    Controllers that are considered secure extend Secure_Area, optionally a $module_id can
    be set to also check if a user can access a particular module in the system.
    */
    function __construct($module_id=null)
    {
        parent::__construct();    
        
        if(!$this->Employee->is_logged_in())
        {
            redirect('login');
        }
        
        if(!$this->Employee->has_permission($module_id,$this->Employee->get_logged_in_employee_info()->person_id))
        {
            redirect('no_access/'.$module_id);
        }
    }
}
?>

Items controller

Code:
<?php
require_once ("Secure_Area.php");
class Items extends Secure_Area
{
    function __construct()
    {
        parent::__construct('items');    
    }
.
.
.    
}
?


I am not sure what you mean on the other question[/quote]


Hello, I was going to open a new thread, but seems I have the same problem, only that I'm subclassing a Model.

Using the code above as example, is there a way to subclass another subclass without using the line
Code:
require_once ("Secure_Area.php");
or loading the first subclass in the autoload? Is this the best way to subclass a subclass?


Messages In This Thread
Code Iginter Core subclassing - by El Forum - 10-20-2008, 06:12 PM
Code Iginter Core subclassing - by El Forum - 10-20-2008, 08:07 PM
Code Iginter Core subclassing - by El Forum - 10-21-2008, 01:38 PM
Code Iginter Core subclassing - by El Forum - 10-21-2008, 01:45 PM
Code Iginter Core subclassing - by El Forum - 10-23-2008, 03:25 AM
Code Iginter Core subclassing - by El Forum - 10-23-2008, 01:56 PM
Code Iginter Core subclassing - by El Forum - 10-23-2008, 08:04 PM
Code Iginter Core subclassing - by El Forum - 10-24-2008, 02:01 PM
Code Iginter Core subclassing - by El Forum - 10-24-2008, 02:40 PM



Theme © iAndrew 2016 - Forum software by © MyBB