Example #1
0
 /**
  * Render control
  */
 public function render()
 {
     $this->template->setFile(__DIR__ . "/Clipboard.latte");
     $this->template->setTranslator($this->system->translator);
     $this->template->clipboard = $this->system->session->get("clipboard");
     $this->template->rootname = FileSystem::getRootName();
     $this->template->render();
 }
Example #2
0
 /**
  * Create navigation structure
  *
  * @param string $dir Source directory in relative format
  *
  * @return array
  */
 protected function getNav($dir)
 {
     $var = array();
     $rootname = FileSystem::getRootName();
     if ($dir === $rootname) {
         $var[] = array("name" => $rootname, "link" => $this->link("openDir", $rootname));
     } else {
         $nav = explode("/", $dir);
         $path = "/";
         foreach ($nav as $item) {
             if ($item) {
                 $path .= "{$item}/";
                 $var[] = array("name" => $item, "link" => $this->link("openDir", $path));
             }
         }
     }
     return $var;
 }
Example #3
0
 /**
  * Constructor
  *
  * @param \Nette\Http\Request $request HTTP request
  * @param \Nette\Http\Session $session Session
  * @param array               $config  Custom configuration
  */
 public function __construct(Request $request, Session $session, $config = array())
 {
     parent::__construct();
     // Create system container with services and configuration
     $this->system = new FileManager\Application\Loader($session, $config);
     $this->system->freeze();
     // Get & validate actual dir
     $actualDir = $this->system->session->get("actualdir");
     $actualPath = $this->getAbsolutePath($actualDir);
     if (!is_dir($actualPath) || empty($actualDir)) {
         // Set root directory as default
         $actualDir = FileSystem::getRootname();
     }
     $this->setActualDir($actualDir);
     // Get selected files via POST
     $selectedFiles = $request->getPost("files");
     if (is_array($selectedFiles)) {
         $this->selectedFiles = $selectedFiles;
     }
     $this->invalidateControl();
 }
Example #4
0
 /**
  * Generate treeview html
  *
  * @return string
  */
 private function generateTreeview()
 {
     $dirs = $this->getDirTree($this->system->parameters["dataDir"]);
     $rootname = FileSystem::getRootName();
     $output = '<ul class="filetree">';
     $output .= '<span class="fm-droppable" data-move-url="' . $this->getComponent("control-Content")->link("move") . '" data-targetdir="' . $rootname . '">';
     $output .= '<a href="' . $this->link("openDir", $rootname) . '" class="ajax treeview-directory fm-root-icon" title="' . $rootname . '">';
     $output .= $rootname;
     $output .= '</a></span>';
     $output .= $this->generateTree($dirs, null);
     $output .= '</ul>';
     return $output;
 }
Example #5
0
 /**
  * Render control
  */
 public function render()
 {
     $this->template->setFile(__DIR__ . "/{$this->view}.latte");
     $this->template->setTranslator($this->system->translator);
     $this->template->files = $this->loadData($this->getActualDir(), $this->system->session->get("mask"), $this->view, $this->system->session->get("order"));
     $this->template->actualdir = $this->getActualDir();
     $this->template->rootname = FileSystem::getRootName();
     $this->template->view = $this->view;
     $this->template->resUrl = $this->system->parameters["resUrl"];
     $this->template->resDir = $this->system->parameters["resDir"];
     $this->template->timeFormat = $this->system->translator->getTimeFormat();
     // Load plugins
     if ($this->system->parameters["plugins"]) {
         $this->template->plugins = array();
         foreach ($this->system->parameters["plugins"] as $plugin) {
             if (in_array("context", $plugin["integration"])) {
                 $this->template->plugins[] = $plugin;
             }
         }
     }
     $this->template->render();
 }