Stud.IP  3.1 Revision 48552
 All Data Structures Namespaces Files Functions Variables Groups Pages
StudipDirectory Class Reference
Inheritance diagram for StudipDirectory:
Inheritance graph
Collaboration diagram for StudipDirectory:
Collaboration graph

Public Member Functions

 createFile ($name, $description= '')
 copy (File $source, $name, $description= '')
 getEntry ($name)
 getPermissions ()
 countFiles ($count_deep=false, $count_folders=true)
 isEmpty ()
 isRootDirectory ()
 link (File $file, $name, $description= '')
 ensureUniqueFilename ($name, File $file=null)
 listFiles ()
 listDirectories ()
 mkdir ($name, $description= '')
 delete ()
 isReadable ()
 isWritable ()
 open ($mode)
 search ($text)
 setPermissions ($permissions)
 unlink ($name)
 update ()
- Public Member Functions inherited from File
 getLinks ()
 getStoragePath ()
 getStorageObject ()
 setContentFromFile ($file)
 checkAccess ($user_id=null, $throw_exception=true)
- Public Member Functions inherited from SimpleORMap
 __construct ($id=null)
 __clone ()
 getRelationOptions ($relation)
 getTableMetadata ()
 hasAutoIncrementColumn ()
 setId ($id)
 getId ()
 getNewId ()
 toArray ($only_these_fields=null)
 toArrayRecursive ($only_these_fields=null)
 getValue ($field)
 getRelationValue ($relation, $field)
 setValue ($field, $value)
 __get ($field)
 __set ($field, $value)
 __isset ($field)
 offsetExists ($offset)
 offsetGet ($offset)
 offsetSet ($offset, $value)
 offsetUnset ($offset)
 getIterator ()
 count ()
 isField ($field)
 isAdditionalField ($field)
 isAliasField ($field)
 setData ($data, $reset=false)
 haveData ()
 isNew ()
 isDeleted ()
 setNew ($is_new)
 getWhereQuery ()
 restore ()
 store ()
 triggerChdate ()
 isDirty ()
 isFieldDirty ($field)
 revertValue ($field)
 getPristineValue ($field)
 initRelation ($relation)
 resetRelation ($relation)

Static Public Member Functions

static getRootDirectory ($context_id)
- Static Public Member Functions inherited from File
static get ($id)
- Static Public Member Functions inherited from SimpleORMap
static expireTableScheme ()
static find ($id)
static exists ($id)
static countBySql ($sql=1, $params=array())
static create ($data)
static build ($data, $is_new=true)
static buildExisting ($data)
static import ($data)
static findBySQL ($sql, $params=array())
static findByObject (SimpleORMap $object)
static findOneBySQL ($where, $params=array())
static findThru ($foreign_key_value, $options)
static findEachBySQL ($callable, $sql, $params=array())
static findMany ($pks=array(), $order= '', $order_params=array())
static findEachMany ($callable, $pks=array(), $order= '', $order_params=array())
static findAndMapBySQL ($callable, $where, $params=array())
static findAndMapMany ($callable, $pks=array(), $order= '', $order_params=array())
static deleteBySQL ($where, $params=array())
static toObject ($id_or_object)
static __callStatic ($name, $arguments)

Static Protected Member Functions

static configure ($config=array())

Additional Inherited Members

- 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)
 getTableScheme ()
 storeRelations ($only_these=null)
 deleteRelations ()
 initializeContent ()
 applyCallbacks ($type)
 registerCallback ($types, $cb)
 unregisterCallback ($types, $cb)
 cbAutoIncrementColumn ($type)
 cbAutoKeyCreation ()
 cbNotificationMapper ($cb_type)
 setSerializedValue ($field, $value)
- Protected Attributes inherited from File
 $storage_object
- Static Protected Attributes inherited from File
static $object_cache = array()

Detailed Description

StudipDirectory.php

Class to represent directories in the database. Every directory is also a file, so this a subclass of File.

Copyright (c) 2013 Elmar Ludwig

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Member Function Documentation

static configure (   $config = array())
staticprotected

Configures this model

Reimplemented from File.

copy ( File  $source,
  $name,
  $description = '' 
)

Create a new file by copying the contents of an existing file into this directory under the given name. Unlike the link() method, this creates a separate file. Returns the directory entry.

Parameters
File$sourcesource file to copy
string$namedestination file name
Returns
DirectoryEntry created DirectoryEntry object

Here is the call graph for this function:

countFiles (   $count_deep = false,
  $count_folders = true 
)

Returns number of linked files or folders in this directory.

Parameters
bool$count_deepCount recursively in directories?
bool$count_foldersCount folders?
Returns
int Number of linked files or folders

Here is the call graph for this function:

Here is the caller graph for this function:

createFile (   $name,
  $description = '' 
)

Create a new empty file in this directory under the given name and returns the directory entry.

Parameters
string$namefile name
Returns
DirectoryEntry created DirectoryEntry object

Here is the call graph for this function:

Here is the caller graph for this function:

delete ( )

Delete the contents of this directory (recursively).

Reimplemented from File.

Reimplemented in RootDirectory.

Here is the call graph for this function:

ensureUniqueFilename (   $name,
File  $file = null 
)

Ensure a unique filename.

Parameters
String$nameBase file name that is supposed to be unique
File | null$fileOptional associated file
Returns
String Unique filename

Here is the call graph for this function:

Here is the caller graph for this function:

getEntry (   $name)

Return the entry with the given name in this directory, if one exists (returns NULL otherwise).

Parameters
string$namefile name
Returns
DirectoryEntry DirectoryEntry object or NULL

Here is the call graph for this function:

Here is the caller graph for this function:

getPermissions ( )

Get access permissions for this directory. Access permissions are not implemented at this time.

static getRootDirectory (   $context_id)
static

Get a root directory object for the given context id. Root directories are not represented in the database. TODO Is this function really needed?

Parameters
string$context_idcontext (course id etc.)
Returns
StudipDirectory directory object

Here is the call graph for this function:

isEmpty ( )

Check whether this directory is empty.

Returns
boolean TRUE or FALSE

Here is the call graph for this function:

isReadable ( )

Check if the directory's backend allows reading of files.

Returns
boolean TRUE or FALSE

Reimplemented from File.

isRootDirectory ( )

Check whether this directory is a root directory, i.e. an instance of the RootDirectory class.

Returns
boolean TRUE or FALSE
isWritable ( )

Check if the directory's backend allows writing of files.

Returns
boolean TRUE or FALSE

Reimplemented from File.

link ( File  $file,
  $name,
  $description = '' 
)

Create a new entry in this directory for the given file under the given name. This will increase the link count of the file by one.

Parameters
File$filefile to link
string$namenew file name
string$descriptionoptional description
Returns
DirectoryEntry created DirectoryEntry object

Here is the call graph for this function:

Here is the caller graph for this function:

listDirectories ( )

Return a list of all child directories in this directory.

Returns
array array of DirectoryEntry objects

Here is the call graph for this function:

listFiles ( )

Return a list of all entries in this directory. Each entry is returned as a DirectoryEntry object.

Returns
array array of DirectoryEntry objects

Here is the caller graph for this function:

mkdir (   $name,
  $description = '' 
)

Create a new sub directory with the given name in this directory. It inherits the backend storage of its parent.

Parameters
string$namedirectory name
int$parent_idplace in folder hierarchy

Here is the call graph for this function:

Here is the caller graph for this function:

open (   $mode)

Opening a directory is not allowed.

Reimplemented from File.

search (   $text)

Search this directory (recursively) for the given text. Searching is not implemented at this time.

setPermissions (   $permissions)

Set access permissions for this directory. Access permissions are not implemented at this time.

unlink (   $name)

Remove the entry with the given name from this directory. If the file's link count drops to zero, it is deleted.

Parameters
string$namefile name

Here is the call graph for this function:

update ( )

Updating a directory is not allowed (and not needed).

Reimplemented from File.


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