Stud.IP  jlu_4.1 Revision
WysiwygDocument Class Reference
Collaboration diagram for WysiwygDocument:
Collaboration graph

Public Member Functions

 __construct ($studipDocument, $mimeType)
 
 filename ()
 
 type ()
 
 url ()
 
 createFolder ( $name, $description=null)
 

Static Public Member Functions

static storeUploadedFilesIn ($foldertype)
 
static getUploadedFiles ()
 
static fromUpload ($file, $folder_id)
 
static studipData ($file, $folder_id)
 
static executeQuery ($query, $parameters, $fetch=true)
 

Detailed Description

Info about Stud.IP documents uploaded by the WYSIWYG editor and collection of static methods for uploading files.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $studipDocument,
  $mimeType 
)

Construct new WysiwygDocument for an uploaded Stud.IP document.

Member Function Documentation

◆ createFolder()

createFolder (   $name,
  $description = null 
)

Create a new Stud.IP folder or return an existing one.

Parameters
string$nameFolder name.
string$descriptionFolder description. Only used if folder doesn't already exist.
string$parent_idParent folder's ID, NULL for top-level folders.
int$permissionFolder access permissions.
Returns
string Folder ID, NULL if something went wrong.
Here is the call graph for this function:

◆ executeQuery()

static executeQuery (   $query,
  $parameters,
  $fetch = true 
)
static

Execute a database query and return it's results.

Do not use this function to fetch large result sets! Result format is as defined by PDO::ATTR_DEFAULT_FETCH_MODE.

Parameters
string$querySQL query to execute.
array$parametersParameters for the SQL query.
boolean$fetchIf set to FALSE fetchAll() is not executed.
Returns
mixed Array of result set rows (empty for zero results), or PDOStatement if $fetch is FALSE. Returns FALSE on failure.
Here is the call graph for this function:

◆ filename()

filename ( )
Returns
string The actual file's name without its path.

◆ fromUpload()

static fromUpload (   $file,
  $folder_id 
)
static

Create a new Stud.IP document from an uploaded file.

Parameters
array$fileMetadata of uploaded file.
string$folder_idID of Stud.IP folder to which file is stored.
Returns
StudipDocument New Stud.IP document for uploaded file.
Exceptions
AccessDeniedExceptionif file is forbidden or upload failed.

◆ getUploadedFiles()

static getUploadedFiles ( )
static

Normalize $_FILES for HTML array upload of multiple files.

$_FILES must have the following structure (HTML array upload):

['files' => ['name' => [name1, name2, ...], 'tmp_name' => [tmp1, tmp2, ...], 'type' => [type1, type2, ...], 'size' => [size1, size2, ...], 'error' => [error1, error2, ...], ...]

The return value will have the structure:

[['name' => name1, 'tmp_name' => tmp1, 'type' => type1, 'size' => size1, 'error' => error1, ...], ['name' => name2, 'tmp_name' => tmp2, 'type' => type2, 'size' => size2, 'error' => error2, ...], ...]

Returns
array Each entry is an associative array for a single file.

◆ storeUploadedFilesIn()

static storeUploadedFilesIn (   $foldertype)
static

Store uploaded files as StudIP documents.

Parameters
FolderType$foldertype
Returns
array Associative array containing upload results.

◆ studipData()

static studipData (   $file,
  $folder_id 
)
static

Initialize Stud.IP metadata array for creating a new Stud.IP document.

Parameters
array$fileMetadata of uploaded file.
string$folder_idID of folder in which the document is created.
Returns
array Stud.IP document metadata
Here is the call graph for this function:

◆ type()

type ( )
Returns
string Mime-type of the uploaded document.

◆ url()

url ( )

Return URL for downloading the file.

Parameters
string$idFile identifier in database table 'dokumente'.
Returns
string Download link, NULL if file doesn't exist.

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