PHP File Manager
Editing File: Report.php
<?php /* * Copyright (C) Wayne Purton-Smith - All Rights Reserved * Unauthorized copying of this file or removing this paragraph, via any medium is strictly prohibited * Proprietary and confidential * Written by Wayne Purton-Smith <waynepurtonsmith@hotmail.co.uk> February 2014 */ class Report extends CI_Controller { function __construct() { parent::__construct(); $this->load->model('reports'); $this->users->denyRestricted('orders', 'customers'); } public function index($mode = NULL) { if($this->input->post('generate_report')) { $this->reports->generate(NULL, $this->input->post('report_name'), $this->input->post('report_from'), $this->input->post('report_to')); redirect('/reports'); exit; } $viewing_month = ($mode == 'year' && $this->uri->segment(3) !== NULL); $date_from = NULL; $date_to = NULL; if($viewing_month) { $date_from = strtotime('1st ' . $this->uri->segment(3) . ' ' . $this->uri->segment(2) . ' 00:00:00'); $date_to = strtotime('last day of this month 23:59:59', $date_from); } $head_data['page_title'] = 'Reports'; $this->load->view('header', $head_data); $data['reports'] = $this->reports->get(NULL, array ( 'date_from' => $date_from, 'date_to' => $date_to ), $mode); $data['viewing_month'] = $viewing_month; $this->load->view('reports/overview', $data); $this->load->view('footer'); } public function templates($mode = NULL) { $head_data['page_title'] = 'Report templates'; $this->load->view('header', $head_data); $data['templates'] = $this->reports->templates(); $this->load->view('reports/templates', $data); $this->load->view('footer'); } public function edit($template_id = 0) { } public function delete($report_id = 0) { $this->reports->delete($report_id); redirect('/reports'); } public function download($report_id = 0) { $this->reports->download($report_id); } }
Cancel