ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilObjFolder Class Reference

Class ilObjFolder. More...

+ Inheritance diagram for ilObjFolder:
+ Collaboration diagram for ilObjFolder:

Public Member Functions

 ilObjFolder ($a_id=0, $a_call_by_reference=true)
 Constructor public.
 setFolderTree ($a_tree)
 cloneObject ($a_target_id, $a_copy_id=0)
 Clone folder.
 putInTree ($a_parent)
 insert folder into grp_tree
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies (crs items, preconditions)
 downloadFolder ()
 getViewMode ()
 Get container view mode.
 addAdditionalSubItemInformation (&$a_item_data)
 Add additional information to sub item, e.g.
 read ()
 Overwritten read method.
- Public Member Functions inherited from ilObject
 ilObject ($a_id=0, $a_reference=true)
 Constructor public.
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not)
 read ($a_force_db=false)
 read object data from db into object
 getId ()
 get object id public
 setId ($a_id)
 set object id public
 setRefId ($a_id)
 set reference id public
 getRefId ()
 get reference id public
 getType ()
 get object type public
 setType ($a_type)
 set object type public
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions
 getTitle ()
 get object title public
 getUntranslatedTitle ()
 get untranslated object title public
 setTitle ($a_title)
 set object title
 getDescription ()
 get object description
 setDescription ($a_desc)
 set object description
 getLongDescription ()
 get object long description (stored in object_description)
 getImportId ()
 get import id
 setImportId ($a_import_id)
 set import id
 _lookupObjIdByImportId ($a_import_id)
 getOwner ()
 get object owner
 getOwnerName ()
 _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id
 setOwner ($a_owner)
 set object owner
 getCreateDate ()
 get create date public
 getLastUpdateDate ()
 get last update date public
 getDiskUsage ()
 Gets the disk usage of the object in bytes.
 setObjDataRecord ($a_record)
 set object_data record (note: this method should only be called from the ilObjectFactory class)
 MDUpdateListener ($a_element)
 Meta data update listener.
 createMetaData ()
 create meta data entry
 updateMetaData ()
 update meta data entry
 deleteMetaData ()
 delete meta data entry
 updateOwner ()
 update owner of object in db
 _getIdForImportId ($a_import_id)
 get current object id for import id (static)
 _lookupOwner ($a_id)
 lookup object owner
 _lookupDescription ($a_id)
 lookup object description
 _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update
 _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects.
 _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree
 _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes
 _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes
 _writeTitle ($a_obj_id, $a_title)
 write title to db (static)
 _writeDescription ($a_obj_id, $a_desc)
 write description to db (static)
 _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static)
 _isInTrash ($a_ref_id)
 checks wether object is in trash
 _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash
 _lookupObjectId ($a_ref_id)
 lookup object id
 _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type
 setPermissions ($a_parent_ref)
 set permissions of object
 createReference ()
 creates reference for object
 countReferences ()
 count references of object
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!!
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type If you want to setup default local roles you MUST overwrite this method in derived object classes (see ilObjForum for an example) public
 createRoleFolder ()
 creates a local role folder
 notify ($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
 notifys an object about an event occured Based on the event passed, each object may decide how it reacts.
 setRegisterMode ($a_bool)
 isUserRegistered ($a_user_id=0)
 requireRegistration ()
 getXMLZip ()
 getHTMLDirectory ()
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container.
 cloneMetaData ($target_obj)
 Copy meta data.
- Public Member Functions inherited from ilContainer
 ilContainer ($a_id=0, $a_call_by_reference=true)
 Constructor public.
 createContainerDirectory ()
 Create directory for the container.
 getContainerDirectory ()
 Get the container directory.
 _getContainerDirectory ($a_id)
 Get the container directory.
 getBigIconPath ()
 Get path for big icon.
 getSmallIconPath ()
 Get path for small icon.
 getTinyIconPath ()
 Get path for tiny icon.
 setHiddenFilesFound ($a_hiddenfilesfound)
 Set Found hidden files (set by getSubItems).
 getHiddenFilesFound ()
 Get Found hidden files (set by getSubItems).
 getStyleSheetId ()
 get ID of assigned style sheet object
 setStyleSheetId ($a_style_id)
 set ID of assigned style sheet object
 _lookupContainerSetting ($a_id, $a_keyword)
 Lookup a container setting.
 _writeContainerSetting ($a_id, $a_keyword, $a_value)
 _lookupIconPath ($a_id, $a_size="big")
 lookup icon path
 saveIcons ($a_big_icon, $a_small_icon, $a_tiny_icon)
 save container icons
 removeBigIcon ()
 remove big icon
 removeSmallIcon ()
 remove small icon
 removeTinyIcon ()
 remove tiny icon
 getFirstColumn ()
 Get right column.
 cloneAllObject ($session_id, $client_id, $new_type, $ref_id, $clone_source, $options, $soap_call=false)
 clone all objects according to this container
 getOrderType ()
 Get order type default implementation.
 setOrderType ($a_value)
 getSubItems ($a_admin_panel_enabled=false, $a_include_side_block=false)
 Get subitems of container.
 gotItems ()
 Check whether we got any items.
 getGroupedObjTypes ()
 Get grouped repository object types.
 enablePageEditing ()
 Check whether page editing is allowed for container.
 create ()
 Create.
 update ()
 Update.

Data Fields

 $folder_tree
- Data Fields inherited from ilObject
const TITLE_LENGTH = 128
 max length of object title
 $ilias
 $lng
 $id
 $ref_id
 $type
 $title
 $untranslatedTitle
 $desc
 $long_desc
 $owner
 $create_date
 $last_update
 $import_id
 $register = false
 $referenced
 $objectList
 $max_title
 $max_desc
 $add_dots
 $obj_data_record
 object_data record
- Data Fields inherited from ilContainer
const VIEW_SESSIONS = 0
const VIEW_OBJECTIVE = 1
const VIEW_TIMING = 2
const VIEW_ARCHIVE = 3
const VIEW_SIMPLE = 4
const VIEW_BY_TYPE = 5
const VIEW_INHERIT = 6
const VIEW_ILINC = 7
const SORT_TITLE = 0
const SORT_MANUAL = 1
const SORT_ACTIVATION = 2
const SORT_INHERIT = 3

Static Private Member Functions

static recurseFolder ($refid, $title, $tmpdir)
 private functions which iterates through all folders and files and create an according file structure in a temporary directory.

Additional Inherited Members

- Static Public Member Functions inherited from ilObject
static _getAllReferences ($a_id)
 get all reference ids of object
static _lookupTitle ($a_id)
 lookup object title
static _getIdsForTitle ($title, $type= '', $partialmatch=false)
static _lookupObjId ($a_id)
static _lookupType ($a_id, $a_reference=false)
 lookup object type
 _exists ($a_id, $a_reference=false)
 checks if an object exists in object_data
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type.
static _prepareCloneSelection ($a_ref_ids, $new_type)
 Prepare copy wizard object selection.
static _getIcon ($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item.
static collectDeletionDependencies (&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
 Collect deletion dependencies.
static getDeletionDependencies ($a_obj_id)
 Get deletion dependencies.
- Static Public Attributes inherited from ilContainer
static $data_preloaded = false
- Protected Attributes inherited from ilContainer
 $order_type = 0
 $hiddenfilesfound = false

Detailed Description

Class ilObjFolder.

Author
Wolfgang Merkens wmerk.nosp@m.ens@.nosp@m.datab.nosp@m.ay.d.nosp@m.e
Version
Id:
class.ilObjFolder.php 25528 2010-09-03 10:37:11Z smeyer

Definition at line 34 of file class.ilObjFolder.php.

Member Function Documentation

ilObjFolder::addAdditionalSubItemInformation ( $a_item_data)

Add additional information to sub item, e.g.

used in courses for timings information etc.

Reimplemented from ilContainer.

Definition at line 238 of file class.ilObjFolder.php.

References ilCourseItems\addAdditionalSubItemInformation(), and ilObject\getRefId().

{
global $tree;
static $items = null;
if(!is_object($items[$this->getRefId()]))
{
if ($course_ref_id = $tree->checkForParentType($this->getRefId(),'crs'))
{
include_once("./Modules/Course/classes/class.ilObjCourse.php");
include_once("./Modules/Course/classes/class.ilCourseItems.php");
$course_obj = new ilObjCourse($course_ref_id);
$items[$this->getRefId()] = new ilCourseItems($course_obj->getRefId(), $this->getRefId());
}
}
if(is_object($items[$this->getRefId()]))
{
$items[$this->getRefId()]->addAdditionalSubItemInformation($a_item_data);
}
}

+ Here is the call graph for this function:

ilObjFolder::cloneDependencies (   $a_target_id,
  $a_copy_id 
)

Clone object dependencies (crs items, preconditions)

public

Parameters
inttarget ref id of new course
intcopy id

Reimplemented from ilObject.

Definition at line 110 of file class.ilObjFolder.php.

References ilCourseItems\cloneDependencies(), ilObject\getId(), ilObjectFactory\getInstanceByRefId(), and ilObject\getRefId().

{
global $tree;
parent::cloneDependencies($a_target_id,$a_copy_id);
if($course_ref_id = $tree->checkForParentType($this->getRefId(),'crs') and
$new_course_ref_id = $tree->checkForParentType($a_target_id,'crs'))
{
include_once('Modules/Course/classes/class.ilCourseItems.php');
$course_obj =& ilObjectFactory::getInstanceByRefId($course_ref_id,false);
$course_items = new ilCourseItems($course_obj->getRefId(),$this->getRefId());
$course_items->cloneDependencies($a_target_id,$a_copy_id);
}
include_once('Services/Tracking/classes/class.ilLPCollections.php');
$lp_collection = new ilLPCollections($this->getId());
$lp_collection->cloneCollections($a_target_id,$a_copy_id);
return true;
}

+ Here is the call graph for this function:

ilObjFolder::cloneObject (   $a_target_id,
  $a_copy_id = 0 
)

Clone folder.

public

Parameters
inttarget id
intcopy id

Reimplemented from ilObject.

Definition at line 64 of file class.ilObjFolder.php.

References ilObject\getId().

{
$new_obj = parent::cloneObject($a_target_id,$a_copy_id);
// Copy learning progress settings
include_once('Services/Tracking/classes/class.ilLPObjSettings.php');
$obj_settings = new ilLPObjSettings($this->getId());
$obj_settings->cloneSettings($new_obj->getId());
unset($obj_settings);
return $new_obj;
}

+ Here is the call graph for this function:

ilObjFolder::downloadFolder ( )

Definition at line 175 of file class.ilObjFolder.php.

References ilObject\$lng, ilObject\_isInTrash(), ilUtil\delDir(), ilUtil\deliverFile(), ilObject\getRefId(), ilObject\getTitle(), ilUtil\ilTempnam(), ilUtil\makeDir(), recurseFolder(), ilUtil\sendInfo(), and ilUtil\zip().

{
global $lng, $rbacsystem, $ilAccess;
include_once "./Services/Utilities/classes/class.ilUtil.php";
include_once 'Modules/File/classes/class.ilObjFile.php';
include_once 'Modules/File/classes/class.ilFileException.php';
if (!$ilAccess->checkAccess("read", "", $this->getRefId()))
{
$this->ilErr->raiseError(get_class($this)."::downloadFolder(): missing read permission!",$this->ilErr->WARNING);
}
{
$this->ilErr->raiseError(get_class($this)."::downloadFolder(): object is trashed!",$this->ilErr->WARNING);
}
$zip = PATH_TO_ZIP;
$tmpdir = ilUtil::ilTempnam();
ilUtil::makeDir($tmpdir);
$basename = ilUtil::getAsciiFilename($this->getTitle());
$deliverFilename = $basename.".zip";
$zipbasedir = $tmpdir.DIRECTORY_SEPARATOR.$basename;
$tmpzipfile = $tmpdir.DIRECTORY_SEPARATOR.$deliverFilename;
try {
ilObjFolder::recurseFolder ($this->getRefId(), $this->getTitle(), $tmpdir);
ilUtil::zip($zipbasedir, $tmpzipfile);
rename($tmpzipfile,$zipfile = ilUtil::ilTempnam());
ilUtil::delDir($tmpdir);
ilUtil::deliverFile($zipfile,$deliverFilename,'',false,true);
} catch (ilFileException $e) {
ilUtil::sendInfo($e->getMessage(), true);
}
}

+ Here is the call graph for this function:

ilObjFolder::getViewMode ( )

Get container view mode.

Reimplemented from ilContainer.

Definition at line 211 of file class.ilObjFolder.php.

References ilObject\_lookupObjId(), ilObjCourseAccess\_lookupViewMode(), ilContainer\VIEW_BY_TYPE, ilContainer\VIEW_SESSIONS, and ilContainer\VIEW_SIMPLE.

{
global $tree;
// default: by type
// get view mode from course
if ($course_ref_id = $tree->checkForParentType($this->ref_id,'crs'))
{
include_once("./Modules/Course/classes/class.ilObjCourseAccess.php");
if ($view_mode == ilContainer::VIEW_SESSIONS ||
$view_mode == ilContainer::VIEW_BY_TYPE ||
$view_mode == ilContainer::VIEW_SIMPLE)
{
$view = $view_mode;
}
}
return $view;
}

+ Here is the call graph for this function:

ilObjFolder::ilObjFolder (   $a_id = 0,
  $a_call_by_reference = true 
)

Constructor public.

Parameters
integerreference_id or object_id
booleantreat the id as reference_id (true) or object_id (false)

Definition at line 44 of file class.ilObjFolder.php.

{
$this->type = "fold";
parent::__construct($a_id,$a_call_by_reference);
$this->lng->loadLanguageModule('fold');
}
ilObjFolder::putInTree (   $a_parent)

insert folder into grp_tree

Reimplemented from ilObject.

Definition at line 81 of file class.ilObjFolder.php.

References ilObject\getId(), ilObject\getRefId(), and ilObject\withReferences().

{
global $tree;
if (!is_object($this->folder_tree))
{
$this->folder_tree =& $tree;
}
if ($this->withReferences())
{
// put reference id into tree
$this->folder_tree->insertNode($this->getRefId(), $a_parent);
}
else
{
// put object id into tree
$this->folder_tree->insertNode($this->getId(), $a_parent);
}
}

+ Here is the call graph for this function:

ilObjFolder::read ( )

Overwritten read method.

public

Parameters
@return

Reimplemented from ilContainer.

Definition at line 267 of file class.ilObjFolder.php.

References ilContainerSortingSettings\_lookupSortMode(), ilObject\getId(), and ilContainer\setOrderType().

{
global $tree;
// Inherit order type from parent course (if exists)
include_once('./Services/Container/classes/class.ilContainerSortingSettings.php');
}

+ Here is the call graph for this function:

static ilObjFolder::recurseFolder (   $refid,
  $title,
  $tmpdir 
)
staticprivate

private functions which iterates through all folders and files and create an according file structure in a temporary directory.

This function works recursive.

Parameters
integer$refidreference it
tmpdictory$tmpdir
Returns
returns first created directory

Definition at line 140 of file class.ilObjFolder.php.

References ilObject\$title, ilObject\_isInTrash(), ilObjFile\_lookupAbsolutePath(), and ilUtil\makeDir().

Referenced by downloadFolder().

{
global $rbacsystem, $tree, $ilAccess;
$tmpdir = $tmpdir.DIRECTORY_SEPARATOR.ilUtil::getASCIIFilename($title);
ilUtil::makeDir($tmpdir);
$subtree = $tree->getChildsByTypeFilter($refid, array("fold","file"));
foreach ($subtree as $child)
{
if (!$ilAccess->checkAccess("read", "", $child["ref_id"]))
{
continue;
}
if (ilObject::_isInTrash($child["ref_id"]))
{
continue;
}
if ($child["type"] == "fold")
{
ilObjFolder::recurseFolder ($child["ref_id"], $child["title"], $tmpdir);
} else {
$newFilename = $tmpdir.DIRECTORY_SEPARATOR.ilUtil::getASCIIFilename($child["title"]);
// copy to temporal directory
$oldFilename = ilObjFile::_lookupAbsolutePath($child["obj_id"]);
if (!copy ($oldFilename, $newFilename))
{
throw new ilFileException("Could not copy ".$oldFilename." to ".$newFilename);
}
touch($newFilename, filectime($oldFilename));
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjFolder::setFolderTree (   $a_tree)

Definition at line 51 of file class.ilObjFolder.php.

{
$this->folder_tree =& $a_tree;
}

Field Documentation

ilObjFolder::$folder_tree

Definition at line 36 of file class.ilObjFolder.php.


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