Пример #1
0
 /**
  * Get fieldset for files
  * @return \FormularFieldset
  */
 private function getFilesFieldset()
 {
     $Fieldset = new FormularFieldset(__('Unused files'));
     $Fieldset->addFileBlock($this->getBlockForFiles('../data/import/'));
     $Fieldset->addFileBlock($this->getBlockForFiles('../data/log/'));
     $Fieldset->addFileBlock($this->getBlockForFiles('../data/backup-tool/backup/'));
     $Fieldset->addFileBlock($this->getBlockForFiles('../data/backup-tool/import/'));
     $Fieldset->addBlock('<input type="submit" value="' . __('Clear directories') . '">');
     $Fieldset->setCollapsed();
     return $Fieldset;
 }
 /**
  * Display list with files 
  */
 protected function displayList()
 {
     $ListOfFiles = $this->getExistingFiles();
     $Fieldset = new FormularFieldset(__('Export data'));
     if (empty($ListOfFiles)) {
         $Fieldset->addFileBlock('<em>You did not export anything.</em>');
     } else {
         foreach ($ListOfFiles as $File) {
             $String = '';
             $FileNameParts = explode('-', $File);
             $Year = isset($FileNameParts[3]) ? $FileNameParts[3] : '';
             if (strlen($Year) == 8) {
                 $String .= '<strong>' . substr($Year, 6, 2) . '.' . substr($Year, 4, 2) . '.' . substr($Year, 0, 4) . ':</strong> ';
             }
             $String .= $File;
             $String .= ', ' . Filesystem::getFilesize(FRONTEND_PATH . $this->BackupPath . $File);
             $Fieldset->addFileBlock('<a href="inc/' . $this->BackupPath . $File . '" target="_blank">' . $String . '</a>');
         }
     }
     if ($this->importIsOnProgress) {
         $Fieldset->setCollapsed();
     }
     $Formular = new Formular();
     $Formular->setId('backup-list');
     $Formular->addFieldset($Fieldset);
     $Formular->display();
 }
Пример #3
0
 /**
  * Get fieldset for files
  * @return \FormularFieldset
  */
 private function getFilesFieldset()
 {
     $Fieldset = new FormularFieldset(__('Unused files'));
     $Fieldset->addFileBlock($this->getBlockForFiles('/import/files/'));
     $Fieldset->addFileBlock($this->getBlockForFiles('/export/files/'));
     $Fieldset->addFileBlock($this->getBlockForFiles('../log/'));
     $Fieldset->addFileBlock($this->getBlockForFiles('../plugin/RunalyzePluginTool_DbBackup/backup/'));
     $Fieldset->addFileBlock($this->getBlockForFiles('../plugin/RunalyzePluginTool_DbBackup/import/'));
     $Fieldset->addBlock('<input type="submit" value="' . __('Clear directories') . '">');
     $Fieldset->setCollapsed();
     return $Fieldset;
 }
Пример #4
0
 /**
  * Display exported files
  */
 protected function displayExportedFiles()
 {
     $ListOfFiles = $this->getExistingFiles();
     $Fieldset = new FormularFieldset(sprintf(__('Up to now you have exported <strong>%d</strong> trainings.'), count($ListOfFiles)));
     if (strlen(Request::param('delete')) > 0) {
         $index = (int) Request::param('delete');
         if (!isset($ListOfFiles[$index - 1])) {
             $Fieldset->addWarning('Don\' do that!');
         } else {
             $Fieldset->addInfo(__('The file has been removed.'));
             Filesystem::deleteFile('export/files/' . $ListOfFiles[$index - 1]);
             unset($ListOfFiles[$index - 1]);
         }
     } else {
         $Fieldset->setCollapsed();
     }
     if (empty($ListOfFiles)) {
         $Fieldset->addFileBlock('<em>' . __('You did not export any training.') . '</em>');
     } else {
         foreach ($ListOfFiles as $i => $File) {
             $String = $File . ', ' . Filesystem::getFilesize(FRONTEND_PATH . 'export/files/' . $File);
             $Link = '<a href="inc/export/files/' . $File . '" target="_blank">' . $String . '</a>';
             $Delete = Ajax::window('<a class="right small" href="' . self::$URL . '?id=' . $this->TrainingID . '&delete=' . ($i + 1) . '">[' . __('delete') . ']</a>', 'small');
             $Fieldset->addFileBlock($Delete . $Link);
         }
     }
     $Formular = new Formular();
     $Formular->setId('export-list');
     $Formular->addFieldset($Fieldset);
     $Formular->display();
 }