Welcome Guest, Not a member yet? Register   Sign In
Organizing Your Controllers into Sub-folders
#5

[eluser]defectivereject[/eluser]
nope
each controller extends either a MY_Controller, a Public_controller or an Admin_controller

then each function within each controller has additional checks for Usertype built in.

and it's set in such a way so you know what folder deals with what modules on the CMS.
I say CMS but it's more of a business management system.
Handles 700 users with 16 access levels and 9 group access levels. as well as 70+ dept levels!!!

also if i get run over or die. someone coming in can see it organised a little more efficiently,

This folder controls that module, that folder controls that module.
Also
each folder could then be deleted and have no knock on effect to the rest of the system.
Code:
class Welcome extends Public_Controller {
        
    function __construct() {
        parent::__construct();

    }
                
    function index() {
        $data['main'] = 'home2';
        $data['title'] = 'Connected';
        $data['docs'] = $this->mdocs->get_latest_five();
        $data['no_tasks'] = $this->widgets->num_tasks();
        $data['no_messages'] = $this->widgets->num_messages();
        $data['no_events'] = $this->widgets->num_events();
        $data['dashevents']= $this->widgets->getdashevents();
        $data['mytasks'] = $this->widgets->showminedash();
        $data['peeps'] = $this->widgets->peeps_names();
        $data['safety_message'] = $this->widgets->safety_messages();
        $data['message'] = $this->session->flashdata('message');

        $data['uid'] = $this->session->userdata('uid');
        $data['usertype'] = $this->session->userdata('usertype');
        $data['sidebar'] = 'templates/newsitenav';
                
        $data['scripts'] = 'templates/scripts/sitescripts';
        $this->load->vars($data);
        $this->load->view('templates/sitetempaudit');
    }
Code:
<?php
if (! defined('BASEPATH')) exit('No direct script access');
class Administration extends Admin_Controller {

    function __construct() {
        parent::__construct();
    }
function backup() {
        $this->load->dbutil();
        $settings = array(
              'tables'      => array('tables'),
              'ignore'      => array('subscribers'),          
              'format'      => 'zip',             // gzip, zip, txt
              'filename'    => 'mybackup.sql',  
              'add_drop'    => TRUE,
              'add_insert'  => TRUE,
              'newline'     => "\n"
            );
        $backmeup =$this->dbutil->backup($settings);
        $this->load->helper('file');
        write_file('./backmeups/backup.zip', $backmeup);
        redirect('administration/index');

    }


Messages In This Thread
Organizing Your Controllers into Sub-folders - by El Forum - 07-05-2011, 04:59 AM
Organizing Your Controllers into Sub-folders - by El Forum - 07-05-2011, 05:33 AM
Organizing Your Controllers into Sub-folders - by El Forum - 07-05-2011, 09:14 AM
Organizing Your Controllers into Sub-folders - by El Forum - 07-05-2011, 09:26 AM
Organizing Your Controllers into Sub-folders - by El Forum - 07-05-2011, 09:32 AM
Organizing Your Controllers into Sub-folders - by El Forum - 07-05-2011, 09:51 AM
Organizing Your Controllers into Sub-folders - by El Forum - 07-05-2011, 09:53 AM



Theme © iAndrew 2016 - Forum software by © MyBB