This commit is contained in:
4ngle 2010-07-06 06:38:27 +00:00
parent 30f5f9edbd
commit 33e2632543
1 changed files with 9 additions and 12 deletions

View File

@ -4,32 +4,29 @@ class FilelistController extends Zend_Controller_Action {
$uuid=$this->_request->getParam('uuid'); $uuid=$this->_request->getParam('uuid');
$filelist=new FilelistTable(); $filelist=new FilelistTable();
$adapter=$filelist->getAdapter(); $adapter=$filelist->getAdapter();
$db=$adapter->query("select file_name,file_path,id,meta_uuid from westdc_fileinfo where meta_uuid='$uuid' and depth=1 order by isdir desc,file_name"); $db=$adapter->query("select file_name,file_path,id,meta_uuid from westdc_fileinfo where meta_uuid='$uuid' order by id");
$files=$db->fetchAll(); $files=$db->fetchAll();
$documents=array(); $documents=array();
$i=0; $i=0;
foreach($files as $file) { foreach($files as $file) {
$fileName=$file['file_name']; $fileName=$file['file_name'];
if($fileName!=='/uuid.txt') {
$pathArray=explode("/",$fileName); $pathArray=explode("/",$fileName);
if(empty($pathArray[2])) { if(empty($pathArray[2])) {
$documents[$i] = $file; $documents[$i] = $file;
$i++; $i++;
} }
} }
}
$this->_helper->layout()->disableLayout(); $this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(); $this->_helper->viewRenderer->setNoRender();
echo Zend_Json::encode($documents); echo Zend_Json::encode($documents);
} }
function subAction() { function subAction() {
$uuid=$this->_request->getParam('uuid'); $uuid=$this->_request->getParam('uuid');
$getUrl=$this->_request->getParam('subpath'); $id=$this->_request->getParam('id');
$subPath=urldecode($getUrl);
$depth=substr_count($subPath,'/');
$filelist=new FilelistTable(); $filelist=new FilelistTable();
$adapter=$filelist->getAdapter(); $adapter=$filelist->getAdapter();
$db=$adapter->query("select file_name,file_path,id,meta_uuid from westdc_fileinfo where meta_uuid='$uuid' and depth='$depth' and file_name ilike '$subpath%' order by isdir desc,file_name"); $subPath=$adapter->fetchOne("select file_name from westdc_fileinfo where id='$id'");
$db=$adapter->query("select file_name,file_path,id,meta_uuid from westdc_fileinfo where meta_uuid='$uuid' order by id");
$files=$db->fetchAll(); $files=$db->fetchAll();
$documents=array(); $documents=array();
$i=0; $i=0;