TYPO3  7.6
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
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)
 
 section ($label, $text, $noStrToUpper=false, $sH=false, $type=0, $allowHtmlInHeader=false)
 
 divider ($dist)
 
 sectionHeader ($label, $sH=false, $addAttribute= '')
 
 sectionBegin ()
 
 sectionEnd ()
 
 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 = ''
 
 $sectionFlag = 0
 
 $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 248 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
\InvalidArgumentExceptionif the message body is no string

Definition at line 853 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 323 of file ModuleTemplate.php.

divider (   $dist)

Inserts a divider image Ends a section (if open) before inserting the image

Parameters
int$distThe margin-top/-bottom of the
ruler.
Returns
string HTML content

Definition at line 654 of file ModuleTemplate.php.

References ModuleTemplate\sectionEnd().

getBackendUserAuthentication ( )
protected

Returns the BE USER Object

Returns
BackendUserAuthentication

Definition at line 747 of file ModuleTemplate.php.

References $GLOBALS.

getBodyTag ( )

Returns the current body tag

Returns
string

Definition at line 186 of file ModuleTemplate.php.

References ModuleTemplate\$bodyTag.

getDocHeaderComponent ( )

Get the DocHeader

Returns
DocHeaderComponent

Definition at line 333 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 453 of file ModuleTemplate.php.

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

getIconFactory ( )

Returns the IconFactory

Returns
IconFactory

Definition at line 237 of file ModuleTemplate.php.

References ModuleTemplate\$iconFactory.

getLanguageService ( )
protected

Returns the LanguageService

Returns
LanguageService

Definition at line 757 of file ModuleTemplate.php.

References $GLOBALS.

Referenced by ModuleTemplate\makeShortcutIcon().

getPageRenderer ( )

Get PageRenderer

Returns
PageRenderer

Definition at line 373 of file ModuleTemplate.php.

References ModuleTemplate\$pageRenderer.

getView ( )

Gets the standalone view.

Returns
StandaloneView

Definition at line 206 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 833 of file ModuleTemplate.php.

References ModuleTemplate\sectionEnd().

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 776 of file ModuleTemplate.php.

References Icon\SIZE_SMALL.

Referenced by ModuleTemplate\section().

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 491 of file ModuleTemplate.php.

loadJavaScripts ( )
protected

Loads all necessary Javascript Files

Returns
void

Definition at line 265 of file ModuleTemplate.php.

Referenced by ModuleTemplate\renderContent().

loadStylesheets ( )
protected

Loads all necessary stylesheets

Returns
void

Definition at line 279 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 520 of file ModuleTemplate.php.

References $GLOBALS, ModuleTemplate\$moduleName, $url, GeneralUtility\_GET(), elseif, 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 574 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 810 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 420 of file ModuleTemplate.php.

References $GLOBALS, and ModuleTemplate\getDocHeaderComponent().

Referenced by ModuleTemplate\setModuleId().

renderContent ( )
section (   $label,
  $text,
  $noStrToUpper = false,
  $sH = false,
  $type = 0,
  $allowHtmlInHeader = false 
)

Begins an output section and sets header and content

Parameters
string$labelThe header
string$textThe HTML-content
bool$noStrToUpperA flag that will prevent the header from being converted to uppercase
bool$sHDefines the type of header (if set, "<h3>" rather than the default "h4")
int$typeThe number of an icon to show with the header (see the icon-function). -1,1,2,3
bool$allowHtmlInHeaderIf set, HTML tags are allowed in $label (otherwise this value is by default htmlspecialchars()'ed)
Returns
string HTML content

Definition at line 627 of file ModuleTemplate.php.

References ModuleTemplate\icons(), ModuleTemplate\sectionBegin(), and ModuleTemplate\sectionHeader().

sectionBegin ( )

Begins an output section. Returns the

-begin tag AND sets the ->sectionFlag TRUE (if the ->sectionFlag is not already set!) You can call this function even if a section is already begun since the function will only return something if the sectionFlag is not already set!
Returns
string HTML content

Definition at line 701 of file ModuleTemplate.php.

Referenced by ModuleTemplate\section(), and ModuleTemplate\sectionHeader().

sectionEnd ( )

Ends and output section Returns the -end tag AND clears the ->sectionFlag (but does so only IF the sectionFlag is set - that is a section is 'open') See sectionBegin() also.

Returns
string HTML content

Definition at line 726 of file ModuleTemplate.php.

Referenced by ModuleTemplate\divider(), and ModuleTemplate\header().

sectionHeader (   $label,
  $sH = false,
  $addAttribute = '' 
)

Make a section header. Begins a section if not already open.

Parameters
string$labelThe label between the

or tags. (Allows HTML) bool $sH If set, is used, otherwise string $addAttribute Additional attributes to h-tag, eg. ' class=""' string HTML content

Definition at line 676 of file ModuleTemplate.php.

References ModuleTemplate\sectionBegin().

Referenced by ModuleTemplate\section().

setBodyTag (   $bodyTag)

Sets the body tag

Parameters
string$bodyTag

Definition at line 196 of file ModuleTemplate.php.

References ModuleTemplate\$bodyTag.

setContent (   $content)

Set content

Parameters
string$contentContent of the module
Returns
void

Definition at line 217 of file ModuleTemplate.php.

References ModuleTemplate\$content.

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

Definition at line 872 of file ModuleTemplate.php.

References ModuleTemplate\$flashMessageQueue.

setForm (   $formTag = '')

Set form tag

Parameters
string$formTagForm tag to add
Returns
void

Definition at line 385 of file ModuleTemplate.php.

setJavaScriptCodeArray ( )
protected

Wrapper function for adding JS inline blocks

Returns
void

Definition at line 308 of file ModuleTemplate.php.

Referenced by ModuleTemplate\renderContent().

setModuleId (   $moduleId)

Sets the ModuleId

Parameters
string$moduleIdID of the module
Returns
void

Definition at line 397 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 410 of file ModuleTemplate.php.

References ModuleTemplate\$moduleName.

setTitle (   $title)

Set title tag

Parameters
string$title

Definition at line 227 of file ModuleTemplate.php.

References ModuleTemplate\$title.

setupPage ( )
protected

Sets mandatory parameters for the view (pageRenderer)

Returns
void

Definition at line 294 of file ModuleTemplate.php.

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 179 of file ModuleTemplate.php.

Referenced by ModuleTemplate\setFlashMessageQueue().

$iconFactory
protected

Definition at line 144 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 151 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.

$sectionFlag = 0
protected

Definition at line 137 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 165 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.