ILIAS  release_8 Revision v8.24
ilBlogPosting Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilBlogPosting:
+ Collaboration diagram for ilBlogPosting:

Public Member Functions

 getParentType ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setBlogId (int $a_id)
 
 getBlogId ()
 
 setCreated (ilDateTime $a_date)
 
 getCreated ()
 
 setAuthor (int $a_id)
 
 getAuthor ()
 
 setApproved (bool $a_status)
 
 isApproved ()
 
 setWithdrawn (ilDateTime $a_date)
 Set last withdrawal date. More...
 
 getWithdrawn ()
 Get last withdrawal date. More...
 
 create (bool $a_import=false)
 Create new blog posting. More...
 
 update (bool $a_validate=true, bool $a_no_history=false, bool $a_notify=true, string $a_notify_action="update")
 
 read ()
 Read blog posting. More...
 
 checkApproval ()
 
 delete ()
 Delete blog posting and all related data. More...
 
 unpublish ()
 Unpublish. More...
 
 setBlogNodeId (int $a_id, bool $a_is_in_workspace=false)
 Set blog node id (needed for notification) More...
 
 getNotificationAbstract ()
 
 getMDSection ()
 
 updateKeywords (array $keywords)
 
 handleNews (bool $a_update=false)
 Handle news item. More...
 
- Public Member Functions inherited from ilPageObject
 __construct (int $a_id=0, int $a_old_nr=0, string $a_lang="-")
 
 afterConstructor ()
 
 getParentType ()
 
 initPageConfig ()
 
 setLanguage (string $a_val)
 Set language. More...
 
 getLanguage ()
 
 setPageConfig (ilPageConfig $a_val)
 
 setConcreteLang (string $a_val)
 
 getConcreteLang ()
 
 getPageConfig ()
 
 setRenderMd5 (string $a_rendermd5)
 
 getRenderMd5 ()
 
 setRenderedContent (string $a_renderedcontent)
 
 getRenderedContent ()
 
 setRenderedTime (string $a_renderedtime)
 
 getRenderedTime ()
 
 setLastChange (string $a_lastchange)
 
 getLastChange ()
 
 setLastChangeUser (int $a_val)
 
 getLastChangeUser ()
 
 setShowActivationInfo (bool $a_val)
 
 getShowActivationInfo ()
 
 getCreationUserId ()
 
 read ()
 Read page data. More...
 
 buildDom (bool $a_force=false)
 
 freeDom ()
 
 getDom ()
 @depracated More...
 
 setId (int $a_id)
 
 getId ()
 
 setParentId (int $a_id)
 
 getParentId ()
 
 addUpdateListener (object $a_object, string $a_method, $a_parameters="")
 
 callUpdateListeners ()
 
 setActive (bool $a_active)
 
 getActive (bool $a_check_scheduled_activation=false)
 
 setActivationStart (?string $a_activationstart)
 
 getActivationStart ()
 
 setActivationEnd (?string $a_activationend)
 Set Activation End. More...
 
 getActivationEnd ()
 
 getContentObject (string $a_hier_id, string $a_pc_id="")
 Get a content object of the page. More...
 
 getContentObjectForPcId (string $pcid)
 Get content object for pc id. More...
 
 getParentContentObjectForPcId (string $pcid)
 Get parent content object for pc id. More...
 
 getContentNode (string $a_hier_id, string $a_pc_id="")
 
 checkForTag (string $a_content_tag, string $a_hier_id, string $a_pc_id="")
 Get content node from dom. More...
 
 getNode ()
 
 setXMLContent (string $a_xml, string $a_encoding="UTF-8")
 set xml content of page, start with <PageObject...>, end with </PageObject>, comply with ILIAS DTD, omit MetaData, use utf-8! More...
 
 appendXMLContent (string $a_xml)
 
 getXMLContent (bool $a_incl_head=false)
 get xml content of page More...
 
 copyXmlContent (bool $a_clone_mobs=false, int $a_new_parent_id=0, int $obj_copy_id=0, bool $self_ass=true)
 Copy content of page; replace page components with copies where necessary (e.g. More...
 
 handleCopiedContent (php4DOMDocument $a_dom, bool $a_self_ass=true, bool $a_clone_mobs=false, int $new_parent_id=0, int $obj_copy_id=0)
 Handle copied content This function copies items, that must be copied, if page content is duplicated. More...
 
 newIIMCopies (php4DOMDocument $temp_dom)
 Replaces media objects in interactive images with copies of the interactive images. More...
 
 newMobCopies (php4DOMDocument $temp_dom)
 Replaces media objects with copies. More...
 
 newQuestionCopies (php4DOMDocument $temp_dom)
 Replaces existing question content elements with new copies. More...
 
 removeQuestions (php4DOMDocument $temp_dom)
 Remove questions from document. More...
 
 countPageContents ()
 
 getXMLFromDom (bool $a_incl_head=false, bool $a_append_mobs=false, bool $a_append_bib=false, string $a_append_str="", bool $a_omit_pageobject_tag=false, int $style_id=0)
 get xml content of page from dom (use this, if any changes are made to the document) More...
 
 getLanguageVariablesXML (int $style_id=0)
 Get language variables as XML. More...
 
 getFirstParagraphText ()
 
 getParagraphForPCID (string $pcid)
 
 setParagraphContent (string $a_hier_id, string $a_content)
 Set content of paragraph. More...
 
 setContainsIntLink (bool $a_contains_link)
 lm parser set this flag to true, if the page contains intern links (this method should only be called by the import parser) todo: move to ilLMPageObject !? More...
 
 containsIntLink ()
 returns true, if page was marked as containing an intern link (via setContainsIntLink) (this method should only be called by the import parser) More...
 
 setImportMode (bool $a_val)
 
 getImportMode ()
 
 needsImportParsing (?bool $a_parse=null)
 
 setContainsQuestion (bool $a_val)
 
 getContainsQuestion ()
 
 collectMediaObjects (bool $a_inline_only=true)
 get all media objects, that are referenced and used within the page More...
 
 getInternalLinks (bool $a_cnt_multiple=false)
 get all internal links that are used within the page More...
 
 getMultimediaXML ()
 get a xml string that contains all media object elements, that are referenced by any media alias in the page More...
 
 getMediaAliasElement (int $a_mob_id, int $a_nr=1)
 get complete media object (alias) element More...
 
 validateDom (bool $throw=false)
 Validate the page content agains page DTD. More...
 
 addHierIDs ()
 Add hierarchical ID (e.g. More...
 
 getHierIds ()
 get all hierarchical ids More...
 
 getFirstRowIds ()
 get ids of all first table rows More...
 
 getFirstColumnIds ()
 get ids of all first table columns More...
 
 getListItemIds ()
 get ids of all list items More...
 
 getFileItemIds ()
 get ids of all file items More...
 
 stripHierIDs ()
 strip all hierarchical id attributes out of the dom tree More...
 
 getHierIdsForPCIds (array $a_pc_ids)
 Get hier ids for a set of pc ids. More...
 
 getHierIdForPcId (string $pcid)
 
 getPCIdsForHierIds (array $hier_ids)
 Get hier ids for a set of pc ids. More...
 
 getPCIdForHierId (string $hier_id)
 
 addFileSizes ()
 add file sizes More...
 
 resolveIntLinks (array $a_link_map=null)
 Resolves all internal link targets of the page, if targets are available (after import) More...
 
 resolveMediaAliases (array $a_mapping, bool $a_reuse_existing_by_import=false)
 Resolve media aliases (after import) More...
 
 resolveIIMMediaAliases (array $a_mapping)
 Resolve iim media aliases (in ilContObjParse) More...
 
 resolveFileItems (array $a_mapping)
 Resolve file items (after import) More...
 
 resolveQuestionReferences (array $a_mapping)
 Resolve all quesiont references (after import) More...
 
 moveIntLinks (array $a_from_to)
 Move internal links from one destination to another. More...
 
 handleImportRepositoryLink (string $a_rep_import_id, string $a_rep_type, int $a_rep_ref_id)
 
 handleRepositoryLinksOnCopy (array $a_mapping, int $a_source_ref_id)
 Handle repository links on copy process. More...
 
 createFromXML ()
 Create new page object with current xml content. More...
 
 updateFromXML ()
 Updates page object with current xml content This function is currently (8 beta) called by: More...
 
 afterUpdate (DOMDocument $domdoc, string $xml)
 After update. More...
 
 update (bool $a_validate=true, bool $a_no_history=false)
 update complete page content in db (dom xml content is used) More...
 
 delete ()
 
 saveStyleUsage (DOMDocument $a_domdoc, int $a_old_nr=0)
 Save all style class/template usages. More...
 
 deleteStyleUsages (int $a_old_nr=0)
 Delete style usages. More...
 
 getLastUpdateOfIncludedElements ()
 Get last update of included elements (media objects and files). More...
 
 deleteInternalLinks ()
 Delete internal links. More...
 
 saveInternalLinks (DOMDocument $a_domdoc)
 save internal links of page More...
 
 create (bool $a_import=false)
 create new page (with current xml data) More...
 
 deleteContent (string $a_hid, bool $a_update=true, string $a_pcid="", bool $move_operation=false)
 delete content object with hierarchical id $a_hid More...
 
 deleteContents (array $a_hids, bool $a_update=true, bool $a_self_ass=false, bool $move_operation=false)
 Delete multiple content objects. More...
 
 cutContents (array $a_hids)
 Copy contents to clipboard and cut them from the page. More...
 
 copyContents (array $a_hids)
 Copy contents to clipboard. More...
 
 pasteContents (string $a_hier_id, bool $a_self_ass=false)
 Paste contents from pc clipboard. More...
 
 switchEnableMultiple (array $a_hids, bool $a_update=true, bool $a_self_ass=false)
 (De-)activate elements More...
 
 deleteContentFromHierId (string $a_hid, bool $a_update=true)
 delete content object with hierarchical id >= $a_hid as part of a split page operation More...
 
 deleteContentBeforeHierId (string $a_hid, bool $a_update=true)
 delete content object with hierarchical id < $a_hid as part of the split page operation More...
 
 insertContent (ilPageContent $a_cont_obj, string $a_pos, int $a_mode=IL_INSERT_AFTER, string $a_pcid="", bool $remove_placeholder=true)
 insert a content node before/after a sibling or as first child of a parent More...
 
 insertContentNode (php4DOMElement $a_cont_node, string $a_pos, int $a_mode=IL_INSERT_AFTER, string $a_pcid="")
 insert a content node before/after a sibling or as first child of a parent More...
 
 moveContentBefore (string $a_source, string $a_target, string $a_spcid="", string $a_tpcid="")
 move content object from position $a_source before position $a_target (both hierarchical content ids) More...
 
 moveContentAfter (string $a_source, string $a_target, string $a_spcid="", string $a_tpcid="")
 move content object from position $a_source before position $a_target (both hierarchical content ids) More...
 
 bbCode2XML (string &$a_content)
 transforms bbCode to corresponding xml More...
 
 insertInstIntoIDs (string $a_inst, bool $a_res_ref_to_obj_id=true)
 inserts installation id into ids (e.g. More...
 
 checkPCIds ()
 Check, whether (all) page content hashes are set. More...
 
 getAllPCIds ()
 Get all pc ids. More...
 
 hasDuplicatePCIds ()
 
 getDuplicatePCIds ()
 Get all duplicate PC Ids. More...
 
 existsPCId (string $a_pc_id)
 
 generatePcId ()
 
 insertPCIds ()
 Insert Page Content IDs. More...
 
 getPageContentsHashes ()
 Get page contents hashes. More...
 
 getQuestionIds ()
 Get question ids. More...
 
 send_paragraph (string $par_id, string $filename)
 
 getFO ()
 get fo page content More...
 
 registerOfflineHandler (object $handler)
 
 getOfflineHandler ()
 
 containsDeactivatedElements (string $a_content)
 Check whether content contains deactivated elements. More...
 
 getHistoryEntries ()
 Get History Entries. More...
 
 getHistoryEntry (int $a_old_nr)
 Get History Entry. More...
 
 getHistoryInfo (int $a_nr)
 Get information about a history entry, its predecessor and its successor. More...
 
 addChangeDivClasses (array $a_hashes)
 
 compareVersion (int $a_left, int $a_right)
 Compares to revisions of the page. More...
 
 increaseViewCnt ()
 Increase view cnt. More...
 
 writeRenderedContent (string $a_content, string $a_md5)
 Write rendered content. More...
 
 containsIntLinks (string $a_content)
 Check whether content contains internal links. More...
 
 performAutomaticModifications ()
 Perform automatic modifications (may be overwritten by sub classes) More...
 
 saveInitialOpenedContent (string $a_type, int $a_id, string $a_target)
 Save initial opened content. More...
 
 getInitialOpenedContent ()
 Get initial opened content. More...
 
 beforePageContentUpdate (ilPageContent $a_page_content)
 Before page content update Note: This one is "work in progress", currently only text paragraphs call this hook It is called before the page content object invokes the update procedure of ilPageObject. More...
 
 copy (int $a_id, string $a_parent_type="", int $a_new_parent_id=0, bool $a_clone_mobs=false, int $obj_copy_id=0)
 Copy page. More...
 
 copyPageToTranslation (string $a_target_lang)
 Copy page to translation. More...
 
 getEditLock ()
 Get page lock. More...
 
 releasePageLock ()
 Release page lock. More...
 
 getEditLockInfo ()
 Get edit lock info. More...
 
 getContentTemplates ()
 Get content templates. More...
 
 getEffectiveEditLockTime ()
 
 getAllFileObjIds ()
 Get all file object ids. More...
 
 resolveResources (array $ref_mapping)
 Resolve resources. More...
 
 getRepoObjId ()
 Get object id of repository object that contains this page, return 0 if page does not belong to a repo object. More...
 
 getPCModel ()
 Get page component model. More...
 
 assignCharacteristic (array $targets, string $char_par, string $char_sec, string $char_med)
 Assign characteristic. More...
 

Static Public Member Functions

static deleteAllBlogPostings (int $a_blog_id)
 Delete all postings for blog. More...
 
static lookupBlogId (int $a_posting_id)
 
static getAllPostings (int $a_blog_id, int $a_limit=1000, int $a_offset=0)
 Get all postings of blog. More...
 
static exists (int $a_blog_id, int $a_posting_id)
 Checks whether a posting exists. More...
 
static getLastPost (int $a_blog_id)
 Get newest posting for blog. More...
 
static searchBlogsByAuthor (int $a_user_id)
 Get all blogs where user has postings. More...
 
static getKeywords (int $a_obj_id, int $a_posting_id)
 
static lookupTitle (int $a_posting_id)
 
- Static Public Member Functions inherited from ilPageObject
static randomhash ()
 
static _exists (string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
 Checks whether page exists. More...
 
static _existsAndNotEmpty (string $a_parent_type, int $a_id, string $a_lang="-")
 Checks whether page exists and is not empty (may return true on some empty pages) More...
 
static preloadActivationDataByParentId (int $a_parent_id)
 Preload activation data by Parent Id. More...
 
static _lookupActive (int $a_id, string $a_parent_type, bool $a_check_scheduled_activation=false, string $a_lang="-")
 lookup activation status More...
 
static _isScheduledActivation (int $a_id, string $a_parent_type, string $a_lang="-")
 Check whether page is activated by time schedule. More...
 
static _writeActive (int $a_id, string $a_parent_type, bool $a_active)
 write activation status More...
 
static _lookupActivationData (int $a_id, string $a_parent_type, string $a_lang="-")
 Lookup activation data. More...
 
static lookupParentId (int $a_id, string $a_type)
 
static _writeParentId (string $a_parent_type, int $a_pg_id, int $a_par_id)
 
static _handleImportRepositoryLinks (string $a_rep_import_id, string $a_rep_type, int $a_rep_ref_id)
 Change targest of repository links. More...
 
static _moveContentAfterHierId (ilPageObject $a_source_page, ilPageObject $a_target_page, string $a_hid)
 move content of hierarchical id >= $a_hid to other page More...
 
static _lookupContainsDeactivatedElements (int $a_id, string $a_parent_type, string $a_lang="-")
 lookup whether page contains deactivated elements More...
 
static getRecentChanges (string $a_parent_type, int $a_parent_id, int $a_period=30, string $a_lang="")
 Get recent pages changes for parent object. More...
 
static getAllPages (string $a_parent_type, int $a_parent_id, string $a_lang="-")
 Get all pages for parent object. More...
 
static getNewPages (string $a_parent_type, int $a_parent_id, string $a_lang="-")
 Get new pages. More...
 
static getParentObjectContributors (string $a_parent_type, int $a_parent_id, string $a_lang="-")
 Get all contributors for parent object. More...
 
static getPageContributors (string $a_parent_type, int $a_page_id, string $a_lang="-")
 Get all contributors for parent object. More...
 
static getPagesWithLinks (string $a_parent_type, int $a_parent_id, string $a_lang="-")
 Get all pages for parent object that contain internal links. More...
 
static lookupTranslations (string $a_parent_type, int $a_id)
 Lookup translations. More...
 
static truncateHTML (string $a_text, int $a_length=100, string $a_ending='...', bool $a_exact=false, bool $a_consider_html=true)
 Truncate (html) string. More...
 
static getLastChangeByParent (string $a_parent_type, int $a_parent_id, string $a_lang="")
 Get all pages for parent object. More...
 

Static Protected Member Functions

static lookup (string $a_field, string $a_posting_id)
 Lookup posting property. More...
 

Protected Attributes

string $title = ""
 
ilDateTime $created = null
 
int $blog_node_id = 0
 
bool $blog_node_is_wsp = false
 
int $author = 0
 
bool $approved = false
 
ilDateTime $withdrawn = null
 
- Protected Attributes inherited from ilPageObject
int $create_user = 0
 
array $id_elements
 
bool $page_not_found = false
 
bool $show_page_act_info = false
 
ilObjectDefinition $obj_definition
 
ilDBInterface $db
 
ilObjUser $user
 
ilLanguage $lng
 
ilTree $tree
 
int $id
 
string $language = "-"
 
bool $import_mode = false
 
ilLogger $log
 
array $page_record = array()
 
bool $active = false
 
ilPageConfig $page_config
 
string $rendermd5 = ""
 
string $renderedcontent = ""
 
string $renderedtime = ""
 
string $lastchange = ""
 
bool $contains_question = false
 
array $hier_ids = []
 
array $first_row_ids = []
 
array $first_col_ids = []
 
array $list_item_ids = []
 
array $file_item_ids = []
 
string $activationstart = null
 
string $activationend = null
 
ILIAS COPage ReadingTime ReadingTimeManager $reading_time_manager
 
 $concrete_lang = ""
 

Additional Inherited Members

- Data Fields inherited from ilPageObject
int $old_nr
 
php4DOMDocument $dom = null
 
string $xml = ""
 
string $encoding = ""
 
php4DOMElement $node
 
string $cur_dtd = "ilias_pg_8.dtd"
 
bool $contains_int_link = false
 
bool $needs_parsing = false
 
string $parent_type = ""
 
int $parent_id = 0
 
array $update_listeners = []
 
int $update_listener_cnt = 0
 
object $offline_handler = null
 
bool $dom_builded = false
 
bool $history_saved = false
 
int $last_change_user = 0
 
- Static Public Attributes inherited from ilPageObject
static array $exists = array()
 
- Protected Member Functions inherited from ilPageObject
 getLangVarXML (string $var)
 
 __afterUpdate (DOMDocument $a_domdoc, string $a_xml, bool $a_creation=false, bool $a_empty=false)
 After update event handler (internal). More...
 
 __beforeDelete ()
 Before deletion handler (internal). More...
 
 __afterDelete ()
 
 afterDelete ()
 
 __afterHistoryEntry (DOMDocument $a_old_domdoc, string $a_old_content, int $a_old_nr)
 
 preparePageForCompare (ilPageObject $page)
 
- Static Protected Attributes inherited from ilPageObject
static array $activation_data = array()
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilBlogPosting

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

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

Member Function Documentation

◆ checkApproval()

ilBlogPosting::checkApproval ( )

Definition at line 200 of file class.ilBlogPosting.php.

200 : void
201 {
202 if (!$this->getActive() && $this->isApproved()) {
203 $this->approved = false;
204 $this->update();
205 }
206 }
update(bool $a_validate=true, bool $a_no_history=false, bool $a_notify=true, string $a_notify_action="update")
getActive(bool $a_check_scheduled_activation=false)

◆ create()

ilBlogPosting::create ( bool  $a_import = false)

Create new blog posting.

Reimplemented from ilPageObject.

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

111 : void {
113
114 $id = $ilDB->nextId("il_blog_posting");
115 $this->setId($id);
116
117 if (!$a_import) {
119 } else {
120 $created = $this->getCreated()->get(IL_CAL_DATETIME);
121 }
122
123 // we are using a separate creation date to enable sorting without JOINs
124 $withdrawn = $this->getWithdrawn()
125 ? $this->getWithdrawn()->get(IL_CAL_DATETIME)
126 : null;
127 $query = "INSERT INTO il_blog_posting (id, title, blog_id, created, author, approved, last_withdrawn)" .
128 " VALUES (" .
129 $ilDB->quote($this->getId(), "integer") . "," .
130 $ilDB->quote($this->getTitle(), "text") . "," .
131 $ilDB->quote($this->getBlogId(), "integer") . "," .
132 $ilDB->quote($created, "timestamp") . "," .
133 $ilDB->quote($this->getAuthor(), "integer") . "," .
134 $ilDB->quote($this->isApproved(), "integer") . "," . // #16526 - import
135 $ilDB->quote($withdrawn, "timestamp") . ")";
136 $ilDB->manipulate($query);
137
138 if (!$a_import) {
139 parent::create($a_import);
140 // $this->saveInternalLinks($this->getXMLContent());
141 }
142 }
const IL_CAL_DATETIME
getWithdrawn()
Get last withdrawal date.
ilDBInterface $db
static now()
Return current timestamp in Y-m-d H:i:s format.
$query

◆ delete()

ilBlogPosting::delete ( )

Delete blog posting and all related data.

Reimplemented from ilPageObject.

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

211 : void
212 {
214
216 $this->getBlogId(),
217 "blog",
218 $this->getId(),
219 $this->getParentType()
220 );
221
222 $query = "DELETE FROM il_blog_posting" .
223 " WHERE id = " . $ilDB->quote($this->getId(), "integer");
224 $ilDB->manipulate($query);
225
226 parent::delete();
227 }
static deleteNewsOfContext(int $a_context_obj_id, string $a_context_obj_type, int $a_context_sub_obj_id=0, string $a_context_sub_obj_type="")
Delete all news of a context.

References $ilDB, $query, ilNewsItem\deleteNewsOfContext(), and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ deleteAllBlogPostings()

static ilBlogPosting::deleteAllBlogPostings ( int  $a_blog_id)
static

Delete all postings for blog.

Definition at line 251 of file class.ilBlogPosting.php.

253 : void {
254 global $DIC;
255
256 $ilDB = $DIC->database();
257
258 $query = "SELECT * FROM il_blog_posting" .
259 " WHERE blog_id = " . $ilDB->quote($a_blog_id, "integer");
260 $set = $ilDB->query($query);
261 while ($rec = $ilDB->fetchAssoc($set)) {
262 // delete all md keywords
263 $md_obj = new ilMD($a_blog_id, $rec["id"], "blp");
264 if (is_object($md_section = $md_obj->getGeneral())) {
265 foreach ($md_section->getKeywordIds() as $id) {
266 $md_key = $md_section->getKeyword($id);
267 $md_key->delete();
268 }
269 }
270
271 $post = new ilBlogPosting($rec["id"]);
272 $post->delete();
273 }
274 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
$post
Definition: ltitoken.php:49

References $id, and $post.

Referenced by ilObjBlog\doDelete().

+ Here is the caller graph for this function:

◆ exists()

static ilBlogPosting::exists ( int  $a_blog_id,
int  $a_posting_id 
)
static

Checks whether a posting exists.

Definition at line 338 of file class.ilBlogPosting.php.

341 : bool {
342 global $DIC;
343
344 $ilDB = $DIC->database();
345
346 $query = "SELECT id FROM il_blog_posting" .
347 " WHERE blog_id = " . $ilDB->quote($a_blog_id, "integer") .
348 " AND id = " . $ilDB->quote($a_posting_id, "integer");
349 $set = $ilDB->query($query);
350 if ($rec = $ilDB->fetchAssoc($set)) {
351 return true;
352 }
353 return false;
354 }

Referenced by ilObjBlogGUI\executeCommand().

+ Here is the caller graph for this function:

◆ getAllPostings()

static ilBlogPosting::getAllPostings ( int  $a_blog_id,
int  $a_limit = 1000,
int  $a_offset = 0 
)
static

Get all postings of blog.

Definition at line 295 of file class.ilBlogPosting.php.

299 : array {
300 global $DIC;
301
302 $ilDB = $DIC->database();
303
304 $pages = parent::getAllPages("blp", $a_blog_id);
305
306 if ($a_limit) {
307 $ilDB->setLimit($a_limit, $a_offset);
308 }
309
310 $query = "SELECT * FROM il_blog_posting" .
311 " WHERE blog_id = " . $ilDB->quote($a_blog_id, "integer") .
312 " ORDER BY created DESC";
313 $set = $ilDB->query($query);
314 $post = array();
315 while ($rec = $ilDB->fetchAssoc($set)) {
316 if (isset($pages[$rec["id"]])) {
317 $post[$rec["id"]] = $pages[$rec["id"]];
318 $post[$rec["id"]]["title"] = $rec["title"];
319 $post[$rec["id"]]["created"] = new ilDateTime($rec["created"], IL_CAL_DATETIME);
320 $post[$rec["id"]]["author"] = $rec["author"];
321 $post[$rec["id"]]["approved"] = (bool) $rec["approved"];
322 $post[$rec["id"]]["last_withdrawn"] = new ilDateTime($rec["last_withdrawn"], IL_CAL_DATETIME);
323
324 foreach (self::getPageContributors("blp", $rec["id"]) as $editor) {
325 if ($editor["user_id"] != $rec["author"]) {
326 $post[$rec["id"]]["editors"][] = $editor["user_id"];
327 }
328 }
329 }
330 }
331
332 return $post;
333 }
@classDescription Date and time handling

Referenced by ILIAS\Blog\Export\BlogHtmlExport\collectAllPagesPageElements(), ilObjBlog\deliverRSS(), ILIAS\Blog\BlogPrintViewProviderGUI\getPages(), ILIAS\Portfolio\PortfolioPrintViewProviderGUI\getPages(), ILIAS\Blog\BlogPrintViewProviderGUI\getSelectionForm(), ILIAS\Portfolio\PortfolioPrintViewProviderGUI\getSelectionForm(), ilBlogDraftsDerivedTaskProvider\getTasks(), and ilBlogPostingGUI\initKeywordsForm().

+ Here is the caller graph for this function:

◆ getAuthor()

ilBlogPosting::getAuthor ( )

Definition at line 74 of file class.ilBlogPosting.php.

74 : int
75 {
76 return $this->author;
77 }

References $author.

◆ getBlogId()

ilBlogPosting::getBlogId ( )

Definition at line 54 of file class.ilBlogPosting.php.

54 : int
55 {
56 return $this->getParentId();
57 }

References ilPageObject\getParentId().

+ Here is the call graph for this function:

◆ getCreated()

ilBlogPosting::getCreated ( )

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

65 {
66 return $this->created;
67 }

References $created.

◆ getKeywords()

static ilBlogPosting::getKeywords ( int  $a_obj_id,
int  $a_posting_id 
)
static

Definition at line 440 of file class.ilBlogPosting.php.

443 : array {
444 return ilMDKeyword::lookupKeywords($a_obj_id, $a_posting_id);
445 }
static lookupKeywords(int $a_rbac_id, int $a_obj_id, bool $a_return_ids=false)

Referenced by ilObjBlogGUI\filterItemsByKeyword(), ilObjBlogGUI\getKeywords(), and ilBlogPostingGUI\initKeywordsForm().

+ Here is the caller graph for this function:

◆ getLastPost()

static ilBlogPosting::getLastPost ( int  $a_blog_id)
static

Get newest posting for blog.

Definition at line 359 of file class.ilBlogPosting.php.

361 : int {
362 $data = self::getAllPostings($a_blog_id, 1);
363 if ($data) {
364 $keys = array_keys($data);
365 return end($keys);
366 }
367 return 0;
368 }
static getAllPostings(int $a_blog_id, int $a_limit=1000, int $a_offset=0)
Get all postings of blog.
$keys
Definition: metadata.php:204

References $data, and $keys.

◆ getMDSection()

ilBlogPosting::getMDSection ( )

Definition at line 416 of file class.ilBlogPosting.php.

416 : ?ilMDGeneral
417 {
418 // general section available?
419 $md_obj = new ilMD($this->getBlogId(), $this->getId(), "blp");
420 if (!is_object($md_section = $md_obj->getGeneral())) {
421 $md_section = $md_obj->addGeneral();
422 $md_section->save();
423 return $md_section;
424 }
425 return $md_section;
426 }

References ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ getNotificationAbstract()

ilBlogPosting::getNotificationAbstract ( )

Definition at line 403 of file class.ilBlogPosting.php.

403 : string
404 {
405 $snippet = ilBlogPostingGUI::getSnippet($this->getId(), true);
406
407 // making things more readable
408 $snippet = str_replace(array('<br/>', '<br />', '</p>', '</div>'), "\n", $snippet);
409
410 return trim(strip_tags($snippet));
411 }
static getSnippet(int $a_id, bool $a_truncate=false, int $a_truncate_length=500, string $a_truncate_sign="...", bool $a_include_picture=false, int $a_picture_width=144, int $a_picture_height=144, string $a_export_directory=null)
Get first text paragraph of page.

References ILIAS\Survey\Mode\getId(), and ilBlogPostingGUI\getSnippet().

+ Here is the call graph for this function:

◆ getParentType()

ilBlogPosting::getParentType ( )

Reimplemented from ilPageObject.

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

34 : string
35 {
36 return "blp";
37 }

◆ getTitle()

ilBlogPosting::getTitle ( )

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

44 : string
45 {
46 return $this->title;
47 }

References $title.

◆ getWithdrawn()

ilBlogPosting::getWithdrawn ( )

Get last withdrawal date.

Definition at line 101 of file class.ilBlogPosting.php.

101 : ?ilDateTime
102 {
103 return $this->withdrawn;
104 }

◆ handleNews()

ilBlogPosting::handleNews ( bool  $a_update = false)

Handle news item.

Definition at line 450 of file class.ilBlogPosting.php.

452 : void {
455
456 // see ilWikiPage::updateNews()
457
458 if (!$this->getActive()) {
459 return;
460 }
461
462 $news_item = null;
463
464 // try to re-use existing news item
465 if ($a_update) {
466 // get last news item of the day (if existing)
468 $this->getBlogId(),
469 "blog",
470 $this->getId(),
471 $this->getParentType(),
472 true
473 );
474 if ($news_id > 0) {
475 $news_item = new ilNewsItem($news_id);
476 }
477 }
478
479 // create new news item
480 if (!$news_item) {
481 $news_set = new ilSetting("news");
482 $default_visibility = $news_set->get("default_visibility", "users");
483
484 $news_item = new ilNewsItem();
485 $news_item->setContext(
486 $this->getBlogId(),
487 "blog",
488 $this->getId(),
489 $this->getParentType()
490 );
491 $news_item->setPriority(NEWS_NOTICE);
492 $news_item->setVisibility($default_visibility);
493 }
494
495 // news author
496 $news_item->setUserId($ilUser->getId());
497
498
499 // news title/content
500
501 $news_item->setTitle($this->getTitle());
502
503 $content = $a_update
504 ? "blog_news_posting_updated"
505 : "blog_news_posting_published";
506
507 // news "author"
508 $content = sprintf($lng->txt($content), ilUserUtil::getNamePresentation($ilUser->getId()));
509
510 // posting author[s]
511 $contributors = array();
512 foreach (self::getPageContributors($this->getParentType(), $this->getId()) as $user) {
513 $contributors[] = $user["user_id"];
514 }
515 if (count($contributors) > 1 || !in_array($this->getAuthor(), $contributors)) {
516 // original author should come first?
517 $authors = array(ilUserUtil::getNamePresentation($this->getAuthor()));
518 foreach ($contributors as $user_id) {
519 if ($user_id != $this->getAuthor()) {
520 $authors[] = ilUserUtil::getNamePresentation($user_id);
521 }
522 }
523 $content .= "\n" . sprintf($lng->txt("blog_news_posting_authors"), implode(", ", $authors));
524 }
525
526 $news_item->setContentTextIsLangVar(false);
527 $news_item->setContent($content);
528
529 $snippet = ilBlogPostingGUI::getSnippet($this->getId());
530 $news_item->setContentLong($snippet);
531
532 if (!$news_item->getId()) {
533 $news_item->create();
534 } else {
535 $news_item->update(true);
536 }
537 }
const NEWS_NOTICE
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
A news item can be created by different sources.
static getLastNewsIdForContext(int $a_context_obj_id, string $a_context_obj_type, int $a_context_sub_obj_id=0, string $a_context_sub_obj_type="", bool $a_only_today=false)
Get last news id of news set related to a certain context.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link="", bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
$ilUser
Definition: imgupload.php:34

◆ isApproved()

ilBlogPosting::isApproved ( )

Definition at line 84 of file class.ilBlogPosting.php.

84 : bool
85 {
86 return $this->approved;
87 }

References $approved.

◆ lookup()

static ilBlogPosting::lookup ( string  $a_field,
string  $a_posting_id 
)
staticprotected

Lookup posting property.

Definition at line 542 of file class.ilBlogPosting.php.

545 : ?string {
546 global $DIC;
547
548 $db = $DIC->database();
549
550 $set = $db->query("SELECT $a_field FROM il_blog_posting " .
551 " WHERE id = " . $db->quote($a_posting_id, "integer"));
552 $rec = $db->fetchAssoc($set);
553
554 return $rec[$a_field] ?? null;
555 }
quote($value, string $type)
query(string $query)
Run a (read-only) Query on the database.
fetchAssoc(ilDBStatement $statement)

◆ lookupBlogId()

static ilBlogPosting::lookupBlogId ( int  $a_posting_id)
static

Definition at line 276 of file class.ilBlogPosting.php.

278 : ?int {
279 global $DIC;
280
281 $ilDB = $DIC->database();
282
283 $query = "SELECT blog_id FROM il_blog_posting" .
284 " WHERE id = " . $ilDB->quote($a_posting_id, "integer");
285 $set = $ilDB->query($query);
286 if ($rec = $ilDB->fetchAssoc($set)) {
287 return (int) $rec["blog_id"];
288 }
289 return null;
290 }

Referenced by ilObjBlogGUI\__construct(), and ilBlogImporter\finalProcessing().

+ Here is the caller graph for this function:

◆ lookupTitle()

static ilBlogPosting::lookupTitle ( int  $a_posting_id)
static

Definition at line 557 of file class.ilBlogPosting.php.

557 : string
558 {
559 return (string) self::lookup("title", $a_posting_id);
560 }
static lookup(string $a_field, string $a_posting_id)
Lookup posting property.

◆ read()

ilBlogPosting::read ( )

Read blog posting.

Reimplemented from ilPageObject.

Definition at line 176 of file class.ilBlogPosting.php.

176 : void
177 {
179
180 $query = "SELECT * FROM il_blog_posting" .
181 " WHERE id = " . $ilDB->quote($this->getId(), "integer");
182 $set = $ilDB->query($query);
183 $rec = $ilDB->fetchAssoc($set);
184
185 $this->setTitle($rec["title"]);
186 $this->setBlogId($rec["blog_id"]);
187 $this->setCreated(new ilDateTime($rec["created"], IL_CAL_DATETIME));
188 $this->setAuthor($rec["author"]);
189 if ($rec["approved"]) {
190 $this->setApproved(true);
191 }
192 $this->setWithdrawn(new ilDateTime($rec["last_withdrawn"], IL_CAL_DATETIME));
193
194 // when posting is deactivated it should loose the approval
195 $this->addUpdateListener($this, "checkApproval");
196
197 parent::read();
198 }
setApproved(bool $a_status)
setCreated(ilDateTime $a_date)
setWithdrawn(ilDateTime $a_date)
Set last withdrawal date.
setTitle(string $a_title)
addUpdateListener(object $a_object, string $a_method, $a_parameters="")

References $ilDB, $query, ILIAS\Survey\Mode\getId(), and IL_CAL_DATETIME.

+ Here is the call graph for this function:

◆ searchBlogsByAuthor()

static ilBlogPosting::searchBlogsByAuthor ( int  $a_user_id)
static

Get all blogs where user has postings.

Definition at line 384 of file class.ilBlogPosting.php.

386 : array {
387 global $DIC;
388
389 $ilDB = $DIC->database();
390
391 $ids = array();
392
393 $sql = "SELECT DISTINCT(blog_id)" .
394 " FROM il_blog_posting" .
395 " WHERE author = " . $ilDB->quote($a_user_id);
396 $set = $ilDB->query($sql);
397 while ($row = $ilDB->fetchAssoc($set)) {
398 $ids[] = (int) $row["blog_id"];
399 }
400 return $ids;
401 }

Referenced by ilBlogDraftsDerivedTaskProvider\getTasks(), and ilPCBlogGUI\initForm().

+ Here is the caller graph for this function:

◆ setApproved()

ilBlogPosting::setApproved ( bool  $a_status)

Definition at line 79 of file class.ilBlogPosting.php.

79 : void
80 {
81 $this->approved = $a_status;
82 }

◆ setAuthor()

ilBlogPosting::setAuthor ( int  $a_id)

Definition at line 69 of file class.ilBlogPosting.php.

69 : void
70 {
71 $this->author = $a_id;
72 }

◆ setBlogId()

ilBlogPosting::setBlogId ( int  $a_id)

Definition at line 49 of file class.ilBlogPosting.php.

49 : void
50 {
51 $this->setParentId($a_id);
52 }
setParentId(int $a_id)

References ilPageObject\setParentId().

+ Here is the call graph for this function:

◆ setBlogNodeId()

ilBlogPosting::setBlogNodeId ( int  $a_id,
bool  $a_is_in_workspace = false 
)

Set blog node id (needed for notification)

Definition at line 373 of file class.ilBlogPosting.php.

376 : void {
377 $this->blog_node_id = $a_id;
378 $this->blog_node_is_wsp = $a_is_in_workspace;
379 }

◆ setCreated()

ilBlogPosting::setCreated ( ilDateTime  $a_date)

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

59 : void
60 {
61 $this->created = $a_date;
62 }

◆ setTitle()

ilBlogPosting::setTitle ( string  $a_title)

Definition at line 39 of file class.ilBlogPosting.php.

39 : void
40 {
41 $this->title = $a_title;
42 }

◆ setWithdrawn()

ilBlogPosting::setWithdrawn ( ilDateTime  $a_date)

Set last withdrawal date.

Definition at line 92 of file class.ilBlogPosting.php.

94 : void {
95 $this->withdrawn = $a_date;
96 }

◆ unpublish()

ilBlogPosting::unpublish ( )

Unpublish.

Definition at line 232 of file class.ilBlogPosting.php.

232 : void
233 {
234 $this->setApproved(false);
235 $this->setActive(false);
237 $this->update(true, false, false);
238
240 $this->getBlogId(),
241 "blog",
242 $this->getId(),
243 $this->getParentType()
244 );
245 }
setActive(bool $a_active)

References ilNewsItem\deleteNewsOfContext(), ILIAS\Survey\Mode\getId(), IL_CAL_DATETIME, and ilUtil\now().

+ Here is the call graph for this function:

◆ update()

ilBlogPosting::update ( bool  $a_validate = true,
bool  $a_no_history = false,
bool  $a_notify = true,
string  $a_notify_action = "update" 
)

Definition at line 144 of file class.ilBlogPosting.php.

149 {
151
152 // blog_id, author and created cannot be changed
153 $withdrawn = $this->getWithdrawn()
154 ? $this->getWithdrawn()->get(IL_CAL_DATETIME)
155 : null;
156 $query = "UPDATE il_blog_posting SET" .
157 " title = " . $ilDB->quote($this->getTitle(), "text") .
158 ",created = " . $ilDB->quote($this->getCreated()->get(IL_CAL_DATETIME), "timestamp") .
159 ",approved =" . $ilDB->quote($this->isApproved(), "integer") .
160 ",last_withdrawn =" . $ilDB->quote($withdrawn, "timestamp") .
161 " WHERE id = " . $ilDB->quote($this->getId(), "integer");
162 $ilDB->manipulate($query);
163
164 $ret = parent::update($a_validate, $a_no_history);
165
166 if ($a_notify && $this->getActive()) {
167 ilObjBlog::sendNotification($a_notify_action, $this->blog_node_is_wsp, $this->blog_node_id, $this->getId());
168 }
169
170 return $ret;
171 }
static sendNotification(string $a_action, bool $a_in_wsp, int $a_blog_node_id, int $a_posting_id, ?string $a_comment=null)

References $ilDB, $query, ilDateTime\get(), ILIAS\Survey\Mode\getId(), IL_CAL_DATETIME, and ilObjBlog\sendNotification().

+ Here is the call graph for this function:

◆ updateKeywords()

ilBlogPosting::updateKeywords ( array  $keywords)

Definition at line 428 of file class.ilBlogPosting.php.

430 : void {
432
433 // language is not "used" anywhere
434 $ulang = $ilUser->getLanguage();
435 $keywords = array($ulang => $keywords);
436
437 ilMDKeyword::updateKeywords($this->getMDSection(), $keywords);
438 }
static updateKeywords(ilMDGeneral $a_md_section, array $a_keywords)

Field Documentation

◆ $approved

bool ilBlogPosting::$approved = false
protected

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

Referenced by isApproved().

◆ $author

int ilBlogPosting::$author = 0
protected

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

Referenced by getAuthor().

◆ $blog_node_id

int ilBlogPosting::$blog_node_id = 0
protected

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

◆ $blog_node_is_wsp

bool ilBlogPosting::$blog_node_is_wsp = false
protected

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

◆ $created

ilDateTime ilBlogPosting::$created = null
protected

Definition at line 27 of file class.ilBlogPosting.php.

Referenced by getCreated().

◆ $title

string ilBlogPosting::$title = ""
protected

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

Referenced by getTitle().

◆ $withdrawn

ilDateTime ilBlogPosting::$withdrawn = null
protected

Definition at line 32 of file class.ilBlogPosting.php.


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