function checkCaseFile($caseid) { App::import('Model', 'CaseFile'); $CaseFile = new CaseFile(); $CaseFile->recursive = -1; $caseFiles = $CaseFile->find('count', array('conditions' => array('CaseFile.easycase_id' => $caseid, 'CaseFile.comment_id !=' => 0, 'CaseFile.isactive' => 1), 'fields' => 'DISTINCT CaseFile.id')); return $caseFiles; }
function getAllCaseFiles($pid, $cno) { if (!$pid || !$cno) { return false; } App::import('Model', 'CaseFile'); $CaseFile = new CaseFile(); $CaseFile->bindModel(array('belongsTo' => array('Easycase' => array('className' => 'Easycase', 'foreignKey' => 'easycase_id'))), false); $filesArr = $CaseFile->find('all', array('conditions' => array('Easycase.project_id' => $pid, 'Easycase.case_no' => $cno, 'CaseFile.isactive' => 1), 'fields' => array('CaseFile.id', 'CaseFile.file', 'CaseFile.file_size', 'CaseFile.downloadurl', 'Easycase.actual_dt_created'), 'order' => array('Easycase.actual_dt_created DESC', 'CaseFile.file ASC'))); return $filesArr; }