Files
2021-07-10 16:25:16 +02:00

82 lines
1.8 KiB
PHP

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Description of Reports_model
*
* @author Theo Weijmer
* @date juni 29, 2013 2:06 PM
*
*
*
*/
class Reports_model extends MY_Model{
protected $tablename = 'tb_reports';
function __construct(){
parent::__construct();
$models = array();
$this->load->model($models);
}
function get_details($where){
$records = $this->get_records_where($where);
$details = $this->get_records_details($records);
return $details;
}
function get_records_details($records){
if($records){
foreach($records as $record){
$details[] = $this->get_record_details($record);
}
}
if(!isset($details)) $details = FALSE;
return $details;
}
function get_single_detail($where){
$record = $this->get_records_where($where, TRUE);
$details = $this->get_record_details($record);
return $details;
}
function get_record_details($record){
$details = new stdClass;
$details->id = $record->id;
$details->name = $record->report_name;
$details->level = $record->report_level;
$details->functie = $record->report_function;
return $details;
}
function get_reports_by_level(){
$this->sql = "
SELECT id, report_name as name, report_level as level, report_function as functie
FROM tb_reports R
WHERE (SELECT {$this->userrole} & report_level)!=0
ORDER BY volgorde";
$records = $this->get_query_result();
// return $this->get_records_details($records);
return $records;
}
function table_def(){
$this->sql = "
";
}
}