westdc-zf1/application/default/controllers/FilelistController.php

33 lines
959 B
PHP

<?php
class FilelistController extends Zend_Controller_Action {
function indexAction() {
$uuid=$this->_request->getParam('uuid');
$filelist=new FilelistTable();
$adapter=$filelist->getAdapter();
$db=$adapter->query("select file_name,file_path,id,meta_uuid from westdc_fileinfo where meta_uuid='$uuid' order by id");
$files=$db->fetchAll();
$documents=array();
$i=0;
foreach($files as $file){
$fileName = $file['file_name'];
$filePath = $file['file_path'];
$id = $file['id'];
if($fileName!=='/uuid.txt'){
$pathArray = explode("/",$fileName);
if(substr($fileName,-1)=='/'&&empty($pathArray[2])){
$documents[$i] = $file;
$i++;
}else{
if(empty($pathArray[2])){
$documents[$i]=$file;
$i++;
}
}
}
}
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
echo Zend_Json::encode($documents);
}
}