Stud.IP  5.4
Folder Class Reference
Inheritance diagram for Folder:
SimpleORMap FeedbackRange

Public Member Functions

 cbMakeUniqueName ()
 
 cbRemoveFeedbackElements ()
 
 fileExists ($file_name)
 
 getUniqueName ($file_name, $folder_naming_mode=false)
 
 getTypedFolder ()
 
 linkFile ($file_or_id, $file_ref_data=[])
 
 unlinkFileRef ($fileref_or_id)
 
 getParents ()
 
 getPath ($delimiter='/')
 
 getRangeName ()
 
 getRangeIcon ($role)
 
 getRangeUrl ()
 
 getRangeCourseId ()
 
 isRangeAccessible (string $user_id=null)
 
- Public Member Functions inherited from SimpleORMap
 __construct ($id=null)
 
 __clone ()
 
 getRelationOptions ($relation)
 
 getTableMetadata ()
 
 hasAutoIncrementColumn ()
 
 setId ($id)
 
 getId ()
 
 getNewId ()
 
 toArray ($only_these_fields=null)
 
 toRawArray ($only_these_fields=null)
 
 toArrayRecursive ($only_these_fields=null)
 
 getValue ($field)
 
 getRelationValue ($relation, $field)
 
 getDefaultValue ($field)
 
 setValue ($field, $value)
 
 __get ($field)
 
 __set ($field, $value)
 
 __isset ($field)
 
 offsetExists ($offset)
 
 offsetGet ($offset)
 
 offsetSet ($offset, $value)
 
 offsetUnset ($offset)
 
 getIterator ()
 
 count ()
 
 isField ($field)
 
 isRelation ($field)
 
 isAdditionalField ($field)
 
 isAliasField ($field)
 
 isI18nField ($field)
 
 setData ($data, $reset=false)
 
 isNew ()
 
 isDeleted ()
 
 setNew ($is_new)
 
 getWhereQuery ()
 
 restore ()
 
 store ()
 
 triggerChdate ()
 
 delete ()
 
 isDirty ()
 
 isFieldDirty ($field)
 
 revertValue ($field)
 
 getPristineValue ($field)
 
 initRelation ($relation)
 
 resetRelation ($relation)
 
 cleanup ()
 
- Public Member Functions inherited from FeedbackRange
 getId ()
 

Static Public Member Functions

static createTopFolder ($range_id, $range_type, $folder_type='RootFolder')
 
static findRangeTypeById ($range_id)
 
static findByTopic_id ($topic_id)
 
static findByTermin_id ($termin_id)
 
static findTopFolder ($range_id)
 
- Static Public Member Functions inherited from SimpleORMap
static tableScheme ($db_table)
 
static expireTableScheme ()
 
static exists ($id)
 
static countBySql ($sql='1', $params=[])
 
static create ($data)
 
static buildExisting ($data)
 
static import ($data)
 
static findBySQL ($sql, $params=[])
 
static findOneBySQL ($where, $params=[])
 
static findThru ($foreign_key_value, $options)
 
static findEachBySQL ($callable, $sql, $params=[])
 
static findMany ($pks=[], $order='', $order_params=[])
 
static findEachMany ($callable, $pks=[], $order='', $order_params=[])
 
static findAndMapBySQL ($callable, $where, $params=[])
 
static findAndMapMany ($callable, $pks=[], $order='', $order_params=[])
 
static deleteBySQL ($where, $params=[])
 
static toObject ($id_or_object)
 
static __callStatic ($name, $arguments)
 

Protected Member Functions

 cbLogDeleteFolder ()
 
- Protected Member Functions inherited from SimpleORMap
 _getId ($field)
 
 _setId ($field, $value)
 
 _getAdditionalValueFromRelation ($field)
 
 _setAdditionalValueFromRelation ($field, $value)
 
 _getAdditionalValue ($field)
 
 _setAdditionalValue ($field, $value)
 
 parseRelationOptions ($type, $name, $options)
 
 storeRelations ($only_these=null)
 
 deleteRelations ()
 
 initializeContent ()
 
 applyCallbacks ($type)
 
 cbNotificationMapper ($cb_type)
 
 cbAfterInitialize ($cb_type)
 
 setSerializedValue ($field, $value)
 
 setI18nValue ($field, $value)
 

Static Protected Member Functions

static configure ($config=[])
 
- Static Protected Member Functions inherited from SimpleORMap
static db_table ()
 
static db_fields ()
 
static pk ()
 
static default_values ()
 
static serialized_fields ()
 
static alias_fields ()
 
static i18n_fields ()
 
static additional_fields ()
 
static has_many ()
 
static has_one ()
 
static belongs_to ()
 
static has_and_belongs_to_many ()
 
static registered_callbacks ()
 
static known_slots ()
 
static notification_map ()
 
static getter_setter_map ()
 
static configure ($config=[])
 
static config ($key)
 
static registerCallback ($types, $cb)
 
static unregisterCallback ($types, $cb)
 

Additional Inherited Members

- Data Fields inherited from SimpleORMap
const ID_SEPARATOR = '_'
 
- Static Public Attributes inherited from SimpleORMap
static $schemes = null
 
- Protected Attributes inherited from SimpleORMap
 $content = []
 
 $content_db = []
 
 $is_new = true
 
 $is_deleted = false
 
 $relations = []
 
 $additional_data = []
 
- Static Protected Attributes inherited from SimpleORMap
static $config = []
 
static $reserved_slots = ['value','newid','iterator','tablemetadata', 'relationvalue','wherequery','relationoptions','data','new','id']
 
static $performs_batch_operation = false
 

Member Function Documentation

◆ cbLogDeleteFolder()

cbLogDeleteFolder ( )
protected

◆ cbMakeUniqueName()

cbMakeUniqueName ( )

This callback is called before storing a Folder object. In case the name field is changed this callback assures that the name of the Folder object is unique inside the parent folder.

◆ cbRemoveFeedbackElements()

cbRemoveFeedbackElements ( )

This callback is called after deleting a Folder. It removes feedback elements that are associated with the Folder.

◆ configure()

static configure (   $config = [])
staticprotected
Parameters
array$config

◆ createTopFolder()

static createTopFolder (   $range_id,
  $range_type,
  $folder_type = 'RootFolder' 
)
static

Creates a top folder (root directory) for a Stud.IP object given by range_id and range_type.

This method creates and stores a top folder (root directory) for a Stud.IP object. To properly create such a folder this method requires the parameters range_id and range_type to be set.

Parameters
string$range_idThe ID of the Stud.IP object
string$range_typeThe type of the object: "course", "inst", "user", ...
Returns
Folder Created Folder object.

◆ fileExists()

fileExists (   $file_name)

Checks if a file or folder with a given file name exists inside the folder.

By looking at the number of associated FileRef objects and the number of associated Folder objects this method determines if a file or folder with a given name exists inside the folder.

Parameters
string$file_nameThe file name of the file or folder which is searched.
Returns
bool Returns true, if a file was found, false otherwise.

◆ findByTermin_id()

static findByTermin_id (   $termin_id)
static

Retrieves folders by the ID of a CourseDate object.

Parameters
string$termin_idThe ID of a CourseDate object.
Returns
Folder[] An array with one folder object matching the $termin_id if such a folder can be found. Null otherwise.

◆ findByTopic_id()

static findByTopic_id (   $topic_id)
static

Retrieves folders by the ID of a CourseTopic object.

Parameters
string$topic_idThe ID of a CourseTopic object.
Returns
Folder[] An array with one folder object matching the topic-ID if such a folder can be found. Null otherwise.

◆ findRangeTypeById()

static findRangeTypeById (   $range_id)
static

Determines the range type by probing the given range ID.

This is a helper method that can be used in conjunction with the createTopFolder method. In case when only the ID of a Stud.IP object is given, this method will help to determine the corresponding object type.

Parameters
string$range_idThe ID of an object whose type shall be determined.
Returns
bool|string Returns false on failure, otherwise the name of the range.

◆ findTopFolder()

static findTopFolder (   $range_id)
static

Find the top folder of a Stud.IP object or create it, if it doesn't exist.

This method finds the top folder (root directory) of a course, institute, personal file area or a message by the ID given in the range_id parameter. If the root folder doesn't exist, it will be created.

Note that the range_id parameter is mandatory!

Parameters
stringrange_id The ID of the Stud.IP object whose top folder shall be found.
Returns
Folder|null Folder object on success or null, if no folder can be created.

◆ getParents()

getParents ( )

Returns a list of parent folders, starting with the top folder.

This method returns a list with the parent folders of the folder until the top folder (root directory) is found. The list is reversed so that it starts with the top folder and ends with this folder.

Returns
[] An array of parent folders, starting with the top folder.

◆ getPath()

getPath (   $delimiter = '/')

Returns the file system path from the top folder to this folder.

By calling the getParents method of this class and getting the names of the parent folders the path is created. The default path separator is a slash, but it can be overwritten by specifying the $delimiter parameter.

Parameters
string$delimiterThe character to be used as path separator.
Returns
string The path from the top folder to this folder, separated by the character set in $delimiter.

◆ getRangeCourseId()

getRangeCourseId ( )

Returns the course id of FeedbackRange object instance

Returns
string course_id

Implements FeedbackRange.

◆ getRangeIcon()

getRangeIcon (   $role)

Returns the icon object that shall be used with the FeedbackRange object instance.

Parameters
string$rolerole of icon
Returns
Icon icon for the FeedbackRange object instance.

Implements FeedbackRange.

◆ getRangeName()

getRangeName ( )

Returns a human-friendly representation of the FeedbackRange object instance's name.

Returns
string A human-friendly name for the FeedbackRange object instance.

Implements FeedbackRange.

◆ getRangeUrl()

getRangeUrl ( )

Returns the URL of FeedbackRange view, where the object instance is visible together with the related feedback element(s).

Returns
string Path that is usable with the url_for and link_for methods.

Implements FeedbackRange.

◆ getTypedFolder()

getTypedFolder ( )

Gets the FolderType object for the current folder.

The FolderType class defines extended attributes for a folder. With this method the associated FolderType of a folder can be determined.

Returns
FolderType An object of a FolderType derivate.
Exceptions
UnexpectedValueExceptionIf the class specified by the folder's folder_type attribute can't be found an Exception is thrown.

◆ getUniqueName()

getUniqueName (   $file_name,
  $folder_naming_mode = false 
)

Makes a given file name unique and returns the altered file name.

The file and folder names in a folder must be unique. This helper method will check, if a file or folder with the name given by the parameter $file_name exists and if so, it will append a number in square brackets to the file name to make it unique. The unique file name is returned.

Parameters
string$file_nameThe file name that shall be checked for uniqueness.
bool$folder_naming_modeEnable (true) or disable (false) the Folder naming mode. The default is false (disabled). If folder naming mode is set to true, the number in square brackets is appended to the end of the name instead of being inserted before the last dot in the name.
Returns
string An unique filename.

◆ isRangeAccessible()

isRangeAccessible ( string  $user_id = null)

Returns the accessebility of FeedbackRange object instance for current active user

Parameters
string$user_idoptional; use this ID instead of $GLOBALS['user']->id
Returns
bool range object accessebility

Implements FeedbackRange.

◆ linkFile()

linkFile (   $file_or_id,
  $file_ref_data = [] 
)

Creates a FileRef object for a given File object or its ID.

This method creates a FileRef object for a file that is represented by its object or its ID. The new FileRef's description is different than the one from the file since it is set via the $description parameter. Furthermore license information can be stored via the $license parameter.

Parameters
File | string$file_or_idEither a file object or a string containing a File object's ID.
array$file_ref_dataThe description for the file that shall be used in the FileRef object.
Returns
FileRef|null On success a FileRef for the given file is returned. On failure, null is returned.

◆ unlinkFileRef()

unlinkFileRef (   $fileref_or_id)

Removes a file reference.

Parameters
FileRef | string$fileref_or_idThe FileRef itself or its ID
Returns
int|bool Returns the amount of deleted databasw rows on success or false on failure.

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