* @license PHP License * @package WB * @subpackage content */ /** * Load required class */ WBClass::load( 'WBContent' , 'WBCache' , 'WBVFS_File' ); /** * Content component: FileBrowser * * * * @version 0.1.0 * @package WB * @subpackage content */ class WBContent_FileBrowser extends WBContent { /** * my parameter list * @var array */ protected $config = array( 'tmpl' => 'list', 'action' => 'dir', 'dir' => 0, 'parent' => 0, 'user' => 501, ); /** * vfs file * @var WBVFS_File */ protected $file; /** * vfs explorer * @var WBVFS_Explorer */ protected $explorer; /** * start VFS objects * * */ protected function startVFS() { if ($this->file) { return; } $param = array( 'user' => $this->config['user'] ); $this->file = WBClass::create('WBVFS_File', $param); $this->explorer = WBClass::create('WBVFS_Explorer', $param); } /** * run * * run component * * @return array parameter list */ public function run() { $this->startVFS(); $dir = $this->config['dir']; if (empty($dir)) { $dir = null; } switch ($this->config['action']) { case 'file'; $list = $this->file->listDir($dir); break; case 'dir'; if ($this->config['parent']) { $dir = $this->explorer->getParentDir($dir); } $list = $this->explorer->lsDir($dir); break; } $this->loadTemplates($this->config['tmpl']); $this->tmpl->addGLobalVars($this->explorer->getDir($dir), 'cwd_'); $this->tmpl->addRows('list', $list); return $this->config; } /** * receive output * * fetch output of this content component * * @return string */ public function getString() { /* $this->loadTemplates($this->config['tmpl']); $this->tmpl->addGLobalVars($this->channel['info'], 'channel_'); $this->tmpl->addRows('item', $this->channel['items']); */ return $this->tmpl->getParsedTemplate('snippet'); } } ?>