PHP Class Backend\Core\Engine\DataGridFunctions

ファイルを表示 Open project: forkcms/forkcms Class Usage Examples

Protected Properties

Property Type Description
$dataGridUsers

Public Methods

Method Description
cleanupPlainText ( string $var ) : string Formats plain text as HTML, links will be detected, paragraphs will be inserted
formatFloat ( float $number, integer $decimals = 2 ) : string Format a number as a float
getDate ( integer $timestamp ) : string Format a date according the users' settings
getLongDate ( integer $timestamp ) : string Format a date as a long representation according the users' settings
getTime ( integer $timestamp ) : string Format a time according the users' settings
getTimeAgo ( integer $timestamp ) : string Get time ago as a string for use in a datagrid
getUser ( integer $id ) : string Get the HTML for a user to use in a datagrid
greyOut ( string $type, string $value, array $attributes = [] ) : array This will grey out certain rows from common columns. These columns are:
showBool ( string | boolean $status, boolean $reverse = false ) : string This is an alias for the template modifier since it can also be used here and people didn't find it.
showImage ( string $path, string $image, string $title = '', string $url = null, integer $width = null, integer $height = null ) : string Returns an image tag
truncate ( string $string, integer $length, boolean $useHellip = true ) : string Truncate a string

Method Details

cleanupPlainText() public static method

Formats plain text as HTML, links will be detected, paragraphs will be inserted
public static cleanupPlainText ( string $var ) : string
$var string The data to cleanup.
return string

formatFloat() public static method

Format a number as a float
public static formatFloat ( float $number, integer $decimals = 2 ) : string
$number float The number to format.
$decimals integer The number of decimals.
return string

getDate() public static method

Format a date according the users' settings
public static getDate ( integer $timestamp ) : string
$timestamp integer The UNIX-timestamp to format as a human readable date.
return string

getLongDate() public static method

Format a date as a long representation according the users' settings
public static getLongDate ( integer $timestamp ) : string
$timestamp integer The UNIX-timestamp to format as a human readable date.
return string

getTime() public static method

Format a time according the users' settings
public static getTime ( integer $timestamp ) : string
$timestamp integer The UNIX-timestamp to format as a human readable time.
return string

getTimeAgo() public static method

Get time ago as a string for use in a datagrid
public static getTimeAgo ( integer $timestamp ) : string
$timestamp integer The UNIX-timestamp to convert in a time-ago-string.
return string

getUser() public static method

Get the HTML for a user to use in a datagrid
public static getUser ( integer $id ) : string
$id integer The Id of the user.
return string

greyOut() public static method

'visible', 'hidden', 'active', 'published'
public static greyOut ( string $type, string $value, array $attributes = [] ) : array
$type string The type of column. This is given since some columns can have different meanings than others.
$value string
$attributes array
return array

showBool() public static method

This is an alias for the template modifier since it can also be used here and people didn't find it.
public static showBool ( string | boolean $status, boolean $reverse = false ) : string
$status string | boolean
$reverse boolean show the opposite of the status
return string

showImage() public static method

Returns an image tag
public static showImage ( string $path, string $image, string $title = '', string $url = null, integer $width = null, integer $height = null ) : string
$path string The path to the image.
$image string The filename of the image.
$title string The title (will be used as alt).
$url string The url
$width integer The width for the
$height integer The height for the
return string

truncate() public static method

Truncate a string
public static truncate ( string $string, integer $length, boolean $useHellip = true ) : string
$string string The string to truncate.
$length integer The maximumlength for the string.
$useHellip boolean Should a hellip be appended?
return string

Property Details

$dataGridUsers protected_oe static_oe property

protected static $dataGridUsers