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

Public Member Functions

 delete ()
 
 checkAccess ($user_id)
 
- 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)
 
 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 ()
 
 delete ()
 
 isDirty ()
 
 isFieldDirty ($field)
 
 revertValue ($field)
 
 getPristineValue ($field)
 
 initRelation ($relation)
 
 resetRelation ($relation)
 

Static Public Member Functions

static findByCourseId ($cid)
 
static findByFolderId ($folder_id)
 
static createWithFile ($file, $data)
 
- 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())
 
- Static Protected Member Functions inherited from SimpleORMap
static configure ($config=array())
 
static tableScheme ($db_table)
 

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 SimpleORMap
 $content = array()
 
 $content_db = array()
 
 $is_new = true
 
 $is_deleted = false
 
 $db_table = ''
 
 $db_fields = null
 
 $pk = null
 
 $default_values = array()
 
 $serialized_fields = array()
 
 $alias_fields = array()
 
 $additional_fields = array()
 
 $relations = array()
 
 $has_many = array()
 
 $has_one = array()
 
 $belongs_to = array()
 
 $has_and_belongs_to_many = array()
 
 $registered_callbacks
 
 $known_slots = array()
 
 $reserved_slots = array('value','newid','iterator','tablemetadata', 'relationvalue','wherequery','relationoptions','data','new','id')
 
 $notification_map = array()
 
 $additional_data = array()
 
- Static Protected Attributes inherited from SimpleORMap
static $schemes = null
 
static $config = array()
 

Member Function Documentation

◆ checkAccess()

checkAccess (   $user_id)

checks access to the document for user with given user_id the number of deleted rows.

Parameters
stringuser_id: id of the user
Returns
boolean: true if user has access to the document
Here is the call graph for this function:

◆ configure()

static configure (   $config = array())
staticprotected

set configuration data from subclass

Parameters
array$configconfiguration data
Returns
void

Reimplemented from SimpleORMap.

◆ createWithFile()

static createWithFile (   $file,
  $data 
)
static

Create a new document using the given file and metadata. This method makes sure that there are no inconsistencies between a real file and its database entry. Only if the file were copied/moved to the documents folder, the database entry is written. If this fails too, the file will be unlinked again. The first parameter can either be an uploaded file or the path to an already existing one. This file will either be moved using move_uploaded_file or it will be copied. The destination is determined this way: If the second parameter $data already contains a "dokument_id", this will be used as the file's destination. This is usually the case when refreshing a file. If there is no such parameter, a new "dokument_id" is generated as usual and is used as the file's destination.

Before a document (and its file) is created, the notification "DocumentWillCreate" will be posted. If the document was created successfuly, the notification "DocumentDidCreate" will be posted. It the document was updated rather than created (see above), the notifications will be "DocumentWillUpdate" and "DocumentDidUpdate". The subject of the notification will always be that document.

Parameters
$filestring full path to a file (either uploaded or already existing)
$dataarray an array containing the metadata of the document; just use the same way as StudipDocument::setData
Returns
StudipDocument|null if successful the created document, null otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ delete()

delete ( )

Delete entry from database. The object is cleared and turned to new state. Posts the Notifications "Document(Will|Did)Delete" if successful. The subject of the notification is the former document.

Returns
boolean always true

Reimplemented from SimpleORMap.

Here is the call graph for this function:

◆ findByCourseId()

static findByCourseId (   $cid)
static

returns array of StudipDocument-objects of given course id

Parameters
stringcid: course_id in the db (Seminar_id) with which all StudipDocuments should be filtered
Returns
array of all StudipDocument from the course with the given course_id

◆ findByFolderId()

static findByFolderId (   $folder_id)
static

returns array of document-objects of given folder with id folder_id

Parameters
stringfolder_id: id of a folder whose documents we want to catch
Returns
array of StudipDocument objects of the given folder_id's folder or empty if that folder contains no documents.

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