public function indexAction() { $lm = $this->clientService->getClient(za()->getConfig('owning_company')); $path = "Clients/" . $lm->title . "/Accounts"; if ($this->_getParam('folder')) { $basePath = base64_decode($this->_getParam('folder')); if ($basePath != $path && $basePath != $path . "/" && strpos($basePath, $path) === 0) { // we've got a 'starts with' situation, so lets give the view a parent path to deal with $this->view->parentPath = dirname($basePath); } $path = $basePath; } // The target of a picker action. If set, we need to show the picker $this->view->picker = $this->_getParam('picker'); // Get all top level files $files = $this->fileService->listDirectory($path); $this->view->files = $files; if ($path == '/') { $this->view->base = ''; } else { $this->view->base = trim($path, '/') . '/'; } $this->renderView('filemanager/list.php'); }
/** * List files from a project * */ public function filelistAction() { $project = $this->byId($this->_getParam('projectid'), 'Project'); $client = $this->byId($project->clientid, 'Client'); $folder = $this->_getParam('folder', ''); $path = 'Clients/' . $client->title . '/Projects/' . $project->title; $projectPath = $path; $parent = ''; if ($folder != null && mb_strlen($folder)) { $path = base64_decode($folder); $parent = dirname($path); if ($path == $projectPath) { $parent = ''; } } $content = $this->cacheService->get($path); if (!$content) { $files = array(); try { $files = $this->fileService->listDirectory($path); } catch (Exception $e) { $this->log->err("Failed loading files from {$path}"); } $this->view->files = $files; $this->view->project = $project; if ($path == '/') { $this->view->base = ''; } else { $this->view->base = trim($path, '/') . '/'; } $this->view->parentPath = $parent; $content = $this->view->render('project/file-list.php'); $this->cacheService->store($path, $content); } $this->getResponse()->appendBody($content); }