Exemple #1
0
 /**
  * Gets the default view of this controller as snippet while providing it with all the collected data
  * without interfering with the {@link #result}.
  * @param  string $path to the files to browse in the filebrowser
  * @return Snippet The default view of this controller as Snippet.
  */
 public function getSnippet($base, $id = '')
 {
     $rebase = $this->buildBase($base, $id);
     $snippet = new Snippet($this->getTemplatePath('default'));
     $path = $rebase;
     if (!empty($this->jail)) {
         $path = jailpath($this->jail, $path);
     }
     // ... which retrieves its data from our result
     $data = array();
     $data['base'] = $rebase;
     $data['files'] = $this->files;
     $data['up_dir'] = $data['base'] !== '/';
     $data['actionUrl'] = $this->actionUrl;
     $data['controls'] = array('copy' => $this->controlCopy, 'move' => $this->controlMove, 'delete' => $this->controlDelete, 'rename' => $this->controlRename, 'refresh' => $this->controlRefresh, 'upload' => $this->controlUpload, 'mkdir' => $this->controlMkdir, 'custom' => $this->controlCustom);
     $snippet->setData($data);
     return $snippet;
 }