|
20 | 20 |
|
21 | 21 | jimport('joomla.application.component.controller'); |
22 | 22 | use Joomla\Utilities\ArrayHelper; |
| 23 | +use Joomla\CMS\MVC\Controller\FormController; |
| 24 | +use Joomla\CMS\Factory; |
| 25 | +use Joomla\CMS\Uri\Uri; |
| 26 | + |
23 | 27 | JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_jtg/tables'); |
24 | 28 |
|
25 | 29 | /** |
|
29 | 33 | * @subpackage Frontend |
30 | 34 | * @since 0.8 |
31 | 35 | */ |
32 | | -class JtgControllerFiles extends JtgController |
| 36 | +class JtgControllerFiles extends FormController |
33 | 37 | { |
| 38 | + /** |
| 39 | + * View method for JTG |
| 40 | + * |
| 41 | + * This function override joomla.application.component.controller |
| 42 | + * View Cache not yet implemented in JTrackGallery |
| 43 | + * |
| 44 | + * @param boolean $cachable If true, the view output will be cached |
| 45 | + * @param array $urlparams An array of safe url parameters and their variable types |
| 46 | + * |
| 47 | + * @return void |
| 48 | + */ |
| 49 | + public function display($cachable = false, $urlparams = false) |
| 50 | + { |
| 51 | + require_once JPATH_COMPONENT . '/helpers/jtg.php'; |
| 52 | + // Load the submenu. |
| 53 | + JtgHelper::addSubmenu($this->getTask()); |
| 54 | + $input = Factory::getApplication()->input; |
| 55 | + switch ($this->getTask()) |
| 56 | + { |
| 57 | + default: |
| 58 | + $input->set('view', 'default'); |
| 59 | + break; |
| 60 | + |
| 61 | + case 'files': |
| 62 | + case 'toshow': |
| 63 | + case 'tohide': |
| 64 | + case 'batch': |
| 65 | + $input->set('view', 'files'); |
| 66 | + $input->set('layout', 'default'); |
| 67 | + break; |
| 68 | + |
| 69 | + case 'upload': |
| 70 | + $input->set('view', 'files'); |
| 71 | + $input->set('layout', 'upload'); |
| 72 | + break; |
| 73 | + |
| 74 | + case 'newfiles': |
| 75 | + $input->set('view', 'files'); |
| 76 | + $input->set('layout', 'import'); |
| 77 | + break; |
| 78 | + |
| 79 | + case 'newfile': |
| 80 | + case 'editfile': |
| 81 | + case 'updateGeneratedValues': |
| 82 | + $input->set('view', 'files'); |
| 83 | + $input->set('layout', 'form'); |
| 84 | + break; |
| 85 | + } |
| 86 | + parent::display(); |
| 87 | + } |
| 88 | + |
34 | 89 | /** |
35 | 90 | * function_description |
36 | 91 | * |
@@ -408,4 +463,11 @@ function fetchJPTfiles () |
408 | 463 | $model = $this->getModel('files'); |
409 | 464 | echo $model->_fetchJPTfiles(); |
410 | 465 | } |
| 466 | + |
| 467 | + public function batch($model = null) |
| 468 | + { |
| 469 | + $model = $this->getModel('files'); |
| 470 | + $this->setRedirect((string)Uri::getInstance()); |
| 471 | + return parent::batch($model); |
| 472 | + } |
411 | 473 | } |
0 commit comments