LimeSurvey API - Master branch

viewHelper
in package

General helper class for generating views.

Table of Contents

Methods

disableHtmlLogging()  : void
disableLogging deactivate default logging in HTML if we don't produce HTML
filterScript()  : string
Deactivate script but show it for debuging This only filter script tag
flatEllipsizeText()  : string
Return a string fixed according to option
flatten()  : string
return cleaned HTML
getFieldCode()  : string
getFieldCode returns complete field information code.
getFieldText()  : string
getFieldText returns complete field information text.
getIconLink()  : string
getIconLink returns HTML needed for a link that consists of only an image with alt text.
getImageLink()  : string
getImageLink returns HTML needed for a link that consists of only an image with alt text.
getLanguageData()  : mixed
NOTE: A real class helper is needed for twig, so I used this one for now.
getViewTestTag()  : string
Get a tag to help automated tests identify pages
purified()  : string
Show purified html
putSeparator()  : string
Return a string with the good separator before and after
stripTagsEM()  : string
Show clean string, leaving ONLY tag for Expression

Methods

disableHtmlLogging()

disableLogging deactivate default logging in HTML if we don't produce HTML

public static disableHtmlLogging() : void

Usage: disableLogging()

Tags
author

Menno Dekker

filterScript()

Deactivate script but show it for debuging This only filter script tag

public static filterScript(string $sHtml) : string
Parameters
$sHtml : string
Tags
todo

: filter inline javascript (onclick etc ..., but don't filter EM javascript) Maybe doing it directly in LEM->GetLastPrettyPrintExpression();

author

Denis Chenu

Return values
string

flatEllipsizeText()

Return a string fixed according to option

public static flatEllipsizeText(string $sString[, bool $bFlat = true ][, int $iAbbreviated = 0 ][, string $sEllipsis = '...' ][, int $fPosition = 1 ]) : string
Parameters
$sString : string

:the string

$bFlat : bool = true

: flattenText or not : completely flat (not like flattenText from common_helper)

$iAbbreviated : int = 0

: max string text (if true : always flat), 0 or false : don't abbreviated

$sEllipsis : string = '...'

if abbreviated : the char to put at end (or middle)

$fPosition : int = 1

if abbreviated position to split (in % : 0 to 1)

Return values
string

flatten()

return cleaned HTML

public static flatten(mixed $sHtml) : string
Parameters
$sHtml : mixed
Return values
string

getFieldCode()

getFieldCode returns complete field information code.

public static getFieldCode(array<string|int, mixed> $aField[, array<string|int, mixed> $aOption = array() ]) : string

Usage: getFieldCode($aField, $aOption)

Parameters
$aField : array<string|int, mixed>

the field information from createFieldMap

$aOption : array<string|int, mixed> = array()

option for filtering

Return values
string

getFieldText()

getFieldText returns complete field information text.

public static getFieldText(array<string|int, mixed> $aField[, array<string|int, mixed> $aOption = array() ]) : string

Usage: getFieldText($aField, $aOption)

Parameters
$aField : array<string|int, mixed>

the field information from createFieldMap

$aOption : array<string|int, mixed> = array()

option (see default)

Return values
string

getIconLink returns HTML needed for a link that consists of only an image with alt text.

public static getIconLink(string $icoClasses, string $linkUrl, string $linkTxt[, string $linkTarget = null ][, string $linkClass = 'imagelink' ][, array<string|int, mixed> $attribs = array() ]) : string

Usage: getIconLink('test.png', 'controller/action/params', 'Your description', 'optionalClass', '_blank')

Parameters
$icoClasses : string

the classes of the icon to generate

$linkUrl : string

Url we want to go to, uses CController->createUrl()

$linkTxt : string

Text to show for the link

$linkTarget : string = null

Optional target to use for the link

$linkClass : string = 'imagelink'

Optional class to add to the link

$attribs : array<string|int, mixed> = array()

Optional array of attirbutes to set on the link

Return values
string

getImageLink returns HTML needed for a link that consists of only an image with alt text.

public static getImageLink(string $imgName, string $linkUrl, string $linkTxt[, string $linkTarget = null ][, string $linkClass = 'imagelink' ][, array<string|int, mixed> $attribs = array() ]) : string

Usage: getImageLink('test.png', 'controller/action/params', 'Your description', 'optionalClass', '_blank')

Parameters
$imgName : string

the name of the image to use, adminImageUrl will be added to it

$linkUrl : string

Url we want to go to, uses CController->createUrl()

$linkTxt : string

Text to show for the link

$linkTarget : string = null

Optional target to use for the link

$linkClass : string = 'imagelink'

Optional class to add to the link

$attribs : array<string|int, mixed> = array()

Optional array of attirbutes to set on the link

Return values
string

getLanguageData()

NOTE: A real class helper is needed for twig, so I used this one for now.

public static getLanguageData([mixed $bOrderByNative = false ][, mixed $sLanguageCode = 'en' ]) : mixed

TODO: convert surveytranslator to a real helper

Parameters
$bOrderByNative : mixed = false
$sLanguageCode : mixed = 'en'

getViewTestTag()

Get a tag to help automated tests identify pages

public static getViewTestTag(string $name) : string
Parameters
$name : string

unique view name

Return values
string

purified()

Show purified html

public static purified(mixed $sHtml) : string
Parameters
$sHtml : mixed
Return values
string

putSeparator()

Return a string with the good separator before and after

public static putSeparator( $sString, mixed $separator) : string
Parameters
$sString :

:the string

$separator : mixed
Return values
string

stripTagsEM()

Show clean string, leaving ONLY tag for Expression

public static stripTagsEM(mixed $sHtml) : string
Parameters
$sHtml : mixed
Return values
string

        
On this page

Search results