77 lines
1.4 KiB
PHP
77 lines
1.4 KiB
PHP
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
/**
|
|
* Description of Files_model
|
|
*
|
|
* @author Theo Weijmer
|
|
* @date juni 11, 2013 4:13 PM
|
|
*
|
|
*
|
|
*
|
|
*/
|
|
|
|
|
|
class Documents_model extends MY_Model{
|
|
|
|
|
|
protected $tablename = 'tb_documents';
|
|
|
|
|
|
function __construct(){
|
|
parent::__construct();
|
|
$models = array('ijkpartituur/Doctypes_model');
|
|
$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->original = $record->document_original;
|
|
$details->name = $record->document_name;
|
|
$details->extension = $record->document_extension;
|
|
$details->size = $record->document_size;
|
|
$details->doctypeid = $record->document_doctype_id;
|
|
$details->doctype = $this->Doctypes_model->get_single_detail(array('id'=>$record->document_doctype_id));
|
|
|
|
return $details;
|
|
}
|
|
|
|
function table_def(){
|
|
$this->sql = "
|
|
|
|
";
|
|
|
|
}
|
|
|
|
} |