TYPO3 CMS  TYPO3_6-2
PermissionModuleController.php
Go to the documentation of this file.
1 <?php
3 
20 
34 
40  public $getLevels = 10;
41 
48  protected $MCONF = array();
49 
55  public $doc;
56 
62  public $content;
63 
69  public $MOD_MENU = array();
70 
76  public $MOD_SETTINGS = array();
77 
83  public $perms_clause;
84 
90  public $pageinfo;
91 
97  public $color;
98 
104  public $color2;
105 
111  public $color3;
112 
119 
125  public $id;
126 
133  public $edit;
134 
140  public $return_id;
141 
147  public $lastEdited;
148 
152  public function __construct() {
153  $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_mod_web_perm.xlf');
154  $GLOBALS['BE_USER']->modAccess($GLOBALS['MCONF'], TRUE);
155  }
156 
162  public function init() {
163  // Setting GPvars:
164  $this->id = (int)GeneralUtility::_GP('id');
165  $this->edit = GeneralUtility::_GP('edit');
166  $this->return_id = GeneralUtility::_GP('return_id');
167  $this->lastEdited = GeneralUtility::_GP('lastEdited');
168  // Module name;
169  $this->MCONF = $GLOBALS['MCONF'];
170  // Page select clause:
171  $this->perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
172  // Initializing document template object:
173  $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
174  $this->doc->backPath = $GLOBALS['BACK_PATH'];
175  $this->doc->setModuleTemplate('EXT:perm/Resources/Private/Templates/perm.html');
176  $this->doc->form = '<form action="' . $GLOBALS['BACK_PATH'] . 'tce_db.php" method="post" name="editform">';
177  $this->doc->loadJavascriptLib('js/jsfunc.updateform.js');
178  $this->doc->getPageRenderer()->loadPrototype();
179  $this->doc->loadJavascriptLib(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('perm') . 'mod1/perm.js');
180  // Setting up the context sensitive menu:
181  $this->doc->getContextMenuCode();
182  // Set up menus:
183  $this->menuConfig();
184  }
185 
191  public function menuConfig() {
192  $level = $GLOBALS['LANG']->getLL('levels');
193  $this->MOD_MENU = array(
194  'depth' => array(
195  1 => '1 ' . $level,
196  2 => '2 ' . $level,
197  3 => '3 ' . $level,
198  4 => '4 ' . $level,
199  10 => '10 ' . $level
200  )
201  );
202  // Clean up settings:
203  $this->MOD_SETTINGS = BackendUtility::getModuleData($this->MOD_MENU, GeneralUtility::_GP('SET'), $this->MCONF['name']);
204  }
205 
211  public function main() {
212  // Access check...
213  // The page will show only if there is a valid page and if this page may be viewed by the user
214  $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
215  $access = is_array($this->pageinfo);
216  // Checking access:
217  if ($this->id && $access || $GLOBALS['BE_USER']->isAdmin() && !$this->id) {
218  if ($GLOBALS['BE_USER']->isAdmin() && !$this->id) {
219  $this->pageinfo = array('title' => '[root-level]', 'uid' => 0, 'pid' => 0);
220  }
221  // This decides if the editform can and will be drawn:
222  $this->editingAllowed = $this->pageinfo['perms_userid'] == $GLOBALS['BE_USER']->user['uid'] || $GLOBALS['BE_USER']->isAdmin();
223  $this->edit = $this->edit && $this->editingAllowed;
224  // If $this->edit then these functions are called in the end of the page...
225  if ($this->edit) {
226  $this->doc->postCode .= $this->doc->wrapScriptTags('
227  setCheck("check[perms_user]", "data[pages][' . $this->id . '][perms_user]");
228  setCheck("check[perms_group]", "data[pages][' . $this->id . '][perms_group]");
229  setCheck("check[perms_everybody]", "data[pages][' . $this->id . '][perms_everybody]");
230  ');
231  }
232 
233  // Draw the HTML page header.
234  $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('permissions') . ($this->edit ? ': ' . $GLOBALS['LANG']->getLL('Edit') : ''));
235  $vContent = $this->doc->getVersionSelector($this->id, 1);
236  if ($vContent) {
237  $this->content .= $this->doc->section('', $vContent);
238  }
239 
240  // Main function, branching out:
241  if (!$this->edit) {
242  $this->notEdit();
243  } else {
244  $this->doEdit();
245  }
246 
247  $docHeaderButtons = $this->getButtons();
248  $markers['CSH'] = $this->docHeaderButtons['csh'];
249  $markers['FUNC_MENU'] = BackendUtility::getFuncMenu($this->id, 'SET[mode]', $this->MOD_SETTINGS['mode'], $this->MOD_MENU['mode']);
250  $markers['CONTENT'] = $this->content;
251 
252  // Build the <body> for the module
253  $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
254  } else {
255  // If no access or if ID == zero
256  $this->content = $this->doc->header($GLOBALS['LANG']->getLL('permissions'));
257  }
258  // Renders the module page
259  $this->content = $this->doc->render($GLOBALS['LANG']->getLL('permissions'), $this->content);
260  }
261 
267  public function printContent() {
268  $this->content = $this->doc->insertStylesAndJS($this->content);
269  echo $this->content;
270  }
271 
277  protected function getButtons() {
278  $buttons = array(
279  'csh' => '',
280  'view' => '',
281  'shortcut' => ''
282  );
283  // CSH
284  $buttons['csh'] = BackendUtility::cshItem('_MOD_web_info', '', $GLOBALS['BACK_PATH'], '', TRUE);
285  // View page
286  $buttons['view'] = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::viewonclick($this->pageinfo['uid'], $GLOBALS['BACK_PATH'], BackendUtility::BEgetRootLine($this->pageinfo['uid']))) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-view') . '</a>';
287  // Shortcut
288  if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
289  $buttons['shortcut'] = $this->doc->makeShortcutIcon('id, edit_record, pointer, new_unique_uid, search_field, search_levels, showLimit', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']);
290  }
291  return $buttons;
292  }
293 
294  /*****************************
295  *
296  * Listing and Form rendering
297  *
298  *****************************/
305  public function doEdit() {
306  if ($GLOBALS['BE_USER']->workspace != 0) {
307  // Adding section with the permission setting matrix:
308  $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('WorkspaceWarningText'), $GLOBALS['LANG']->getLL('WorkspaceWarning'), \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING);
310  $flashMessageService = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService');
312  $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
313  $defaultFlashMessageQueue->enqueue($flashMessage);
314  }
315  // Get usernames and groupnames
316  $beGroupArray = BackendUtility::getListGroupNames('title,uid');
317  $beGroupKeys = array_keys($beGroupArray);
318  $beUserArray = BackendUtility::getUserNames();
319  if (!$GLOBALS['BE_USER']->isAdmin()) {
320  $beUserArray = BackendUtility::blindUserNames($beUserArray, $beGroupKeys, 1);
321  }
322  $beGroupArray_o = ($beGroupArray = BackendUtility::getGroupNames());
323  if (!$GLOBALS['BE_USER']->isAdmin()) {
324  $beGroupArray = BackendUtility::blindGroupNames($beGroupArray_o, $beGroupKeys, 1);
325  }
326 
327  // Owner selector:
328  $options = '';
329 
330  // flag: is set if the page-userid equals one from the user-list
331  $userset = 0;
332  foreach ($beUserArray as $uid => $row) {
333  if ($uid == $this->pageinfo['perms_userid']) {
334  $userset = 1;
335  $selected = ' selected="selected"';
336  } else {
337  $selected = '';
338  }
339  $options .= '<option value="' . $uid . '"' . $selected . '>' . htmlspecialchars($row['username']) . '</option>';
340  }
341  $options = '<option value="0"></option>' . $options;
342  $selector = '<select name="data[pages][' . $this->id . '][perms_userid]">' . $options . '</select>';
343  $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('Owner'), $selector, TRUE);
344 
345  // Group selector:
346  $options = '';
347  $userset = 0;
348  foreach ($beGroupArray as $uid => $row) {
349  if ($uid == $this->pageinfo['perms_groupid']) {
350  $userset = 1;
351  $selected = ' selected="selected"';
352  } else {
353  $selected = '';
354  }
355  $options .= '<option value="' . $uid . '"' . $selected . '>' . htmlspecialchars($row['title']) . '</option>';
356  }
357 
358  // If the group was not set AND there is a group for the page
359  if (!$userset && $this->pageinfo['perms_groupid']) {
360  $options = '<option value="' . $this->pageinfo['perms_groupid'] . '" selected="selected">' . htmlspecialchars($beGroupArray_o[$this->pageinfo['perms_groupid']]['title']) . '</option>' . $options;
361  }
362  $options = '<option value="0"></option>' . $options;
363  $selector = '<select name="data[pages][' . $this->id . '][perms_groupid]">' . $options . '</select>';
364 
365  $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('Group'), $selector, TRUE);
366 
367  // Permissions checkbox matrix:
368  $code = '
369  <table class="t3-table" id="typo3-permissionMatrix">
370  <thead>
371  <tr>
372  <th></th>
373  <th>' . $GLOBALS['LANG']->getLL('1', TRUE) . '</th>
374  <th>' . $GLOBALS['LANG']->getLL('16', TRUE) . '</th>
375  <th>' . $GLOBALS['LANG']->getLL('2', TRUE) . '</th>
376  <th>' . $GLOBALS['LANG']->getLL('4', TRUE) . '</th>
377  <th>' . $GLOBALS['LANG']->getLL('8', TRUE) . '</th>
378  </tr>
379  </thead>
380  <tbody>
381  <tr>
382  <td><strong>' . $GLOBALS['LANG']->getLL('Owner', TRUE) . '</strong></td>
383  <td>' . $this->printCheckBox('perms_user', 1) . '</td>
384  <td>' . $this->printCheckBox('perms_user', 5) . '</td>
385  <td>' . $this->printCheckBox('perms_user', 2) . '</td>
386  <td>' . $this->printCheckBox('perms_user', 3) . '</td>
387  <td>' . $this->printCheckBox('perms_user', 4) . '</td>
388  </tr>
389  <tr>
390  <td><strong>' . $GLOBALS['LANG']->getLL('Group', TRUE) . '</strong></td>
391  <td>' . $this->printCheckBox('perms_group', 1) . '</td>
392  <td>' . $this->printCheckBox('perms_group', 5) . '</td>
393  <td>' . $this->printCheckBox('perms_group', 2) . '</td>
394  <td>' . $this->printCheckBox('perms_group', 3) . '</td>
395  <td>' . $this->printCheckBox('perms_group', 4) . '</td>
396  </tr>
397  <tr>
398  <td><strong>' . $GLOBALS['LANG']->getLL('Everybody', TRUE) . '</strong></td>
399  <td>' . $this->printCheckBox('perms_everybody', 1) . '</td>
400  <td>' . $this->printCheckBox('perms_everybody', 5) . '</td>
401  <td>' . $this->printCheckBox('perms_everybody', 2) . '</td>
402  <td>' . $this->printCheckBox('perms_everybody', 3) . '</td>
403  <td>' . $this->printCheckBox('perms_everybody', 4) . '</td>
404  </tr>
405  </tbody>
406  </table>
407 
408  <input type="hidden" name="data[pages][' . $this->id . '][perms_user]" value="' . $this->pageinfo['perms_user'] . '" />
409  <input type="hidden" name="data[pages][' . $this->id . '][perms_group]" value="' . $this->pageinfo['perms_group'] . '" />
410  <input type="hidden" name="data[pages][' . $this->id . '][perms_everybody]" value="' . $this->pageinfo['perms_everybody'] . '" />
411  ' . $this->getRecursiveSelect($this->id, $this->perms_clause) . '
412  <input type="submit" name="submit" value="' . $GLOBALS['LANG']->getLL('Save', TRUE) . '" />' . '<input type="submit" value="' . $GLOBALS['LANG']->getLL('Abort', TRUE) . '" onclick="' . htmlspecialchars(('jumpToUrl(' . GeneralUtility::quoteJSvalue((BackendUtility::getModuleUrl('web_perm') . '&id=' . $this->id), TRUE) . '); return false;')) . '" />
413  <input type="hidden" name="redirect" value="' . htmlspecialchars((BackendUtility::getModuleUrl('web_perm') . '&mode=' . $this->MOD_SETTINGS['mode'] . '&depth=' . $this->MOD_SETTINGS['depth'] . '&id=' . (int)$this->return_id . '&lastEdited=' . $this->id)) . '" />
415 
416  // Adding section with the permission setting matrix:
417  $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('permissions'), $code, TRUE);
418 
419  // CSH for permissions setting
420  $this->content .= BackendUtility::cshItem('xMOD_csh_corebe', 'perm_module_setting', $GLOBALS['BACK_PATH'], '<br /><br />');
421 
422  // Adding help text:
423  if ($GLOBALS['BE_USER']->uc['helpText']) {
424  $legendText = '<p><strong>' . $GLOBALS['LANG']->getLL('1', TRUE) . '</strong>: ' . $GLOBALS['LANG']->getLL('1_t', TRUE) . '<br />';
425  $legendText .= '<strong>' . $GLOBALS['LANG']->getLL('16', TRUE) . '</strong>: ' . $GLOBALS['LANG']->getLL('16_t', TRUE) . '<br />';
426  $legendText .= '<strong>' . $GLOBALS['LANG']->getLL('2', TRUE) . '</strong>: ' . $GLOBALS['LANG']->getLL('2_t', TRUE) . '<br />';
427  $legendText .= '<strong>' . $GLOBALS['LANG']->getLL('4', TRUE) . '</strong>: ' . $GLOBALS['LANG']->getLL('4_t', TRUE) . '<br />';
428  $legendText .= '<strong>' . $GLOBALS['LANG']->getLL('8', TRUE) . '</strong>: ' . $GLOBALS['LANG']->getLL('8_t', TRUE) . '</p>';
429 
430  $code = $legendText . '<p>' . $GLOBALS['LANG']->getLL('def', TRUE) . '</p>';
431 
432  $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('Legend', TRUE), $code, TRUE);
433  }
434  }
435 
442  public function notEdit() {
443  // Get usernames and groupnames: The arrays we get in return contains only 1) users which are members of the groups of the current user, 2) groups that the current user is member of
444  $beGroupKeys = $GLOBALS['BE_USER']->userGroupsUID;
445  $beUserArray = BackendUtility::getUserNames();
446  if (!$GLOBALS['BE_USER']->isAdmin()) {
447  $beUserArray = BackendUtility::blindUserNames($beUserArray, $beGroupKeys, 0);
448  }
449  $beGroupArray = BackendUtility::getGroupNames();
450  if (!$GLOBALS['BE_USER']->isAdmin()) {
451  $beGroupArray = BackendUtility::blindGroupNames($beGroupArray, $beGroupKeys, 0);
452  }
453 
454  // Length of strings:
455  $tLen = 20;
456 
457  // Selector for depth:
458  $code = $GLOBALS['LANG']->getLL('Depth') . ': ';
459  $code .= BackendUtility::getFuncMenu($this->id, 'SET[depth]', $this->MOD_SETTINGS['depth'], $this->MOD_MENU['depth']);
460  $this->content .= $this->doc->section('', $code);
461 
463  $tree = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Tree\\View\\PageTreeView');
464  $tree->init('AND ' . $this->perms_clause);
465  $tree->addField('perms_user', 1);
466  $tree->addField('perms_group', 1);
467  $tree->addField('perms_everybody', 1);
468  $tree->addField('perms_userid', 1);
469  $tree->addField('perms_groupid', 1);
470  $tree->addField('hidden');
471  $tree->addField('fe_group');
472  $tree->addField('starttime');
473  $tree->addField('endtime');
474  $tree->addField('editlock');
475 
476  // Creating top icon; the current page
477  $HTML = IconUtility::getSpriteIconForRecord('pages', $this->pageinfo);
478  $tree->tree[] = array('row' => $this->pageinfo, 'HTML' => $HTML);
479 
480  // Create the tree from $this->id:
481  $tree->getTree($this->id, $this->MOD_SETTINGS['depth'], '');
482 
483  // Make header of table:
484  $code = '
485  <thead>
486  <tr>
487  <th colspan="2">&nbsp;</th>
488  <th>' . $GLOBALS['LANG']->getLL('Owner', TRUE) . '</th>
489  <th align="center">' . $GLOBALS['LANG']->getLL('Group', TRUE) . '</th>
490  <th align="center">' . $GLOBALS['LANG']->getLL('Everybody', TRUE) . '</th>
491  <th align="center">' . $GLOBALS['LANG']->getLL('EditLock', TRUE) . '</th>
492  </tr>
493  </thead>
494  ';
495 
496  // Traverse tree:
497  foreach ($tree->tree as $data) {
498  $cells = array();
499  $pageId = $data['row']['uid'];
500 
501  // Background colors:
502  $bgCol = $this->lastEdited == $pageId ? ' class="bgColor-20"' : '';
503  $lE_bgCol = $bgCol;
504 
505  // User/Group names:
506  $userName = $beUserArray[$data['row']['perms_userid']] ?
507  $beUserArray[$data['row']['perms_userid']]['username'] :
508  ($data['row']['perms_userid'] ? $data['row']['perms_userid'] : '');
509 
510  if ($data['row']['perms_userid'] && !$beUserArray[$data['row']['perms_userid']]) {
511  $userName = \TYPO3\CMS\Perm\Controller\PermissionAjaxController::renderOwnername($pageId, $data['row']['perms_userid'], htmlspecialchars(GeneralUtility::fixed_lgd_cs($userName, 20)), FALSE);
512  } else {
513  $userName = \TYPO3\CMS\Perm\Controller\PermissionAjaxController::renderOwnername($pageId, $data['row']['perms_userid'], htmlspecialchars(GeneralUtility::fixed_lgd_cs($userName, 20)));
514  }
515 
516  $groupName = $beGroupArray[$data['row']['perms_groupid']] ?
517  $beGroupArray[$data['row']['perms_groupid']]['title'] :
518  ($data['row']['perms_groupid'] ? $data['row']['perms_groupid'] : '');
519 
520  if ($data['row']['perms_groupid'] && !$beGroupArray[$data['row']['perms_groupid']]) {
521  $groupName = \TYPO3\CMS\Perm\Controller\PermissionAjaxController::renderGroupname($pageId, $data['row']['perms_groupid'], htmlspecialchars(GeneralUtility::fixed_lgd_cs($groupName, 20)), FALSE);
522  } else {
523  $groupName = \TYPO3\CMS\Perm\Controller\PermissionAjaxController::renderGroupname($pageId, $data['row']['perms_groupid'], htmlspecialchars(GeneralUtility::fixed_lgd_cs($groupName, 20)));
524  }
525 
526  // Seeing if editing of permissions are allowed for that page:
527  $editPermsAllowed = $data['row']['perms_userid'] == $GLOBALS['BE_USER']->user['uid'] || $GLOBALS['BE_USER']->isAdmin();
528 
529  // First column:
530  $cellAttrib = $data['row']['_CSSCLASS'] ? ' class="' . $data['row']['_CSSCLASS'] . '"' : '';
531  $cells[] = '<td align="left" nowrap="nowrap"' . ($cellAttrib ? $cellAttrib : $bgCol) . '>' .
532  $data['HTML'] . htmlspecialchars(GeneralUtility::fixed_lgd_cs($data['row']['title'], $tLen)) . '</td>';
533 
534  // "Edit permissions" -icon
535  if ($editPermsAllowed && $pageId) {
536  $aHref = BackendUtility::getModuleUrl('web_perm') . '&mode=' . $this->MOD_SETTINGS['mode'] . '&depth=' . $this->MOD_SETTINGS['depth'] . '&id=' . ($data['row']['_ORIG_uid'] ? $data['row']['_ORIG_uid'] : $pageId) . '&return_id=' . $this->id . '&edit=1';
537  $cells[] = '<td' . $bgCol . '><a href="' . htmlspecialchars($aHref) . '" title="' . $GLOBALS['LANG']->getLL('ch_permissions', TRUE) . '">' .
538  IconUtility::getSpriteIcon('actions-document-open') . '</a></td>';
539  } else {
540  $cells[] = '<td' . $bgCol . '></td>';
541  }
542 
543  $cells[] = '
544  <td' . $bgCol . ' nowrap="nowrap">' . ($pageId ? \TYPO3\CMS\Perm\Controller\PermissionAjaxController::renderPermissions($data['row']['perms_user'], $pageId, 'user') . ' ' . $userName : '') . '</td>
545  <td' . $bgCol . ' nowrap="nowrap">' . ($pageId ? \TYPO3\CMS\Perm\Controller\PermissionAjaxController::renderPermissions($data['row']['perms_group'], $pageId, 'group') . ' ' . $groupName : '') . '</td>
546  <td' . $bgCol . ' nowrap="nowrap">' . ($pageId ? ' ' . \TYPO3\CMS\Perm\Controller\PermissionAjaxController::renderPermissions($data['row']['perms_everybody'], $pageId, 'everybody') : '') . '</td>
547  <td' . $bgCol . ' nowrap="nowrap">' . ($data['row']['editlock'] ? '<span id="el_' . $pageId . '" class="editlock"><a class="editlock" onclick="WebPermissions.toggleEditLock(\'' . $pageId . '\', \'1\');" title="' . $GLOBALS['LANG']->getLL('EditLock_descr', TRUE) . '">' . IconUtility::getSpriteIcon('status-warning-lock') . '</a></span>' : ($pageId === 0 ? '' : '<span id="el_' . $pageId . '" class="editlock"><a class="editlock" onclick="WebPermissions.toggleEditLock(\'' . $pageId . '\', \'0\');" title="Enable the &raquo;Admin-only&laquo; edit lock for this page">[+]</a></span>')) . '</td>
548  ';
549 
550  // Compile table row:
551  $code .= '<tr>' . implode('', $cells) . '</tr>';
552  }
553 
554  // Wrap rows in table tags:
555  $code = '<table class="t3-table" id="typo3-permissionList">' . $code . '</table>';
556 
557  // Adding the content as a section:
558  $this->content .= $this->doc->section('', $code);
559 
560  // CSH for permissions setting
561  $this->content .= BackendUtility::cshItem('xMOD_csh_corebe', 'perm_module', $GLOBALS['BACK_PATH'], '<br />|');
562 
563  // Creating legend table:
564  $legendText = '<strong>' . $GLOBALS['LANG']->getLL('1', TRUE) . '</strong>: ' . $GLOBALS['LANG']->getLL('1_t', TRUE);
565  $legendText .= '<br /><strong>' . $GLOBALS['LANG']->getLL('16', TRUE) . '</strong>: ' . $GLOBALS['LANG']->getLL('16_t', TRUE);
566  $legendText .= '<br /><strong>' . $GLOBALS['LANG']->getLL('2', TRUE) . '</strong>: ' . $GLOBALS['LANG']->getLL('2_t', TRUE);
567  $legendText .= '<br /><strong>' . $GLOBALS['LANG']->getLL('4', TRUE) . '</strong>: ' . $GLOBALS['LANG']->getLL('4_t', TRUE);
568  $legendText .= '<br /><strong>' . $GLOBALS['LANG']->getLL('8', TRUE) . '</strong>: ' . $GLOBALS['LANG']->getLL('8_t', TRUE);
569 
570  $code = '<div id="permission-information">
571  <img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/legend.gif', 'width="86" height="75"') . ' alt="" />
572  <div class="text">' . $legendText . '</div></div>';
573 
574  $code .= '<div id="perm-legend">' . $GLOBALS['LANG']->getLL('def', TRUE);
575  $code .= '<br /><br />' . IconUtility::getSpriteIcon('status-status-permission-granted') . ': ' . $GLOBALS['LANG']->getLL('A_Granted', TRUE);
576  $code .= '<br />' . IconUtility::getSpriteIcon('status-status-permission-denied') . ': ' . $GLOBALS['LANG']->getLL('A_Denied', TRUE);
577  $code .= '</div>';
578 
579  // Adding section with legend code:
580  $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('Legend') . ':', $code, TRUE, TRUE);
581  }
582 
583  /*****************************
584  *
585  * Helper functions
586  *
587  *****************************/
595  public function printCheckBox($checkName, $num) {
596  $onclick = 'checkChange(\'check[' . $checkName . ']\', \'data[pages][' . $GLOBALS['SOBE']->id . '][' . $checkName . ']\')';
597  return '<input type="checkbox" name="check[' . $checkName . '][' . $num . ']" onclick="' . htmlspecialchars($onclick) . '" /><br />';
598  }
599 
608  // Initialize tree object:
609  $tree = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Tree\\View\\PageTreeView');
610  $tree->init('AND ' . $perms_clause);
611  $tree->addField('perms_userid', 1);
612  $tree->makeHTML = 0;
613  $tree->setRecs = 1;
614  // Make tree:
615  $tree->getTree($id, $this->getLevels, '');
616  // If there are a hierarchy of page ids, then...
617  if ($GLOBALS['BE_USER']->user['uid'] && count($tree->orig_ids_hierarchy)) {
618  // Init:
619  $label_recur = $GLOBALS['LANG']->getLL('recursive');
620  $label_levels = $GLOBALS['LANG']->getLL('levels');
621  $label_pA = $GLOBALS['LANG']->getLL('pages_affected');
622  $theIdListArr = array();
623  $opts = '
624  <option value=""></option>';
625  // Traverse the number of levels we want to allow recursive setting of permissions for:
626  for ($a = $this->getLevels; $a > 0; $a--) {
627  if (is_array($tree->orig_ids_hierarchy[$a])) {
628  foreach ($tree->orig_ids_hierarchy[$a] as $theId) {
629  if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->user['uid'] == $tree->recs[$theId]['perms_userid']) {
630  $theIdListArr[] = $theId;
631  }
632  }
633  $lKey = $this->getLevels - $a + 1;
634  $opts .= '
635  <option value="' . htmlspecialchars(implode(',', $theIdListArr)) . '">' . htmlspecialchars($label_recur . ' ' . $lKey . ' ' . $label_levels, ENT_COMPAT, 'UTF-8', FALSE) . ' (' . count($theIdListArr) . ' ' . $label_pA . ')' . '</option>';
636  }
637  }
638  // Put the selector box together:
639  $theRecursiveSelect = '<br />
640  <select name="mirror[pages][' . $id . ']">
641  ' . $opts . '
642  </select>
643  <br /><br />';
644  } else {
645  $theRecursiveSelect = '';
646  }
647  // Return selector box element:
648  return $theRecursiveSelect;
649  }
650 
651 }
static blindUserNames($usernames, $groupArray, $excludeBlindedFlag=0)
static skinImg($backPath, $src, $wHattribs='', $outputMode=0)
static readPageAccess($id, $perms_clause)
static renderOwnername($page, $ownerUid, $username, $validUser=TRUE)
static BEgetRootLine($uid, $clause='', $workspaceOL=FALSE)
$uid
Definition: server.php:36
static cshItem($table, $field, $BACK_PATH, $wrap='', $onlyIconMode=FALSE, $styleAttrib='')
static getGroupNames($fields='title, uid', $where='')
static getSpriteIconForRecord($table, array $row, array $options=array())
static getModuleUrl($moduleName, $urlParameters=array(), $backPathOverride=FALSE, $returnAbsoluteUrl=FALSE)
static getModuleData($MOD_MENU, $CHANGED_SETTINGS, $modName, $type='', $dontValidateList='', $setDefaultList='')
static getUserNames($fields='username, usergroup, usergroup_cached_list, uid', $where='')
static getHiddenTokenField($formName='securityToken', $tokenName='formToken')
static getSpriteIcon($iconName, array $options=array(), array $overlays=array())
static blindGroupNames($groups, $groupArray, $excludeBlindedFlag=0)
static renderGroupname($page, $groupUid, $groupname, $validGroup=TRUE)
static getFuncMenu($mainParams, $elementName, $currentValue, $menuItems, $script='', $addparams='')
static fixed_lgd_cs($string, $chars, $appendString='...')
static getListGroupNames($fields='title, uid')
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]