ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjBlog Class Reference

Class ilObjBlog. More...

+ Inheritance diagram for ilObjBlog:
+ Collaboration diagram for ilObjBlog:

Public Member Functions

 initType ()
 
 getNotesStatus ()
 Get notes status. More...
 
 setNotesStatus ($a_status)
 Toggle notes status. More...
 
 hasProfilePicture ()
 Get profile picture status. More...
 
 setProfilePicture ($a_status)
 Toggle profile picture status. More...
 
 getBackgroundColor ()
 Get background color. More...
 
 setBackgroundColor ($a_value)
 Set background color. More...
 
 getFontColor ()
 Get font color. More...
 
 setFontColor ($a_value)
 Set font color. More...
 
 getImage ()
 Get banner image. More...
 
 setImage ($a_value)
 Set banner image. More...
 
 getImageFullPath ($a_as_thumb=false)
 Get banner image incl. More...
 
 deleteImage ()
 remove existing file More...
 
 uploadImage (array $a_upload)
 Upload new image file. More...
 
 hasRSS ()
 Get RSS status. More...
 
 setRSS ($a_status)
 Toggle RSS status. More...
 
 hasApproval ()
 Get approval status. More...
 
 setApproval ($a_status)
 Toggle approval status. More...
 
 getStyleSheetId ()
 Get style sheet id. More...
 
 setStyleSheetId ($a_style)
 Set style sheet id. More...
 
 initDefaultRoles ()
 
 getLocalContributorRole ($a_node_id)
 Get object id of local contributor role. More...
 
 getRolesWithContribute ($a_node_id)
 
- Public Member Functions inherited from ilObject2
 __construct ($a_id=0, $a_reference=true)
 Constructor public. More...
 
 withReferences ()
 
 read ($a_force_db=false)
 Read data from db. More...
 
 getId ()
 
 setId ($a_id)
 
 setRefId ($a_id)
 
 getRefId ()
 
 getType ()
 
 setType ($a_type)
 
 getPresentationTitle ()
 
 getTitle ()
 
 getUntranslatedTitle ()
 
 setTitle ($a_title)
 
 getDescription ()
 
 setDescription ($a_desc)
 
 getLongDescription ()
 
 getImportId ()
 
 setImportId ($a_import_id)
 
 getOwner ()
 
 getOwnerName ()
 
 _lookupOwnerName ($a_owner_id)
 
 setOwner ($a_owner)
 
 getCreateDate ()
 
 getLastUpdateDate ()
 
 setObjDataRecord ($a_record)
 
 create ($a_clone_mode=false)
 
 update ()
 
 MDUpdateListener ($a_element)
 
 createMetaData ()
 
 updateMetaData ()
 
 deleteMetaData ()
 
 updateOwner ()
 
 _getIdForImportId ($a_import_id)
 
 _lookupOwner ($a_id)
 
 _lookupLastUpdate ($a_id, $a_as_string=false)
 
 _getLastUpdateOfObjects ($a_objs)
 
 _setDeletedDate ($a_ref_id)
 
 _resetDeletedDate ($a_ref_id)
 
 _lookupDeletedDate ($a_ref_id)
 
 _writeTitle ($a_obj_id, $a_title)
 
 _writeDescription ($a_obj_id, $a_desc)
 
 _writeImportId ($a_obj_id, $a_import_id)
 
 _isInTrash ($a_ref_id)
 
 _hasUntrashedReference ($a_obj_id)
 
 _getObjectsDataForType ($a_type, $a_omit_trash=false)
 
 putInTree ($a_parent_ref)
 
 setPermissions ($a_parent_ref)
 
 createReference ()
 
 countReferences ()
 
 delete ()
 
 initDefaultRoles ()
 
 createRoleFolder ()
 
 notify ($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 appendCopyInfo ($a_target_id, $a_copy_id)
 
 cloneMetaData ($target_obj)
 
 cloneObject ($a_target_id, $a_copy_id=null, $a_omit_tree=false)
 
 cloneDependencies ($a_target_id, $a_copy_id)
 
- Public Member Functions inherited from ilObject
 ilObject ($a_id=0, $a_reference=true)
 Constructor public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ($a_force_db=false)
 read object data from db into object More...
 
 getId ()
 get object id public More...
 
 setId ($a_id)
 set object id public More...
 
 setRefId ($a_id)
 set reference id public More...
 
 getRefId ()
 get reference id public More...
 
 getType ()
 get object type public More...
 
 setType ($a_type)
 set object type public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title public More...
 
 getUntranslatedTitle ()
 get untranslated object title public More...
 
 setTitle ($a_title)
 set object title More...
 
 getDescription ()
 get object description More...
 
 setDescription ($a_desc)
 set object description More...
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 get import id More...
 
 setImportId ($a_import_id)
 set import id More...
 
 getOwner ()
 get object owner More...
 
 getOwnerName ()
 
 _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date public More...
 
 getLastUpdateDate ()
 get last update date public More...
 
 getDiskUsage ()
 Gets the disk usage of the object in bytes. More...
 
 setObjDataRecord ($a_record)
 set object_data record (note: this method should only be called from the ilObjectFactory class) More...
 
 create ()
 create More...
 
 update ()
 update object in db More...
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 updateOwner ()
 update owner of object in db More...
 
 _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
 _lookupOwner ($a_id)
 lookup object owner More...
 
 _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
 _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
 _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree More...
 
 _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
 _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
 _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
 _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
 _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
 _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
 _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
 _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type More...
 
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!? More...
 
 setPermissions ($a_parent_ref)
 set permissions of object More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 count references of object More...
 
 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 If you want to setup default local roles you MUST overwrite this method in derived object classes (see ilObjForum for an example) public More...
 
 createRoleFolder ()
 creates a local role folder More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. More...
 
 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. More...
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 cloneObject ($a_target_id, $a_copy_id=0, $a_omit_tree=false)
 Clone object permissions, put in tree ... More...
 
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies. More...
 
 cloneMetaData ($target_obj)
 Copy meta data. More...
 
 _lookupCreationDate ($a_id)
 Lookup creation date. More...
 

Static Public Member Functions

static initStorage ($a_id, $a_subdir=null)
 Init file system storage. More...
 
static sendNotification ($a_action, $a_in_wsp, $a_blog_node_id, $a_posting_id, $a_comment=null)
 
static deliverRSS ($a_wsp_id)
 Deliver blog as rss feed. More...
 
- Static Public Member Functions inherited from ilObject2
static _lookupObjIdByImportId ($a_import_id)
 
static _getAllReferences ($a_id)
 
static _lookupTitle ($a_id)
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 
static _lookupObjId ($a_id)
 
static _lookupType ($a_id, $a_reference=false)
 
static _lookupObjectId ($a_ref_id)
 
static _exists ($a_id, $a_reference=false)
 
static _getObjectsByType ($a_obj_type="", $a_owner="")
 
static _prepareCloneSelection ($a_ref_ids, $new_type)
 
static _getIcon ($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId ($a_import_id)
 
static _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupObjId ($a_id)
 
static setDeletedDates ($a_ref_ids)
 Set deleted date type $ilDB. More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id More...
 
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data More...
 
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type. More...
 
static _prepareCloneSelection ($a_ref_ids, $new_type, $show_path=true)
 Prepare copy wizard object selection. More...
 
static _getIcon ($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies ($a_obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $a_obj_ids)
 Get long description data. More...
 
static getAllOwnedRepositoryObjects ($a_user_id)
 Get all ids of objects user owns. More...
 
static hasAutoRating ($a_type, $a_ref_id)
 Check if auto rating is active for parent group/course. More...
 

Protected Member Functions

 doRead ()
 
 doCreate ()
 
 doDelete ()
 
 doUpdate ()
 
 doCloneObject (ilObjBlog $new_obj, $a_target_id, $a_copy_id=null)
 
 handleQuotaUpdate ()
 
- Protected Member Functions inherited from ilObject2
 initType ()
 
 doRead ()
 
 doCreate ()
 
 beforeCreate ()
 
 doUpdate ()
 
 beforeUpdate ()
 
 doMDUpdateListener ($a_element)
 
 beforeMDUpdateListener ($a_element)
 
 doCreateMetaData ()
 
 beforeCreateMetaData ()
 
 doUpdateMetaData ()
 
 beforeUpdateMetaData ()
 
 doDelete ()
 
 beforeDelete ()
 
 doCloneObject ($new_obj, $a_target_id, $a_copy_id=null)
 
 beforeCloneObject ()
 

Protected Attributes

 $notes
 
 $bg_color
 
 $font_color
 
 $img
 
 $ppic
 
 $rss
 
 $approval
 
 $style
 

Additional Inherited Members

- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 max length of object title More...
 
const DESC_LENGTH = 128
 
 $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 More...
 

Detailed Description

Class ilObjBlog.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
Id
class.ilObjFolder.php 25528 2010-09-03 10:37:11Z smeyer

Definition at line 15 of file class.ilObjBlog.php.

Member Function Documentation

◆ deleteImage()

ilObjBlog::deleteImage ( )

remove existing file

Definition at line 275 of file class.ilObjBlog.php.

References handleQuotaUpdate(), and setImage().

Referenced by doDelete(), and uploadImage().

276  {
277  if($this->id)
278  {
279  include_once "Modules/Blog/classes/class.ilFSStorageBlog.php";
280  $storage = new ilFSStorageBlog($this->id);
281  $storage->delete();
282 
283  $this->setImage(null);
284 
285  $this->handleQuotaUpdate();
286  }
287  }
setImage($a_value)
Set banner image.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deliverRSS()

static ilObjBlog::deliverRSS (   $a_wsp_id)
static

Deliver blog as rss feed.

Parameters
int$a_wsp_id

Definition at line 515 of file class.ilObjBlog.php.

References ilObject\$id, $ilSetting, $tpl, ilLink\_getStaticLink(), ilPageObject\_lookupActive(), ilObject\_lookupObjId(), exit, ilBlogPosting\getAllPostings(), ilBlogPostingGUI\getSnippet(), and IL_CAL_DATETIME.

516  {
517  global $tpl, $ilSetting;
518 
519  if(!$ilSetting->get('enable_global_profiles'))
520  {
521  return;
522  }
523 
524  // #10827
525  if(substr($a_wsp_id, -4) != "_cll")
526  {
527  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
528  $wsp_id = new ilWorkspaceTree(0);
529  $obj_id = $wsp_id->lookupObjectId($a_wsp_id);
530  $is_wsp = "_wsp";
531  }
532  else
533  {
534  $a_wsp_id = substr($a_wsp_id, 0, -4);
535  $obj_id = ilObject::_lookupObjId($a_wsp_id);
536  $is_wsp = null;
537  }
538  if(!$obj_id)
539  {
540  return;
541  }
542 
543  $blog = new self($obj_id, false);
544  if(!$blog->hasRSS())
545  {
546  return;
547  }
548 
549  include_once "Services/Feeds/classes/class.ilFeedWriter.php";
550  $feed = new ilFeedWriter();
551 
552  include_once "Services/Link/classes/class.ilLink.php";
553  $url = ilLink::_getStaticLink($a_wsp_id, "blog", true, $is_wsp);
554  $url = str_replace("&", "&", $url);
555 
556  // #11870
557  $feed->setChannelTitle(str_replace("&", "&", $blog->getTitle()));
558  $feed->setChannelDescription(str_replace("&", "&", $blog->getDescription()));
559  $feed->setChannelLink($url);
560 
561  // needed for blogpostinggui / pagegui
562  $tpl = new ilTemplate("tpl.main.html", true, true);
563 
564  include_once("./Modules/Blog/classes/class.ilBlogPosting.php");
565  include_once("./Modules/Blog/classes/class.ilBlogPostingGUI.php");
566  foreach(ilBlogPosting::getAllPostings($obj_id) as $item)
567  {
568  $id = $item["id"];
569 
570  // only published items
571  $is_active = ilBlogPosting::_lookupActive($id, "blp");
572  if(!$is_active)
573  {
574  continue;
575  }
576 
577  $snippet = strip_tags(ilBlogPostingGUI::getSnippet($id));
578  $snippet = str_replace("&", "&", $snippet);
579 
580  $url = ilLink::_getStaticLink($a_wsp_id, "blog", true, "_".$id.$is_wsp);
581  $url = str_replace("&", "&", $url);
582 
583  $feed_item = new ilFeedItem();
584  $feed_item->setTitle(str_replace("&", "&", $item["title"])); // #16022
585  $feed_item->setDate($item["created"]->get(IL_CAL_DATETIME));
586  $feed_item->setDescription($snippet);
587  $feed_item->setLink($url);
588  $feed_item->setAbout($url);
589  $feed->addItem($feed_item);
590  }
591 
592  $feed->showFeed();
593  exit();
594  }
Feed writer class.
static getSnippet($a_id)
Get first text paragraph of page.
exit
Definition: login.php:54
const IL_CAL_DATETIME
Tree handler for personal workspace.
A FeedItem represents an item in a News Feed.
static getAllPostings($a_blog_id, $a_limit=1000, $a_offset=0)
Get all postings of blog.
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
static _lookupObjId($a_id)
special template class to simplify handling of ITX/PEAR
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
global $ilSetting
Definition: privfeed.php:40
+ Here is the call graph for this function:

◆ doCloneObject()

ilObjBlog::doCloneObject ( ilObjBlog  $new_obj,
  $a_target_id,
  $a_copy_id = null 
)
protected

Definition at line 109 of file class.ilObjBlog.php.

References $img, ilObjStyleSheet\_lookupStandard(), getBackgroundColor(), getFontColor(), ilObject2\getId(), getImage(), ilObjectFactory\getInstanceByObjId(), getNotesStatus(), getStyleSheetId(), hasApproval(), hasProfilePicture(), hasRSS(), initStorage(), setApproval(), setBackgroundColor(), setFontColor(), setImage(), setNotesStatus(), setProfilePicture(), setRSS(), setStyleSheetId(), and ilObject2\update().

110  {
111  // banner?
112  $img = $this->getImage();
113  if($img)
114  {
115  $new_obj->setImage($img);
116 
117  $source = $this->initStorage($this->getId());
118  $target = $new_obj->initStorage($new_obj->getId());
119 
120  copy($source.$img, $target.$img);
121  }
122 
123  $new_obj->setNotesStatus($this->getNotesStatus());
124  $new_obj->setProfilePicture($this->hasProfilePicture());
125  $new_obj->setBackgroundColor($this->getBackgroundColor());
126  $new_obj->setFontColor($this->getFontColor());
127  $new_obj->setRSS($this->hasRSS());
128  $new_obj->setApproval($this->hasApproval());
129  $new_obj->update();
130 
131  // set/copy stylesheet
132  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
133  $style_id = $this->getStyleSheetId();
134  if ($style_id > 0 && !ilObjStyleSheet::_lookupStandard($style_id))
135  {
136  $style_obj = ilObjectFactory::getInstanceByObjId($style_id);
137  $new_id = $style_obj->ilClone();
138  $new_obj->setStyleSheetId($new_id);
139  $new_obj->update();
140  }
141  }
getNotesStatus()
Get notes status.
setNotesStatus($a_status)
Toggle notes status.
hasApproval()
Get approval status.
getFontColor()
Get font color.
setRSS($a_status)
Toggle RSS status.
getImage()
Get banner image.
setFontColor($a_value)
Set font color.
hasRSS()
Get RSS status.
getBackgroundColor()
Get background color.
setProfilePicture($a_status)
Toggle profile picture status.
static initStorage($a_id, $a_subdir=null)
Init file system storage.
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
setApproval($a_status)
Toggle approval status.
_lookupStandard($a_id)
Lookup standard flag.
hasProfilePicture()
Get profile picture status.
getStyleSheetId()
Get style sheet id.
setBackgroundColor($a_value)
Set background color.
setStyleSheetId($a_style)
Set style sheet id.
setImage($a_value)
Set banner image.
+ Here is the call graph for this function:

◆ doCreate()

ilObjBlog::doCreate ( )
protected

Definition at line 50 of file class.ilObjBlog.php.

51  {
52  global $ilDB;
53 
54  $ilDB->manipulate("INSERT INTO il_blog (id,notes,ppic,rss_active,approval) VALUES (".
55  $ilDB->quote($this->id, "integer").",".
56  $ilDB->quote(true, "integer").",".
57  $ilDB->quote(true, "integer").",".
58  $ilDB->quote(true, "integer").",".
59  $ilDB->quote(false, "integer").")");
60 
61  /*
62  if ($this->getStyleSheetId() > 0)
63  {
64  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
65  ilObjStyleSheet::writeStyleUsage($this->id, $this->getStyleSheetId());
66  }
67  */
68  }

◆ doDelete()

ilObjBlog::doDelete ( )
protected

Definition at line 70 of file class.ilObjBlog.php.

References ilBlogPosting\deleteAllBlogPostings(), deleteImage(), ilNotification\removeForObject(), and ilNotification\TYPE_BLOG.

71  {
72  global $ilDB;
73 
74  $this->deleteImage();
75 
76  include_once "Modules/Blog/classes/class.ilBlogPosting.php";
78 
79  // remove all notifications
80  include_once "./Services/Notification/classes/class.ilNotification.php";
82 
83  $ilDB->manipulate("DELETE FROM il_blog".
84  " WHERE id = ".$ilDB->quote($this->id, "integer"));
85  }
static removeForObject($type, $id)
Remove all notifications for given object.
deleteImage()
remove existing file
static deleteAllBlogPostings($a_blog_id)
Delete all postings for blog.
+ Here is the call graph for this function:

◆ doRead()

ilObjBlog::doRead ( )
protected

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

References $row, ilObjStyleSheet\lookupObjectStyle(), setApproval(), setBackgroundColor(), setFontColor(), setImage(), setNotesStatus(), setProfilePicture(), setRSS(), and setStyleSheetId().

32  {
33  global $ilDB;
34 
35  $set = $ilDB->query("SELECT * FROM il_blog".
36  " WHERE id = ".$ilDB->quote($this->id, "integer"));
37  $row = $ilDB->fetchAssoc($set);
38  $this->setNotesStatus((bool)$row["notes"]);
39  $this->setProfilePicture((bool)$row["ppic"]);
40  $this->setBackgroundColor($row["bg_color"]);
41  $this->setFontColor($row["font_color"]);
42  $this->setImage($row["img"]);
43  $this->setRSS($row["rss_active"]);
44  $this->setApproval($row["approval"]);
45 
46  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
48  }
setNotesStatus($a_status)
Toggle notes status.
setRSS($a_status)
Toggle RSS status.
static lookupObjectStyle($a_obj_id)
Lookup object style.
setFontColor($a_value)
Set font color.
setProfilePicture($a_status)
Toggle profile picture status.
setApproval($a_status)
Toggle approval status.
setBackgroundColor($a_value)
Set background color.
setStyleSheetId($a_style)
Set style sheet id.
setImage($a_value)
Set banner image.
+ Here is the call graph for this function:

◆ doUpdate()

ilObjBlog::doUpdate ( )
protected

Definition at line 87 of file class.ilObjBlog.php.

References getStyleSheetId(), and ilObjStyleSheet\writeStyleUsage().

88  {
89  global $ilDB;
90 
91  if($this->id)
92  {
93  $ilDB->manipulate("UPDATE il_blog".
94  " SET notes = ".$ilDB->quote($this->getNotesStatus(), "integer").
95  ",ppic = ".$ilDB->quote($this->hasProfilePicture(), "integer").
96  ",bg_color = ".$ilDB->quote($this->getBackgroundColor(), "text").
97  ",font_color = ".$ilDB->quote($this->getFontcolor(), "text").
98  ",img = ".$ilDB->quote($this->getImage(), "text").
99  ",rss_active = ".$ilDB->quote($this->hasRSS(), "integer").
100  ",approval = ".$ilDB->quote($this->hasApproval(), "integer").
101  " WHERE id = ".$ilDB->quote($this->id, "integer"));
102 
103 
104  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
106  }
107  }
static writeStyleUsage($a_obj_id, $a_style_id)
Write style usage.
getStyleSheetId()
Get style sheet id.
+ Here is the call graph for this function:

◆ getBackgroundColor()

ilObjBlog::getBackgroundColor ( )

Get background color.

Returns
string

Definition at line 188 of file class.ilObjBlog.php.

References $bg_color.

Referenced by doCloneObject().

189  {
190  if(!$this->bg_color)
191  {
192  $this->bg_color = "ffffff";
193  }
194  return $this->bg_color;
195  }
+ Here is the caller graph for this function:

◆ getFontColor()

ilObjBlog::getFontColor ( )

Get font color.

Returns
string

Definition at line 212 of file class.ilObjBlog.php.

References $font_color.

Referenced by doCloneObject().

213  {
214  if(!$this->font_color)
215  {
216  $this->font_color = "505050";
217  }
218  return $this->font_color;
219  }
+ Here is the caller graph for this function:

◆ getImage()

ilObjBlog::getImage ( )

Get banner image.

Returns
string

Definition at line 236 of file class.ilObjBlog.php.

References $img.

Referenced by doCloneObject().

237  {
238  return $this->img;
239  }
+ Here is the caller graph for this function:

◆ getImageFullPath()

ilObjBlog::getImageFullPath (   $a_as_thumb = false)

Get banner image incl.

path

Parameters
bool$a_as_thumb

Definition at line 256 of file class.ilObjBlog.php.

References $img, $path, and initStorage().

257  {
258  if($this->img)
259  {
260  $path = $this->initStorage($this->id);
261  if(!$a_as_thumb)
262  {
263  return $path.$this->img;
264  }
265  else
266  {
267  return $path."thb_".$this->img;
268  }
269  }
270  }
static initStorage($a_id, $a_subdir=null)
Init file system storage.
$path
Definition: index.php:22
+ Here is the call graph for this function:

◆ getLocalContributorRole()

ilObjBlog::getLocalContributorRole (   $a_node_id)

Get object id of local contributor role.

Parameters
int$a_node_id
Returns
int

Definition at line 632 of file class.ilObjBlog.php.

References ilObject\_lookupTitle().

Referenced by getRolesWithContribute().

633  {
634  global $rbacreview;
635 
636  foreach($rbacreview->getLocalRoles($a_node_id) as $role_id)
637  {
638  if(substr(ilObject::_lookupTitle($role_id), 0, 19) == "il_blog_contributor")
639  {
640  return $role_id;
641  }
642  }
643  }
static _lookupTitle($a_id)
lookup object title
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNotesStatus()

ilObjBlog::getNotesStatus ( )

Get notes status.

Returns
bool

Definition at line 148 of file class.ilObjBlog.php.

References $notes.

Referenced by doCloneObject().

149  {
150  return $this->notes;
151  }
+ Here is the caller graph for this function:

◆ getRolesWithContribute()

ilObjBlog::getRolesWithContribute (   $a_node_id)

Definition at line 645 of file class.ilObjBlog.php.

References $res, ilRbacReview\_getOperationIdByName(), ilObjRole\_getTranslation(), and getLocalContributorRole().

646  {
647  global $rbacreview;
648 
649  include_once "Services/AccessControl/classes/class.ilObjRole.php";
650 
651  $contr_op_id = ilRbacReview::_getOperationIdByName("contribute");
652  $contr_role_id = $this->getLocalContributorRole($a_node_id);
653 
654  $res = array();
655  foreach($rbacreview->getParentRoleIds($a_node_id) as $role_id => $role)
656  {
657  if($role_id != $contr_role_id &&
658  in_array($contr_op_id, $rbacreview->getActiveOperationsOfRole($a_node_id, $role_id)))
659  {
660  $res[$role_id] = ilObjRole:: _getTranslation($role["title"]);
661  }
662  }
663 
664  return $res;
665  }
_getTranslation($a_role_title)
static _getOperationIdByName($a_operation)
get operation id by name of operation public static
getLocalContributorRole($a_node_id)
Get object id of local contributor role.
+ Here is the call graph for this function:

◆ getStyleSheetId()

ilObjBlog::getStyleSheetId ( )

Get style sheet id.

Returns
bool

Definition at line 410 of file class.ilObjBlog.php.

References $style.

Referenced by doCloneObject(), and doUpdate().

411  {
412  return (int)$this->style;
413  }
+ Here is the caller graph for this function:

◆ handleQuotaUpdate()

ilObjBlog::handleQuotaUpdate ( )
protected

Definition at line 667 of file class.ilObjBlog.php.

References ilUtil\dirsize(), ilObject2\getId(), ilObject2\getType(), ilDiskQuotaHandler\handleUpdatedSourceObject(), and initStorage().

Referenced by deleteImage(), and uploadImage().

668  {
669  include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
671  $this->getId(),
672  ilUtil::dirsize($this->initStorage($this->getId())),
673  array($this->getId()));
674  }
static initStorage($a_id, $a_subdir=null)
Init file system storage.
static dirsize($directory)
get size of a directory or a file.
static handleUpdatedSourceObject($a_src_obj_type, $a_src_obj_id, $a_src_filesize, $a_owner_obj_ids=null, $a_is_prtf=false)
Find and update/create all related entries for source object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasApproval()

ilObjBlog::hasApproval ( )

Get approval status.

Returns
bool

Definition at line 390 of file class.ilObjBlog.php.

References $approval.

Referenced by doCloneObject().

391  {
392  return (bool)$this->approval;
393  }
+ Here is the caller graph for this function:

◆ hasProfilePicture()

ilObjBlog::hasProfilePicture ( )

Get profile picture status.

Returns
bool

Definition at line 168 of file class.ilObjBlog.php.

References $ppic.

Referenced by doCloneObject().

169  {
170  return $this->ppic;
171  }
+ Here is the caller graph for this function:

◆ hasRSS()

ilObjBlog::hasRSS ( )

Get RSS status.

Returns
bool

Definition at line 370 of file class.ilObjBlog.php.

References $rss.

Referenced by doCloneObject().

371  {
372  return $this->rss;
373  }
+ Here is the caller graph for this function:

◆ initDefaultRoles()

ilObjBlog::initDefaultRoles ( )

Definition at line 596 of file class.ilObjBlog.php.

References $res, ilObject2\createRoleFolder(), ilObject2\getId(), and ilObject2\getRefId().

597  {
598  global $rbacadmin, $rbacreview, $ilDB;
599 
600  // SET PERMISSION TEMPLATE OF NEW LOCAL CONTRIBUTOR ROLE
601  $set = $ilDB->query("SELECT obj_id FROM object_data ".
602  " WHERE type=".$ilDB->quote("rolt", "text").
603  " AND title=".$ilDB->quote("il_blog_contributor", "text"));
604  $res = $ilDB->fetchAssoc($set);
605  if($res["obj_id"])
606  {
607  $rolf_obj = $this->createRoleFolder();
608 
609  // CREATE ADMIN ROLE
610  $role_obj = $rolf_obj->createRole("il_blog_contributor_".$this->getRefId(),
611  "Contributor of blog obj_no.".$this->getId());
612 
613  $rbacadmin->copyRoleTemplatePermissions($res["obj_id"], ROLE_FOLDER_ID,
614  $rolf_obj->getRefId(), $role_obj->getId());
615 
616  // SET OBJECT PERMISSIONS OF BLOG OBJECT
617  $ops = $rbacreview->getOperationsOfRole($role_obj->getId(), "blog", $rolf_obj->getRefId());
618  $rbacadmin->grantPermission($role_obj->getId(), $ops, $this->getRefId());
619 
620  return true;
621  }
622 
623  return false;
624  }
+ Here is the call graph for this function:

◆ initStorage()

static ilObjBlog::initStorage (   $a_id,
  $a_subdir = null 
)
static

Init file system storage.

Parameters
type$a_id
type$a_subdir
Returns
string

Definition at line 296 of file class.ilObjBlog.php.

References $path.

Referenced by doCloneObject(), getImageFullPath(), ilBlogDataSet\getXmlRecord(), handleQuotaUpdate(), ilBlogDataSet\importRecord(), and uploadImage().

297  {
298  include_once "Modules/Blog/classes/class.ilFSStorageBlog.php";
299  $storage = new ilFSStorageBlog($a_id);
300  $storage->create();
301 
302  $path = $storage->getAbsolutePath()."/";
303 
304  if($a_subdir)
305  {
306  $path .= $a_subdir."/";
307 
308  if(!is_dir($path))
309  {
310  mkdir($path);
311  }
312  }
313 
314  return $path;
315  }
$path
Definition: index.php:22
+ Here is the caller graph for this function:

◆ initType()

ilObjBlog::initType ( )

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

27  {
28  $this->type = "blog";
29  }

◆ sendNotification()

static ilObjBlog::sendNotification (   $a_action,
  $a_in_wsp,
  $a_blog_node_id,
  $a_posting_id,
  $a_comment = null 
)
static

Definition at line 425 of file class.ilObjBlog.php.

References $ilUser, ilObject\_lookupObjId(), ilNotification\getNotificationsForObject(), ilWorkspaceTree\lookupObjectId(), ilNotification\TYPE_BLOG, and ilNotification\updateNotificationTime().

Referenced by ilBlogPostingGUI\activatePage(), ilBlogPostingGUI\observeNoteAction(), and ilBlogPosting\update().

426  {
427  global $ilUser;
428 
429  // get blog object id (repository or workspace)
430  if($a_in_wsp)
431  {
432  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
433  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
434  $tree = new ilWorkspaceTree($ilUser->getId()); // owner of tree is irrelevant
435  $blog_obj_id = $tree->lookupObjectId($a_blog_node_id);
436  $access_handler = new ilWorkspaceAccessHandler($tree);
437  }
438  else
439  {
440  $blog_obj_id = ilObject::_lookupObjId($a_blog_node_id);
441  $access_handler = null;
442  }
443  if(!$blog_obj_id)
444  {
445  return;
446  }
447 
448  include_once "./Modules/Blog/classes/class.ilBlogPosting.php";
449  $posting = new ilBlogPosting($a_posting_id);
450 
451  // #11138
452  $ignore_threshold = ($a_action == "comment");
453 
454  // approval handling
455  $admin_only = false;
456  if(!$posting->isApproved())
457  {
458  $blog = new self($blog_obj_id, false);
459  if($blog->hasApproval())
460  {
461  switch($a_action)
462  {
463  case "update":
464  // un-approved posting was updated - no notifications
465  return;
466 
467  case "new":
468  // un-approved posting was activated - admin-only notification
469  $admin_only = true;
470  $ignore_threshold = true;
471  break;
472  }
473  }
474  }
475 
476  // recipients
477  include_once "./Services/Notification/classes/class.ilNotification.php";
479  $blog_obj_id, $a_posting_id, $ignore_threshold);
480  if(!sizeof($users))
481  {
482  return;
483  }
484 
485  include_once "./Services/Notification/classes/class.ilSystemNotification.php";
486  $ntf = new ilSystemNotification($a_in_wsp);
487  $ntf->setLangModules(array("blog"));
488  $ntf->setRefId($a_blog_node_id);
489  $ntf->setChangedByUserId($ilUser->getId());
490  $ntf->setSubjectLangId('blog_change_notification_subject');
491  $ntf->setIntroductionLangId('blog_change_notification_body_'.$a_action);
492  $ntf->addAdditionalInfo('blog_posting', $posting->getTitle());
493  if($a_comment)
494  {
495  $ntf->addAdditionalInfo('comment', $a_comment, true);
496  }
497  $ntf->setGotoLangId('blog_change_notification_link');
498  $ntf->setReasonLangId('blog_change_notification_reason');
499 
500  $notified = $ntf->sendMail($users, "_".$a_posting_id,
501  ($admin_only ? "write" : "read"));
502 
503  // #14387
504  if(sizeof($notified))
505  {
506  ilNotification::updateNotificationTime(ilNotification::TYPE_BLOG, $blog_obj_id, $notified, $a_posting_id);
507  }
508  }
Class ilBlogPosting.
Access handler for personal workspace.
static updateNotificationTime($type, $id, array $user_ids, $page_id=false)
Update the last mail timestamp for given object and users.
static getNotificationsForObject($type, $id, $page_id=null, $ignore_threshold=false)
Get all users for given object.
Tree handler for personal workspace.
static _lookupObjId($a_id)
global $ilUser
Definition: imgupload.php:15
lookupObjectId($a_node_id)
Get object id for node id.
Wrapper classes for system notifications.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setApproval()

ilObjBlog::setApproval (   $a_status)

Toggle approval status.

Parameters
bool$a_status

Definition at line 400 of file class.ilObjBlog.php.

Referenced by doCloneObject(), and doRead().

401  {
402  $this->approval = (bool)$a_status;
403  }
+ Here is the caller graph for this function:

◆ setBackgroundColor()

ilObjBlog::setBackgroundColor (   $a_value)

Set background color.

Parameters
string$a_value

Definition at line 202 of file class.ilObjBlog.php.

Referenced by doCloneObject(), and doRead().

203  {
204  $this->bg_color = (string)$a_value;
205  }
+ Here is the caller graph for this function:

◆ setFontColor()

ilObjBlog::setFontColor (   $a_value)

Set font color.

Parameters
string$a_value

Definition at line 226 of file class.ilObjBlog.php.

Referenced by doCloneObject(), and doRead().

227  {
228  $this->font_color = (string)$a_value;
229  }
+ Here is the caller graph for this function:

◆ setImage()

ilObjBlog::setImage (   $a_value)

Set banner image.

Parameters
string$a_value

Definition at line 246 of file class.ilObjBlog.php.

Referenced by deleteImage(), doCloneObject(), doRead(), and uploadImage().

247  {
248  $this->img = (string)$a_value;
249  }
+ Here is the caller graph for this function:

◆ setNotesStatus()

ilObjBlog::setNotesStatus (   $a_status)

Toggle notes status.

Parameters
bool$a_status

Definition at line 158 of file class.ilObjBlog.php.

Referenced by doCloneObject(), and doRead().

159  {
160  $this->notes = (bool)$a_status;
161  }
+ Here is the caller graph for this function:

◆ setProfilePicture()

ilObjBlog::setProfilePicture (   $a_status)

Toggle profile picture status.

Parameters
bool$a_status

Definition at line 178 of file class.ilObjBlog.php.

Referenced by doCloneObject(), and doRead().

179  {
180  $this->ppic = (bool)$a_status;
181  }
+ Here is the caller graph for this function:

◆ setRSS()

ilObjBlog::setRSS (   $a_status)

Toggle RSS status.

Parameters
bool$a_status

Definition at line 380 of file class.ilObjBlog.php.

Referenced by doCloneObject(), and doRead().

381  {
382  $this->rss = (bool)$a_status;
383  }
+ Here is the caller graph for this function:

◆ setStyleSheetId()

ilObjBlog::setStyleSheetId (   $a_style)

Set style sheet id.

Parameters
int$a_style

Definition at line 420 of file class.ilObjBlog.php.

Referenced by doCloneObject(), and doRead().

421  {
422  $this->style = (int)$a_style;
423  }
+ Here is the caller graph for this function:

◆ uploadImage()

ilObjBlog::uploadImage ( array  $a_upload)

Upload new image file.

Parameters
array$a_upload
Returns
bool

Definition at line 323 of file class.ilObjBlog.php.

References $path, deleteImage(), ilUtil\escapeShellArg(), ilUtil\execConvert(), handleQuotaUpdate(), initStorage(), and setImage().

324  {
325  if(!$this->id)
326  {
327  return false;
328  }
329 
330  $this->deleteImage();
331 
332  // #10074
333  $clean_name = preg_replace("/[^a-zA-Z0-9\_\.\-]/", "", $a_upload["name"]);
334 
335  $path = $this->initStorage($this->id);
336  $original = "org_".$this->id."_".$clean_name;
337  $thumb = "thb_".$this->id."_".$clean_name;
338  $processed = $this->id."_".$clean_name;
339 
340  if(@move_uploaded_file($a_upload["tmp_name"], $path.$original))
341  {
342  chmod($path.$original, 0770);
343 
344  $blga_set = new ilSetting("blga");
345  $dimensions = $blga_set->get("banner_width")."x".
346  $blga_set->get("banner_height");
347 
348  // take quality 100 to avoid jpeg artefacts when uploading jpeg files
349  // taking only frame [0] to avoid problems with animated gifs
350  $original_file = ilUtil::escapeShellArg($path.$original);
351  $thumb_file = ilUtil::escapeShellArg($path.$thumb);
352  $processed_file = ilUtil::escapeShellArg($path.$processed);
353  ilUtil::execConvert($original_file."[0] -geometry 100x100 -quality 100 JPEG:".$thumb_file);
354  ilUtil::execConvert($original_file."[0] -geometry ".$dimensions."! -quality 100 JPEG:".$processed_file);
355 
356  $this->setImage($processed);
357 
358  $this->handleQuotaUpdate();
359 
360  return true;
361  }
362  return false;
363  }
ILIAS Setting Class.
deleteImage()
remove existing file
static execConvert($args)
execute convert command
static initStorage($a_id, $a_subdir=null)
Init file system storage.
static escapeShellArg($a_arg)
$path
Definition: index.php:22
setImage($a_value)
Set banner image.
+ Here is the call graph for this function:

Field Documentation

◆ $approval

ilObjBlog::$approval
protected

Definition at line 23 of file class.ilObjBlog.php.

Referenced by hasApproval().

◆ $bg_color

ilObjBlog::$bg_color
protected

Definition at line 18 of file class.ilObjBlog.php.

Referenced by getBackgroundColor().

◆ $font_color

ilObjBlog::$font_color
protected

Definition at line 19 of file class.ilObjBlog.php.

Referenced by getFontColor().

◆ $img

ilObjBlog::$img
protected

Definition at line 20 of file class.ilObjBlog.php.

Referenced by doCloneObject(), getImage(), and getImageFullPath().

◆ $notes

ilObjBlog::$notes
protected

Definition at line 17 of file class.ilObjBlog.php.

Referenced by getNotesStatus().

◆ $ppic

ilObjBlog::$ppic
protected

Definition at line 21 of file class.ilObjBlog.php.

Referenced by hasProfilePicture().

◆ $rss

ilObjBlog::$rss
protected

Definition at line 22 of file class.ilObjBlog.php.

Referenced by hasRSS().

◆ $style

ilObjBlog::$style
protected

Definition at line 24 of file class.ilObjBlog.php.

Referenced by getStyleSheetId().


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