TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
ModuleTemplate Class Reference

Public Member Functions

 getBodyTag ()
 
 setBodyTag ($bodyTag)
 
 getView ()
 
 setContent ($content)
 
 setTitle ($title)
 
 getIconFactory ()
 
 __construct ()
 
 addJavaScriptCode ($name= '', $code= '')
 
 getDocHeaderComponent ()
 
 renderContent ()
 
 getPageRenderer ()
 
 setForm ($formTag= '')
 
 setModuleId ($moduleId)
 
 setModuleName ($moduleName)
 
 registerModuleMenu ($moduleMenuIdentifier)
 
 getDynamicTabMenu (array $menuItems, $domId, $defaultTabIndex=1, $collapsible=false, $wrapContent=true, $storeLastActiveTab=true)
 
 loadJavascriptLib ($lib)
 
 makeShortcutIcon ($gvList, $setList, $modName, $motherModName= '', $displayName= '', $classes= 'btn btn-default btn-sm')
 
 makeShortcutUrl ($gvList, $setList)
 
 icons ($type)
 
 redirectUrls ($thisLocation= '')
 
 header ($text)
 
 addFlashMessage ($messageBody, $messageTitle= '', $severity=AbstractMessage::OK, $storeInSession=true)
 
 setFlashMessageQueue ($flashMessageQueue)
 

Public Attributes

const STATUS_ICON_ERROR = 3
 
const STATUS_ICON_WARNING = 2
 
const STATUS_ICON_NOTIFICATION = 1
 
const STATUS_ICON_OK = -1
 

Protected Member Functions

 loadJavaScripts ()
 
 loadStylesheets ()
 
 setupPage ()
 
 setJavaScriptCodeArray ()
 
 getBackendUserAuthentication ()
 
 getLanguageService ()
 

Protected Attributes

 $docHeaderComponent
 
 $javascriptCodeArray = []
 
 $pageRenderer
 
 $templateRootPaths = ['EXT:backend/Resources/Private/Templates']
 
 $partialRootPaths = ['EXT:backend/Resources/Private/Partials']
 
 $layoutRootPaths = ['EXT:backend/Resources/Private/Layouts']
 
 $templateFile = 'Module.html'
 
 $view
 
 $content = ''
 
 $iconFactory
 
 $moduleId = ''
 
 $moduleName = ''
 
 $title = ''
 
 $bodyTag = '<body>'
 
 $flashMessageQueue
 

Detailed Description

A class taking care of the "outer" HTML of a module, especially the doc header and other related parts.

Definition at line 38 of file ModuleTemplate.php.

Constructor & Destructor Documentation

__construct ( )

Class constructor Sets up view and property objects

Exceptions
InvalidTemplateResourceExceptionIn case a template is invalid

Definition at line 241 of file ModuleTemplate.php.

References GeneralUtility\makeInstance().

Member Function Documentation

addFlashMessage (   $messageBody,
  $messageTitle = '',
  $severity = AbstractMessage::OK,
  $storeInSession = true 
)

Creates a Message object and adds it to the FlashMessageQueue.

Parameters
string$messageBodyThe message
string$messageTitleOptional message title
int$severityOptional severity, must be one of constants
bool$storeInSessionOptional, defines whether the message should be stored in the session (default)
Returns
void
Exceptions
InvalidArgumentException if the message body is no string

Definition at line 715 of file ModuleTemplate.php.

References GeneralUtility\makeInstance().

addJavaScriptCode (   $name = '',
  $code = '' 
)

Adds JS inline blocks of code to the internal registry

Parameters
string$nameJavascript code block name
string$codeInline Javascript
Returns
void

Definition at line 316 of file ModuleTemplate.php.

getBackendUserAuthentication ( )
protected

Returns the BE USER Object

Returns
BackendUserAuthentication

Definition at line 610 of file ModuleTemplate.php.

References $GLOBALS.

getBodyTag ( )

Returns the current body tag

Returns
string

Definition at line 179 of file ModuleTemplate.php.

References ModuleTemplate\$bodyTag.

getDocHeaderComponent ( )

Get the DocHeader

Returns
DocHeaderComponent

Definition at line 326 of file ModuleTemplate.php.

References ModuleTemplate\$docHeaderComponent.

Referenced by DatabaseRecordList\getDocHeaderButtons(), and ModuleTemplate\registerModuleMenu().

getDynamicTabMenu ( array  $menuItems,
  $domId,
  $defaultTabIndex = 1,
  $collapsible = false,
  $wrapContent = true,
  $storeLastActiveTab = true 
)

Creates a tab menu where the tabs or collapsible are rendered with bootstrap markup

Parameters
array$menuItemsTab elements, each element is an array with "label" and "content"
string$domIdDOM id attribute, will be appended with an iteration number per tab.
int$defaultTabIndexDefault tab to open (for toggle <=0). Value corresponds to integer-array index + 1 (index zero is "1", index "1" is 2 etc.). A value of zero (or something non-existing will result in no default tab open.
bool$collapsibleIf set, the tabs are rendered as headers instead over each sheet. Effectively this means there is no tab menu, but rather a foldout/fold-in menu.
bool$wrapContentIf set, the content is wrapped in div structure which provides a padding and border style. Set this FALSE to get unstyled content pane with fullsize content area.
bool$storeLastActiveTabIf set, the last open tab is stored in local storage and will be re-open again. If you don't need this feature, e.g. for wizards like import/export you can disable this behaviour.
Returns
string

Definition at line 446 of file ModuleTemplate.php.

References ModuleTemplate\$view, ExtensionManagementUtility\extPath(), GeneralUtility\makeInstance(), and GeneralUtility\shortMD5().

getIconFactory ( )

Returns the IconFactory

Returns
IconFactory

Definition at line 230 of file ModuleTemplate.php.

References ModuleTemplate\$iconFactory.

getLanguageService ( )
protected

Returns the LanguageService

Returns
LanguageService

Definition at line 620 of file ModuleTemplate.php.

References $GLOBALS.

Referenced by ModuleTemplate\makeShortcutIcon().

getPageRenderer ( )

Get PageRenderer

Returns
PageRenderer

Definition at line 366 of file ModuleTemplate.php.

References ModuleTemplate\$pageRenderer.

getView ( )

Gets the standalone view.

Returns
StandaloneView

Definition at line 199 of file ModuleTemplate.php.

References ModuleTemplate\$view.

header (   $text)

Returns the header-bar in the top of most backend modules Closes section if open.

Parameters
string$textThe text string for the header
Returns
string HTML content

Definition at line 696 of file ModuleTemplate.php.

icons (   $type)

Returns an image-tag with an 18x16 icon of the following types:

$type: -1:» OK icon (Check-mark) 1:» Notice (Speach-bubble) 2:» Warning (Yellow triangle) 3:» Fatal error (Red stop sign)

Parameters
int$typeSee description
Returns
string HTML image tag (if applicable)

Definition at line 639 of file ModuleTemplate.php.

References Icon\SIZE_SMALL.

loadJavascriptLib (   $lib)

Includes a javascript library that exists in the core /typo3/ directory

Parameters
string$libLibrary name. Call it with the full path like "sysext/core/Resources/Public/JavaScript/QueryGenerator.js" to load it
Returns
void

Definition at line 486 of file ModuleTemplate.php.

loadJavaScripts ( )
protected

Loads all necessary Javascript Files

Returns
void

Definition at line 258 of file ModuleTemplate.php.

Referenced by ModuleTemplate\renderContent().

loadStylesheets ( )
protected

Loads all necessary stylesheets

Returns
void

Definition at line 272 of file ModuleTemplate.php.

References $GLOBALS.

Referenced by ModuleTemplate\renderContent().

makeShortcutIcon (   $gvList,
  $setList,
  $modName,
  $motherModName = '',
  $displayName = '',
  $classes = 'btn btn-default btn-sm' 
)

Returns a linked shortcut-icon which will call the shortcut frame and set a shortcut there back to the calling page/module

Parameters
string$gvListIs the list of GET variables to store (if any)
string$setListIs the list of SET[] variables to store (if any) - SET[] variables a stored in $GLOBALS["SOBE"]->MOD_SETTINGS for backend modules
string$modNameModule name string
string | int$motherModNameIs used to enter the "parent module name" if the module is a submodule under eg. Web>* or File>*. You can also set this value to 1 in which case the currentLoadedModule is sent to the shortcut script (so - not a fixed value!) - that is used in file_edit and wizard_rte modules where those are really running as a part of another module.
string$displayNameWhen given this name is used instead of the module name.
string$classesAdditional CSS classes for the link around the icon
Returns
string HTML content
Todo:
Make this thing return a button object

Definition at line 515 of file ModuleTemplate.php.

References ModuleTemplate\$moduleName, GeneralUtility\_GET(), GeneralUtility\getIndpEnv(), ModuleTemplate\getLanguageService(), ModuleTemplate\makeShortcutUrl(), GeneralUtility\quoteJSvalue(), BackendUtility\shortcutExists(), and Icon\SIZE_SMALL.

makeShortcutUrl (   $gvList,
  $setList 
)

MAKE url for storing Internal func

Parameters
string$gvListIs the list of GET variables to store (if any)
string$setListIs the list of SET[] variables to store (if any)
  • SET[] variables a stored in $GLOBALS["SOBE"]->MOD_SETTINGS for backend modules
Returns
string

Definition at line 569 of file ModuleTemplate.php.

References $GLOBALS, GeneralUtility\_GET(), GeneralUtility\compileSelectedGetVarsFromArray(), and GeneralUtility\implodeArrayForUrl().

Referenced by ModuleTemplate\makeShortcutIcon().

redirectUrls (   $thisLocation = '')

Returns JavaScript variables setting the returnUrl and thisScript location for use by JavaScript on the page. Used in fx. db_list.php (Web>List)

Parameters
string$thisLocationURL to "this location" / current script
Returns
string Urls are returned as JavaScript variables T3_RETURN_URL and T3_THIS_LOCATION
See also
typo3/db_list.php

Definition at line 673 of file ModuleTemplate.php.

References GeneralUtility\_GP(), GeneralUtility\linkThisScript(), GeneralUtility\quoteJSvalue(), and GeneralUtility\sanitizeLocalUrl().

registerModuleMenu (   $moduleMenuIdentifier)

Generates the Menu for things like Web->Info

Parameters
$moduleMenuIdentifier

Definition at line 413 of file ModuleTemplate.php.

References $GLOBALS, and ModuleTemplate\getDocHeaderComponent().

Referenced by ModuleTemplate\setModuleId().

setBodyTag (   $bodyTag)

Sets the body tag

Parameters
string$bodyTag

Definition at line 189 of file ModuleTemplate.php.

References ModuleTemplate\$bodyTag.

setContent (   $content)

Set content

Parameters
string$contentContent of the module
Returns
void

Definition at line 210 of file ModuleTemplate.php.

References ModuleTemplate\$content.

setFlashMessageQueue (   $flashMessageQueue)
Parameters
\TYPO3\CMS\Core\Messaging\FlashMessageQueue$flashMessageQueue

Definition at line 734 of file ModuleTemplate.php.

References ModuleTemplate\$flashMessageQueue.

setForm (   $formTag = '')

Set form tag

Parameters
string$formTagForm tag to add
Returns
void

Definition at line 378 of file ModuleTemplate.php.

setJavaScriptCodeArray ( )
protected

Wrapper function for adding JS inline blocks

Returns
void

Definition at line 301 of file ModuleTemplate.php.

Referenced by ModuleTemplate\renderContent().

setModuleId (   $moduleId)

Sets the ModuleId

Parameters
string$moduleIdID of the module
Returns
void

Definition at line 390 of file ModuleTemplate.php.

References ModuleTemplate\$moduleId, and ModuleTemplate\registerModuleMenu().

setModuleName (   $moduleName)

Sets the ModuleName

Parameters
string$moduleNameName of the module
Returns
void

Definition at line 403 of file ModuleTemplate.php.

References ModuleTemplate\$moduleName.

setTitle (   $title)

Set title tag

Parameters
string$title

Definition at line 220 of file ModuleTemplate.php.

References ModuleTemplate\$title.

setupPage ( )
protected

Sets mandatory parameters for the view (pageRenderer)

Returns
void

Definition at line 287 of file ModuleTemplate.php.

References $GLOBALS.

Referenced by ModuleTemplate\renderContent().

Member Data Documentation

$bodyTag = '<body>'
protected
$content = ''
protected

Definition at line 130 of file ModuleTemplate.php.

Referenced by ModuleTemplate\setContent().

$docHeaderComponent
protected

Definition at line 73 of file ModuleTemplate.php.

Referenced by ModuleTemplate\getDocHeaderComponent().

$flashMessageQueue
protected

Definition at line 172 of file ModuleTemplate.php.

Referenced by ModuleTemplate\setFlashMessageQueue().

$iconFactory
protected

Definition at line 137 of file ModuleTemplate.php.

Referenced by ModuleTemplate\getIconFactory().

$javascriptCodeArray = []
protected

Definition at line 81 of file ModuleTemplate.php.

$layoutRootPaths = ['EXT:backend/Resources/Private/Layouts']
protected

Definition at line 109 of file ModuleTemplate.php.

$moduleId = ''
protected

Definition at line 144 of file ModuleTemplate.php.

Referenced by ModuleTemplate\setModuleId().

$moduleName = ''
protected
$pageRenderer
protected

Definition at line 88 of file ModuleTemplate.php.

Referenced by ModuleTemplate\getPageRenderer().

$partialRootPaths = ['EXT:backend/Resources/Private/Partials']
protected

Definition at line 102 of file ModuleTemplate.php.

$templateFile = 'Module.html'
protected

Definition at line 116 of file ModuleTemplate.php.

$templateRootPaths = ['EXT:backend/Resources/Private/Templates']
protected

Definition at line 95 of file ModuleTemplate.php.

$title = ''
protected

Definition at line 158 of file ModuleTemplate.php.

Referenced by ModuleTemplate\setTitle().

$view
protected

Definition at line 123 of file ModuleTemplate.php.

Referenced by ModuleTemplate\getDynamicTabMenu(), and ModuleTemplate\getView().

const STATUS_ICON_ERROR = 3

Error Icon Constant

Definition at line 45 of file ModuleTemplate.php.

const STATUS_ICON_NOTIFICATION = 1

Notification Icon Constant

Definition at line 59 of file ModuleTemplate.php.

const STATUS_ICON_OK = -1

OK Icon Constant

Definition at line 66 of file ModuleTemplate.php.

const STATUS_ICON_WARNING = 2

Warning Icon Constant

Definition at line 52 of file ModuleTemplate.php.