ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilObjContentPage Class Reference
+ Inheritance diagram for ilObjContentPage:
+ Collaboration diagram for ilObjContentPage:

Public Member Functions

 __construct (int $a_id=0, bool $a_reference=true)
 
 getObjectTranslation ()
 
 getPageObjIds ()
 
 trackProgress (int $usrId)
 
- Public Member Functions inherited from ilObject2
 __construct (int $a_id=0, bool $a_reference=true)
 Constructor. More...
 
 read ()
 
 create (bool $a_clone_mode=false)
 
 update ()
 
 delete ()
 
 cloneMetaData (ilObject $target_obj)
 
 cloneObject (int $target_id, int $copy_id=0, bool $omit_tree=false)
 
- Public Member Functions inherited from ilObject
 getObjectProperties ()
 
 flushObjectProperties ()
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 processAutoRating ()
 
 read ()
 
 getId ()
 
 setId (int $id)
 
 setRefId (int $ref_id)
 
 getRefId ()
 
 getType ()
 
 setType (string $type)
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 
 getUntranslatedTitle ()
 Get untranslated object title WebDAV needs to access the untranslated title of an object. More...
 
 setTitle (string $title)
 
 getDescription ()
 
 setDescription (string $description)
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 
 setImportId (string $import_id)
 
 setOfflineStatus (bool $status)
 
 getOfflineStatus ()
 
 supportsOfflineHandling ()
 
 getOwner ()
 
 getOwnerName ()
 get full name of object owner More...
 
 setOwner (int $usr_id)
 
 getCreateDate ()
 Get create date in YYYY-MM-DD HH-MM-SS format. More...
 
 getLastUpdateDate ()
 Get last update date in YYYY-MM-DD HH-MM-SS format. More...
 
 create ()
 note: title, description and type should be set when this function is called More...
 
 update ()
 
 MDUpdateListener (string $element)
 Metadata update listener. More...
 
 createMetaData ()
 
 updateMetaData ()
 
 deleteMetaData ()
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree (int $parent_ref_id)
 maybe this method should be in tree object!? More...
 
 setPermissions (int $parent_ref_id)
 
 setParentRolePermissions (int $parent_ref_id)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 
 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!! More...
 
 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. More...
 
 applyDidacticTemplate (int $tpl_id)
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo (int $target_id, int $copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies (int $target_id, int $copy_id)
 Clone object dependencies. More...
 
 cloneMetaData (ilObject $target_obj)
 Copy meta data. More...
 
 selfOrParentWithRatingEnabled ()
 
 getPossibleSubObjects (bool $filter=true)
 get all possible sub objects of this type the object can decide which types of sub objects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Protected Member Functions

 initType ()
 
 doCloneObject (ilObject2 $new_obj, int $a_target_id, ?int $a_copy_id=null)
 
 doRead ()
 
 doCreate (bool $clone_mode=false)
 
 doUpdate ()
 
 doDelete ()
 
- Protected Member Functions inherited from ilObject2
 initType ()
 
 doRead ()
 
 doCreate (bool $clone_mode=false)
 
 beforeCreate ()
 If overwritten this method should return true, there is currently no "abort" handling for cases where "false" is returned. More...
 
 doUpdate ()
 
 beforeUpdate ()
 
 doDelete ()
 
 beforeDelete ()
 
 doCloneObject (ilObject2 $new_obj, int $a_target_id, ?int $a_copy_id=null)
 
 beforeCloneObject ()
 
- Protected Member Functions inherited from ilObject
 doMDUpdateListener (string $a_element)
 
 beforeMDUpdateListener (string $a_element)
 
 doCreateMetaData ()
 
 beforeCreateMetaData ()
 
 doUpdateMetaData ()
 
 beforeUpdateMetaData ()
 
 doDeleteMetaData ()
 
 beforeDeleteMetaData ()
 
 handleAutoRating ()
 
 hasAutoRating ()
 

Protected Attributes

int $styleId = 0
 
ilObjectTranslation $objTrans = null
 
DomainService $content_style_domain
 
- Protected Attributes inherited from ilObject
ilLogger $obj_log
 
ILIAS $ilias
 
ilObjectDefinition $obj_definition
 
ilDBInterface $db
 
ilLogger $log
 
ilErrorHandling $error
 
ilTree $tree
 
ilAppEventHandler $app_event_handler
 
ilRbacAdmin $rbac_admin
 
ilRbacReview $rbac_review
 
ilObjUser $user
 
ilLanguage $lng
 
LOMServices $lom_services
 
bool $call_by_reference
 
int $max_title = self::TITLE_LENGTH
 
int $max_desc = self::DESC_LENGTH
 
bool $add_dots = true
 
int $ref_id = null
 
string $type = ""
 
string $title = ""
 
string $desc = ""
 
string $long_desc = ""
 
int $owner = 0
 
string $create_date = ""
 
string $last_update = ""
 
string $import_id = ""
 
bool $register = false
 

Private Member Functions

 initTranslationService ()
 
 initPageMetricsService (ILIAS\Refinery\Factory $refinery)
 

Private Attributes

PageMetricsService $pageMetricsService
 

Additional Inherited Members

- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId (string $import_id)
 Get (latest) object id for an import id. More...
 
static _lookupImportId (int $obj_id)
 
static _lookupOwnerName (int $owner_id)
 Lookup owner name for owner id. More...
 
static _getIdForImportId (string $import_id)
 
static _getAllReferences (int $id)
 get all reference ids for object ID More...
 
static _lookupTitle (int $obj_id)
 
static lookupOfflineStatus (int $obj_id)
 Lookup offline status using objectDataCache. More...
 
static _lookupOwner (int $obj_id)
 Lookup owner user ID for object ID. More...
 
static _getIdsForTitle (string $title, string $type='', bool $partial_match=false)
 
static _lookupDescription (int $obj_id)
 
static _lookupLastUpdate (int $obj_id, bool $formatted=false)
 
static _getLastUpdateOfObjects (array $obj_ids)
 
static _lookupObjId (int $ref_id)
 
static _setDeletedDate (int $ref_id, int $deleted_by)
 
static setDeletedDates (array $ref_ids, int $user_id)
 
static _resetDeletedDate (int $ref_id)
 
static _lookupDeletedDate (int $ref_id)
 
static _writeTitle (int $obj_id, string $title)
 write title to db (static) More...
 
static _writeDescription (int $obj_id, string $desc)
 write description to db (static) More...
 
static _writeImportId (int $obj_id, string $import_id)
 write import id to db (static) More...
 
static _lookupType (int $id, bool $reference=false)
 
static _isInTrash (int $ref_id)
 
static _hasUntrashedReference (int $obj_id)
 checks whether an object has at least one reference that is not in trash More...
 
static _lookupObjectId (int $ref_id)
 
static _getObjectsDataForType (string $type, bool $omit_trash=false)
 get all objects of a certain type More...
 
static _exists (int $id, bool $reference=false, ?string $type=null)
 checks if an object exists in object_data More...
 
static _getObjectsByType (string $obj_type="", int $owner=null)
 
static _prepareCloneSelection (array $ref_ids, string $new_type, bool $show_path=true)
 Prepare copy wizard object selection. More...
 
static getIconForType (string $type)
 
static _getIcon (int $obj_id=0, string $size="big", string $type="", bool $offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (array &$deps, int $ref_id, int $obj_id, string $type, int $depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies (int $obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $obj_ids)
 
static getAllOwnedRepositoryObjects (int $user_id)
 
static fixMissingTitles ($type, array &$obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate (int $obj_id)
 
static _getObjectTypeIdByTitle (string $type, \ilDBInterface $ilDB=null)
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 
const DESC_LENGTH = 128
 
const LONG_DESC_LENGTH = 4000
 
const TABLE_OBJECT_DATA = "object_data"
 
array $objectList
 
string $untranslatedTitle
 
- Data Fields inherited from ilContentPageObjectConstants
const OBJ_TYPE = 'copa'
 
const HTTP_PARAM_PAGE_EDITOR_STYLE_CONTEXT = 'page_editor_style'
 
const UI_CMD_VIEW = 'view'
 
const UI_CMD_EDIT = 'edit'
 
const UI_CMD_UPDATE = 'update'
 
const UI_CMD_COPAGE_DOWNLOAD_FILE = 'downloadFile'
 
const UI_CMD_COPAGE_DISPLAY_FULLSCREEN = 'displayMediaFullscreen'
 
const UI_CMD_COPAGE_DISPLAY_MEDIA = 'displayMedia'
 
const UI_CMD_COPAGE_DOWNLOAD_PARAGRAPH = 'download_paragraph'
 
const UI_CMD_COPAGE_EDIT = 'edit'
 
const UI_CMD_STYLES_EDIT = 'editStyleProperties'
 
const UI_TAB_ID_CONTENT = 'content'
 
const UI_TAB_ID_INFO = 'info_short'
 
const UI_TAB_ID_SETTINGS = 'settings'
 
const UI_TAB_ID_STYLE = 'style'
 
const UI_TAB_ID_I18N = 'i18n'
 
const UI_TAB_ID_LP = 'learning_progress'
 
const UI_TAB_ID_EXPORT = 'export'
 
const UI_TAB_ID_PERMISSIONS = 'perm_settings'
 
const UI_TAB_ID_MD = 'meta_data'
 

Detailed Description

Definition at line 26 of file class.ilObjContentPage.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjContentPage::__construct ( int  $a_id = 0,
bool  $a_reference = true 
)

Definition at line 33 of file class.ilObjContentPage.php.

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), and initPageMetricsService().

34  {
35  global $DIC;
36 
37  parent::__construct($a_id, $a_reference);
38 
39  $this->initPageMetricsService($DIC->refinery());
40  $this->content_style_domain = $DIC->contentStyle()
41  ->domain();
42  }
initPageMetricsService(ILIAS\Refinery\Factory $refinery)
global $DIC
Definition: shib_login.php:25
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ doCloneObject()

ilObjContentPage::doCloneObject ( ilObject2  $new_obj,
int  $a_target_id,
?int  $a_copy_id = null 
)
protected

Definition at line 71 of file class.ilObjContentPage.php.

References ilPageObject\_exists(), ilCopyWizardOptions\_getInstance(), ilContainer\_lookupContainerSetting(), ilContainer\_writeContainerSetting(), ilObject2\cloneMetaData(), ilObject\getId(), ilObjectTranslation\getInstance(), ilObject\getOfflineStatus(), ilObject\getType(), ilObjectServiceSettingsGUI\INFO_TAB_VISIBILITY, ilPageObject\lookupTranslations(), ilObject\setOfflineStatus(), and ilObject2\update().

71  : void
72  {
73  assert($new_obj instanceof ilObjContentPage);
74  parent::doCloneObject($new_obj, $a_target_id, $a_copy_id);
75  $this->cloneMetaData($new_obj);
76 
78  $ot->copy($new_obj->getId());
79  $new_ot = clone $ot;
80  $new_ot->setObjId($new_obj->getId());
81  $new_obj->objTrans = $new_ot;
82 
83  if (ilContentPagePage::_exists($this->getType(), $this->getId(), '', true)) {
84  $translations = ilContentPagePage::lookupTranslations($this->getType(), $this->getId());
85  foreach ($translations as $language) {
86  $originalPageObject = new ilContentPagePage($this->getId(), 0, $language);
87  $copiedXML = $originalPageObject->copyXmlContent();
88 
89  $duplicatePageObject = new ilContentPagePage();
90  $duplicatePageObject->setId($new_obj->getId());
91  $duplicatePageObject->setParentId($new_obj->getId());
92  $duplicatePageObject->setLanguage($language);
93  $duplicatePageObject->setXMLContent($copiedXML);
94  $duplicatePageObject->createFromXML();
95 
96  $this->pageMetricsService->store(
98  $new_obj->getId(),
99  $duplicatePageObject->getLanguage()
100  )
101  );
102  }
103  }
104 
105  $style = $this->content_style_domain->styleForObjId($this->getId());
106  $style->cloneTo($new_obj->getId());
107 
109  $new_obj->getId(),
111  (string) ((bool) ilContainer::_lookupContainerSetting(
112  $this->getId(),
114  '1'
115  ))
116  );
117 
118  $lpSettings = new ilLPObjSettings($this->getId());
119  $lpSettings->cloneSettings($new_obj->getId());
120 
121  $cwo = ilCopyWizardOptions::_getInstance($a_copy_id);
122  //copy online status if object is not the root copy object
123  if (!$cwo->isRootNode($this->getRefId())) {
124  $new_obj->setOfflineStatus($this->getOfflineStatus());
125  } else {
126  $new_obj->setOfflineStatus(true);
127  }
128 
129  $new_obj->update();
130  }
cloneMetaData(ilObject $target_obj)
static lookupTranslations(string $a_parent_type, int $a_id)
Lookup translations.
static _lookupContainerSetting(int $a_id, string $a_keyword, string $a_default_value=null)
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
static getInstance(int $obj_id)
setOfflineStatus(bool $status)
static _writeContainerSetting(int $a_id, string $a_keyword, string $a_value)
static _getInstance(int $a_copy_id)
+ Here is the call graph for this function:

◆ doCreate()

ilObjContentPage::doCreate ( bool  $clone_mode = false)
protected

Definition at line 139 of file class.ilObjContentPage.php.

References ilObject\createMetaData(), ilObject\getId(), initTranslationService(), ilObject\setOfflineStatus(), and ilObject2\update().

139  : void
140  {
141  parent::doCreate($clone_mode);
142 
143  $this->initTranslationService();
144 
145  $this->db->manipulateF(
146  'INSERT INTO content_page_data (content_page_id, stylesheet ) VALUES(%s, %s)',
147  ['integer', 'integer'],
148  [$this->getId(), 0]
149  );
150 
151  $this->setOfflineStatus(true);
152  $this->update();
153 
154  $this->createMetaData();
155  }
setOfflineStatus(bool $status)
+ Here is the call graph for this function:

◆ doDelete()

ilObjContentPage::doDelete ( )
protected

Definition at line 169 of file class.ilObjContentPage.php.

References ilPageObject\_exists(), ilObject\getId(), ilObject\getType(), and initTranslationService().

169  : void
170  {
171  parent::doDelete();
172 
173  if (ilContentPagePage::_exists($this->getType(), $this->getId(), '', true)) {
174  $originalPageObject = new ilContentPagePage($this->getId());
175  $originalPageObject->delete();
176  }
177 
178  $this->initTranslationService();
179  $this->objTrans->delete();
180 
181  $this->db->manipulateF(
182  'DELETE FROM content_page_metrics WHERE content_page_id = %s',
183  ['integer'],
184  [$this->getId()]
185  );
186 
187  $this->db->manipulateF(
188  'DELETE FROM content_page_data WHERE content_page_id = %s',
189  ['integer'],
190  [$this->getId()]
191  );
192  }
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
+ Here is the call graph for this function:

◆ doRead()

ilObjContentPage::doRead ( )
protected

Definition at line 132 of file class.ilObjContentPage.php.

References initTranslationService().

132  : void
133  {
134  parent::doRead();
135 
136  $this->initTranslationService();
137  }
+ Here is the call graph for this function:

◆ doUpdate()

ilObjContentPage::doUpdate ( )
protected

Definition at line 157 of file class.ilObjContentPage.php.

References ilObject\getLongDescription(), getObjectTranslation(), ilObject\getTitle(), and ilObject\updateMetaData().

157  : void
158  {
159  parent::doUpdate();
160 
161  $trans = $this->getObjectTranslation();
162  $trans->setDefaultTitle($this->getTitle());
163  $trans->setDefaultDescription($this->getLongDescription());
164  $trans->save();
165 
166  $this->updateMetaData();
167  }
getLongDescription()
get object long description (stored in object_description)
+ Here is the call graph for this function:

◆ getObjectTranslation()

ilObjContentPage::getObjectTranslation ( )

Definition at line 59 of file class.ilObjContentPage.php.

References $objTrans, and initTranslationService().

Referenced by doUpdate().

60  {
61  $this->initTranslationService();
62 
63  return $this->objTrans;
64  }
ilObjectTranslation $objTrans
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPageObjIds()

ilObjContentPage::getPageObjIds ( )
Returns
int[]

Definition at line 197 of file class.ilObjContentPage.php.

References $res, ilObject\getId(), ilObject\getType(), and ILIAS\Repository\int().

197  : array
198  {
199  $pageObjIds = [];
200 
201  $sql = 'SELECT DISTINCT page_id FROM page_object WHERE parent_id = %s AND parent_type = %s';
202  $res = $this->db->queryF(
203  $sql,
204  ['integer', 'text'],
205  [$this->getId(), $this->getType()]
206  );
207 
208  while ($row = $this->db->fetchAssoc($res)) {
209  $pageObjIds[] = (int) $row['page_id'];
210  }
211 
212  return $pageObjIds;
213  }
$res
Definition: ltiservices.php:69
+ Here is the call graph for this function:

◆ initPageMetricsService()

ilObjContentPage::initPageMetricsService ( ILIAS\Refinery\Factory  $refinery)
private

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

Referenced by __construct().

+ Here is the caller graph for this function:

◆ initTranslationService()

ilObjContentPage::initTranslationService ( )
private

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

References ilObject\getId(), and ilObjectTranslation\getInstance().

Referenced by doCreate(), doDelete(), doRead(), and getObjectTranslation().

44  : void
45  {
46  if (null === $this->objTrans && $this->getId() > 0) {
47  $this->objTrans = ilObjectTranslation::getInstance($this->getId());
48  }
49  }
static getInstance(int $obj_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initType()

ilObjContentPage::initType ( )
protected

Definition at line 66 of file class.ilObjContentPage.php.

66  : void
67  {
68  $this->type = self::OBJ_TYPE;
69  }

◆ trackProgress()

ilObjContentPage::trackProgress ( int  $usrId)

Definition at line 215 of file class.ilObjContentPage.php.

References ilLearningProgress\_tracProgress(), ilObject\getId(), ilObject\getRefId(), and ilObject\getType().

215  : void
216  {
218  $usrId,
219  $this->getId(),
220  $this->getRefId(),
221  $this->getType()
222  );
223  }
static _tracProgress(int $a_user_id, int $a_obj_id, int $a_ref_id, string $a_obj_type='')
+ Here is the call graph for this function:

Field Documentation

◆ $content_style_domain

DomainService ilObjContentPage::$content_style_domain
protected

Definition at line 31 of file class.ilObjContentPage.php.

◆ $objTrans

ilObjectTranslation ilObjContentPage::$objTrans = null
protected

Definition at line 29 of file class.ilObjContentPage.php.

Referenced by getObjectTranslation().

◆ $pageMetricsService

PageMetricsService ilObjContentPage::$pageMetricsService
private

Definition at line 30 of file class.ilObjContentPage.php.

◆ $styleId

int ilObjContentPage::$styleId = 0
protected

Definition at line 28 of file class.ilObjContentPage.php.


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