Stud.IP  jlu_3.3 Revision
WysiwygDocument Class Reference
Collaboration diagram for WysiwygDocument:
Collaboration graph

Public Member Functions

 __construct ($studipDocument, $mimeType)
 
 filename ()
 
 type ()
 
 url ()
 
 createFolder ( $name, $description=NULL, $parent_id=NULL, $permission=7)
 

Static Public Member Functions

static storeUploadedFilesIn ($folder_id)
 
static getUploadedFiles ()
 
static fromUpload ($file, $folder_id)
 
static studipData ($file, $folder_id)
 
static getFolderId ($name, $parent_id=null)
 
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,
  $parent_id = NULL,
  $permission = 7 
)

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.
Here is the call graph for this function:

◆ getFolderId()

static getFolderId (   $name,
  $parent_id = null 
)
static

Return a folder's identifier.

@params string $name Folder name. @params string $parent_id Parent folder's ID, NULL for top-level folders.

Returns
string Folder ID if folder exists, NULL if not.

◆ 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 (   $folder_id)
static

Store uploaded files as StudIP documents.

Parameters
string$folder_idUID of Stud.IP document folder to which files are stored.
Returns
array Associative array containing upload results.
Here is the call graph for this function:

◆ 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.
Here is the call graph for this function:

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