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

33 lines
959 B
PHP
Raw Normal View History

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