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->uri->segment(3,date('Y-m-d',strtotime(date('o-\\WW'))-60*60*24*7)); $dates['to'] = $this->uri->segment(4,date("Y-m-d", strtotime($dates['from']) + 6 * 24* 60 * 60)); $data['report_name']=$this->Reports_model->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->load->vars($data); //load template $this->load->view('template/t_main_full', $data); } In my Model: function getMyReportDescriptionSummary($dates) { $this->db->select("some_data, some_data_2, some_data_3" ); $this->db->join("table1"); $this->db->join("table2"); $this->db->where("some_params"); $Q = $this->db->get(); if($Q->num_rows() > 0) { return $Q->result_array(); } else { return false; } } In my repots layout page: //function to check permissions <? if($this->Model_Users->accessVerify('my_report_name')) {?> <tr>My report</tr> <?}?>