Am I using MVC Codeigniter correctly? I'm currently writing Report's system. I have about 20 different users with different access.
Am I doing it correctly? Can I improve my style of writing this code? All my reports based on the same structure.

In my Report's Controller:

function my_report_name() 
    {
        //current week by default
        $dates['from'] = $this-&gt;uri-&gt;segment(3,date('Y-m-d',strtotime(date('o-\\WW'))-60*60*24*7)); 
        $dates['to'] = $this-&gt;uri-&gt;segment(4,date("Y-m-d", strtotime($dates['from']) + 6 * 24* 60 * 60));

        $data['report_name']=$this-&gt;Reports_model-&gt;getMyReportDescriptionSummary($dates);

        $data['title'] = "My Report Name Description";
        //view in 'view/report' folder to use
        //name of view always the same as name of function
        $data['main'] = "report/my_report_name";
        $data['menuReport'] = "class='current'";
        $data['panel'] = "panel/panel";

        $this-&gt;load-&gt;vars($data);
        //load template
        $this-&gt;load-&gt;view('template/t_main_full', $data);

    }


In my Model:

function getMyReportDescriptionSummary($dates)
    {
        $this-&gt;db-&gt;select("some_data,
                           some_data_2,
                           some_data_3"
                          );
        $this-&gt;db-&gt;join("table1");
        $this-&gt;db-&gt;join("table2");
        $this-&gt;db-&gt;where("some_params");
        $Q = $this-&gt;db-&gt;get();

        if($Q-&gt;num_rows() &gt; 0)
        {
            return $Q-&gt;result_array();
        }
        else
        {
            return false;
        }
    }


In my repots layout page:

//function to check permissions
&lt;? if($this-&gt;Model_Users-&gt;accessVerify('my_report_name')) {?&gt;
&lt;tr&gt;My report&lt;/tr&gt;
&lt;?}?&gt;
From a CodeIgniter point of view, this is fine but CI isn't really MVC. in MVC proper, the controller would be doing very little (See: https://stackoverflow.com/questions/13813046/how-is-mvc-supposed-to-work-in-codeigniter ). However in CodeIgniter's implementation you still want to strive for "Fat model, thin controller", which you're doing for the most part. This will give you far greater reusability as the logic isn't tied to a specific controller. I'd argue that most of the things in the $data array are actually stateful or display logic (e.g. which panel to display) so don't belong in the controller.

MVC strives for a high separation of concerns with reusable components and although CodeIgniter goes against this philosophy slightly, you can still work around it. Keep your views and models reusable.