TYPO3 CMS  TYPO3_6-2
RecyclerAjaxController.php
Go to the documentation of this file.
1 <?php
3 
18 
26 
32  protected $content;
33 
39  protected $command;
40 
48  protected $data;
49 
55  public function init() {
56  $this->mapCommand();
57  $this->getContent();
58  }
59 
65  public function mapCommand() {
66  $this->command = GeneralUtility::_GP('cmd');
67  $this->data = GeneralUtility::_GP('data');
68  // check params
69  if (!is_string($this->command)) {
70  // @TODO make devlog output
71  return FALSE;
72  }
73  // Create content
74  $this->createContent();
75  }
76 
82  protected function createContent() {
83  $str = '';
84  switch ($this->command) {
85  case 'getDeletedRecords':
86  $table = GeneralUtility::_GP('table') ? GeneralUtility::_GP('table') : GeneralUtility::_GP('tableDefault');
87  $limit = GeneralUtility::_GP('limit') ? (int)GeneralUtility::_GP('limit') : (int)GeneralUtility::_GP('pagingSizeDefault');
88  $start = GeneralUtility::_GP('start') ? (int)GeneralUtility::_GP('start') : 0;
89  $filter = GeneralUtility::_GP('filterTxt') ? GeneralUtility::_GP('filterTxt') : '';
90  $startUid = GeneralUtility::_GP('startUid') ? GeneralUtility::_GP('startUid') : '';
91  $depth = GeneralUtility::_GP('depth') ? GeneralUtility::_GP('depth') : '';
92  $this->setDataInSession('tableSelection', $table);
93  $model = GeneralUtility::makeInstance('TYPO3\\CMS\\Recycler\\Domain\\Model\\DeletedRecords');
94  $model->loadData($startUid, $table, $depth, $start . ',' . $limit, $filter);
95  $deletedRowsArray = $model->getDeletedRows();
96  $model = GeneralUtility::makeInstance('TYPO3\\CMS\\Recycler\\Domain\\Model\\DeletedRecords');
97  $totalDeleted = $model->getTotalCount($startUid, $table, $depth, $filter);
98  // load view
99  $view = GeneralUtility::makeInstance('TYPO3\\CMS\\Recycler\\Controller\\DeletedRecordsController');
100  $str = $view->transform($deletedRowsArray, $totalDeleted);
101  break;
102  case 'doDelete':
103  $str = FALSE;
104  $model = GeneralUtility::makeInstance('TYPO3\\CMS\\Recycler\\Domain\\Model\\DeletedRecords');
105  if ($model->deleteData($this->data)) {
106  $str = TRUE;
107  }
108  break;
109  case 'doUndelete':
110  $str = FALSE;
111  $recursive = GeneralUtility::_GP('recursive');
112  $model = GeneralUtility::makeInstance('TYPO3\\CMS\\Recycler\\Domain\\Model\\DeletedRecords');
113  if ($model->undeleteData($this->data, $recursive)) {
114  $str = TRUE;
115  }
116  break;
117  case 'getTables':
118  $depth = GeneralUtility::_GP('depth') ? GeneralUtility::_GP('depth') : 0;
119  $startUid = GeneralUtility::_GP('startUid') ? GeneralUtility::_GP('startUid') : '';
120  $this->setDataInSession('depthSelection', $depth);
121  $model = GeneralUtility::makeInstance('TYPO3\\CMS\\Recycler\\Domain\\Model\\Tables');
122  $str = $model->getTables('json', 1, $startUid, $depth);
123  break;
124  default:
125  $str = 'No command was recognized.';
126  }
127  $this->content = $str;
128  }
129 
135  public function getContent() {
136  echo $this->content;
137  }
138 
146  protected function setDataInSession($identifier, $data) {
147  $GLOBALS['BE_USER']->uc['tx_recycler'][$identifier] = $data;
148  $GLOBALS['BE_USER']->writeUC();
149  }
150 
151 }
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]