Template

class OCP\Template
This class provides the template system for owncloud. You can use it to load
specific templates, add data and generate the html code
Source:lib/public/Template.php#39
Parent:OC_Template

Methods

public static OCP\Template::image_path($app, $image)
Make OC_Helper::imagePath available as a simple function
Source:

lib/public/Template.php#51

Parameters:
  • $app (string)
  • $image (string)
See:

\OCP\IURLGenerator::imagePath

Returns:

string to the image

Since:

8.0.0

public static OCP\Template::mimetype_icon($mimetype)
Make OC_Helper::mimetypeIcon available as a simple function
Source:

lib/public/Template.php#64

Parameters:
  • $mimetype (string)
Returns:

string to the image of this file type.

Since:

8.0.0

public static OCP\Template::preview_icon($path)
Make preview_icon available as a simple function
Source:

lib/public/Template.php#76

Parameters:
  • $path (string) path to file
Returns:

string to the preview of the image

Since:

8.0.0

public static OCP\Template::publicPreview_icon($path, $token)
Make publicpreview_icon available as a simple function
Returns the path to the preview of the image.
Source:

lib/public/Template.php#90

Parameters:
  • $path (string) of file
  • $token (string)
Returns:

string link to the preview

Since:

8.0.0

public static OCP\Template::human_file_size($bytes)
Make OC_Helper::humanFileSize available as a simple function
Example: 2048 to 2 kB.
Source:

lib/public/Template.php#103

Parameters:
  • $bytes (int) in bytes
Returns:

string size as string

Since:

8.0.0

public static OCP\Template::relative_modified_date($timestamp, $dateOnly=false)
Return the relative date in relation to today. Returns something like “last hour” or “two month ago”
Source:

lib/public/Template.php#117

Parameters:
  • $timestamp (int) unix timestamp
  • $dateOnly (bool)
Returns:

string human readable interpretation of the timestamp

Since:

8.0.0

public static OCP\Template::html_select_options($options, $selected, $params=array())
Generate html code for an options block.
Source:

lib/public/Template.php#131

Parameters:
  • $options (array) the options
  • $selected (mixed) which one is selected?
  • $params (array) the parameters
Returns:

string html options

Since:

8.0.0