Stud.IP  5.4
StandardFile Class Reference
Inheritance diagram for StandardFile:
FileType StandardFileInterface LibraryFile URLFile

Public Member Functions

 __construct ($fileref, $file=null)
 
 __get ($name)
 
 __set ($name, $value)
 
 __isset ($name)
 
 offsetExists ($offset)
 
 offsetGet ($offset)
 
 offsetSet ($offset, $value)
 
 offsetUnset ($offset)
 
 getIcon ($role)
 
 getId ()
 
 getFilename ()
 
 getUserId ()
 
 getUserName ()
 
 getAccessibility ()
 
 getUser ()
 
 getSize ()
 
 getMimeType ()
 
 getDownloadURL ()
 
 getDownloads ()
 
 getPath ()
 
 getLastChangeDate ()
 
 getMakeDate ()
 
 getDescription ()
 
 getTermsOfUse ()
 
 getActionmenu ()
 
 getInfoDialogButtons (array $extra_link_params=[])
 
 delete ()
 
 getFolderType ()
 
 isVisible ($user_id=null)
 
 isDownloadable ($user_id=null)
 
 isEditable ($user_id=null)
 
 isWritable ($user_id=null)
 
 convertToStandardFile ()
 
 addToFolder (FolderType $standard_folder, $filename, $user_id=null)
 
 getFileRef ()
 
 getContentForAdditionalColumn ($column_index)
 
 getAdditionalColumnOrderWeigh ($column_index)
 
 getInfoTemplate (bool $include_downloadable_infos=false)
 

Static Public Member Functions

static create ($data, $user_id=null)
 

Protected Attributes

 $fileref = null
 
 $file = null
 

Constructor & Destructor Documentation

◆ __construct()

__construct (   $fileref,
  $file = null 
)

StandardFile constructor.

Parameters
$fileref
null$file: (optional) Is set if fileref and file are both new and not connected with each other in the database.

Implements StandardFileInterface.

Member Function Documentation

◆ __get()

__get (   $name)

magic method for dynamic properties

◆ __isset()

__isset (   $name)

magic method for dynamic properties

◆ __set()

__set (   $name,
  $value 
)

magic method for dynamic properties

◆ addToFolder()

addToFolder ( FolderType  $standard_folder,
  $filename,
  $user_id = null 
)

◆ convertToStandardFile()

convertToStandardFile ( )

Returns an object of the class StandardFile or a derived class.

Returns
StandardFile

Implements FileType.

◆ create()

static create (   $data,
  $user_id = null 
)
static

Creates a prepared file with ids that could be added to a folder

Parameters
array$data: ['name': "myfilename", 'type': "mime_type", 'size': "1234", 'tmp_name': "", 'error': null]
null | string$user_id: the id of the user that should own the new file
Returns
FileType|array : FileType (of called class) on success or an array with errors if an error occurred.

◆ delete()

delete ( )

Deletes that file.

Returns
bool : true on success

Implements FileType.

◆ getAccessibility()

getAccessibility ( )

Returns if a file is accessible or not.

Returns
bool

Implements FileType.

◆ getActionmenu()

getActionmenu ( )

Returns an instance of ActionMenu.

Returns
ActionMenu|null

Implements FileType.

◆ getAdditionalColumnOrderWeigh()

getAdditionalColumnOrderWeigh (   $column_index)

Returns an integer or text that marks the value the content of the given column should be ordered by.

Parameters
string$column_index
Returns
mixed : order value

Implements FileType.

◆ getContentForAdditionalColumn()

getContentForAdditionalColumn (   $column_index)

Returns the content for that additional column, if it exists. You can return null a string or a Flexi_Template as the content.

Parameters
string$column_index
Returns
null|string|Flexi_Template

Implements FileType.

◆ getDescription()

getDescription ( )

Returns the description of that FileType object.

Returns
string|null

Implements FileType.

◆ getDownloads()

getDownloads ( )

Returns the number of downloads this file already has. Returns null if information is not available.

Returns
integer|null

Implements FileType.

◆ getDownloadURL()

getDownloadURL ( )

Returns the URL to download the file. May be sendfile.php?... or an external link.

Returns
string|null

Implements FileType.

◆ getFilename()

getFilename ( )

Filename of the FileType-object.

Returns
mixed

Implements FileType.

◆ getFileRef()

getFileRef ( )

◆ getFolderType()

getFolderType ( )

Returns the FolderTyp of the parent folder.

Returns
FolderType

Implements FileType.

◆ getIcon()

getIcon (   $role)

Returns the name of the icon shape that shall be used with the FileType implementation.

Parameters
string$rolerole of icon
Returns
Icon icon for the FileType implementation.

Implements FileType.

◆ getId()

getId ( )

Returns the id of the file which is most likely the id of the FileRef object within the FileType object.

Returns
mixed

Implements FileType.

◆ getInfoDialogButtons()

getInfoDialogButtons ( array  $extra_link_params = [])

Returns a list of Stud.IP button objects that represent actions that shall be visible for the file type in the info dialog.

Parameters
array$extra_link_paramsAn optional array of URL parameters that should be added to Button URLs, if reasonable. The parameter names are the keys of the array while their values are also the array item values.
Returns
Interactable[] A list of Stud.IP buttons (LinkButton or Button).

Implements FileType.

◆ getInfoTemplate()

getInfoTemplate ( bool  $include_downloadable_infos = false)

Generates a Flexi_Template containing additional information that are displayes in the information dialog of a file.

Parameters
bool$include_downloadable_infosWhether to include information like file previews that can be downloaded (true) or to not include them (false). Defaults to false.
Returns
Flexi_Template|null Either a Flexi_Template containing additional information or null if no such information shall be displayed in the information dialog.

Implements FileType.

◆ getLastChangeDate()

getLastChangeDate ( )

Returns the UNIX-Timestamp of the last change or null if this information is unknown.

Returns
integer|null

Implements FileType.

◆ getMakeDate()

getMakeDate ( )

Returns the UNIX-timestamp of creation of that file

Returns
integer|null

Implements FileType.

◆ getMimeType()

getMimeType ( )

Returns the mime-type of that FileType-object.

Returns
string

Implements FileType.

◆ getPath()

getPath ( )

Returns the (real) file system path for the file. This is only relevant for FileType implementations storing real files on the server disk. Other implementations shall just return an empty string.

Returns
The file system path for the file or an empty string if the file doesn't have a path in the file system.

Implements FileType.

◆ getSize()

getSize ( )

Returns the size of the file in bytes. If this is null, the file doesn't exist physically - is probably only a weblink or a request for libraries.

Returns
integer|null

Implements FileType.

◆ getTermsOfUse()

getTermsOfUse ( )
Returns
ContentTermsOfUse

Implements FileType.

◆ getUser()

getUser ( )
Returns
The User object representing the author.

Implements FileType.

◆ getUserId()

getUserId ( )

The user_id in Stud.IP if the author has Stud.IP account. If it has none, return null.

Returns
mixed|null

Implements FileType.

◆ getUserName()

getUserName ( )

Return the name of the author as a string.

Returns
string|null

Implements FileType.

◆ isDownloadable()

isDownloadable (   $user_id = null)

Determines if a user may download the file.

Parameters
string$user_idThe user who wishes to download the file.
Returns
boolean True, if the user is permitted to download the file, false otherwise.

Implements FileType.

◆ isEditable()

isEditable (   $user_id = null)

Determines if a user may edit the file.

Parameters
string$user_idThe user who wishes to edit the file.
Returns
boolean True, if the user is permitted to edit the file, false otherwise.

Implements FileType.

◆ isVisible()

isVisible (   $user_id = null)

Determines whether the file is visible for a user.

Parameters
string$user_idThe user for which the visibility of the file shall be determined.
Returns
boolean True, if the user is permitted to see the file, false otherwise.

Implements FileType.

◆ isWritable()

isWritable (   $user_id = null)

Determines if a user may write to the file.

Parameters
string$user_idThe user who wishes to write to the file.
Returns
boolean True, if the user is permitted to write to the file, false otherwise.

Implements FileType.

◆ offsetExists()

offsetExists (   $offset)

ArrayAccess: Check whether the given offset exists.

◆ offsetGet()

offsetGet (   $offset)

ArrayAccess: Get the value at the given offset.

◆ offsetSet()

offsetSet (   $offset,
  $value 
)

ArrayAccess: Set the value at the given offset.

◆ offsetUnset()

offsetUnset (   $offset)

ArrayAccess: unset the value at the given offset (not applicable)

Field Documentation

◆ $file

$file = null
protected

◆ $fileref

$fileref = null
protected

The documentation for this class was generated from the following file: